Class ClassDesc2

3DS Max Plug-In SDK

Class ClassDesc2

See Also: Class ClassDesc, Class Animatable, Class ParamBlockDesc2, Class IParamMap2, Class IObjParam, Class ParamMap2UserDlgProc, Class IAutoMParamDlg.

class ClassDesc2 : public ClassDesc

Description:

This class is available in release 3.0 and later only.

A subclass of ClassDesc which you specialize to provide a class descriptor for plug-in classes that will use the ParamBlock2 system. It contains a table of ParamBlockDesc2s for all the parameter blocks used in the plug-in and a number of sets of methods including access to the block descriptors, auto user interface management, auto param block2 construction, and access to any automatically-maintained ParamMap2s.

Methods:

public:

Prototype:

ClassDesc2();

Remarks:

Constructor.  The master ParamDlg and Effect ParamDlg pointers are set to NULL.

Prototype:

~ClassDesc2();

Remarks:

Destructor.

Prototype:

void ResetClassParams(BOOL fileReset);

Remarks:

This method may be called to restore all sticky parameters to their default values.

Parameters:

BOOL fileReset

This parameter is not used.

Prototype:

int NumParamBlockDescs();

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns the number of parameter block2 descriptors used by this plug-in class.

Prototype:

ParamBlockDesc2* GetParamBlockDesc(int i);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns a pointer to the 'i-th' parameter block2 descriptor.

Parameters:

int i

The zero based index of the parameter block2 descriptor to return.

Prototype:

ParamBlockDesc2* GetParamBlockDescByID(BlockID id);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns a pointer to the parameter block2 descriptor as specified by its BlockID.

Note: typedef short BlockID;

Parameters:

BlockID id

The permanent ID for the parameter block.

Prototype:

ParamBlockDesc2* GetParamBlockDescByName(TCHAR* name);

Remarks:

Returns a pointer to the parameter block2 descriptor as specified by the descriptor's internal name.

Parameters:

TCHAR* name

The internal name of the parameter block descriptor.

Prototype:

void AddParamBlockDesc(ParamBlockDesc2* pbd);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Adds a parameter block2 to the list of those maintained by this class descriptor.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block2 descriptor of the parameter block2 to add.

Prototype:

void ClearParamBlockDescs();

Remarks:

Implemented by the System.

Removes all the parameter block 2 descriptors maintained by this plug-in.

Prototype:

void BeginEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

This method is called to handle the beginning of the automatic command panel user interface management provided by the param map 2 system. This method is called by the plug-in from its Animatable::BeginEditParams() method. The parameters passed to that method are simply passed along to this method.

Parameters:

IObjParam *ip

The interface pointer passed to the plug-in.

ReferenceMaker* obj

Points to the plug-in class calling this method.

ULONG flags

The flags passed along to the plug-in in Animatable::BeginEditParams().

Animatable *prev

The pointer passed to the plug-in in Animatable::BeginEditParams().

Prototype:

void EndEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

This method is called to handle the ending of the automatic command panel user interface management provided by the param map 2 system. This method is called by the plug-in from its Animatable::EndEditParams() method. The parameters passed to that method are simply passed along to this method.

Parameters:

IObjParam *ip

The interface pointer passed to the plug-in.

ReferenceMaker* obj

Points to the plug-in class calling this method.

ULONG flags

The flags passed along to the plug-in in Animatable::EndEditParams().

Animatable *prev

The pointer passed to the plug-in in Animatable::EndEditParams().

Prototype:

void InvalidateUI();

Remarks:

Implemented by the System.

This invalidates the entire UI for every parameter map of the plug-in.

Prototype:

void InvalidateUI(ParamBlockDesc2* pbd);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

This is called if the user interface parameters needs to be updated. This invalidates the entire UI managed by the param map whose description is passed.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor for the rollup.

Prototype:

void InvalidateUI(ParamBlockDesc2* pbd, ParamID id, int tabIndex=-1);

Remarks:

Implemented by the System.

This is called if a certain user interface parameter of the specified parameter map needs to be updated. The parameter ID of the control is passed. If the parameter is a Tab<> then the index into the table of the parameter is passed.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor for the rollup.

ParamID id

The permanent parameter ID of the parameter.

int tabIndex=-1

If the parameter is a Tab<> then this is the zero based index into the table. The default value of -1 indicates it is not a table.

Prototype:

void MakeAutoParamBlocks(ReferenceMaker* owner);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

This method is called to create the parameter blocks for the plug-in.

Parameters:

