MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / playAnimationByID

Method playAnimationByID

Engine/source/T3D/player.cpp:7451–7498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7449}
7450
7451U32 Player::playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim)
7452{
7453 if (anim_id == BAD_ANIM_ID)
7454 return 0;
7455
7456 S32 seq_id = mDataBlock->actionList[anim_id].sequence;
7457 if (seq_id == -1)
7458 {
7459 Con::errorf("Player::playAnimation() problem. BAD_SEQ_ID");
7460 return 0;
7461 }
7462
7463 if (mShapeInstance->getShape()->sequences[seq_id].isBlend())
7464 return playBlendAnimation(seq_id, pos, rate);
7465
7466 if (isClientObject())
7467 {
7468 PlayerData::ActionAnimation &anim = mDataBlock->actionList[anim_id];
7469 if (anim.sequence != -1)
7470 {
7471 mActionAnimation.action = anim_id;
7472 mActionAnimation.forward = (rate >= 0);
7473 mActionAnimation.firstPerson = false;
7474 mActionAnimation.holdAtEnd = hold;
7475 mActionAnimation.waitForEnd = hold? true: wait;
7476 mActionAnimation.animateOnServer = false;
7477 mActionAnimation.atEnd = false;
7478 mActionAnimation.delayTicks = (S32)sNewAnimationTickTime;
7479
7480 F32 transTime = (trans < 0) ? sAnimationTransitionTime : trans;
7481
7482 mShapeInstance->setTimeScale(mActionAnimation.thread, rate);
7483 mShapeInstance->transitionToSequence(mActionAnimation.thread,anim.sequence,
7484 pos, transTime, true);
7485 }
7486 }
7487
7488 if (is_death_anim)
7489 anim_clip_flags |= IS_DEATH_ANIM;
7490 else
7491 anim_clip_flags &= ~IS_DEATH_ANIM;
7492
7493 anim_clip_flags |= ANIM_OVERRIDDEN;
7494 last_anim_tag = unique_anim_tag_counter++;
7495 last_anim_id = anim_id;
7496
7497 return last_anim_tag;
7498}
7499
7500F32 Player::getAnimationDurationByID(U32 anim_id)
7501{

Callers

nothing calls this directly

Calls 5

transitionToSequenceMethod · 0.80
errorfFunction · 0.50
isBlendMethod · 0.45
getShapeMethod · 0.45
setTimeScaleMethod · 0.45

Tested by

no test coverage detected