Public Member Functions | Public Attributes

MSPluginDesc Class Reference

Search for all occurrences

#include <mxsPlugin.h>

Inheritance diagram for MSPluginDesc:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MSPluginDesc (MSPluginClass *ipc)
int  IsPublic ()
  Controls if the plug-in shows up in lists from the user to choose from.
void *  Create (BOOL loading=FALSE)
  3ds Max calls this method when it needs a pointer to a new instance of the plug-in class.
const MCHAR *  ClassName ()
  This method returns the name of the class.
SClass_ID  SuperClassID ()
  This method returns a system defined constant describing the class this plug-in class was derived from.
Class_ID  ClassID ()
  This method must return the unique ID for the object.
const MCHAR *  Category ()
  This methods returns a string describing the category a plug-in fits into.
int  BeginCreate (Interface *i)
  The custom creation process of the plug-in object is handled by this method.
int  EndCreate (Interface *i)
  The termination of the custom creation process is managed by the implementation of this method.
void  ResetClassParams (BOOL fileReset)
DWORD  InitialRollupPageState ()
  This method returns a DWORD which is used to initialize the rollup state in both the create branch and the modify branch.
BOOL  IsManipulator ()
  Returns TRUE if the class implements a manipulator object; otherwise FALSE.
BOOL  CanManipulate (ReferenceTarget *hTarget)
  The method returns true if the class is a manipulator and it manipulates the given base object, modifier or controller.
BOOL  CanManipulateNode (INode *pNode)
  Returns TRUE if the manipulator applies to the given node; otherwise FALSE.
Manipulator CreateManipulator (ReferenceTarget *hTarget, INode *pNode)
  Creates a manipulator object When a manipulator returns TRUE to CanManipulate(ReferenceTarget* hTarget), the system calls this version of CreateManipulator() to create an instance of the manipulator.
Manipulator CreateManipulator (INode *pNode)
  Creates a manipulator object.
const MCHAR *  InternalName ()
  Returns a string which provides a fixed, machine parsable internal name for the plug-in.
HINSTANCE  HInstance ()
  Returns the DLL instance handle of the plug-in.
MCHAR *  GetString (INT_PTR id)
MCHAR *  GetRsrcString (INT_PTR id)
  Returns a pointer to the string from the resource string table.
void  StartTool (IObjCreate *iob)
void  StopTool (IObjCreate *iob)
Class_ID  SubClassID ()
  This method can be used for further categorizing plugins.
bool  IsCompatibleWithRenderer (ClassDesc &rendererClassDesc)
bool  GetCustomMtlBrowserIcon (HIMAGELIST &hImageList, int &inactiveIndex, int &activeIndex, int &disabledIndex)

Public Attributes

MSPluginClass *  pc
MSPlugin plugin
RefTargetHandle  base_obj

Constructor & Destructor Documentation

MSPluginDesc ( MSPluginClass *  ipc ) [inline]
{ pc = ipc; Init(*this); }

Member Function Documentation

int IsPublic ( ) [virtual]

Controls if the plug-in shows up in lists from the user to choose from.

Returns:
If the plug-in can be picked and assigned by the user, as is usually the case, return TRUE. Certain plug-ins may be used privately by other plug-ins implemented in the same DLL and should not appear in lists for user to choose from. These plug-ins would return FALSE.

Implements ClassDesc.

void* Create ( BOOL  loading = FALSE ) [inline, virtual]

3ds Max calls this method when it needs a pointer to a new instance of the plug-in class.

For example, if 3ds Max is loading a file from disk containing a previously used plug-in (procedural object, modifier, controller, etc...), it will call the plug-in's Animatable::Create() method. The plug-in responds by allocating a new instance of its plug-in class. See the Advanced Topic section on Memory Allocation for more details.

Parameters:
loading This parameter is a flag indicating if the class being created is going to be loaded from a disk file. If the flag is TRUE, the plug-in may not have to perform any initialization of the object because the loading process will take care of it. See the Advanced Topics section on Loading and Saving for more information.

