Public Member Functions

MorphControl Class Reference

Search for all occurrences

Detailed Description

See also:
Class Control, Class SetMorphTargetPacket, Class Object, Class ObjectState.

Description:
This is a special control base class for controllers that control morphing of geometry.

For the 3ds Max morph system, the morph object itself doesn't do much except provide the front end UI in the create and modify branches. It just allows the user to add targets, delete targets, etc., but it doesn't really do any of the work -- it just passes everything on to the morph controller.

The morph controller has references to the objects (one for each target) and stores keys in whatever form it wants, and interpolates between the objects. In 3ds Max 1.x there was only one morph controller. In 3ds Max 2.0 there is the new Barycentric one. Both of these work with any type of object as long as its Deformable. It just deforms the points.

The key to the way this works is that the controller just takes the targets and creates a new object from some combination of the targets. Basically the morph object calls GetValue() on the controller and passes it an ObjectState. The morph controller then computes the new object and drops it down into the ObjectState passed. This can be any object.

The val pointer used with GetValue() will point to an ObjectState. This would be the result of evaluating a combination of targets and producing a new object that is some combination of the targets.

The val pointer used with SetValue() will point to a SetMorphTargetPacket data structure. This has a pointer to an object (entire pipeline) and the name of the target.

The Morph Object is not really an object. Rather it has a reference to the Morph Controller which is the thing that actually generates the object. The Morph Controller needs to call Object::HasUVW() and Object::SetGenUVW() on each of the targets.

#include <control.h>

Inheritance diagram for MorphControl:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual int  NumMorphTargs ()
virtual Object GetMorphTarg (int i)
virtual void  DeleteMorphTarg (int i)
virtual void  GetMorphTargName (int i, MSTR &name)
virtual void  SetMorphTargName (int i, MSTR name)
virtual Matrix3  GetMorphTargTM (int i)
virtual BOOL  ValidTarget (TimeValue t, Object *obj)
virtual int  GetFlaggedTarget ()
virtual BOOL  HasUVW ()
virtual void  SetGenUVW (BOOL sw)

Member Function Documentation

virtual int NumMorphTargs ( ) [inline, virtual]
Remarks:
Returns the number of morph targets managed by this controller.
Default Implementation:
{return 0;}
{return 0;}
virtual Object* GetMorphTarg ( int  i ) [inline, virtual]
Remarks:
Returns a pointer to the 'i-th' object managed by this morph controller. Note that these are pointers to the pipelines, not the result of evaluating the pipelines.
Parameters:
int i

The index of the morph target. This value may be 0 through NumMorphTargs()-1.
Default Implementation:
{return NULL;}
{return NULL;}
virtual void DeleteMorphTarg ( int  i ) [inline, virtual]
Remarks:
Deletes the 'i-th' target.
Parameters:
int i

The index of the morph target. This value may be 0 through NumMorphTargs()-1.
Default Implementation:
{}
{}
virtual void GetMorphTargName ( int  i,
MSTR name 
) [inline, virtual]
Remarks:
Retrieves the name of the specified morph target.
Parameters:
int i

The index of the morph target whose name is returned. This value may be 0 through NumMorphTargs()-1.

MSTR &name

The name is returned here.
Default Implementation:
{name.printf(_M("Target #%d"),i);}
{name.printf(_M("Target #%d"),i);}
virtual void SetMorphTargName ( int  i,
MSTR  name 
) [inline, virtual]
Remarks:
Sets the name of the specified morph target.
Parameters:
int i

The index of the morph target whose name is set. This value may be 0 through NumMorphTargs()-1.

MSTR &name

The to set is passed here.
Default Implementation:
{}
{}
virtual Matrix3 GetMorphTargTM ( int  i ) [inline, virtual]
Remarks:
Retrieves the transformation matrix of the 'i-th' morph target.
Parameters:
int i

The index of the morph target whose TM is returned. This value may be 0 through NumMorphTargs()-1.
Default Implementation:
{return Matrix3(1);}
{return Matrix3(1);}
virtual BOOL ValidTarget ( TimeValue  t,
Object obj 
) [inline, virtual]
Remarks:
This method checks the object passed to see if it is an acceptable target.
Parameters:
TimeValue t

The time to check the object.

Object *obj

The object to check.
Returns:
TRUE if the object is a valid target; otherwise FALSE.
Default Implementation:
{return FALSE;}
{return FALSE;}
virtual int GetFlaggedTarget ( ) [inline, virtual]
Remarks:
When a 3ds Max reference REFMSG_SELECT_BRANCH message is received the morph controller should mark the target indicated and be prepared to return its ID from this method. This way the morph object can set the branch to that target. See this message in Reference Messages.
Returns:
The ID of the morph target.
Default Implementation:
{return -1;}
{return -1;}
virtual BOOL HasUVW ( ) [inline, virtual]
virtual void SetGenUVW ( BOOL  sw ) [inline, virtual]

MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl
MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl MorphControl