Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions

MSCustAttrib Class Reference

Search for all occurrences

#include <mxsCustomAttributes.h>

Inheritance diagram for MSCustAttrib:
Inheritance graph
[legend]

List of all members.

Public Member Functions

ScripterExport  MSCustAttrib ()
ScripterExport  MSCustAttrib (MSCustAttribDef *pc, BOOL loading)
ScripterExport  ~MSCustAttrib ()
ScripterExport void  sprin1 (CharStream *s)
ScripterExport HWND  AddRollupPage (HINSTANCE hInst, MCHAR *dlgTemplate, DLGPROC dlgProc, MCHAR *title, LPARAM param=0, DWORD flags=0, int category=ROLLUP_CAT_CUSTATTRIB-1)
ScripterExport void  DeleteRollupPage (HWND hRollup)
ScripterExport IRollupWindow GetRollupWindow ()
ReferenceTarget get_delegate ()
const MCHAR *  GetName ()
ScripterExport ParamDlg CreateParamDlg (HWND hwMtlEdit, IMtlParams *imp)
void  SetName (const MCHAR *newName)
void  GetClassName (MSTR &s)
  Retrieves the name of the plugin class.
Class_ID  ClassID ()
  Retrieves a constant that uniquely identifies the plugin class.
SClass_ID  SuperClassID ()
  Retrieves a constant representing the type of the plugin.
void  FreeCaches ()
int  NumSubs ()
Animatable SubAnim (int i)
MSTR  SubAnimName (int i)
int  NumParamBlocks ()
IParamBlock2 GetParamBlock (int i)
IParamBlock2 GetParamBlockByID (BlockID id)
BOOL  CanCopyAnim ()
ScripterExport void *  GetInterface (ULONG id)
  Inherited from Animatable.
ScripterExport void  DeleteThis ()
ScripterExport void  BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev)
ScripterExport void  EndEditParams (IObjParam *ip, ULONG flags, Animatable *next)
RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
int  NumRefs ()
  Returns the total number of references this ReferenceMaker can hold.
RefTargetHandle  GetReference (int i)
  Returns the 'i-th' reference.
void  RefDeleted ()
RefTargetHandle  Clone (RemapDir &remap)
  This method is used by 3ds Max to clone an object.
ScripterExport IOResult  Save (ISave *isave)
ScripterExport IOResult  Load (ILoad *iload)
ScripterExport int  NumSubTexmaps ()
ScripterExport Texmap GetSubTexmap (int i)
ScripterExport void  SetSubTexmap (int i, Texmap *m)
ScripterExport MSTR  GetSubTexmapSlotName (int i)
int  MapSlotType (int i)
MSTR  GetSubTexmapTVName (int i)
ReferenceTarget GetRefTarget ()

Public Attributes

IObjParam cip
IMtlParams mip
MSTR  name

Static Public Attributes

static MSAutoMParamDlg masterMDlg

Protected Member Functions

