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

Method generateSequences

Engine/source/ts/loader/tsShapeLoader.cpp:722–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

720// Animation Sequences
721
722void TSShapeLoader::generateSequences()
723{
724 for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++)
725 {
726 updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq);
727
728 // Initialize the sequence
729 appSequences[iSeq]->setActive(true);
730
731 shape->sequences.increment();
732 TSShape::Sequence& seq = shape->sequences.last();
733
734 seq.nameIndex = shape->addName(appSequences[iSeq]->getName());
735 seq.toolBegin = appSequences[iSeq]->getStart();
736 seq.priority = appSequences[iSeq]->getPriority();
737 seq.flags = appSequences[iSeq]->getFlags();
738
739 // Compute duration and number of keyframes (then adjust time between frames to match)
740 seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart();
741 seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1;
742
743 seq.sourceData.start = 0;
744 seq.sourceData.end = seq.numKeyframes-1;
745 seq.sourceData.total = seq.numKeyframes;
746
747 // Set membership arrays (ie. which nodes and objects are affected by this sequence)
748 setNodeMembership(seq, appSequences[iSeq]);
749 setObjectMembership(seq, appSequences[iSeq]);
750
751 // Generate keyframes
752 generateNodeAnimation(seq);
753 generateObjectAnimation(seq, appSequences[iSeq]);
754 generateGroundAnimation(seq, appSequences[iSeq]);
755 generateFrameTriggers(seq, appSequences[iSeq]);
756
757 // Set sequence flags
758 seq.dirtyFlags = 0;
759 if (seq.rotationMatters.testAll() || seq.translationMatters.testAll() || seq.scaleMatters.testAll())
760 seq.dirtyFlags |= TSShapeInstance::TransformDirty;
761 if (seq.visMatters.testAll())
762 seq.dirtyFlags |= TSShapeInstance::VisDirty;
763 if (seq.frameMatters.testAll())
764 seq.dirtyFlags |= TSShapeInstance::FrameDirty;
765 if (seq.matFrameMatters.testAll())
766 seq.dirtyFlags |= TSShapeInstance::MatFrameDirty;
767
768 // Set shape flags (only the most significant scale type)
769 U32 curVal = shape->mFlags & TSShape::AnyScale;
770 shape->mFlags &= ~(TSShape::AnyScale);
771 shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards)
772
773 appSequences[iSeq]->setActive(false);
774 }
775}
776
777void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* appSeq)
778{

Callers

nothing calls this directly

Calls 12

getMaxFunction · 0.85
incrementMethod · 0.80
addNameMethod · 0.80
sizeMethod · 0.45
setActiveMethod · 0.45
lastMethod · 0.45
getNameMethod · 0.45
getStartMethod · 0.45
getPriorityMethod · 0.45
getFlagsMethod · 0.45
getEndMethod · 0.45
testAllMethod · 0.45

Tested by

no test coverage detected