Class IMtlParams

3DS Max Plug-In SDK

Class IMtlParams

See Also: Class Mtl, Working with Materials, Class IRollupWindow.

class IMtlParams : public InterfaceServer

Description:

This is the interface that is passed in to the material or texture map when it is in the material editor. All methods of this class are implemented by the system.

Methods:

Prototype:

virtual void MtlChanged()=0;

Remarks:

This method may be called to causes the viewports to be redrawn. It should be called when any parameter that affects the look of the material in the viewport has been altered. If the material is not on a visible node in a shaded view, nothing will happen. This method should NOT be called as a spinner is being dragged, but only upon release of the mouse button.

Prototype:

virtual HWND AddRollupPage(HINSTANCE hInst, TCHAR *dlgTemplate, DLGPROC dlgProc, TCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;

Remarks:

This method may be called to add a rollup page to the material editor dialog. It returns the window handle of the dialog that makes up the rollup page.

Parameters:

HINSTANCE hInst

The DLL instance handle of the plug-in.

TCHAR *dlgTemplate

The dialog template for the rollup page.

DLGPROC dlgProc

The dialog proc to handle the message sent to the rollup page.

TCHAR *title

The title displayed in the title bar.

LPARAM param=0

Any specific data to pass along may be stored here. This may be later retrieved using the GetWindowLong() call from the Windows API.

DWORD flags=0

The following flag is defined:

APPENDROLL_CLOSED

Starts the page in the rolled up state.

int category = ROLLUP_CAT_STANDARD

The category parameter provides flexibility with regard to where a particular rollup should be displayed in the UI. RollupPanels with lower category fields will be displayed before RollupPanels with higher category fields. For RollupPanels with equal category value the one that was added first will be displayed first. Allthough it is possible to pass any int value as category there exist currently 5 different category defines: ROLLUP_CAT_SYSTEM, ROLLUP_CAT_STANDARD, and ROLLUP_CAT_CUSTATTRIB.

When using ROLLUP_SAVECAT, the rollup page will make the provided category sticky, meaning it will not read the category from the RollupOrder.cfg file, but rather save the category field that was passed as argument in the CatRegistry and in the RollupOrder.cfg file.

The method will take the category of the replaced rollup in case the flags argument contains ROLLUP_USEREPLACEDCAT. This is mainly done, so that this system works with param maps as well.

Return Value:

The window handle of the rollup page.

Prototype:

virtual HWND AddRollupPage(HINSTANCE hInst, DLGTEMPLATE *dlgTemplate, DLGPROC dlgProc, TCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;

Remarks:

This method is available in release 4.0 and later only.

This method may be called to add a rollup page to the material editor dialog. It returns the window handle of the dialog that makes up the rollup page. This method is currently not used.

Parameters:

HINSTANCE hInst

The DLL instance handle of the plug-in.

DLGTEMPLATE *dlgTemplate

The dialog template for the rollup page.

DLGPROC dlgProc

The dialog proc to handle the message sent to the rollup page.

TCHAR *title

The title displayed in the title bar.

LPARAM param=0

Any specific data to pass along may be stored here. This may be later retrieved using the GetWindowLong() call from the Windows API.

DWORD flags=0

The following flag is defined:

APPENDROLL_CLOSED

Starts the page in the rolled up state.

int category = ROLLUP_CAT_STANDARD

The category parameter provides flexibility with regard to where a particular rollup should be displayed in the UI. RollupPanels with lower category fields will be displayed before RollupPanels with higher category fields. For RollupPanels with equal category value the one that was added first will be displayed first. Allthough it is possible to pass any int value as category there exist currently 5 different category defines: ROLLUP_CAT_SYSTEM, ROLLUP_CAT_STANDARD, and ROLLUP_CAT_CUSTATTRIB.

When using ROLLUP_SAVECAT, the rollup page will make the provided category sticky, meaning it will not read the category from the RollupOrder.cfg file, but rather save the category field that was passed as argument in the CatRegistry and in the RollupOrder.cfg file.

The method will take the category of the replaced rollup in case the flags argument contains ROLLUP_USEREPLACEDCAT. This is mainly done, so that this system works with param maps as well.

Return Value:

The window handle of the rollup page.

Prototype:

virtual HWND ReplaceRollupPage(HWND hOldRollup, HINSTANCE hInst, TCHAR *dlgTemplate, DLGPROC dlgProc, TCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;

Remarks:

This method is available in release 4.0 and later only.

This method is used to replace the rollup page whose index is passed.

Parameters:

HWND hOldRollup

The handle to the rollup to replace.

HINSTANCE hInst

The DLL instance handle of the plug-in.

TCHAR *dlgTemplate

The dialog template for the rollup page.

DLGPROC dlgProc

The dialog proc to handle the message sent to the rollup page.

TCHAR *title

The title displayed in the title bar.

LPARAM param=0

Any specific data to pass along may be stored here.

DWORD flags=0

Append rollup page flags:

APPENDROLL_CLOSED

Starts the page in the rolled up state.

int category = ROLLUP_CAT_STANDARD

The category parameter provides flexibility with regard to where a particular rollup should be displayed in the UI. RollupPanels with lower category fields will be displayed before RollupPanels with higher category fields. For RollupPanels with equal category value the one that was added first will be displayed first. Allthough it is possible to pass any int value as category there exist currently 5 different category defines: ROLLUP_CAT_SYSTEM, ROLLUP_CAT_STANDARD, and ROLLUP_CAT_CUSTATTRIB.

When using ROLLUP_SAVECAT, the rollup page will make the provided category sticky, meaning it will not read the category from the RollupOrder.cfg file, but rather save the category field that was passed as argument in the CatRegistry and in the RollupOrder.cfg file.

The method will take the category of the replaced rollup in case the flags argument contains ROLLUP_USEREPLACEDCAT. This is mainly done, so that this system works with param maps as well.

Return Value:

The handle of the replacement page is returned.

Prototype:

virtual HWND ReplaceRollupPage(HWND hOldRollup, HINSTANCE hInst, DLGTEMPLATE *dlgTemplate, DLGPROC dlgProc, TCHAR *title, LPARAM param=0,DWORD flags=0, int category = ROLLUP_CAT_STANDARD)=0;

Remarks:

This method is available in release 4.0 and later only.

This method is used to replace the rollup page whose index is passed. This method is currently not being used.

Parameters:

HWND hOldRollup

The handle to the rollup to replace.

HINSTANCE hInst

The DLL instance handle of the plug-in.

DLGTEMPLATE *dlgTemplate

The dialog template for the rollup page.

DLGPROC dlgProc

The dialog proc to handle the message sent to the rollup page.

TCHAR *title

The title displayed in the title bar.

LPARAM param=0

Any specific data to pass along may be stored here.

DWORD flags=0

Append rollup page flags:

APPENDROLL_CLOSED

Starts the page in the rolled up state.

int category = ROLLUP_CAT_STANDARD

The category parameter provides flexibility with regard to where a particular rollup should be displayed in the UI. RollupPanels with lower category fields will be displayed before RollupPanels with higher category fields. For RollupPanels with equal category value the one that was added first will be displayed first. Allthough it is possible to pass any int value as category there exist currently 5 different category defines: ROLLUP_CAT_SYSTEM, ROLLUP_CAT_STANDARD, and ROLLUP_CAT_CUSTATTRIB.

When using ROLLUP_SAVECAT, the rollup page will make the provided category sticky, meaning it will not read the category from the RollupOrder.cfg file, but rather save the category field that was passed as argument in the CatRegistry and in the RollupOrder.cfg file.

The method will take the category of the replaced rollup in case the flags argument contains ROLLUP_USEREPLACEDCAT. This is mainly done, so that this system works with param maps as well.

Return Value:

The handle of the replacement page is returned.

Prototype:

virtual void DeleteRollupPage( HWND hRollup )=0;

Remarks:

This method may be called to remove a rollup page and destroy it.

Parameters:

HWND hRollup

The handle of the rollup window. This is the handle returned from AddRollupPage().

Prototype:

virtual void RollupMouseMessage(HWND hDlg, UINT message,

 WPARAM wParam, LPARAM lParam )=0;

Remarks:

This method allows hand cursor scrolling when the user clicks the mouse in an unused area of the dialog. When the user mouses down in dead area of the material editor, the plug-in should pass mouse messages to this function.

Note: In 3ds max 2.0 and later only use of this method is no longer required -- the functionality happens automatically.

Parameters:

HWND hDlg

The window handle of the dialog.

UINT message

The message sent to the dialog proc.

WPARAM wParam

Passed in to the dialog proc. Pass along to this method.

LPARAM lParam

Passed in to the dialog proc. Pass along to this method.

Example:

case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE:

im->iMtlParams->RollupMouseMessage(hDlg,message,wParam,lParam);

Prototype:

virtual int IsRollupPanelOpen(HWND hwnd)=0;

Remarks:

Returns nonzero if the rollup page whose handle is passed is open; otherwise zero.

Parameters:

HWND hwnd

The window handle of the rollup page to check.

Prototype:

virtual int GetRollupScrollPos()=0;

Remarks:

Returns the rollup scroll position. This is used, for example, by the Standard material because it saves and restores the rollup page positions with the material. This is just a convenience for the user.

Prototype:

virtual void SetRollupScrollPos(int spos)=0;

Remarks:

This method may be called to set the rollup scroll position. If the position was previously saved, this method may be called to restore it. The Standard material uses this method because it saves and restores the rollup positions with the material as a convenience for the user.

Parameters:

int spos

Specifies the rollup scroll position.

Prototype:

virtual void RegisterTimeChangeCallback(TimeChangeCallback *tc)=0;

Remarks:

This method is available in release 2.0 and later only.

Registers a callback object that will get called every time the user changes the 3ds max frame slider.

Parameters:

TimeChangeCallback *tc

The calllback called when the time changes. See Class TimeChangeCallback.

Prototype:

virtual void UnRegisterTimeChangeCallback(TimeChangeCallback *tc)=0;

Remarks:

This method is available in release 2.0 and later only.

This method un-registers the time change callback.

Parameters:

TimeChangeCallback *tc

The calllback called when the time changes. See Class TimeChangeCallback.

Prototype:

virtual void RegisterDlgWnd( HWND hDlg )=0;

Remarks:

This is called automatically in AddRollupPage(), so a plug-in doesn't need to do it. It is now obsolete.

Parameters:

HWND hDlg

The handle of the dialog window.

Prototype:

virtual int UnRegisterDlgWnd( HWND hDlg )=0;

Remarks:

This method is called automatically and is now obsolete.

Parameters:

HWND hDlg

The handle of the dialog window.

Prototype:

virtual TimeValue GetTime()=0;

Remarks:

Returns the current time (the frame slider position).

Return Value:

The current time.

Pick an object from the scene

Prototype:

virtual void SetPickMode(PickObjectProc *proc)=0;

Remarks:

This method is available in release 2.0 and later only.

Calling this methods puts the user into a pick mode where they can select items in the scene.

Parameters:

PickObjectProc *proc

This is the callback object for the picking. Its methods allow for filtering the picks, changing cursors over valid hits, and allowing multiple picks. See Class PickObjectProc.

Prototype:

virtual void EndPickMode()=0;

Remarks:

This method is available in release 2.0 and later only.

This method is called to terminate the pick mode.

Prototype:

virtual IRollupWindow *GetMtlEditorRollup()=0;

Remarks:

This method is available in release 3.0 and later only.

This method returns an interface to Materials Editor rollup.