virtual void  SetReference (int i, RefTargetHandle rtarg)
  Stores a ReferenceTarget as its 'i-th' reference`.

Constructor & Destructor Documentation

ScripterExport MSCustAttrib ( ) [inline]
: cip(NULL), mip(NULL) { }
ScripterExport MSCustAttrib ( MSCustAttribDef pc,
BOOL  loading 
)
ScripterExport ~MSCustAttrib ( ) [inline]

Member Function Documentation

ScripterExport void sprin1 ( CharStream *  s ) [virtual]

Reimplemented from Value.

ScripterExport HWND AddRollupPage ( HINSTANCE  hInst,
MCHAR *  dlgTemplate,
DLGPROC  dlgProc,
MCHAR *  title,
LPARAM  param = 0,
DWORD  flags = 0,
int  category = ROLLUP_CAT_CUSTATTRIB-1 
) [virtual]
ScripterExport void DeleteRollupPage ( HWND  hRollup ) [virtual]
ScripterExport IRollupWindow* GetRollupWindow ( ) [virtual]
ReferenceTarget* get_delegate ( ) [inline, virtual]

Implements MSPlugin.

{ return NULL; }  // no delegates in MSCustAttribs 
const MCHAR* GetName ( void  ) [inline, virtual]
Remarks:
A CustAttrib plugin can implement this method in order to provide the name that gets displayed in the TrackView.
Default Implementation:
{ return "Custom Attribute";}

Reimplemented from CustAttrib.

{ return name; } 
ScripterExport ParamDlg* CreateParamDlg ( HWND  hwMtlEdit,
IMtlParams imp 
) [virtual]
Remarks:
This method gets called when the material or texture is to be displayed in the material editor parameters area. The plug-in should allocate a new instance of a class derived from ParamDlg to manage the user interface.
Parameters:
HWND hwMtlEdit

The window handle of the materials editor.

IMtlParams *imp

The interface pointer for calling methods in 3ds Max.
Returns:
A pointer to the created instance of a class derived from ParamDlg.
Default Implementation:
{return NULL;}

Reimplemented from CustAttrib.

void SetName ( const MCHAR *  newName ) [inline]
void GetClassName ( MSTR s ) [inline, virtual]

Retrieves the name of the plugin class.

This name is usually used internally for debugging purposes. For Material plug-ins this method is used to put up the material "type" name in the Material Editor.

Parameters:
s Reference to a string filled in with the name of the plugin class

Reimplemented from ReferenceTarget.

{ s = MSTR(pc->class_name->to_string()); }  
Class_ID ClassID ( ) [inline, virtual]

Retrieves a constant that uniquely identifies the plugin class.

This method must return the unique ID for the plugin class. If two ClassIDs conflict, the system will only load the first conflicting one it finds. A program (gencid.exe) is provided to generate unique class id values.

Returns:
A class id that uniquely identifies a plugin class
See also:
Class ClassID, List of Class IDs.

Reimplemented from Animatable.

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

Retrieves a constant representing the type of the plugin.

Returns:
A super class id that uniquely identifies the type (category) of the plugin. Note that several plugin classes can be of the same type, thus return the same super class id. Plugins are uniquely identified by their class ids. List of Super Class IDs.
See also:
SClass_ID

Reimplemented from CustAttrib.

{ return pc->sclass_id; }
void FreeCaches ( ) [inline, virtual]
Remarks:
This is called to delete any item that can be rebuilt. For example, the procedural sphere object has a mesh that it caches. It could call Mesh::FreeAll() on the mesh from this method. This will free the vertex/face/uv arrays. If the sphere is ever evaluated again it can just rebuild the mesh. If an object (like a sphere) has modifiers applied to it, and those modifiers are not animated, then the result of the pipeline is cached in the node. So there is no reason for the sphere to also have a cache of its representation. Therefore when this method is called, the sphere can free the data of the mesh.
Default Implementation:
{}

Reimplemented from Animatable.

{ }         
int NumSubs ( ) [inline, virtual]
Remarks:
The system uses a virtual array mechanism to access the sub-anims of a plug-in. This method returns the total number of sub-anims maintained by the plug-in. If a plug-in is using a parameter block to manage its parameters it should just return 1 for all the parameters directed by the parameter block.
Returns:
The number of sub-anims used by the plug-in.
Default Implementation:
{ return 0; }

Reimplemented from Animatable.

{ return pblocks.Count(); }  
Animatable* SubAnim ( int  i ) [inline, virtual]
Remarks:
This method returns a pointer to the 'i-th' sub-anim. If a plug-in is using a parameter block to manage all its parameters it should just return a pointer to the parameter block itself from this method. This method may return NULL so developers need to check the return value before calling other sub anim methods (such as SubAnimName()).
Parameters:
i This is the index of the sub-anim to return.
Default Implementation:
{ return NULL };

Reimplemented from Animatable.

{ return pblocks[i]; }
MSTR SubAnimName ( int  i ) [inline, virtual]
Remarks:
This method returns the name of the 'i-th' sub-anim to appear in track view. The system has no idea what name to assign to the sub-anim (it only knows it by the virtual array index), so this method is called to retrieve the name to display. Developer need to make sure the 'i-th' SubAnim() is non-NULL or this method will fail.
Parameters:
i The index of the parameter name to return
Returns:
The name of the 'i-th' parameter.

Reimplemented from Animatable.

{ return pblocks[i]->GetLocalName(); }
int NumParamBlocks ( ) [inline, virtual]
Remarks:
This method is available in release 3.0 and later only.

This method returns the number of ParamBlock2s in this instance.
Default Implementation:
{ return 0; }

Reimplemented from Animatable.

{ return pblocks.Count(); }
IParamBlock2* GetParamBlock ( int  i ) [inline, virtual]
Remarks:
This method return 'i-th' ParamBlock2 in this instance (or NULL if not available).
Parameters:
i The zero based index of the ParamBlock2 to return.
Default Implementation:
{ return NULL; }

Reimplemented from Animatable.

{ return pblocks[i]; }
IParamBlock2* GetParamBlockByID ( BlockID  id ) [inline]
BOOL CanCopyAnim ( ) [inline, virtual]
Remarks:
In addition to SubNumToRefNum(), if an anim doesn't want to be copied (via Track View or the Edit Modifier Stack 'Copy' button) it can return FALSE from this method, otherwise it can use the default implementation to return TRUE.
Default Implementation:
{return TRUE;}

Reimplemented from Animatable.

{ return FALSE; }
ScripterExport void* GetInterface ( ULONG  id ) [virtual]

Inherited from Animatable.

Returns a pointer to the interface.

Parameters:
id - The id of the interface.
Returns:
A Pointer to the Interface

Reimplemented from ReferenceTarget.

ScripterExport void DeleteThis ( )

Reimplemented from MSPlugin.

ScripterExport void BeginEditParams ( IObjParam ip,
ULONG  flags,
Animatable prev 
) [virtual]
Remarks:
This method is called by the system when the user may edit the item's (object, modifier, controller, etc.) parameters.
Parameters:
ip Interface pointer. The developer can use it to call methods such as AddRollupPage(). Note that this pointer is only valid between BeginEditParams() and EndEditParams(). It should not be used outside this interval.
flags Describe which branch of the command panel or dialog the item is being edited in. The following are possible values:

BEGIN_EDIT_CREATE
Indicates an item is being edited in the create branch.

BEGIN_EDIT_MOTION
Indicates a controller is being edited in the motion branch.

BEGIN_EDIT_HIERARCHY
Indicates a controller is being edited in the Pivot subtask of the hierarchy branch.

BEGIN_EDIT_IK
Indicates a controller is being edited in the IK subtask of the hierarchy branch.

BEGIN_EDIT_LINKINFO
Indicates a controller is being edited in the Link Info subtask of the hierarchy branch.

prev Pointer to an Animatable object. This parameter may be used in the motion and hierarchy branches of the command panel. This pointer allows a plug-in to look at the ClassID of the previous item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel, but simply update the values displayed in the UI fields. This prevents the UI from 'flickering' when the current item begins its edit. For example, if you are in the motion branch and are looking at an item's PRS controller values, and then select another item that is displayed with a PRS controller, the UI will not change - only the values displayed in the fields will change. If however you selected a target camera that has a lookat controller (not a PRS controller) the UI will change because a different set of parameters need to be displayed. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from Animatable.

ScripterExport void EndEditParams ( IObjParam ip,
ULONG  flags,
Animatable next 
) [virtual]
Remarks:
This method is called when the user is finished editing an objects parameters. The system passes a flag into the EndEditParams() method to indicate if the rollup page should be removed. If this flag is TRUE, the plug-in must un-register the rollup page, and delete it from the panel.
Parameters:
ip An interface pointer. The developer may use the interface pointer to call methods such as DeleteRollupPage().

flags The following flag may be set:

END_EDIT_REMOVEUI
If TRUE, the item's user interface should be removed.

next Animatable pointer. Can be used in the motion and hierarchy branches of the command panel. It allows a plug-in to look at the ClassID of the next item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from Animatable.

RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [inline]

Reimplemented from MSPlugin.

                    { 
                        if (!(pc->mpc_flags & MPC_REDEFINITION))
                            return ((MSPlugin*)this)->NotifyRefChanged(changeInt, hTarget, partID, message); 
                        else
                            return REF_SUCCEED;
                    }
int NumRefs ( ) [inline, virtual]

Returns the total number of references this ReferenceMaker can hold.

The plugin implements this method to indicate the total number of of references it can make. This includes all references whether they are NULL (inactive) or non-NULL (active) at the time when this method is called. A plugin can hold a variable number of references, thus the return value of this method is not to be cached and reused by client code.

Returns:
The total number of references this plugin can hold. The default implementation is return 0.

Reimplemented from ReferenceMaker.

{ return pblocks.Count(); }
RefTargetHandle GetReference ( int  i ) [inline, virtual]

Returns the 'i-th' reference.

The plugin implements this method to return its 'i-th' reference. The plug-in simply keeps track of its references using an integer index for each one. This method is normally called by the system.

Parameters:
i - The index of the reference to retrieve. Valid values are from 0 to NumRefs()-1.
Returns:
The reference handle of the 'i-th' reference. Note that different calls to this method with the same 'i' value can result in different reference handles being retrieved, as the plugin changes the scene objects it references as its 'i-th' reference.

Reimplemented from ReferenceMaker.

{ return pblocks[i]; }
virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [inline, protected, virtual]

Stores a ReferenceTarget as its 'i-th' reference`.

