1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-14 01:19:59 +00:00

Merge branch 'headsup' into 'master'

Force assign head animation timer (bug #4389)

Closes #4389

See merge request OpenMW/openmw!1361
This commit is contained in:
psi29a 2021-11-14 19:59:31 +00:00
commit d4e8a58351
5 changed files with 38 additions and 8 deletions

View File

@ -11,6 +11,7 @@
Bug #3855: AI sometimes spams defensive spells
Bug #3905: Great House Dagoth issues
Bug #4203: Resurrecting an actor should close the loot GUI
Bug #4389: NPC's lips do not move if his head model has the NiBSAnimationNode root node
Bug #4602: Robert's Bodies: crash inside createInstance()
Bug #4700: Editor: Incorrect command implementation
Bug #4744: Invisible particles must still be processed

View File

@ -332,7 +332,7 @@ void ActorAnimation::resetControllers(osg::Node* node)
std::shared_ptr<SceneUtil::ControllerSource> src;
src.reset(new NullAnimationTime);
SceneUtil::AssignControllerSourcesVisitor removeVisitor(src);
SceneUtil::ForceControllerSourcesVisitor removeVisitor(src);
node->accept(removeVisitor);
}

View File

@ -837,14 +837,18 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
}
}
}
SceneUtil::ForceControllerSourcesVisitor assignVisitor(src);
node->accept(assignVisitor);
}
else if (type == ESM::PRT_Weapon)
src = mWeaponAnimationTime;
else
src.reset(new NullAnimationTime);
SceneUtil::AssignControllerSourcesVisitor assignVisitor(src);
node->accept(assignVisitor);
{
if (type == ESM::PRT_Weapon)
src = mWeaponAnimationTime;
else
src.reset(new NullAnimationTime);
SceneUtil::AssignControllerSourcesVisitor assignVisitor(src);
node->accept(assignVisitor);
}
}
return true;

View File

@ -121,6 +121,21 @@ namespace SceneUtil
ctrl.setSource(mToAssign);
}
ForceControllerSourcesVisitor::ForceControllerSourcesVisitor()
: AssignControllerSourcesVisitor()
{
}
ForceControllerSourcesVisitor::ForceControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: AssignControllerSourcesVisitor(toAssign)
{
}
void ForceControllerSourcesVisitor::visit(osg::Node&, Controller &ctrl)
{
ctrl.setSource(mToAssign);
}
FindMaxControllerLengthVisitor::FindMaxControllerLengthVisitor()
: SceneUtil::ControllerVisitor()
, mMaxLength(0)

View File

@ -85,10 +85,20 @@ namespace SceneUtil
/// By default assigns the ControllerSource passed to the constructor of this class if no ControllerSource is assigned to that controller yet.
void visit(osg::Node& node, Controller& ctrl) override;
private:
protected:
std::shared_ptr<ControllerSource> mToAssign;
};
class ForceControllerSourcesVisitor : public AssignControllerSourcesVisitor
{
public:
ForceControllerSourcesVisitor();
ForceControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign);
/// Assign the wanted ControllerSource even if one is already assigned to the controller.
void visit(osg::Node& node, Controller& ctrl) override;
};
/// Finds the maximum of all controller functions in the given scene graph
class FindMaxControllerLengthVisitor : public ControllerVisitor
{