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

Method onImageStateAnimation

Engine/source/T3D/player.cpp:4291–4369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4289}
4290
4291void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool direction, bool scaleToState, F32 stateTimeOutValue)
4292{
4293 if (mDataBlock->allowImageStateAnimation && isGhost())
4294 {
4295 MountedImage& image = mMountedImageList[imageSlot];
4296
4297 // Just as with onImageAnimThreadChange we're going to apply various prefixes to determine the final sequence to use.
4298 // Here is the order:
4299 // imageBasePrefix_scriptPrefix_baseAnimName
4300 // imageBasePrefix_baseAnimName
4301 // scriptPrefix_baseAnimName
4302 // baseAnimName
4303
4304 // Collect the prefixes
4305 const char* imageBasePrefix = "";
4306 bool hasImageBasePrefix = image.dataBlock && image.dataBlock->imageAnimPrefix && image.dataBlock->imageAnimPrefix[0];
4307 if (hasImageBasePrefix)
4308 imageBasePrefix = image.dataBlock->imageAnimPrefix;
4309 const char* scriptPrefix = getImageScriptAnimPrefix(imageSlot).getString();
4310 bool hasScriptPrefix = scriptPrefix && scriptPrefix[0];
4311
4312 S32 seqIndex = mShapeInstance->getShape()->findSequence(seqName);
4313
4314 // Find the final sequence based on the prefix combinations
4315 if (hasImageBasePrefix || hasScriptPrefix)
4316 {
4317 bool found = false;
4318 String baseSeqName(seqName);
4319
4320 if (!found && hasImageBasePrefix && hasScriptPrefix)
4321 {
4322 String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
4323 S32 index = mShapeInstance->getShape()->findSequence(seqName);
4324 if (index != -1)
4325 {
4326 seqIndex = index;
4327 found = true;
4328 }
4329 }
4330
4331 if (!found && hasImageBasePrefix)
4332 {
4333 String seqName = String(imageBasePrefix) + String("_") + baseSeqName;
4334 S32 index = mShapeInstance->getShape()->findSequence(seqName);
4335 if (index != -1)
4336 {
4337 seqIndex = index;
4338 found = true;
4339 }
4340 }
4341
4342 if (!found && hasScriptPrefix)
4343 {
4344 String seqName = String(scriptPrefix) + String("_") + baseSeqName;
4345 S32 index = mShapeInstance->getShape()->findSequence(seqName);
4346 if (index != -1)
4347 {
4348 seqIndex = index;

Callers

nothing calls this directly

Calls 8

StringClass · 0.50
getStringMethod · 0.45
findSequenceMethod · 0.45
getShapeMethod · 0.45
addThreadMethod · 0.45
setSequenceMethod · 0.45
getDurationMethod · 0.45
setTimeScaleMethod · 0.45

Tested by

no test coverage detected