The plugin implements this method to store the reference handle passed to it as its 'i-th' reference. In its implementation of this method, the plugin should simply assign the reference handle passed in as a parameter to the member variable that holds the 'i-th' reference. Other reference handling methods such as ReferenceMaker::DeleteReference(), or ReferenceMaker::ReplaceReference() should not be called from within this method. The plugin itself or other plugins should not call this method directly. The system will call this method when a new reference is created or an existing one is replaced by calling ReferenceMaker::ReplaceReference().

Parameters:
i - The index of the reference to store. Valid values are from 0 to NumRefs()-1.
rtarg - The reference handle to store.

Reimplemented from ReferenceMaker.

                    { 
                        if (i >= pblocks.Count())
                            pblocks.SetCount(i+1); 
                        pblocks[i] = (IParamBlock2*)rtarg; 
                    }
void RefDeleted ( ) [inline]
RefTargetHandle Clone ( RemapDir remap ) [virtual]

This method is used by 3ds Max to clone an object.

See also:
CloneRefHierarchy(), class RemapDir This method is called by 3ds Max to have the plugin clone itself. The plug-in's implementation of this method should copy both the data structure and all the data residing in the data structure of this reference target. The plugin should clone all its references as well. Also, the plug-in's implementation of this method must call BaseClone(). In order for classes derived from this class to clone cleanly, the Clone method should just create the new instance, and then call an implementation of BaseClone that clones the references and copies any other necessary data. For example:
            class MyDerivedPlugin
                : public MyBasePlugin
            {
                const int MY_REFERENCE = 1;

                ReferenceTarget* Clone(RemapDir& remap)
                {
                    ReferenceTarget* result = new MyDerivedPlugin();
                    BaseClone(this, result, remap);
                    return result;
                }

                void BaseClone(ReferenceTarget* from, ReferenceTarget* to, RemapDir& remap)
                {
                    if (!to || !from || from == to)
                        return;    
                    MyBasePlugin::BaseClone(from, to, remap);
                    to->ReplaceReference(MY_REFERENCE, remap->CloneRef(from->GetReference(MY_REFERENCE)));
                }
            };

This method should not be directly called by plug-ins. Instead, either RemapDir::CloneRef() or CloneRefHierachy() should be used to perform cloning. These methods ensure that the mapping from the original object to the clone is added to the RemapDir used for cloning, which may be used during backpatch operations

Note:
See the remarks in method BaseClone() below.
Parameters:
remap - A RemapDir instance used for remapping references during a Clone.
Returns:
A pointer to the cloned item.

Reimplemented from ReferenceTarget.

ScripterExport IOResult Save ( ISave isave ) [virtual]

Reimplemented from MSPlugin.

ScripterExport IOResult Load ( ILoad iload )

Reimplemented from MSPlugin.

ScripterExport int NumSubTexmaps ( ) [virtual]
Remarks:
Returns the number of sub-textures managed by this material or texture.
Default Implementation:
{ return 0; }

Reimplemented from ISubMap.

ScripterExport Texmap* GetSubTexmap ( int  i ) [virtual]
Remarks:
Returns a pointer to the 'i-th' sub-texmap managed by the material or texture.

Note: For the 3ds Max Standard material, the sub-texmap indexes used with this method are listed in Texture Map Indices.
Parameters:
int i

Specifies the texmap to return.
Default Implementation:
{ return NULL; }

Reimplemented from ISubMap.

ScripterExport void SetSubTexmap ( int  i,
Texmap m 
) [virtual]
Remarks:
Stores the 'i-th' sub-texmap managed by the material or texture.

