Public Member Functions | Friends

RestoreObj Class Reference

This reference page is linked to from the following overview topics: The Undo Mechanism and Transform Controllers, How to Enable Undo and Redo, Undo and Redo Example, Deriving from RestoreObj, Undo Memory Limits.


Search for all occurrences

Detailed Description

See also:
Class Hold, Undo and Redo.

Description:
This class is the restore object used in the undo / redo system of 3ds Max.

#include <hold.h>

Inheritance diagram for RestoreObj:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  RestoreObj ()
virtual  ~RestoreObj ()
virtual void  Restore (int isUndo)=0
virtual void  Redo ()=0
virtual int  Size ()
virtual void  EndHold ()
virtual MSTR  Description ()
virtual INT_PTR  Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)

Friends

class  HoldStore
class  GenUndoObject
class  CheckForFlush

Constructor & Destructor Documentation

RestoreObj ( ) [inline]
{ next = prev = NULL; }
virtual ~RestoreObj ( ) [inline, virtual]
{};

Member Function Documentation

virtual void Restore ( int  isUndo ) [pure virtual]
Remarks:
The developer implements this method to restore the state of the database to as it was when theHold.Put() was called with this restore object.

Regardless of the value of the isUndo parameter, the method must restore the state of the scene to the one it was in when theHold.Put() was called with this restore object.

RestoreObj::Restore and RestoreObj::Redo may be called several times in a row: these methods must protect against any problems that may arise because of this, such as trying to undo multiple times in a row what has been undone already.
Parameters:
isUndo Nonzero if Restore() is being called in response to the Undo command; otherwise zero. If isUndo is nonzero, the developer needs to save whatever data they need to allow the user to redo the operation.

Implemented in JPLimitsRestore, PatchObjectRestore, RealWorldScaleRecord< T >, DeletedRestore, RefMgrAddDeleteRestore< T >, AppendGizmoRestore, DeleteGizmoRestore, ConvertToRestore, and AssignControllerRestore.

virtual void Redo ( ) [pure virtual]
Remarks:
This method is called when the user selects the Redo command. The developer should restore the database to the state prior to the last Undo command.

Implemented in JPLimitsRestore, PatchObjectRestore, RealWorldScaleRecord< T >, DeletedRestore, RefMgrAddDeleteRestore< T >, AppendGizmoRestore, DeleteGizmoRestore, ConvertToRestore, and AssignControllerRestore.

virtual int Size ( ) [inline, virtual]
Remarks:
Returns the size of the restore object in bytes. This size does not need to be exact but should be close. This is used to make sure all the accumulated restore objects do not grow beyond a manageable size.
Default Implementation:
{ return 1; }
Returns:
The size of the restore object in bytes.

Reimplemented in PatchObjectRestore.

{ return sizeof(RestoreObj); }
virtual void EndHold ( ) [inline, virtual]
Remarks:
This method is called when theHold.Accept() or theHold.Cancel() is called. This means the restore object is no longer held, it was either tossed out or sent to the undo system. The developer may then call ClearAFlag(A_HELD) to indicate the restore object is no longer being held.

Reimplemented in JPLimitsRestore, and PatchObjectRestore.

{ }
virtual MSTR Description ( ) [inline, virtual]
Remarks:
This method is used internally to 3ds Max in debugging only. It is used to display a symbolic name for the restore object.
Returns:
The name of the restore object.
Default Implementation:
{ return MSTR(_M("---")); }

Reimplemented in PatchObjectRestore, DeletedRestore, RefMgrAddDeleteRestore< T >, AppendGizmoRestore, DeleteGizmoRestore, ConvertToRestore, and AssignControllerRestore.

{ return MSTR(_M("---")); }
virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
) [inline, virtual]
Remarks:
This is a general purpose function that allows the API to be extended in the future. The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.

This is reserved for future use.
Default Implementation:
{return -1;}
        {
            UNUSED_PARAM(cmd);
            UNUSED_PARAM(arg1);
            UNUSED_PARAM(arg2);
            UNUSED_PARAM(arg3);
            return -1;
        }

Friends And Related Function Documentation

friend class HoldStore [friend]
friend class GenUndoObject [friend]
friend class CheckForFlush [friend]

RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj
RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj RestoreObj