ReferenceMaker* owner

Points to the plug-in class calling this method.

Prototype:

int NumParamMaps();

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns the number of automatically-maintained parameter map2s.

Prototype:

IParamMap2* GetParamMap(ParamBlockDesc2* pbd, MapID map_id = 0);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns a pointer to the parameter map2 as specified by the parameter block2 pointer passed.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor2 associated with this parameter map.

MapID map_id

This parameter is available in release 4.0 and later only.

Specifies the ID of the map/rollout to get.

Prototype:

IParamMap2* GetParamMap(ParamBlockDesc2* pbd);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns a pointer to the parameter map2 as specified by the parameter block2 pointer passed.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor2 associated with this parameter map.

Prototype:

void SetUserDlgProc(ParamBlockDesc2* pbd, ParamMap2UserDlgProc* proc=NULL);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

This method allows the developer to provide special handling for controls not processed automatically by the parameter map (or those that need additional processing). The developer provides a dialog proc to process the messages from the controls. This method is used to tell the parameter map that the developer defined method should be called. The given proc will be called after default processing is done.

Note, in version 4.0 and later, this actually maps to a call on the explicit map ID overload of SetUserDlgProc() with default map ID of 0.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor for the parameter map.

ParamMap2UserDlgProc* proc=NULL

Points to the class derived from ParamMap2UserDlgProc which handles the controls.

Prototype:

void SetUserDlgProc(ParamBlockDesc2* pbd, MapID map_id, ParamMap2UserDlgProc* proc=NULL);

Remarks:

This method is available in release 4.0 and later only.

This overload of SetUserDlgProc() has a new parameter, map_id, that specifies the ID of the parameter map/rollup to set the user dialog proc for. See original function for the rest of the description.

Prototype:

ParamMap2UserDlgProc* GetUserDlgProc(ParamBlockDesc2* pbd, MapID map_id = 0);

Remarks:

Implemented by the System.

This is a method of the base class ClassDesc. This class provides an implementation of the method used by plug-ins using the ParamBlock2 system.

Returns a pointer to the user dialog proc associated with the parameter map as specified by the parameter block descriptor2 pointer.

Parameters:

ParamBlockDesc2* pbd

Points to the parameter block descriptor for the parameter map.

MapID map_id

This parameter is available in release 4.0 and later only.

Specifies the ID of the map/rollout to get the user dialog proc for.

Prototype:

IAutoMParamDlg* CreateParamDlgs(HWND hwMtlEdit, IMtlParams *imp, MtlBase* obj);

Remarks:

Implemented by the System.

This method creates and returns a pointer to the object which handles the automatic processing of the user interface in the materials editor. This method loops over all parameter blocks which specify AUTO_UI and makes the AutoMParamDlgs for them. The first one becomes the master and the others are added to it.

Parameters:

HWND hwMtlEdit

The window handle of the materials editor.

IMtlParams *imp

The interface pointer provided for calling methods in 3ds max.

MtlBase* obj

Points to the plug-in class calling this method.

Prototype:

IAutoMParamDlg* CreateParamDlg(BlockID id, HWND hwMtlEdit, IMtlParams *imp, ReferenceTarget* obj, MapID map_id = 0);

Remarks:

Implemented by the System.

This method creates and returns a pointer to the object which handles the automatic processing of the user interface in the materials editor. This method makes an AutoMParamDlg for the specified parameter block.

Parameters:

BlockID id

The permanent ID of the parameter block.

HWND hwMtlEdit

The window handle of the materials editor.

IMtlParams *imp

The interface pointer provided for calling methods in 3ds max.

MtlBase* obj

Points to the plug-in class calling this method.

MapID map_id

This parameter is available in release 4.0 and later only.

Specifies the ID of the map/rollout in the parameter block to create AutoMParamDlg for.

Prototype:

IAutoEParamDlg* CreateParamDialogs(IRendParams *ip, SpecialFX* obj);

Remarks:

Implemented by the System.

This method creates and returns a pointer to the object which handles the automatic processing of the user interface in the rendering effects dialog. This method loops over all parameter blocks which specify AUTO_UI and makes the AutoMParamDlgs for them. The first one becomes the master and the others are added to it.

Parameters:

IRendParams *ip

The interface pointer provided for calling methods in 3ds max.

SpecialFX* obj

Points to the plug-in class calling this method. See Class SpecialFX.

Prototype:

