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

Method removeSequence

Engine/source/ts/tsShapeEdit.cpp:1803–1859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803bool TSShape::removeSequence(const String& name)
1804{
1805 // Find the sequence to be removed
1806 S32 seqIndex = findSequence(name);
1807 if (seqIndex < 0)
1808 {
1809 Con::errorf("TSShape::removeSequence: Could not find sequence '%s'", name.c_str());
1810 return false;
1811 }
1812
1813 TSShape::Sequence& seq = sequences[seqIndex];
1814
1815 // Remove the node transforms for this sequence
1816 S32 transCount = eraseStates(nodeTranslations, seq.translationMatters, seq.baseTranslation, seq.numKeyframes);
1817 S32 rotCount = eraseStates(nodeRotations, seq.rotationMatters, seq.baseRotation, seq.numKeyframes);
1818 S32 scaleCount = 0;
1819 if (seq.flags & TSShape::ArbitraryScale)
1820 {
1821 scaleCount = eraseStates(nodeArbitraryScaleRots, seq.scaleMatters, seq.baseScale, seq.numKeyframes);
1822 eraseStates(nodeArbitraryScaleFactors, seq.scaleMatters, seq.baseScale, seq.numKeyframes);
1823 }
1824 else if (seq.flags & TSShape::AlignedScale)
1825 scaleCount = eraseStates(nodeAlignedScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes);
1826 else
1827 scaleCount = eraseStates(nodeUniformScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes);
1828
1829 // Remove the object states for this sequence
1830 TSIntegerSet objMatters(seq.frameMatters);
1831 objMatters.overlap(seq.matFrameMatters);
1832 objMatters.overlap(seq.visMatters);
1833 S32 objCount = eraseStates(objectStates, objMatters, seq.baseObjectState, seq.numKeyframes);
1834
1835 // Remove groundframes and triggers
1836 TSIntegerSet dummy;
1837 eraseStates(groundTranslations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0);
1838 eraseStates(groundRotations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0);
1839 eraseStates(triggers, dummy, seq.firstTrigger, seq.numTriggers, 0);
1840
1841 // Fixup the base indices of the other sequences
1842 for (S32 i = seqIndex + 1; i < sequences.size(); i++)
1843 {
1844 sequences[i].baseTranslation -= transCount;
1845 sequences[i].baseRotation -= rotCount;
1846 sequences[i].baseScale -= scaleCount;
1847 sequences[i].baseObjectState -= objCount;
1848 sequences[i].firstGroundFrame -= seq.numGroundFrames;
1849 sequences[i].firstTrigger -= seq.numTriggers;
1850 }
1851
1852 // Remove the sequence itself
1853 sequences.erase(seqIndex);
1854
1855 // Remove the sequence name if it is no longer in use
1856 removeName(name);
1857
1858 return true;
1859}
1860

Callers 1

Calls 6

eraseStatesFunction · 0.85
errorfFunction · 0.50
c_strMethod · 0.45
overlapMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected