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

Method onImage

Engine/source/T3D/player.cpp:4147–4243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4145}
4146
4147void Player::onImage(U32 imageSlot, bool unmount)
4148{
4149 // Update 3rd person sequences based on images used. Start be getting a
4150 // list of all possible image prefix sequences.
4151 String prefixPaths[ShapeBase::MaxMountedImages];
4152 buildImagePrefixPaths(prefixPaths);
4153
4154 // Clear out any previous image state animation
4155 if (mImageStateThread)
4156 {
4157 mShapeInstance->destroyThread(mImageStateThread);
4158 mImageStateThread = 0;
4159 }
4160
4161 // Attempt to update the action thread
4162 U32 action = mActionAnimation.action;
4163 if (action != PlayerData::NullAnimation)
4164 {
4165 String actionSeq = mDataBlock->actionList[action].name;
4166 if (actionSeq.isNotEmpty())
4167 {
4168 S32 seqIndex = mDataBlock->actionList[action].sequence;
4169 S32 prefixIndex = findPrefixSequence(prefixPaths, actionSeq);
4170 if (prefixIndex != -1)
4171 {
4172 seqIndex = prefixIndex;
4173 }
4174
4175 // Only change the sequence if it isn't already playing.
4176 if (seqIndex != mShapeInstance->getSequence(mActionAnimation.thread))
4177 {
4178 F32 pos = mShapeInstance->getPos(mActionAnimation.thread);
4179 mShapeInstance->setSequence(mActionAnimation.thread, seqIndex, pos);
4180 }
4181 }
4182 }
4183
4184 // Attempt to update the arm thread
4185 U32 armAction = getArmAction();
4186 if (armAction != PlayerData::NullAnimation)
4187 {
4188 String armSeq = mDataBlock->actionList[armAction].name;
4189 if (armSeq.isNotEmpty())
4190 {
4191 S32 seqIndex = mDataBlock->actionList[armAction].sequence;
4192 S32 prefixIndex = findPrefixSequence(prefixPaths, armSeq);
4193 if (prefixIndex != -1)
4194 {
4195 seqIndex = prefixIndex;
4196 }
4197
4198 // Only change the sequence if it isn't already playing.
4199 if (seqIndex != mShapeInstance->getSequence(mArmAnimation.thread))
4200 {
4201 F32 pos = mShapeInstance->getPos(mArmAnimation.thread);
4202 mShapeInstance->setSequence(mArmAnimation.thread, seqIndex, pos);
4203 }
4204 }

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