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

Method undo

Engine/source/gui/worldEditor/worldEditor.cpp:369–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void WorldEditor::WorldEditorUndoAction::undo()
370{
371 // NOTE: This function also handles WorldEditorUndoAction::redo().
372
373 MatrixF oldMatrix;
374 VectorF oldScale;
375 for( U32 i = 0; i < mEntries.size(); i++ )
376 {
377 SceneObject *obj;
378 if ( !Sim::findObject( mEntries[i].mObjId, obj ) )
379 continue;
380
381 mWorldEditor->setClientObjInfo( obj, mEntries[i].mMatrix, mEntries[i].mScale );
382
383 // Grab the current state.
384 oldMatrix = obj->getTransform();
385 oldScale = obj->getScale();
386
387 // Restore the saved state.
388 obj->setTransform( mEntries[i].mMatrix );
389 obj->setScale( mEntries[i].mScale );
390
391 // Store the previous state so the next time
392 // we're called we can restore it.
393 mEntries[i].mMatrix = oldMatrix;
394 mEntries[i].mScale = oldScale;
395 }
396
397 // Mark the world editor as dirty!
398 mWorldEditor->setDirty();
399 mWorldEditor->mSelected->invalidateCentroid();
400
401 // Let the script get a chance at it.
402 Con::executef( mWorldEditor, "onWorldEditorUndo" );
403}
404
405//------------------------------------------------------------------------------
406// edit stuff

Callers

nothing calls this directly

Calls 9

executefFunction · 0.85
setClientObjInfoMethod · 0.80
findObjectFunction · 0.50
sizeMethod · 0.45
getTransformMethod · 0.45
getScaleMethod · 0.45
setTransformMethod · 0.45
setScaleMethod · 0.45
setDirtyMethod · 0.45

Tested by

no test coverage detected