Note: For the 3ds Max Standard material, the sub-texmap indexes used with this method are listed in Texture Map Indices.
Parameters:
int i

The index of the storage for the texmap.

Texmap *m

The texmap to store.
Default Implementation:
{}

Reimplemented from ISubMap.

ScripterExport MSTR GetSubTexmapSlotName ( int  i ) [virtual]
Remarks:
This method returns the slot name of the 'i-th' sub-texmap. This name appears in the materials editor dialog. For instance, if you are in a material and then you go down into a map, this is the name that appears just below the 'Get Material' icon. For example, in the Standard material when you choose one of the maps, the map name appears to let you know which slot you are working on. For the Standard material, this may be "Ambient", "Diffuse", "Specular", etc.
Parameters:
int i

Specifies the slot whose name is returned.
Default Implementation:
The default implementation returns an empty ("") string.

Reimplemented from ISubMap.

int MapSlotType ( int  i ) [inline, virtual]
Remarks:
In the Coordinates rollup in the user interface for a texture map are two options. These options are Texture or Environment. The slot type is one of these two options, texture coordinates or environment coordinates. There are a variety of texture coordinate types. There are the type assigned to the object and the environment type (Spherical, Cylindrical, Shrink-wrap, Screen). This method is used to determine the type required by the particular sub-texture. This is either texture coordinates (MAPSLOT_TEXTURE) or environment coordinates (MAPSLOT_ENVIRON).
Parameters:
int i

The index of the sub-texture whose slot type to return.
Returns:
See Map Slot Types.
Default Implementation:
{ return MAPSLOT_TEXTURE; }

Implements ISubMap.

{ UNUSED_PARAM(i); return MAPSLOT_TEXTURE; }
MSTR GetSubTexmapTVName ( int  i ) [inline]
Remarks:
Returns the name to appear in Track View of the 'i-th' sub-texmap.
Parameters:
int i

Specifies the sub-texmap whose name is returned.

Reimplemented from ISubMap.

{ return GetSubTexmapSlotName(i); }
ReferenceTarget* GetRefTarget ( ) [inline, virtual]
Remarks:
Implemented by the System.

The implementation of this method is provided by MtlBase. It returns its this pointer.

Implements ISubMap.

{ return this; }

Member Data Documentation


MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib
MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib MSCustAttrib