|
|
@ -311,6 +311,7 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
|
|
Animation::Animation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem)
|
|
|
|
Animation::Animation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem)
|
|
|
|
: mInsert(parentNode)
|
|
|
|
: mInsert(parentNode)
|
|
|
|
|
|
|
|
, mSkeleton(NULL)
|
|
|
|
, mPtr(ptr)
|
|
|
|
, mPtr(ptr)
|
|
|
|
, mResourceSystem(resourceSystem)
|
|
|
|
, mResourceSystem(resourceSystem)
|
|
|
|
, mAccumulate(1.f, 1.f, 0.f)
|
|
|
|
, mAccumulate(1.f, 1.f, 0.f)
|
|
|
@ -338,10 +339,8 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
|
|
void Animation::setActive(bool active)
|
|
|
|
void Animation::setActive(bool active)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (SceneUtil::Skeleton* skel = dynamic_cast<SceneUtil::Skeleton*>(mObjectRoot.get()))
|
|
|
|
if (mSkeleton)
|
|
|
|
{
|
|
|
|
mSkeleton->setActive(active);
|
|
|
|
skel->setActive(active);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Animation::updatePtr(const MWWorld::Ptr &ptr)
|
|
|
|
void Animation::updatePtr(const MWWorld::Ptr &ptr)
|
|
|
@ -965,6 +964,7 @@ namespace MWRender
|
|
|
|
mObjectRoot->getParent(0)->removeChild(mObjectRoot);
|
|
|
|
mObjectRoot->getParent(0)->removeChild(mObjectRoot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mObjectRoot = NULL;
|
|
|
|
mObjectRoot = NULL;
|
|
|
|
|
|
|
|
mSkeleton = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
mNodeMap.clear();
|
|
|
|
mNodeMap.clear();
|
|
|
|
mActiveControllers.clear();
|
|
|
|
mActiveControllers.clear();
|
|
|
@ -976,9 +976,11 @@ namespace MWRender
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::ref_ptr<osg::Node> newObjectRoot = mResourceSystem->getSceneManager()->createInstance(model);
|
|
|
|
osg::ref_ptr<osg::Node> newObjectRoot = mResourceSystem->getSceneManager()->createInstance(model);
|
|
|
|
if (!dynamic_cast<SceneUtil::Skeleton*>(newObjectRoot.get()))
|
|
|
|
mSkeleton = dynamic_cast<SceneUtil::Skeleton*>(newObjectRoot.get());
|
|
|
|
|
|
|
|
if (!mSkeleton)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::ref_ptr<SceneUtil::Skeleton> skel = new SceneUtil::Skeleton;
|
|
|
|
osg::ref_ptr<SceneUtil::Skeleton> skel = new SceneUtil::Skeleton;
|
|
|
|
|
|
|
|
mSkeleton = skel.get();
|
|
|
|
skel->addChild(newObjectRoot);
|
|
|
|
skel->addChild(newObjectRoot);
|
|
|
|
newObjectRoot = skel;
|
|
|
|
newObjectRoot = skel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|