Skip to content

Commit

Permalink
Fixed|Model Renderer: Repeated triggering of a single thing state
Browse files Browse the repository at this point in the history
If a thing stays in a single-state loop (e.g., HEAD_STND), don’t keep
retriggering the state. Sequence triggering should only occur if
the thing state changes or when a model animation sequence ends.

Warn if a model definition tries to use animations on a model that
has none.
  • Loading branch information
skyjake committed Mar 19, 2017
1 parent 4e146c4 commit cbf111c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
20 changes: 17 additions & 3 deletions doomsday/apps/client/src/render/modelrenderer.cpp
Expand Up @@ -456,10 +456,24 @@ DENG2_PIMPL(ModelRenderer)
DENG2_FOR_EACH_CONST(Record::Subrecords, state, states)
{
// Sequences are added in source order.
auto seqs = ScriptedInfo::subrecordsOfType(DEF_SEQUENCE, *state.value());
for (String key : ScriptedInfo::sortRecordsBySource(seqs))
auto const seqs = ScriptedInfo::subrecordsOfType(DEF_SEQUENCE, *state.value());
if (!seqs.isEmpty())
{
model.animations[state.key()] << render::Model::AnimSequence(key, *seqs[key]);
if (model.animationCount() > 0)
{
for (String key : ScriptedInfo::sortRecordsBySource(seqs))
{
model.animations[state.key()] << render::Model::AnimSequence(key, *seqs[key]);
}
}
else
{
LOG_GL_WARNING("Model \"%s\" has no animation sequences in the model file "
"but animation sequence definition found at %s")
<< path
<< ScriptedInfo::sourceLocation
(*seqs[ScriptedInfo::sortRecordsBySource(seqs).first()]);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/render/stateanimator.cpp
Expand Up @@ -653,8 +653,8 @@ void StateAnimator::triggerByState(String const &stateName)
continue;
}

/*LOG_GL_XVERBOSE("Mobj %i starting animation: " _E(b))
<< d->names.geti("self.__id__") << seq.name;*/
//qDebug() << "Mobj starting animation: id"
// << d->names.geti(d->ownerNamespaceVarName + ".__id__") << seq.name;
break;
}
}
Expand Down
5 changes: 4 additions & 1 deletion doomsday/apps/client/src/world/clientmobjthinkerdata.cpp
Expand Up @@ -291,7 +291,10 @@ void ClientMobjThinkerData::stateChanged(state_t const *previousState)
* for instance allowing consecutive attack sequences to play as a single,
* long sequence (e.g., Hexen's Ettin).
*/
d->flags |= StateChanged;
if (mobj()->state != previousState)
{
d->flags |= StateChanged;
}
d->triggerParticleGenerators(justSpawned);
}

Expand Down

0 comments on commit cbf111c

Please sign in to comment.