IAutoEParamDlg* CreateParamDialog(BlockID id, IRendParams *ip, SpecialFX* obj, MapID mapID=0);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method creates and returns a pointer to the object which handles the automatic processing of the user interface in the rendering effects dialog. This method makes an AutoEParamDlg for the specified parameter block.

Parameters:

BlockID id

The permanent ID of the parameter block.

IRendParams *ip

The interface pointer provided for calling methods in 3ds max.

SpecialFX* obj

Points to the plug-in class calling this method. See Class SpecialFX.

MapID map_id

Specifies the ID of the map/rollout in the parameter block to create AutoEParamDlg for.

Prototype:

void MasterDlgDeleted(IAutoMParamDlg* dlg);

Remarks:

Implemented by the System.

This method is called when an AutoMParamDlg is deleted.

Parameters:

IAutoMParamDlg* dlg

Pointer to the object which handles the automatic processing of the user interface in the materials editor.

Prototype:

void MasterDlgDeleted(IAutoEParamDlg* dlg);

Remarks:

Implemented by the System.

This method is called when an AutoEParamDlg is deleted.

Parameters:

IAutoEParamDlg* dlg

Pointer to the object which handles the automatic processing of the user interface in the rendering effects dialog.

Prototype:

IAutoMParamDlg* GetMParamDlg();

Remarks:

Implemented by the System.

Returns the master dialog processing routine for the materials editor plug-in.

Prototype:

IAutoEParamDlg* GetEParamDlg();

Remarks:

Implemented by the System.

Returns the master dialog processing routine for the rendering effects plug-in.

Prototype:

void RestoreRolloutState();

Remarks:

This method may be called to restore any saved rollout state (open/closed condition and scrolling position) for any parameter map maintained by the plug-in.

Prototype:

ParamID LastNotifyParamID(ReferenceMaker* owner, IParamBlock2*& pb);

Remarks:

This method scans all the parameter blocks in the owner and returns the ParamID and parameter block making the most recent change notification.

Parameters:

ReferenceMaker* owner

The owner of the parameter blocks.

IParamBlock2*& pb

The parameter block which made the most recent notification.

Return Value:

The parameter ID of the parameter which made the most recent notification.

Prototype:

void Reset(ReferenceMaker* owner, BOOL updateUI = TRUE, BOOL callSetHandlers = TRUE);

Remarks:

This method may be called to reset all the parameters of all know parameter blocks to their default values and optionally update the user interface.

Parameters:

ReferenceMaker* owner

The owner of this ClassDesc2.

BOOL updateUI = TRUE

If TRUE to user inteface is updated. If FALSE it's not.

BOOL callSetHandlers = TRUE

TRUE to call PBAccessor::Set() for all the parameters; otherwise FALSE.

Prototype:

void GetValidity(ReferenceMaker* owner, TimeValue t, Interval &valid);

Remarks:

This method updates the validity interval passed with the cumulative validity interval of all the owner's parameter blocks.

Parameters:

ReferenceMaker* owner

The owner of this ClassDesc2.

TimeValue t

The time about which to compute the interval.

Interval &valid

The interval to update.

The following functions are not part of this class but are available for use.

Function:

IParamBlock2 *CreateParameterBlock2(ParamBlockDesc2 *pdesc, ReferenceMaker* iowner);

Remarks:

This method is used to create a parameter block2.

Parameters:

ParamBlockDesc2 *pdesc

This is an array of parameter block descriptors.

ReferenceMaker* iowner

Points to the owner of the parameter block.

Return Value:

A pointer to the created parameter block. On error NULL is returned.

Function:

IParamBlock2* UpdateParameterBlock2(ParamBlockDescID *pdescOld, int oldCount, IParamBlock *oldPB, ParamBlockDesc2* pdescNew, IParamBlock2* newPB=NULL);

Remarks:

This function creates a new ParamBlock2, based on an existing ParamBlock of an earlier version. The new parameter block inherits any parameters from the old parameter block whose parameter IDs match. This may also be used to partially update an existing ParamBlock2.

Parameters:

ParamBlockDescID *pdescOld

The array of parameter block descriptors which describes each parameter in the old parameter block.

int oldCount

The number of elements in the array above.

IParamBlock *oldPB

The old parameter block.

ParamBlockDesc2* pdescNew

Points to the new parameter block 2 descriptor.

IParamBlock2* newPB=NULL

Points to an existing IParamBlock2 indicating that this paramblock should be filled in from the old ParamBlock, rather than creating a new one.

Return Value:

The new parameter block2.

Function:

void SetPB2MacroRecorderInterface(MacroRecorder* mri);

Remarks:

This function for internal use only.