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

Method updateAnimThread

Engine/source/T3D/shapeImage.cpp:2829–2995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2827}
2828
2829void ShapeBase::updateAnimThread(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState)
2830{
2831 MountedImage& image = mMountedImageList[imageSlot];
2832 ShapeBaseImageData::StateData& stateData = *image.state;
2833
2834 F32 randomPos = Platform::getRandom();
2835 for (U32 i=0; i<ShapeBaseImageData::MaxShapes; ++i)
2836 {
2837 if (!image.dataBlock->shapeIsValid[i] || (i != imageShapeIndex && !image.doAnimateAllShapes))
2838 continue;
2839
2840 if (image.animThread[i] && stateData.sequence[i] != -1)
2841 {
2842 S32 seqIndex = stateData.sequence[i]; // Standard index without any prefix
2843 bool scaleAnim = stateData.scaleAnimation;
2844 if (i == ShapeBaseImageData::FirstPersonImageShape)
2845 scaleAnim = stateData.scaleAnimationFP;
2846
2847 // We're going to apply various prefixes to determine the final sequence to use.
2848 // Here is the order:
2849 // shapeBasePrefix_scriptPrefix_baseAnimName
2850 // shapeBasePrefix_baseAnimName
2851 // scriptPrefix_baseAnimName
2852 // baseAnimName
2853
2854 // Collect the prefixes
2855 const char* shapeBasePrefix = getImageAnimPrefix(imageSlot, i);
2856 bool hasShapeBasePrefix = shapeBasePrefix && shapeBasePrefix[0];
2857 const char* scriptPrefix = getImageScriptAnimPrefix(imageSlot).getString();
2858 bool hasScriptPrefix = scriptPrefix && scriptPrefix[0];
2859
2860 // Find the final sequence based on the prefix combinations
2861 if (hasShapeBasePrefix || hasScriptPrefix)
2862 {
2863 bool found = false;
2864 String baseSeqName(image.shapeInstance[i]->getShape()->getSequenceName(stateData.sequence[i]));
2865
2866 if (!found && hasShapeBasePrefix && hasScriptPrefix)
2867 {
2868 String seqName = String(shapeBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
2869 S32 index = image.shapeInstance[i]->getShape()->findSequence(seqName);
2870 if (index != -1)
2871 {
2872 seqIndex = index;
2873 found = true;
2874 }
2875 }
2876
2877 if (!found && hasShapeBasePrefix)
2878 {
2879 String seqName = String(shapeBasePrefix) + String("_") + baseSeqName;
2880 S32 index = image.shapeInstance[i]->getShape()->findSequence(seqName);
2881 if (index != -1)
2882 {
2883 seqIndex = index;
2884 found = true;
2885 }
2886 }

Callers

nothing calls this directly

Calls 11

hasSequenceMethod · 0.80
transitionToSequenceMethod · 0.80
setPosMethod · 0.80
StringClass · 0.50
getStringMethod · 0.45
getShapeMethod · 0.45
findSequenceMethod · 0.45
getSequenceMethod · 0.45
setSequenceMethod · 0.45
getDurationMethod · 0.45
setTimeScaleMethod · 0.45

Tested by

no test coverage detected