MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / onImage

Method onImage

Engine/source/T3D/player.cpp:4076–4172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4074}
4075
4076void Player::onImage(U32 imageSlot, bool unmount)
4077{
4078 // Update 3rd person sequences based on images used. Start be getting a
4079 // list of all possible image prefix sequences.
4080 String prefixPaths[ShapeBase::MaxMountedImages];
4081 buildImagePrefixPaths(prefixPaths);
4082
4083 // Clear out any previous image state animation
4084 if (mImageStateThread)
4085 {
4086 mShapeInstance->destroyThread(mImageStateThread);
4087 mImageStateThread = 0;
4088 }
4089
4090 // Attempt to update the action thread
4091 U32 action = mActionAnimation.action;
4092 if (action != PlayerData::NullAnimation)
4093 {
4094 String actionSeq = mDataBlock->actionList[action].name;
4095 if (actionSeq.isNotEmpty())
4096 {
4097 S32 seqIndex = mDataBlock->actionList[action].sequence;
4098 S32 prefixIndex = findPrefixSequence(prefixPaths, actionSeq);
4099 if (prefixIndex != -1)
4100 {
4101 seqIndex = prefixIndex;
4102 }
4103
4104 // Only change the sequence if it isn't already playing.
4105 if (seqIndex != mShapeInstance->getSequence(mActionAnimation.thread))
4106 {
4107 F32 pos = mShapeInstance->getPos(mActionAnimation.thread);
4108 mShapeInstance->setSequence(mActionAnimation.thread, seqIndex, pos);
4109 }
4110 }
4111 }
4112
4113 // Attempt to update the arm thread
4114 U32 armAction = getArmAction();
4115 if (armAction != PlayerData::NullAnimation)
4116 {
4117 String armSeq = mDataBlock->actionList[armAction].name;
4118 if (armSeq.isNotEmpty())
4119 {
4120 S32 seqIndex = mDataBlock->actionList[armAction].sequence;
4121 S32 prefixIndex = findPrefixSequence(prefixPaths, armSeq);
4122 if (prefixIndex != -1)
4123 {
4124 seqIndex = prefixIndex;
4125 }
4126
4127 // Only change the sequence if it isn't already playing.
4128 if (seqIndex != mShapeInstance->getSequence(mArmAnimation.thread))
4129 {
4130 F32 pos = mShapeInstance->getPos(mArmAnimation.thread);
4131 mShapeInstance->setSequence(mArmAnimation.thread, seqIndex, pos);
4132 }
4133 }

Callers

nothing calls this directly

Calls 7

destroyThreadMethod · 0.45
isNotEmptyMethod · 0.45
getSequenceMethod · 0.45
getPosMethod · 0.45
setSequenceMethod · 0.45
getShapeMethod · 0.45
findSequenceMethod · 0.45

Tested by

no test coverage detected