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

Method undo

Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp:2165–2199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2163}
2164
2165void GuiConvexEditorUndoAction::undo()
2166{
2167 ConvexShape *object = NULL;
2168 if ( !Sim::findObject( mObjId, object ) )
2169 return;
2170
2171 // Temporarily save the ConvexShape current data.
2172 Vector< MatrixF > tempSurfaces;
2173 tempSurfaces.merge( object->mSurfaces );
2174 MatrixF tempObjToWorld( object->getTransform() );
2175 Point3F tempScale( object->getScale() );
2176
2177 // Restore the Object to the UndoAction state.
2178 object->mSurfaces.clear();
2179 object->mSurfaces.merge( mSavedSurfaces );
2180 object->setScale( mSavedScale );
2181 object->setTransform( mSavedObjToWorld );
2182
2183 // Regenerate the ConvexShape and synch the client object.
2184 object->_updateGeometry();
2185 GuiConvexEditorCtrl::synchClientObject( object );
2186
2187 // If applicable set the selected ConvexShape and face
2188 // on the editor.
2189 mEditor->setSelection( object, -1 );
2190 mEditor->updateGizmoPos();
2191
2192 // Now save the previous ConvexShape data in this UndoAction
2193 // since an undo action must become a redo action and vice-versa
2194
2195 mSavedObjToWorld = tempObjToWorld;
2196 mSavedScale = tempScale;
2197 mSavedSurfaces.clear();
2198 mSavedSurfaces.merge( tempSurfaces );
2199}
2200
2201ConvexEditorCreateTool::ConvexEditorCreateTool( GuiConvexEditorCtrl *editor )
2202 : Parent( editor ),

Callers 1

handleDeleteMethod · 0.45

Calls 10

updateGizmoPosMethod · 0.80
findObjectFunction · 0.50
mergeMethod · 0.45
getTransformMethod · 0.45
getScaleMethod · 0.45
clearMethod · 0.45
setScaleMethod · 0.45
setTransformMethod · 0.45
_updateGeometryMethod · 0.45
setSelectionMethod · 0.45

Tested by

no test coverage detected