From 30d9014a2c6354af5dece4129866895b71d9cd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Sun, 20 Dec 2015 18:46:24 +0200 Subject: [PATCH] Model Renderer: Added "alwaysTrigger" option for animation sequences `alwaysTrigger` ensures that even if the current state sequence is already ongoing, the model animation sequence is started regardless. This is useful for weapon firing animations, for example, if timing should follow the state animation sequence exactly. --- doomsday/apps/client/src/render/stateanimator.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doomsday/apps/client/src/render/stateanimator.cpp b/doomsday/apps/client/src/render/stateanimator.cpp index 88876fdacd..68b8efed4a 100644 --- a/doomsday/apps/client/src/render/stateanimator.cpp +++ b/doomsday/apps/client/src/render/stateanimator.cpp @@ -37,6 +37,7 @@ static String const DEF_PROBABILITY("prob"); static String const DEF_ROOT_NODE ("node"); static String const DEF_LOOPING ("looping"); static String const DEF_PRIORITY ("priority"); +static String const DEF_ALWAYS_TRIGGER("alwaysTrigger"); static String const DEF_RENDER ("render"); static String const DEF_PASS ("pass"); static String const DEF_VARIABLE ("variable"); @@ -638,10 +639,14 @@ void StateAnimator::triggerByState(String const &stateName) String const node = seq.def->gets(DEF_ROOT_NODE, ""); int animId = d->animationId(seq.name); - // Do not restart running sequences. - /// @todo Only restart the animation if the current state is not the expected - /// one (checking the state cycle). - if(isRunning(animId, node)) continue; + bool const alwaysTrigger = ScriptedInfo::isTrue(*seq.def, DEF_ALWAYS_TRIGGER, false); + if(!alwaysTrigger) + { + // Do not restart running sequences. + /// @todo Only restart the animation if the current state is not the expected + /// one (checking the state cycle). + if(isRunning(animId, node)) continue; + } int const priority = seq.def->geti(DEF_PRIORITY, ANIM_DEFAULT_PRIORITY);