Note: If this parameter is TRUE, developers must initialize their references to NULL. Otherwise 3ds Max may crash.

3ds Max provides a default plug-in object creation process. Many plug-ins fit this form. When the system is about to create an instance of the plug-in object it calls a method BaseObject::GetCreateMouseCallBack().This method returns a callback object whose proc() method handles the mouse input during its creation phase. Most of the work is then handled by the system. The procedural sphere is an example of this type of plug-in. Certain plug-ins may have special creation needs however. The target camera is an example of such a plug-in. Because it needs to create two nodes in the scene (the camera and the target) it requires a custom creation process. To support these plug-ins the following two methods are provided. They allow the plug-in to manage the creation process themselves. See Object Creation Methods for more details.

Implements ClassDesc.

{ return pc->Create(loading); }
const MCHAR* ClassName ( ) [inline, virtual]

This method returns the name of the class.

This name appears in the button for the plug-in in the 3ds Max user interface.

Returns:
The name of the class.

Implements ClassDesc.

{ return pc->ClassName(); }
SClass_ID SuperClassID ( ) [inline, virtual]

This method returns a system defined constant describing the class this plug-in class was derived from.

For example, the Bend modifier returns OSM_CLASS_ID. This super class ID is used by all object space modifiers. See List of SuperClassIDs.

Returns:
The SuperClassID of the plug-in.

Implements ClassDesc.

{ return pc->SuperClassID(); }
Class_ID ClassID ( ) [inline, virtual]

This method must return the unique ID for the object.

If two ClassIDs conflict, the system will only load the first one it finds. The ClassID consists of two unsigned 32-bit quantities. The constructor assigns a value to each of these, for example Class_ID(0xA1C8E1D1, 0xE7AA2BE5). A developer should use the random Class_ID generator to avoid conflicts (Generate a random Class_ID). See Class Class_ID for more information.

Returns:
The unique ClassID of the plug-in.

Implements ClassDesc.

{ return pc->ClassID(); }
const MCHAR* Category ( ) [inline, virtual]

This methods returns a string describing the category a plug-in fits into.

The category is usually selected in the drop down list in the create, or utility branch of the command panel. In the create branch, if this is set to be an existing category (i.e. "Standard Primitives", "Splines", ...) then the plug-in will appear in that category. If the category doesn't yet exists then it is created. If the plug-in does not need to appear in the list, it may simply return a null string as in _M(""). In the modify branch, the category determines which group it appears in the Configure Button Sets / Modifiers list. These are the categories such as "MAX STANDARD", "MAX EDIT", and "MAX SURFACE".

This method is also used to distinguish between the various types of texture maps so they can be separated in the Material/Map Browser. The appropriate string should be returned by this method of the Texmap. For example:

        const MCHAR* Category() { 
            return TEXMAP_CAT_3D; 
        }

The options for texture maps are:

  • MCHAR TEXMAP_CAT_2D[]; -> 2D maps.
  • MCHAR TEXMAP_CAT_3D[]; - 3D maps.
  • MCHAR TEXMAP_CAT_COMP[]; - Composite.
  • MCHAR TEXMAP_CAT_COLMOD[]; - Color modifier.
  • MCHAR TEXMAP_CAT_ENV[]; - Environment.

Implements ClassDesc.

{ return pc->Category(); }
int BeginCreate ( Interface i ) [virtual]

The custom creation process of the plug-in object is handled by this method.

For example, a plug-in can create a custom command mode and push it on the command stack to handle the creation process.

Important Note: A plug-in that doesn't want to participate in the standard object creation mechanism using CreateMouseCallBack must push a CommandMode on the stack in this method and remove it in EndCreate(). This is true even if the plug-in doesn't do anything inside the mode. A mode has to be pushed on the stack and then later popped off otherwise a crash will occur (if the default implementation of this method is not used). For more details on object creation see the Advanced Topics section Object Creation Methods.

