diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 6cda9728cd..d084d6a08e 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -31,7 +31,7 @@ namespace OsgAOpenMW osg::ref_ptr callback = new OsgaController::KeyframeController(); - std::vector emulatedAnimations; + std::vector emulatedAnimations; for (auto animation : mAnimationManager->getAnimationList()) { @@ -69,7 +69,7 @@ namespace OsgAOpenMW mTarget.mTextKeys.emplace(startTime, std::move(loopstart)); mTarget.mTextKeys.emplace(stopTime, std::move(loopstop)); - SceneUtil::EmulatedAnimation emulatedAnimation; + OsgaController::EmulatedAnimation emulatedAnimation; emulatedAnimation.mStartTime = startTime; emulatedAnimation.mStopTime = stopTime; emulatedAnimation.mName = animationName; diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index 4f83196f34..778b4bc9a9 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -17,7 +17,7 @@ namespace OsgAOpenMW public: RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target, osg::ref_ptr animationManager); - virtual void apply(osg::Node& node); + virtual void apply(osg::Node& node) override; private: SceneUtil::KeyframeHolder& mTarget; diff --git a/components/sceneutil/keyframe.hpp b/components/sceneutil/keyframe.hpp index 5a0435469c..e09541cb9a 100644 --- a/components/sceneutil/keyframe.hpp +++ b/components/sceneutil/keyframe.hpp @@ -11,13 +11,6 @@ namespace SceneUtil { - struct EmulatedAnimation - { - float mStartTime; - float mStopTime; - std::string mName; - }; - class KeyframeController : public osg::NodeCallback, public SceneUtil::Controller { public: @@ -26,18 +19,12 @@ namespace SceneUtil KeyframeController(const KeyframeController& copy, const osg::CopyOp& copyop) : osg::NodeCallback(copy, copyop) , SceneUtil::Controller(copy) - , mMergedAnimationTracks(copy.mMergedAnimationTracks) - , mEmulatedAnimations(copy.mEmulatedAnimations) {} META_Object(SceneUtil, KeyframeController) virtual osg::Vec3f getTranslation(float time) const { return osg::Vec3f(); } - virtual void operator() (osg::Node* node, osg::NodeVisitor* nodeVisitor) { traverse(node, nodeVisitor); } - - protected: - std::vector> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae) - std::vector mEmulatedAnimations; + virtual void operator() (osg::Node* node, osg::NodeVisitor* nodeVisitor) override { traverse(node, nodeVisitor); } }; /// Wrapper object containing an animation track as a ref-countable osg::Object. diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index 6b635d4ea1..e20ecb5b89 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -102,6 +102,8 @@ namespace OsgaController } KeyframeController::KeyframeController(const KeyframeController ©, const osg::CopyOp ©op) : SceneUtil::KeyframeController(copy, copyop) + , mMergedAnimationTracks(copy.mMergedAnimationTracks) + , mEmulatedAnimations(copy.mEmulatedAnimations) { mLinker = nullptr; } @@ -183,7 +185,7 @@ namespace OsgaController traverse(node, nv); } - void KeyframeController::setEmulatedAnimations(std::vector emulatedAnimations) + void KeyframeController::setEmulatedAnimations(std::vector emulatedAnimations) { mEmulatedAnimations = emulatedAnimations; } diff --git a/components/sceneutil/osgacontroller.hpp b/components/sceneutil/osgacontroller.hpp index 4ae1221992..a3072088aa 100644 --- a/components/sceneutil/osgacontroller.hpp +++ b/components/sceneutil/osgacontroller.hpp @@ -18,6 +18,13 @@ namespace OsgaController { + struct EmulatedAnimation + { + float mStartTime; + float mStopTime; + std::string mName; + }; + class LinkVisitor : public osg::NodeVisitor { public: @@ -29,9 +36,9 @@ namespace OsgaController virtual void setAnimation(Resource::Animation* animation); - virtual void apply(osg::Node& node); + virtual void apply(osg::Node& node) override; - virtual void apply(osg::Geode& node); + virtual void apply(osg::Geode& node) override; protected: Resource::Animation* mAnimation; @@ -57,13 +64,16 @@ namespace OsgaController void operator() (osg::Node*, osg::NodeVisitor*) override; /// @brief Sets details of the animations - void setEmulatedAnimations(std::vector emulatedAnimations); + void setEmulatedAnimations(std::vector emulatedAnimations); /// @brief Adds an animation track to a model void addMergedAnimationTrack(osg::ref_ptr animationTrack); + private: bool mNeedToLink = true; osg::ref_ptr mLinker; + std::vector> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae) + std::vector mEmulatedAnimations; }; }