| 4464 | } |
| 4465 | |
| 4466 | void Player::onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState, const char* anim, F32 pos, F32 timeScale, bool reset) |
| 4467 | { |
| 4468 | if (!mShapeFPInstance[imageSlot] || !mShapeFPAnimThread[imageSlot]) |
| 4469 | return; |
| 4470 | |
| 4471 | MountedImage& image = mMountedImageList[imageSlot]; |
| 4472 | ShapeBaseImageData::StateData& stateData = *image.state; |
| 4473 | |
| 4474 | if (reset) |
| 4475 | { |
| 4476 | // Reset cyclic sequences back to the first frame to turn it off |
| 4477 | // (the first key frame should be it's off state). |
| 4478 | if (mShapeFPAnimThread[imageSlot]->getSequence()->isCyclic() && (stateData.sequenceNeverTransition || !(stateData.sequenceTransitionIn || (lastState && lastState->sequenceTransitionOut))) ) |
| 4479 | { |
| 4480 | mShapeFPInstance[imageSlot]->setPos(mShapeFPAnimThread[imageSlot],0); |
| 4481 | mShapeFPInstance[imageSlot]->setTimeScale(mShapeFPAnimThread[imageSlot],0); |
| 4482 | } |
| 4483 | |
| 4484 | return; |
| 4485 | } |
| 4486 | |
| 4487 | // Just as with ShapeBase::udpateAnimThread we're going to apply various prefixes to determine the final sequence to use. |
| 4488 | // Here is the order: |
| 4489 | // imageBasePrefix_scriptPrefix_baseAnimName |
| 4490 | // imageBasePrefix_baseAnimName |
| 4491 | // scriptPrefix_baseAnimName |
| 4492 | // baseAnimName |
| 4493 | |
| 4494 | // Collect the prefixes |
| 4495 | const char* imageBasePrefix = ""; |
| 4496 | bool hasImageBasePrefix = image.dataBlock && image.dataBlock->imageAnimPrefixFP && image.dataBlock->imageAnimPrefixFP[0]; |
| 4497 | if (hasImageBasePrefix) |
| 4498 | imageBasePrefix = image.dataBlock->imageAnimPrefixFP; |
| 4499 | const char* scriptPrefix = getImageScriptAnimPrefix(imageSlot).getString(); |
| 4500 | bool hasScriptPrefix = scriptPrefix && scriptPrefix[0]; |
| 4501 | |
| 4502 | S32 seqIndex = mShapeFPInstance[imageSlot]->getShape()->findSequence(anim); |
| 4503 | |
| 4504 | // Find the final sequence based on the prefix combinations |
| 4505 | if (hasImageBasePrefix || hasScriptPrefix) |
| 4506 | { |
| 4507 | bool found = false; |
| 4508 | String baseSeqName(anim); |
| 4509 | |
| 4510 | if (!found && hasImageBasePrefix && hasScriptPrefix) |
| 4511 | { |
| 4512 | String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; |
| 4513 | S32 index = mShapeFPInstance[imageSlot]->getShape()->findSequence(seqName); |
| 4514 | if (index != -1) |
| 4515 | { |
| 4516 | seqIndex = index; |
| 4517 | found = true; |
| 4518 | } |
| 4519 | } |
| 4520 | |
| 4521 | if (!found && hasImageBasePrefix) |
| 4522 | { |
| 4523 | String seqName = String(imageBasePrefix) + String("_") + baseSeqName; |
nothing calls this directly
no test coverage detected