diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 78ddffbe8..a6cdd2838 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -7,6 +7,7 @@ #include #include +#include #include "components/esm/records.hpp" #include @@ -90,6 +91,53 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt) std::string effect; MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayer().getPlayer().getCell(); + /* + ESMS::CellRefList::List creatureData = (current->creatures).list; + ESMS::CellRefList::List::iterator creaturedataiter = creatureData.begin(); + + for(int i = 0; i < creatureData.size(); i++) + { + //std::cout << "Testing" << i < "\n"; + ESMS::LiveCellRef item = *creaturedataiter; + Ogre::Entity* creaturemodel = item.model; + + if(evt.timeSinceLastFrame == 0) + creaturemodel->getSkeleton()->setBindingPose(); + creaturemodel->getSkeleton()->setBlendMode(Ogre::SkeletonAnimationBlendMode::ANIMBLEND_AVERAGE); //ANIMBLEND_AVERAGE + Ogre::AnimationState *mAnimationState = creaturemodel->getAnimationState("WholeThing"); + mAnimationState->setWeight(.5); + mAnimationState->setLoop(true); + //npcmodel->getSkeleton()-> + + mAnimationState->setEnabled(true); + + + + + Ogre::AnimationState *mAnimationState2 = creaturemodel->getAnimationState("WholeThing2"); + mAnimationState2->setLoop(true); + mAnimationState2->setWeight(.5); + mAnimationState2->setEnabled(true); + + mAnimationState2->createBlendMask(creaturemodel->getSkeleton()->getNumBones(),1); + mAnimationState->createBlendMask(creaturemodel->getSkeleton()->getNumBones(),1); + for(int j = 2; j < creaturemodel->getSkeleton()->getNumBones(); j++) + { + mAnimationState->setBlendMaskEntry(j,1); + mAnimationState2->setBlendMaskEntry(j,1); + } + // set skeleton + std::cout << "TimePosition:" << mAnimationState->getTimePosition() << "\n"; + + mAnimationState->addTime(evt.timeSinceLastFrame); + mAnimationState2->addTime(evt.timeSinceLastFrame); + //npcmodel->_updateAnimation(); + //mAnimationState2->setEnabled(true); + creaturedataiter++; + }*/ + + + //If the region has changed if(!(current->cell->data.flags & current->cell->Interior) && timer.elapsed() >= 10){ timer.restart(); diff --git a/components/esm_store/cell_store.hpp b/components/esm_store/cell_store.hpp index 43860dff3..a55bb3d0e 100644 --- a/components/esm_store/cell_store.hpp +++ b/components/esm_store/cell_store.hpp @@ -14,6 +14,7 @@ #include "components/esm/records.hpp" #include "components/esm/loadcell.hpp" #include +#include #include #include @@ -29,6 +30,8 @@ namespace ESMS // The object that this instance is based on. const X* base; + Ogre::Entity *model; + /* Information about this instance, such as 3D location and rotation and individual type-dependent data. */ diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 3d63a9f98..a1254ed7f 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1225,20 +1225,15 @@ void NIFLoader::loadResource(Resource *resource) } - /* - else if (n != NULL) - { - std::cout << "handle" << handle << "\n"; - //handle++; - }*/ + + //std::cout <"BE\n"; } - - // set skeleton - if (!mSkel.isNull()) + if (!mSkel.isNull() && mesh->isLoaded()) { mesh->_notifySkeleton(mSkel); + std::cout << "Skeleton notified\n"; } // set skeleton