Class IDerivedObject

3DS Max Plug-In SDK

Class IDerivedObject

See Also: Class Object, Class ModContext, Class Modifier, Class INode, Geometry Pipeline System.

class IDerivedObject : public Object

Description:

This class provides an interface into derived objects. Methods of this class are provided so developers can access the modifier stack, add and delete modifiers, etc. All methods of this class are implemented by the system.

To use this interface you must #include the following file:

#include "modstack.h"

To get an IDerivedObject pointer from the pipeline of a node in the scene first retrieve the object reference using INode::GetOjbectRef(). Given this Object pointer check its SuperClassID to see if it is GEN_DERIVOB_CLASS_ID. If it is, you can cast it to an IDerivedObject.

Note: The following functions are not part of class IDerivedObject but are available for use in conjunction with its methods.

Prototype:

IDerivedObject *CreateDerivedObject(Object *pob=NULL);

Remarks:

This method creates an object space derived object.

Parameters:

Object *pob=NULL

If non-NULL then the derived object will be set up to reference this object.

Return Value:

A pointer to the derived object.

Prototype:

Object *MakeObjectDerivedObject(Object *obj);

Remarks:

Creates a new empty derived object, sets it to point at the given object and returns a pointer to the derived object.

Parameters:

Object *obj

The object reference of the derived object will point at this object.

Return Value:

A pointer to the derived object.

Prototype:

IDerivedObject *CreateWSDerivedObject(Object *pob=NULL);

Remarks:

This method creates a world space derived object.

Parameters:

Object *pob=NULL

If non-NULL then the WS derived object will be set up to reference this object.

Return Value:

A pointer to the derived object.

Methods:

Prototype:

virtual void AddModifier(Modifier *mod, ModContext *mc=NULL, int before=0)=0;

Remarks:

Adds a modifier to this derived object.

Parameters:

Modifier *mod

The modifier to add.

ModContext *mc=NULL

The mod context for the modifier.

int before=0

If this value is set to 0 then the modifier will be placed at the end of the pipeline (top of stack). If this value is set to NumModifiers() then the modifier will be placed at the start of the pipeline (bottom of stack).

Prototype:

virtual Object *GetObjRef()=0;

Remarks:

Gets the object that this derived object references. This is the next object down in the stack and may be the base object.

Return Value:

The object that this derived object references.

Prototype:

virtual RefResult ReferenceObject(Object *pob)=0;

Remarks:

Sets the object that this derived object references. This is the next object down in the stack and may be the base object.

Parameters:

Object *pob

The object that this derived object should reference.

Return Value:

One of the following values:

REF_SUCCEED

REF_FAIL

Prototype:

virtual int NumModifiers()=0;

Remarks:

Returns the number of modifiers this derived object has.

Prototype:

virtual void DeleteModifier(int index=0)=0;

Remarks:

Deletes the specified modifier from the stack.

Parameters:

int index=0

The index of the modifier to delete.

Prototype:

virtual Modifier *GetModifier(int index)=0;

Remarks:

Returns the modifier specified by the index.

Parameters:

int index

The index of the modifier to return.

Prototype:

virtual void SetModifier(int index, Modifier *mod)=0;

Remarks:

This method replaces the modifier in the stack whose index is passed.

Parameters:

int index

The index of the modifier in the stack.

Modifier *mod

The modifier that will replace it.

Prototype:

virtual ModContext* GetModContext(int index)=0;

Remarks:

Returns the ModContext of the specified modifier.

Parameters:

int index

The index of the modifier in the stack.

Prototype:

virtual ObjectState Eval(TimeValue t, int modIndex = 0)=0;

Remarks:

This method is available in release 4.0 and later only.

This method allows you to evaluate the pipeline starting with a specific modifier index. Prior to version 4.0 you had to turn all the modApps off, evaluate and then turn them on again. Now this can be easily done by specifying the modifier index.

Parameters:

TimeValue t

Specifies the time to evaluate the object.

int modIndex = 0

The index of the modifier.

Return Value:

The result of evaluating the object as an ObjectState.