mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 08:36:43 +00:00
Rebuild the actor after switching between werewolf forms
This commit is contained in:
parent
5fbfce6d1e
commit
75131e6a48
5 changed files with 31 additions and 0 deletions
|
@ -101,7 +101,11 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||||
{
|
{
|
||||||
assert(viewMode != VM_HeadOnly);
|
assert(viewMode != VM_HeadOnly);
|
||||||
mViewMode = viewMode;
|
mViewMode = viewMode;
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpcAnimation::rebuild()
|
||||||
|
{
|
||||||
updateNpcBase();
|
updateNpcBase();
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
||||||
|
|
|
@ -88,6 +88,9 @@ public:
|
||||||
void setViewMode(ViewMode viewMode);
|
void setViewMode(ViewMode viewMode);
|
||||||
|
|
||||||
void updateParts(bool forceupdate = false);
|
void updateParts(bool forceupdate = false);
|
||||||
|
|
||||||
|
/// Rebuilds the NPC, updating their root model, animation sources, and equipment.
|
||||||
|
void rebuild();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,24 @@ void RenderingManager::updatePlayerPtr(const MWWorld::Ptr &ptr)
|
||||||
mCamera->attachTo(ptr);
|
mCamera->attachTo(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
|
||||||
|
{
|
||||||
|
NpcAnimation *anim = NULL;
|
||||||
|
if(ptr.getRefData().getHandle() == "player")
|
||||||
|
anim = mPlayerAnimation;
|
||||||
|
else if(MWWorld::Class::get(ptr).isActor())
|
||||||
|
anim = dynamic_cast<NpcAnimation*>(mActors.getAnimation(ptr));
|
||||||
|
if(anim)
|
||||||
|
{
|
||||||
|
anim->rebuild();
|
||||||
|
if(mCamera->getHandle() == ptr.getRefData().getHandle())
|
||||||
|
{
|
||||||
|
mCamera->attachTo(ptr);
|
||||||
|
mCamera->setAnimation(anim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RenderingManager::update (float duration, bool paused)
|
void RenderingManager::update (float duration, bool paused)
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
|
|
@ -131,6 +131,10 @@ public:
|
||||||
/// Specifies an updated Ptr object for the player (used on cell change).
|
/// Specifies an updated Ptr object for the player (used on cell change).
|
||||||
void updatePlayerPtr(const MWWorld::Ptr &ptr);
|
void updatePlayerPtr(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
|
/// Currently for NPCs only. Rebuilds the NPC, updating their root model, animation sources,
|
||||||
|
/// and equipment.
|
||||||
|
void rebuildPtr(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
void update (float duration, bool paused);
|
void update (float duration, bool paused);
|
||||||
|
|
||||||
void setAmbientColour(const Ogre::ColourValue& colour);
|
void setAmbientColour(const Ogre::ColourValue& colour);
|
||||||
|
|
|
@ -1919,6 +1919,8 @@ namespace MWWorld
|
||||||
windowManager->unsetForceHide(MWGui::GW_Magic);
|
windowManager->unsetForceHide(MWGui::GW_Magic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRendering->rebuildPtr(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue