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

Method onImageStateAnimation

Engine/source/T3D/player.cpp:4362–4440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4360}
4361
4362void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool direction, bool scaleToState, F32 stateTimeOutValue)
4363{
4364 if (mDataBlock->allowImageStateAnimation && isGhost())
4365 {
4366 MountedImage& image = mMountedImageList[imageSlot];
4367
4368 // Just as with onImageAnimThreadChange we're going to apply various prefixes to determine the final sequence to use.
4369 // Here is the order:
4370 // imageBasePrefix_scriptPrefix_baseAnimName
4371 // imageBasePrefix_baseAnimName
4372 // scriptPrefix_baseAnimName
4373 // baseAnimName
4374
4375 // Collect the prefixes
4376 const char* imageBasePrefix = "";
4377 bool hasImageBasePrefix = image.dataBlock && image.dataBlock->imageAnimPrefix && image.dataBlock->imageAnimPrefix[0];
4378 if (hasImageBasePrefix)
4379 imageBasePrefix = image.dataBlock->imageAnimPrefix;
4380 const char* scriptPrefix = getImageScriptAnimPrefix(imageSlot).getString();
4381 bool hasScriptPrefix = scriptPrefix && scriptPrefix[0];
4382
4383 S32 seqIndex = mShapeInstance->getShape()->findSequence(seqName);
4384
4385 // Find the final sequence based on the prefix combinations
4386 if (hasImageBasePrefix || hasScriptPrefix)
4387 {
4388 bool found = false;
4389 String baseSeqName(seqName);
4390
4391 if (!found && hasImageBasePrefix && hasScriptPrefix)
4392 {
4393 String comboSeqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
4394 S32 index = mShapeInstance->getShape()->findSequence(comboSeqName);
4395 if (index != -1)
4396 {
4397 seqIndex = index;
4398 found = true;
4399 }
4400 }
4401
4402 if (!found && hasImageBasePrefix)
4403 {
4404 String imgSeqName = String(imageBasePrefix) + String("_") + baseSeqName;
4405 S32 index = mShapeInstance->getShape()->findSequence(imgSeqName);
4406 if (index != -1)
4407 {
4408 seqIndex = index;
4409 found = true;
4410 }
4411 }
4412
4413 if (!found && hasScriptPrefix)
4414 {
4415 String scriptSeqName = String(scriptPrefix) + String("_") + baseSeqName;
4416 S32 index = mShapeInstance->getShape()->findSequence(scriptSeqName);
4417 if (index != -1)
4418 {
4419 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