mudbox::Operation Class Reference

#include <operation.h>

Inheritance diagram for mudbox::Operation:

Inheritance graph
[legend]
List of all members.

Detailed Description

The base class of all operations.

The main purpose of this class is that it makes it possible for plugins to execute undoable operations. When a plugin want undoable operations, it has to derive its own class from Operation, and implement the Serialize and ExecuteAndInvert functions. In this case, when one want to execute the operation, it not makes the changes directly, but creates an instance of the operation class, fills the necessary data members, and then calls Kernel::DoOperation(). That function will later call the ExecuteAndInvert function of the operation object, which will do the changes at that time. The Serialize function must properly store/restore the state of the operation object, otherwise the undo/redo will not work properly.


Public Member Functions

virtual const mudbox::ClassDesc RuntimeClass (void) const
  Operation (void)
virtual  ~Operation (void)
virtual bool  ExecuteAndInvert (void)
  Executes and then inverts the operation.

Static Public Member Functions

const mudbox::ClassDesc StaticClass (void)
mudbox::Node CreateInstances (unsigned int iCount=1)

Constructor & Destructor Documentation

mudbox::Operation::Operation void   ) 
 
virtual mudbox::Operation::~Operation void   )  [virtual]
 

Member Function Documentation

virtual const mudbox::ClassDesc* mudbox::Operation::RuntimeClass void   )  const [inline, virtual]
 

Reimplemented from mudbox::Node.

Reimplemented in mudbox::BrushOperation.

00040 :
const mudbox::ClassDesc* mudbox::Operation::StaticClass void   )  [static]
 

Reimplemented from mudbox::Node.

Reimplemented in mudbox::BrushOperation.

mudbox::Node* mudbox::Operation::CreateInstances unsigned int  iCount = 1  )  [static]
 

Reimplemented from mudbox::Node.

Reimplemented in mudbox::BrushOperation.

virtual bool mudbox::Operation::ExecuteAndInvert void   )  [virtual]
 

Executes and then inverts the operation.

This function must do two things, it has to execute the current operation, and then invert the effect of the object, so that the next time if this function is called, it should execute the inverse of the previous effect. Calling this function twice in a row should result both the state of the scene and the object to be the same as it was before the first call. Some examples of a typical implementation of this function:

  • If the task of the operation is to create an object, this function should change the type of the operation into delete an object, and should remember the ID of the newly created object.
  • If the task of the operation is to delete something, it should first scan the object for all the data which is needed to properly recreate a the object later, and change the type of the operation to 'create'.
  • If the task of the operation is to select something, the operation type should not change during this function, but the target of the operation should change to the object which was selected at the time of this call. This way the next time when this function is called, the selection will be restored into the original object.

Reimplemented in mudbox::BrushOperation.


mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation
mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation mudbox::Operation