diff --git a/components/sceneutil/skeleton.cpp b/components/sceneutil/skeleton.cpp index 9f646ade5c..45ccefe6e5 100644 --- a/components/sceneutil/skeleton.cpp +++ b/components/sceneutil/skeleton.cpp @@ -80,15 +80,16 @@ Bone* Skeleton::getBone(const std::string &name) { if (bone->mChildren[i]->mNode == matrixTransform) { - child = bone->mChildren[i]; + child = bone->mChildren[i].get(); break; } } - if (!child) + if (child == nullptr) { - child = new Bone; - bone->mChildren.push_back(child); + auto childBone = std::make_unique(); + child = childBone.get(); + bone->mChildren.push_back(std::move(childBone)); mNeedToUpdateBoneMatrices = true; } bone = child; @@ -165,13 +166,6 @@ Bone::Bone() { } -Bone::~Bone() -{ - for (unsigned int i=0; i mChildren; + std::vector> mChildren; /// Update the skeleton-space matrix of this bone and all its children. void update(const osg::Matrixf* parentMatrixInSkeletonSpace); - - private: - Bone(const Bone&); - void operator=(const Bone&); }; /// @brief Handles the bone matrices for any number of child RigGeometries.