Class ObjectState

3DS Max Plug-In SDK

Class ObjectState

See Also: Class Object, Class Matrix3.

class ObjectState

Description:

The ObjectState is the structure that flows up the geometry pipeline. It contains a matrix, a material index, some flags for channels, and a pointer to the object in the pipeline.

Data Members:

public:

Object *obj;

This is a pointer to the object in the pipeline. The validity interval of the object can be retrieved using obj->ObjectValidity().

Methods:

Prototype:

ObjectState();

Remarks:

Constructor. The object pointer is initialized to NULL.

Prototype:

ObjectState(Object *ob);

Remarks:

Constructor. The object pointer is set to the object passed. The tm pointer is set to NULL and the tm and mtl validity intervals are set to FOREVER.

Parameters:

Object *ob

The object to initialize the object pointer to.

Prototype:

ObjectState(const ObjectState& os);

Remarks:

Constructor. The object state is initialized to the object state passed.

Parameters:

const ObjectState& os

The object state to initialized to os.

Prototype:

~ObjectState();

Remarks:

Destructor. If the tm exists, it is deleted.

Prototype:

void OSSetFlag(ulong f);

Remarks:

Call this method to update the object state flags.

Parameters:

ulong f

The flags to set. The specified flags are ORed into the current state of the flags.

Prototype:

void OSClearFlag(ulong f);

Remarks:

Call this method to clear the specified object state flags.

Parameters:

ulong f

The flags to clear.

Prototype:

ulong OSTestFlag(ulong f) const;

Remarks:

Call this method to test the specified flags.

Parameters:

ulong f

The flags to test.

Return Value:

Nonzero if the specified flags are all set; otherwise 0.

Prototype:

void OSCopyFlag(ulong f, const ObjectState& fromos);

Remarks:

Copies the specified flag settings from the specified object state to this object state.

Parameters:

ulong f

The flags to copy.

const ObjectState& fromos

The source object state.

Prototype:

Interval tmValid() const

Remarks:

Returns the validity interval of the object state's transformation matrix.

Prototype:

Interval mtlValid() const;

Remarks:

Returns the validity interval of the object state's material.

Prototype:

Interval Validity(TimeValue t) const;

Remarks:

Returns the validity interval of the object state. If the object is not defined, this interval is NEVER. Otherwise it is the intersection of the tm validity interval, the mtl validity interval and the interval returned from obj->ObjectValidity(t).

Parameters:

TimeValue t

Specifies the time to retrieve the validity interval.

Return Value:

The validity interval of the object state.

Prototype:

int TMIsIdentity() const;

Remarks:

Returns nonzero if the object state's transformation matrix is the identity matrix; otherwise zero.

Prototype:

void SetTM(Matrix3* mat, Interval iv);

Remarks:

Sets the object state's transformation matrix to the specified Matrix3 and its validity interval to the interval passed. If the specified matrix is NULL, a new Matrix3 is allocated and is initialized to the identity matrix.

Parameters:

Matrix3* mat

Specifies the matrix to set.

Interval iv

Specifies the validity interval to set.

Prototype:

Matrix3* GetTM() const;

Remarks:

Returns the object state's transformation matrix.

Prototype:

void SetIdentityTM();

Remarks:

Sets the object state tm to the identity transformation matrix.

Prototype:

void ApplyTM(Matrix3* mat, Interval iv);

Remarks:

Applies the specified matrix to the object state tm. The object state tm is multiplied by the specified matrix. The specified interval is intersected with the object state tm validity interval.

Parameters:

Matrix3* mat

The matrix to apply.

Interval iv

The interval to intersect with the object state's tm validity interval.

Prototype:

void CopyTM(const ObjectState &fromos);

Remarks:

Copies the object state tm (and its validity interval) from the specified object state's tm.

Parameters:

const ObjectState &fromos

The object state whose tm is to be copied.

Prototype:

void CopyMtl(const ObjectState &fromos);

Remarks:

Copies the object state material (and its validity interval) from the specified object state's material.

Parameters:

const ObjectState &fromos

The object state whose material is to be copied.

Prototype:

void Invalidate(ChannelMask channels, BOOL checkLock=FALSE);

Remarks:

Invalidates the specified channels of the object state's object.

Parameters:

ChannelMask channels

The channels of the object to invalidate.

BOOL checkLock=FALSE

If checkLock is TRUE and OBJ_CHANNELS is one of the specified channels, the object the object state points to is not deleted if it is locked; otherwise it is deleted.

Prototype:

void DeleteObj(BOOL checkLock=FALSE);

Remarks:

Deletes the object state's object.

Parameters:

BOOL checkLock=FALSE

If checkLock is TRUE, the object the object state points to is not deleted if it is locked; otherwise it is always deleted.

Operators:

Prototype:

ObjectState& operator=(const ObjectState& os);

Remarks:

Assignment operator. The object pointer, flags, transformation matrix (and its validity interval), and material (and its validity interval) are copied from the specified object state.