Parameters:
i An interface pointer the plug-in may use to call functions in 3ds Max.
Returns:
To use the default creation process (the system implementation for this method) return 0; Return nonzero if the plug-in implements this method.

Reimplemented from ClassDesc.

int EndCreate ( Interface i ) [virtual]

The termination of the custom creation process is managed by the implementation of this method.

For example, the plug-in could remove a custom command mode from the command stack. See the Advanced Topics section on Object Creation Methods for more details.

Parameters:
i An interface pointer the plug-in may use to call functions in 3ds Max.
Returns:
To use the system implementation for this method return 0; Return nonzero if the plug-in implements this method.

Reimplemented from ClassDesc.

void ResetClassParams ( BOOL  fileReset ) [virtual]
Remarks:
This method may be called to restore all sticky parameters to their default values.
Parameters:
fileReset This parameter is not used.

Reimplemented from ClassDesc2.

DWORD InitialRollupPageState ( ) [virtual]

This method returns a DWORD which is used to initialize the rollup state in both the create branch and the modify branch.

The semantics are different, however for these two cases. Whenever the rollups are created in the create branch, their state will be that specified by this method. In the modify branch, the first time an object of this type is modified the state will be that of this method, but after that it will remain what it was last set to.

Returns:
The bits of this DWORD set indicate the corrresponding rollup page is closed. The zero bit corresponds to the plug-ins first rollup, the first bit is the second rollup, etc. The value 0x7fffffff is returned by the default implementation so the command panel can detect this method is not being overridden, and just leave the rollups as is.

Reimplemented from ClassDesc.

BOOL IsManipulator ( ) [inline, virtual]

Returns TRUE if the class implements a manipulator object; otherwise FALSE.

Reimplemented from ClassDesc.

{ return pc->IsManipulator(); }
BOOL CanManipulate ( ReferenceTarget hTarget ) [inline, virtual]

The method returns true if the class is a manipulator and it manipulates the given base object, modifier or controller.

When starting "Manipulate" mode, this is called on selected nodes for the base object, all modifiers, the TM controller and the position, rotation and scale controllers, if the TM controller is a PRSController.

Parameters:
hTarget A pointer to a reference target.

Reimplemented from ClassDesc.

{ return pc->CanManipulate(hTarget); }
BOOL CanManipulateNode ( INode pNode ) [inline, virtual]

Returns TRUE if the manipulator applies to the given node; otherwise FALSE.

This method can be used to indicate that the manipulator works on a part of an object that is not covered by BOOL CanManipulate(ReferenceTarget* hTarget) such as the visibility controller of a node.

Parameters:
pNode The INode to check.

Reimplemented from ClassDesc.

{ return pc->CanManipulateNode(pNode); }
Manipulator* CreateManipulator ( ReferenceTarget hTarget,
INode pNode 
) [inline, virtual]

Creates a manipulator object When a manipulator returns TRUE to CanManipulate(ReferenceTarget* hTarget), the system calls this version of CreateManipulator() to create an instance of the manipulator.

Parameters:
hTarget - The ReferenceTarget for which a manipulator is requested
pNode - The node that the manipulator needs to manipulate (know about)
Returns:
- Pointer to the newly created manipulator, or NULL if the creation failed.
        Manipulator* BendManipClassDesc::CreateManipulator(ReferenceTarget* hTarget, INode* node) {
            if (hTarget->ClassID() != Class_ID(BENDOSM_CLASS_ID, 0))
                return NULL;
            return (new BendManip((SimpleMod2*)hTarget, node));
        }

Reimplemented from ClassDesc.

{ return pc->CreateManipulator(hTarget, pNode); }
Manipulator* CreateManipulator ( INode pNode ) [inline, virtual]

Creates a manipulator object.

When a manipulator returns TRUE to CanManipulateNode(INode* pNode), the system calls this version of CreateManipulator() to create an instance of the manipulator.

Parameters:
pNode - The node that the manipulator needs to manipulate (know about)
Returns:
- Pointer to the newly created manipulator, or NULL if the creation failed.

