| 4393 | } |
| 4394 | |
| 4395 | void Player::onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState, const char* anim, F32 pos, F32 timeScale, bool reset) |
| 4396 | { |
| 4397 | if (!mShapeFPInstance[imageSlot] || !mShapeFPAnimThread[imageSlot]) |
| 4398 | return; |
| 4399 | |
| 4400 | MountedImage& image = mMountedImageList[imageSlot]; |
| 4401 | ShapeBaseImageData::StateData& stateData = *image.state; |
| 4402 | |
| 4403 | if (reset) |
| 4404 | { |
| 4405 | // Reset cyclic sequences back to the first frame to turn it off |
| 4406 | // (the first key frame should be it's off state). |
| 4407 | if (mShapeFPAnimThread[imageSlot]->getSequence()->isCyclic() && (stateData.sequenceNeverTransition || !(stateData.sequenceTransitionIn || (lastState && lastState->sequenceTransitionOut))) ) |
| 4408 | { |
| 4409 | mShapeFPInstance[imageSlot]->setPos(mShapeFPAnimThread[imageSlot],0); |
| 4410 | mShapeFPInstance[imageSlot]->setTimeScale(mShapeFPAnimThread[imageSlot],0); |
| 4411 | } |
| 4412 | |
| 4413 | return; |
| 4414 | } |
| 4415 | |
| 4416 | // Just as with ShapeBase::udpateAnimThread we're going to apply various prefixes to determine the final sequence to use. |
| 4417 | // Here is the order: |
| 4418 | // imageBasePrefix_scriptPrefix_baseAnimName |
| 4419 | // imageBasePrefix_baseAnimName |
| 4420 | // scriptPrefix_baseAnimName |
| 4421 | // baseAnimName |
| 4422 | |
| 4423 | // Collect the prefixes |
| 4424 | const char* imageBasePrefix = ""; |
| 4425 | bool hasImageBasePrefix = image.dataBlock && image.dataBlock->imageAnimPrefixFP && image.dataBlock->imageAnimPrefixFP[0]; |
| 4426 | if (hasImageBasePrefix) |
| 4427 | imageBasePrefix = image.dataBlock->imageAnimPrefixFP; |
| 4428 | const char* scriptPrefix = getImageScriptAnimPrefix(imageSlot).getString(); |
| 4429 | bool hasScriptPrefix = scriptPrefix && scriptPrefix[0]; |
| 4430 | |
| 4431 | S32 seqIndex = mShapeFPInstance[imageSlot]->getShape()->findSequence(anim); |
| 4432 | |
| 4433 | // Find the final sequence based on the prefix combinations |
| 4434 | if (hasImageBasePrefix || hasScriptPrefix) |
| 4435 | { |
| 4436 | bool found = false; |
| 4437 | String baseSeqName(anim); |
| 4438 | |
| 4439 | if (!found && hasImageBasePrefix && hasScriptPrefix) |
| 4440 | { |
| 4441 | String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; |
| 4442 | S32 index = mShapeFPInstance[imageSlot]->getShape()->findSequence(seqName); |
| 4443 | if (index != -1) |
| 4444 | { |
| 4445 | seqIndex = index; |
| 4446 | found = true; |
| 4447 | } |
| 4448 | } |
| 4449 | |
| 4450 | if (!found && hasImageBasePrefix) |
| 4451 | { |
| 4452 | String seqName = String(imageBasePrefix) + String("_") + baseSeqName; |
nothing calls this directly
no test coverage detected