mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-03 19:56:07 +00:00
CSkeleton: Make BoneByName() use a string view
Same behavior, but without a mandatory allocating API.
This commit is contained in:
parent
671b8037b9
commit
60d003df88
@ -81,7 +81,7 @@ CBone* CSkeleton::BoneByID(uint32 BoneID) const
|
|||||||
return iter->get();
|
return iter->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
CBone* CSkeleton::BoneByName(const TString& name) const
|
CBone* CSkeleton::BoneByName(std::string_view name) const
|
||||||
{
|
{
|
||||||
const auto iter = std::find_if(mBones.begin(), mBones.end(),
|
const auto iter = std::find_if(mBones.begin(), mBones.end(),
|
||||||
[&name](const auto& bone) { return bone->Name() == name; });
|
[&name](const auto& bone) { return bone->Name() == name; });
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <Common/Math/CRay.h>
|
#include <Common/Math/CRay.h>
|
||||||
#include <Common/Math/CVector3f.h>
|
#include <Common/Math/CVector3f.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
class CBoneTransformData;
|
class CBoneTransformData;
|
||||||
class CBone;
|
class CBone;
|
||||||
@ -37,7 +38,7 @@ public:
|
|||||||
~CSkeleton() override;
|
~CSkeleton() override;
|
||||||
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
||||||
CBone* BoneByID(uint32 BoneID) const;
|
CBone* BoneByID(uint32 BoneID) const;
|
||||||
CBone* BoneByName(const TString& name) const;
|
CBone* BoneByName(std::string_view name) const;
|
||||||
uint32 MaxBoneID() const;
|
uint32 MaxBoneID() const;
|
||||||
|
|
||||||
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user