Reimplemented from ClassDesc.

{ return pc->CreateManipulator(pNode); }
const MCHAR* InternalName ( ) [inline, virtual]

Returns a string which provides a fixed, machine parsable internal name for the plug-in.

This name is used by MAXScript.

Reimplemented from ClassDesc.

{ return pc->InternalName(); }
HINSTANCE HInstance ( ) [inline, virtual]

Returns the DLL instance handle of the plug-in.

This is used so that string resources can be loaded by the ParamBlock2 system.

Reimplemented from ClassDesc.

{ return pc->HInstance(); }
MCHAR* GetString ( INT_PTR  id ) [inline]
{ return id != 0 ? (MCHAR*)id : NULL; } // resIDs are actual string ptrs in msplugins...
MCHAR* GetRsrcString ( INT_PTR  id ) [inline, virtual]

Returns a pointer to the string from the resource string table.

Reimplemented from ClassDesc.

{ return id != 0 ? (MCHAR*)id : NULL; }
void StartTool ( IObjCreate iob )
void StopTool ( IObjCreate iob )
Class_ID SubClassID ( ) [inline, virtual]

This method can be used for further categorizing plugins.

If a plugin has sub-plugins (like light > shadows, particles > operators), this method can be used to differentiate them. sub-plugins can be derived from ReferenceTarget but return a particular class ID published by the parent plugins SDK headers. Then parent plugin can get a list of all reference targets whose SubClassID matches the published SubClassID.

Reimplemented from ClassDesc.

    {
        if (pc->extend_cd != NULL) 
            return pc->extend_cd->SubClassID();
        return Class_ID(0,0); 
    }
bool IsCompatibleWithRenderer ( ClassDesc rendererClassDesc ) [inline, virtual]
Remarks:
Returns whether this material/map is compatible with the given renderer. (Use the class ID of the renderer to determine compatibility).
Parameters:
rendererClassDesc - Class descriptor of a Renderer plugin

Implements IMtlRender_Compatibility_MtlBase.

    {
        ClassDesc * cd = pc->extend_cd;
        if(cd == NULL)
        {
            return true;
        }
        IMtlRender_Compatibility_MtlBase* rendererCompatibility = Get_IMtlRender_Compability_MtlBase(*cd);
        if(rendererCompatibility)
            return rendererCompatibility->IsCompatibleWithRenderer(rendererClassDesc);
        else
            return true;
    }
bool GetCustomMtlBrowserIcon ( HIMAGELIST &  hImageList,
int &  inactiveIndex,
int &  activeIndex,
int &  disabledIndex 
) [inline, virtual]
Remarks:
Provides custom icons for the material/map browser. Returns true if custom icons are provided.

When using this method, the developer should keep a single instance of the imagelist used, and it is the developers responsibility to release the memory
Parameters:
hImagelist - The image list from which the icons are extracted. The images should have a mask.
inactiveIndex - Index (into image list) of icon to be displayed when the material/map has the "Show Maps in Viewport" flag turned OFF.
activeIndex - Index (into image list) of icon to be displayed when the material/map has the "Show Maps in Viewport" flag turned ON.
disabledIndex - Index (into image list) of icon to be displayed when the material/map is NOT COMPATIBLE with the current renderer.
Returns:
true if custom icons are provided

Reimplemented from IMtlRender_Compatibility_MtlBase.

    {
        ClassDesc * cd = pc->extend_cd;
        if(cd == NULL)
        {
            return false;
        }

        IMtlRender_Compatibility_MtlBase* rendererCompatibility = Get_IMtlRender_Compability_MtlBase(*cd);
        if(rendererCompatibility)
            return rendererCompatibility->GetCustomMtlBrowserIcon(hImageList, inactiveIndex,  activeIndex,  disabledIndex);
        else
            return false;
    }

Member Data Documentation

MSPluginClass* pc

MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc
MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc MSPluginDesc