Force assign head animation timer (bug #4389)

pull/3224/head
Alexei Dobrohotov 3 years ago
parent 726653087e
commit e125308dd8

@ -9,6 +9,7 @@
Bug #3846: Strings starting with "-" fail to compile if not enclosed in quotes
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

@ -335,7 +335,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);
}

@ -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;

@ -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)

@ -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
{

Loading…
Cancel
Save