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

Method removeObject

Engine/source/ts/tsShapeEdit.cpp:852–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850}
851
852bool TSShape::removeObject(const String& name)
853{
854 // Find the object
855 S32 objIndex = findObject(name);
856 if (objIndex < 0)
857 {
858 Con::errorf("TSShape::removeObject: Could not find object '%s'", name.c_str());
859 return false;
860 }
861
862 // Need to make everything editable since node indexes etc will change
863 makeEditable();
864
865 // Destroy all meshes in the object
866 TSShape::Object& obj = objects[objIndex];
867 while ( obj.numMeshes )
868 {
869 destructInPlace(meshes[obj.startMeshIndex + obj.numMeshes - 1]);
870 removeMeshFromObject(objIndex, obj.numMeshes - 1);
871 }
872
873 // Remove the object from the shape
874 objects.erase(objIndex);
875 S32 subShapeIndex = getSubShapeForObject(objIndex);
876 subShapeNumObjects[subShapeIndex]--;
877 for (S32 i = subShapeIndex + 1; i < subShapeFirstObject.size(); i++)
878 subShapeFirstObject[i]--;
879
880 // Remove the object from all sequences
881 for (S32 i = 0; i < sequences.size(); i++)
882 {
883 TSShape::Sequence& seq = sequences[i];
884
885 TSIntegerSet objMatters(seq.frameMatters);
886 objMatters.overlap(seq.matFrameMatters);
887 objMatters.overlap(seq.visMatters);
888
889 if (objMatters.test(objIndex))
890 eraseStates(objectStates, objMatters, seq.baseObjectState, seq.numKeyframes, objIndex);
891
892 seq.frameMatters.erase(objIndex);
893 seq.matFrameMatters.erase(objIndex);
894 seq.visMatters.erase(objIndex);
895 }
896
897 // Remove the object name if it is no longer in use
898 removeName(name);
899
900 // Update smallest visible detail
901 updateSmallestVisibleDL();
902
903 initObjects();
904
905 return true;
906}
907
908//-----------------------------------------------------------------------------
909

Callers 2

installMethod · 0.45

Calls 9

destructInPlaceFunction · 0.85
eraseStatesFunction · 0.85
findObjectFunction · 0.50
errorfFunction · 0.50
c_strMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45
overlapMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected