mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Rebuild the actor after switching between werewolf forms
This commit is contained in:
parent
5fbfce6d1e
commit
75131e6a48
@ -101,7 +101,11 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||
{
|
||||
assert(viewMode != VM_HeadOnly);
|
||||
mViewMode = viewMode;
|
||||
rebuild();
|
||||
}
|
||||
|
||||
void NpcAnimation::rebuild()
|
||||
{
|
||||
updateNpcBase();
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
||||
|
@ -88,6 +88,9 @@ public:
|
||||
void setViewMode(ViewMode viewMode);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
@ -131,6 +131,10 @@ public:
|
||||
/// Specifies an updated Ptr object for the player (used on cell change).
|
||||
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 setAmbientColour(const Ogre::ColourValue& colour);
|
||||
|
@ -1919,6 +1919,8 @@ namespace MWWorld
|
||||
windowManager->unsetForceHide(MWGui::GW_Magic);
|
||||
}
|
||||
}
|
||||
|
||||
mRendering->rebuildPtr(actor);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user