Class ISubMap
See Also: Class MtlBase, Class Texmap, Class ParamDlg, Class ReferenceTarget.
class ISubMap
Description:
This class is available in release 4.0 and later only.
The methods of this class provide access to the sub-textures of a MtlBase. These properties include the number of sub-maps, the slot type, on / off state, etc.
The MtlBase class sub-classes from this class. If a developer is creating a plug-in derived from MtlBase (for instance a Material or Texture) then implementations of these methods are required. Developers may call these methods on an existing MtlBase sub-class.
Methods:
public:
Prototype:
virtual int NumSubTexmaps()
Remarks:
Implemented by the Plug-In.
Returns the number of sub-textures managed by this material or texture.
Default Implementation:
{ return 0; }
Prototype:
virtual Texmap* GetSubTexmap(int i)
Remarks:
Implemented by the Plug-In.
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 index used with this method is shown in List of Texture Map Indices.
Parameters:
int i
Specifies the texmap to return.
Default Implementation:
{ return NULL; }
Prototype:
virtual int MapSlotType(int i)
Remarks:
Implemented by the Plug-In.
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.
Return Value:
Default Implementation:
{ return MAPSLOT_TEXTURE; }
Prototype:
virtual void SetSubTexmap(int i, Texmap *m);
Remarks:
Implemented by the Plug-In.
Stores the 'i-th' sub-texmap managed by the material or texture.
Note: For the 3ds max Standard material, the sub-texmap index used with this method is shown in List of Texture Map Indices.
Parameters:
int i
The index of the storage for the texmap.
Texmap *m
The texmap to store.
Default Implementation:
{}
Prototype:
virtual int SubTexmapOn(int i)
Remarks:
Implemented by the Plug-In.
Returns nonzero if the specified sub-texmap is on; otherwise zero. Some materials may have user interface controls to toggle the sub-maps on and off. The Standard material has such controls for example.
Parameters:
int i
The index of the sub-texmap to check.
Default Implementation:
{ return 1; }
Prototype:
virtual TSTR GetSubTexmapSlotName(int i);
Remarks:
Implemented by the Plug-In.
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.
Prototype:
TSTR GetSubTexmapTVName(int i);
Remarks:
Implemented by the Plug-In.
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.
Prototype:
virtual BOOL SetDlgThing(ParamDlg* dlg);
Remarks:
This method is called by the ParamMap2 AUTO_UI system if the material/texmap is letting the system build an AutoMParamDlg for it. This method is called on a material/texmap coming into an exsting set of ParamDlgs, once for each secondary ParamDlg and it should set the appropriate 'thing' into the given dlg (the 'thing' being, for example, a Texout* or UVGen*). Return FALSE if dlg is unrecognized.
Note: See the discussion above in CreateParamDlg() for additional details on this method.
Parameters:
ParamDlg* dlg
Points to the ParamDlg to check. See Class ParamDlg.
Return Value:
TRUE if the dlg passed is recognized; FALSE if unrecognized.
Default Implementation:
{ return FALSE; }
Sample Code:
BOOL Gradient::SetDlgThing(ParamDlg* dlg)
{
if (dlg == uvGenDlg)
uvGenDlg->SetThing(uvGen);
else if (dlg == texoutDlg)
texoutDlg->SetThing(texout);
else
return FALSE;
return TRUE;
}
Prototype:
void CopySubTexmap(HWND hwnd, int ifrom, int ito);
Remarks:
Implemented by the System.
This method is used to handle the drag-and-drop of texmaps. A developer implements the logic to handle the drag and drop. Once they have the information about what slot was dropped on what other slot, this method may be called to handle the copying. This is used by the 3ds max Standard material.
Parameters:
HWND hwnd
The rollup page window handle.
int ifrom
The source texmap.
int ito
The destination texmap.
Prototype:
virtual ReferenceTarget *GetRefTarget()=0;
Remarks:
Implemented by the System.
The implementation of this method is provided by MtlBase. It returns its this pointer.