Class ParamDlg

3DS Max Plug-In SDK

Class ParamDlg

See Also: Class Mtl, Class Texmap, Working with Materials and Textures.

class ParamDlg : public InterfaceServer

Description:

Every MtlBase sub-class defines a ParamDlg to manage its part of the material editor.

Methods:

Prototype:

virtual Class_ID ClassID()=0;

Remarks:

Implemented by the Plug-In.

Returns the unique Class_ID of the plug-in this dialog manages. See Class Class_ID.

Prototype:

virtual void SetThing(ReferenceTarget *m)=0;

Remarks:

Implemented by the Plug-In.

This sets the current material or texture being edited to the material or texture passed.

Parameters:

ReferenceTarget *m

The material or texture to set as current.

Prototype:

virtual ReferenceTarget* GetThing()=0;

Remarks:

Implemented by the Plug-In.

This method returns the current material or texture being edited.

Prototype:

virtual void SetTime(TimeValue t)=0;

Remarks:

Implemented by the Plug-In.

This method is called when the current time has changed. This gives the developer an opportunity to update any user interface data that may need adjusting due to the change in time.

Parameters:

TimeValue t

The new current time.

Prototype:

virtual void ReloadDialog()=0;

Remarks:

Implemented by the Plug-In.

This method should stuff values into all the parameter dialog's controls, edit fields etc. In fact this method is now only called after doing a "Reset". It is also useful inside the material/map when a NotifyRefChanged() is processed it may need to be called.

Prototype:

virtual void ActivateDlg(BOOL onOff)=0;

Remarks:

Implemented by the Plug-In.

This method is called when the dialog box becomes active or inactive. Currently this is used when working with color swatch custom controls. Color swatches need to know when the dialog box becomes active or inactive because they change their method of drawing themselves. When the dialog is active, color swatches are drawn in pure color (this requires a color register in the palette). When the dialog becomes inactive the color swatches are drawn using dithered painting. This is needed because there are only 8 available color registers.

A method of the color swatch control is called to indicate if it is in an active or inactive dialog. See the sample code below. Also see Class IColorSwatch.

Parameters:

BOOL onOff

TRUE if the dialog is active; otherwise FALSE.

Sample Code:

void NoiseDlg::ActivateDlg(BOOL onOff) {

 for (int i=0; i<NCOLS; i++)

  cs[i]->Activate(onOff);

 }

Prototype:

virtual void DeleteThis()=0;

Remarks:

Implemented by the Plug-In.

This method is called by the system to delete an instance of this class. A developer must use the same memory manager to delete the item as they did to allocate it (in MtlBase::CreateParamDlg()). For example if a developer used the new operator to allocate the memory, this method would be implemented as { delete this; }

Prototype:

virtual int FindSubTexFromHWND(HWND hwnd);

Remarks:

This method is available in release 2.0 and later only.

This method needs to be implemented if the plug-in texmap is using a TexDADMgr. It should return the index of the sub-texmap corresponding to the window whose handle is passed. If the handle is not valid return -1.

Parameters:

HWND hwnd

The window handle to check.

Default Implementation:

{ return -1;}

Sample Code:

int CellTexParamDlg::FindSubTexFromHWND(HWND hw) {

 if (hw==GetDlgItem(pmap->GetHWnd(),IDC_CELLTEX_CELLCOLOR_MAP))

  return 0;

 if (hw==GetDlgItem(pmap->GetHWnd(),IDC_CELLTEX_DIVCOL1_MAP))

  return 1;

 if (hw==GetDlgItem(pmap->GetHWnd(),IDC_CELLTEX_DIVCOL2_MAP))

  return 2;

 return -1;

 }

Prototype:

virtual int FindSubMtlFromHWND(HWND hwnd);

Remarks:

This method is available in release 2.0 and later only.

This method needs to be implemented if the plug-in material is using a MtlDADMgr. It should return the index of the sub-map corresponding to the window whose handle is passed. If the handle is not valid return -1.

Parameters:

HWND hwnd

The window handle to check.

Default Implementation:

{ return -1;}