Skip to content

Commit

Permalink
Model Renderer: Added "alwaysTrigger" option for animation sequences
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
skyjake committed Dec 20, 2015
1 parent f11dae9 commit 30d9014
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions doomsday/apps/client/src/render/stateanimator.cpp
Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 30d9014

Please sign in to comment.