Class JointParams

3DS Max Plug-In SDK

Class JointParams

See Also: Class AnimProperty, Class Control, Class InterpCtrlUI.

class JointParams : public AnimProperty

Description:

This class handles the data storage and user interface for inverse kinematic joint parameters. The default 3ds max controllers use this data structure to store their IK information. Plug-in controllers don't have to unless they want to.

Note the following is a dialog proc for handling joint parameters that is exported for use by plug-ins.

BOOL CALLBACK JointParamDlgProc(HWND hWnd,UINT message,

 WPARAM wParam,LPARAM lParam);

Data Members:

public:

float *min, *max;

Pointers to an array of floats corresponding to the number of degrees of freedom These are the From and To parameters.

float *damping;

Pointer to an array of floating point Damping parameters for each degree of freedom.

float scale;

This is a scale factor applied to the values in the spinner edit fields. This is to make them more sensible to the user. For example a percentage that is stored internally as 0.0 to 1.0 could be presented to the user as 0.0 to 100.0 by using a scale of 100.

DWORD flags;

One or more of the following values:

JNT_XACTIVE

JNT_YACTIVE

JNT_ZACTIVE

JNT_XLIMITED

JNT_YLIMITED

JNT_ZLIMITED

JNT_XEASE

JNT_YEASE

JNT_ZEASE

JNT_LIMITEXACT

JNT_ROLLOPEN

JNT_ROT

JNT_POS

int dofs;

The number of degrees of freedom the plug-in has.

Operators:

Prototype:

JointParams& operator=(JointParams& j);

Remarks:

Assignment operator.

Methods:

Prototype:

JointParams(DWORD type=JNT_POS,int dofs=3,float s=1.0f);

Remarks:

Constructor. The data members are initialized to the values passed.

Prototype:

JointParams(const JointParams &j);

Remarks:

Constructor. The data members are initialized to those of the JointParam passed.

Prototype:

~JointParams();

Remarks:

Destructor.

Prototype:

DWORD ID();

Remarks:

Implemented by the System.

Returns the ID of the AnimProperty - PROPID_JOINTPARAMS

Prototype:

BOOL IsDefault();

Remarks:

Implemented by the System.

Returns TRUE if the current state of the parameters are the defaults.

Prototype:

IOResult Save(ISave *isave);

Remarks:

Implemented by the System.

This method may be called to save the joint properties to the 3ds max file.

Parameters:

ISave *isave

This pointer may be used to call methods to write data to disk. See Class ISave.

Return Value:

One of the following values:

IO_OK - The result was acceptable - no errors.

IO_ERROR - This is returned if an error occured.

Prototype:

IOResult Load(ILoad *iload);

Remarks:

Implemented by the System.

This method is called to load the joint properties from the 3ds max file.

Parameters:

ILoad *iload

This pointer may be used to call methods to load data from disk. See Class ILoad.

Return Value:

One of the following values:

IO_OK - The result was acceptable - no errors.

IO_ERROR - This is returned if an error occured.

Prototype:

float ConstrainInc(int index,float v,float delta);

Remarks:

Implemented by the System.

This method applies constraints to the given delta based on parameters and the current value v. It uses the current min/max limits to constrain the result: v+delta so that v+delta < max and v+delta > min. It returns a new delta such that the previous will both be TRUE. If ease is turned on, then the values will be slowed down as they approach the limits. It also applies the damping if turned on.

Parameters:

int index

This is the index of the parameter. For example on a position controller the index could be 0 (x), 1 (y), or 2 (z).

float v

The current value of the parameter.

float delta

The increment to apply.

Return Value:

A new delta value. Usually it will return delta, but if the value was constrained, then the value may be smaller or larger.

Prototype:

BOOL Active(int i);

Remarks:

Implemented by the System.

Returns TRUE if the specified joint is active; otherwise FALSE.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

Return Value:

TRUE if the joint is active; otherwise FALSE.

Prototype:

BOOL Limited(int i)

Remarks:

Implemented by the System.

Returns TRUE if the joint is limited; otherwise FALSE.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

Return Value:

TRUE if the joint is limited; otherwise FALSE.

Prototype:

BOOL Ease(int i)

Remarks:

Implemented by the System.

Returns TRUE if the joint has the Ease property set; otherwise FALSE.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

Return Value:

TRUE if the joint has the Ease property set; otherwise FALSE.

Prototype:

DWORD Type()

Remarks:

Implemented by the System.

Returns the type of joint, sliding or rotation. This will either be JNT_POS for sliding joints of JNT_ROT for rotational joints.

Prototype:

BOOL RollupOpen()

Remarks:

Implemented by the System.

Returns TRUE if the rollup page if open; otherwise FALSE.

Prototype:

void SetActive(int i,BOOL s)

Remarks:

Implemented by the System.

Sets the specified joint to the specified active or inactive state.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

BOOL s

TRUE to set the joint active; otherwise FALSE.

Prototype:

void SetLimited(int i,BOOL s)

Remarks:

Implemented by the System.

Sets the specified joint to the specified limited or not limited state.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

BOOL s

TRUE to set the joint as limited; otherwise FALSE.

Prototype:

void SetEase(int i,BOOL s)

Remarks:

Implemented by the System.

Sets the specified joint to the specified eased or not eased state.

Parameters:

int i

One of the following values:

0 = X

1 = Y

2 = Z

BOOL s

TRUE to set the joint as eased; otherwise FALSE.

Prototype:

void SetType(DWORD type)

Remarks:

Implemented by the System.

Sets the type of joint.

Parameters:

DWORD type

Specifies the type of joint. One of the following values:

JNT_POS - Sliding joint.

JNT_ROT - Rotating joint.

Prototype:

void SetRollOpen(BOOL open)

Remarks:

Implemented by the System.

Set the rollup page as open or closed.

Parameters:

BOOL open

TRUE to open the page; FALSE to close it.

Prototype:

virtual void SpinnerChange(InterpCtrlUI *ui,WORD id,

 ISpinnerControl *spin,BOOL interactive);

Remarks:

Implemented by the Plug-In.

This is called when the user is interactively manipulating one of the spinner controls or enters a value into a spinner's edit field. This method has a default implementation.

Parameters:

InterpCtrlUI *ui

This is simply a container class to hold some data while the controllers parameters are being edited.

WORD id

The spinner control id.

ISpinnerControl *spin

A pointer to the spinner control.

BOOL interactive

TRUE if the user is doing an interactive adjustment; otherwise FALSE.

 

These methods manage the joint parameters dialog.

Prototype:

void InitDialog(InterpCtrlUI *ui);

Remarks:

Implemented by the System.

This is used internally.

Prototype:

void EndDialog(InterpCtrlUI *ui,BOOL dontDel=FALSE);

Remarks:

Implemented by the System.

This is used internally.

Prototype:

void SpinnerDown(InterpCtrlUI *ui,WORD id,ISpinnerControl *spin);

Remarks:

Implemented by the System.

This is used internally.

Prototype:

void SpinnerUp(InterpCtrlUI *ui,WORD id,ISpinnerControl *spin,

 BOOL accept);

Remarks:

Implemented by the System.

This is used internally.

Prototype:

void Command(InterpCtrlUI *ui,WORD notify, WORD id, HWND hCtrl);

Remarks:

Implemented by the System.

This is used internally.

Prototype:

void EnableDisable(InterpCtrlUI *ui);

Remarks:

Implemented by the System.

This is used internally.