Skip to content

Commit 173b7f5

Browse files
committed
ovis: fix play / stop animation for multiple entities
ovis: fix build on windows platform (type conversion)
1 parent f0d30f2 commit 173b7f5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/ovis/src/ovis.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <opencv2/calib3d.hpp>
1313
#include <opencv2/core/utils/configuration.private.hpp>
1414

15+
1516
namespace cv
1617
{
1718
namespace ovis
@@ -277,7 +278,7 @@ class WindowSceneImpl : public WindowScene
277278
RenderWindow* rWin;
278279
Ptr<OgreBites::CameraMan> camman;
279280
Ptr<Rectangle2D> bgplane;
280-
std::unordered_map<String, Controller<Real>*> frameCtrlrs;
281+
std::unordered_map<AnimationState*, Controller<Real>*> frameCtrlrs;
281282

282283
Ogre::RenderTarget* depthRTT;
283284
int flags;
@@ -600,9 +601,9 @@ class WindowSceneImpl : public WindowScene
600601
animstate->setEnabled(true);
601602
animstate->setLoop(loop);
602603

603-
if (frameCtrlrs.find(animname) != frameCtrlrs.end()) return;
604+
if (frameCtrlrs.find(animstate) != frameCtrlrs.end()) return;
604605
frameCtrlrs.insert({
605-
animname,
606+
animstate,
606607
Ogre::ControllerManager::getSingleton().createFrameTimePassthroughController(
607608
Ogre::AnimationStateControllerValue::create(animstate, true)
608609
)
@@ -620,8 +621,8 @@ class WindowSceneImpl : public WindowScene
620621

621622
animstate->setEnabled(false);
622623
animstate->setTimePosition(0);
623-
Ogre::ControllerManager::getSingleton().destroyController(frameCtrlrs[animname]);
624-
frameCtrlrs.erase(animname);
624+
Ogre::ControllerManager::getSingleton().destroyController(frameCtrlrs[animstate]);
625+
frameCtrlrs.erase(animstate);
625626
}
626627

627628
void setEntityProperty(const String& name, int prop, const String& value) CV_OVERRIDE
@@ -659,7 +660,7 @@ class WindowSceneImpl : public WindowScene
659660
Entity* ent = dynamic_cast<Entity*>(node.getAttachedObject(name));
660661
CV_Assert(ent && "invalid entity");
661662

662-
ent->getSkeleton()->setBlendMode(static_cast<Ogre::SkeletonAnimationBlendMode>(value[0]));
663+
ent->getSkeleton()->setBlendMode(static_cast<Ogre::SkeletonAnimationBlendMode>(int(value[0])));
663664
break;
664665
}
665666
default:

0 commit comments

Comments
 (0)