MtlBase Class Reference

#include <MtlBase.h>

Class Description

See also
Class ReferenceTarget, Class ISubMap, Class Mtl, Class Texmap, Class ShadeContext, Class RenderMapsContext, Class RenderGlobalContext, Class UVGen, Class XYZGen, Class PStamp, Class Quat.

Description:
This is the base class from which materials and textures are subclassed. Methods are provided to access the name, flags, and sub-materials/maps. There is also a method that is called when the material or texture is to be displayed in the material editor parameters area.

Note the following about dialog proc processing of sub-map buttons:

When you post the message:

PostMessage(hwmedit, WM_TEXMAP_BUTTON, i,(LPARAM)theMtl);

You are telling the system that the user clicked on the button for the 'i-th' sub-map of theMtl. The message doesn't propagate up – it goes directly to the materials editor. It then uses calls on theMtl->SetSubTexmap() and theMtl->GetSubTexmap() to assign the new map. So even if your material has some complicated internal hierarchical structure of references, to the system it is still a simple "logical" hierarchy of a material with some sub-texmaps.
Data Members:
Quat meditRotate;

This data member is available in release 2.0 and later only.

This describes the rotation of the sample geometry in the materials editor.

ULONG gbufID;

This is the G-Buffer ID of the material or texmap. This is a "effects number" assigned in the materials editor to a map or material, and it will be written into the effects channel of the G-Buffer when a pixel with that material on it is rendered. To implement this, each map or material, in the beginning of its Shade(), EvalColor(), or EvalMono() methods should have the code:

if (gbufID) sc.SetGBufferID(gbufID);
+ Inheritance diagram for MtlBase:

Public Member Functions

CoreExport MtlBase ()
 
CoreExport ~MtlBase ()
 
virtual CoreExport Class_ID ClassID ()
 Retrieves a constant that uniquely identifies the plugin class. More...
 
int GetMeditObjType ()
 
void SetMeditObjType (int t)
 
int GetMeditTiling ()
 
void SetMeditTiling (int t)
 
CoreExport BOOL AnyMulti ()
 
BOOL TextureDisplayEnabled ()
 
CoreExport MtlBaseoperator= (const MtlBase &m)
 
CoreExport SvGraphNodeReference SvTraverseAnimGraph (IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags)
 
CoreExport bool SvHandleDoubleClick (IGraphObjectManager *gom, IGraphNode *gNode)
 
CoreExport MSTR SvGetName (IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
 
CoreExport bool SvCanSetName (IGraphObjectManager *gom, IGraphNode *gNode)
 
CoreExport bool SvSetName (IGraphObjectManager *gom, IGraphNode *gNode, const MSTR &name)
 
CoreExport COLORREF SvHighlightColor (IGraphObjectManager *gom, IGraphNode *gNode)
 
CoreExport bool SvIsSelected (IGraphObjectManager *gom, IGraphNode *gNode)
 Returns true if the object is selected in its schematic view. More...
 
CoreExport MultiSelectCallbackSvGetMultiSelectCallback (IGraphObjectManager *gom, IGraphNode *gNode)
 
CoreExport bool SvCanSelect (IGraphObjectManager *gom, IGraphNode *gNode)
 
CoreExport MtlBaseGetActiveMB ()
 Get the active MtlBase. More...
 
CoreExport void SetActiveMB (MtlBase *activeMB)
 Set the active MtlBase. More...
 
virtual CoreExport voidGetInterface (ULONG id)
 Inherited from Animatable. More...
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 Inherited from Animatable. More...
 
virtual ReferenceTargetGetRefTarget ()
 
virtual CoreExport int SetProperty (ULONG id, void *data)
 
virtual CoreExport voidGetProperty (ULONG id)
 
virtual CoreExport void BaseClone (ReferenceTarget *from, ReferenceTarget *to, RemapDir &remap)
 This method copies base class data from an object to its clone. More...
 
virtual BOOL GetTransparencyHint (TimeValue t, Interval &valid)
 Transparency hint indicates whether the material is potentially transparent for both rendering and viewport display, so that the renderers or viewport can decide whether to optimize it or not. More...
 
Naming Methods (MtlBase)
 
MSTRGetName ()
 
CoreExport void SetName (MSTR s)
 
virtual CoreExport MSTR GetFullName ()
 
Flag Access Methods
 
CoreExport void SetMtlFlag (int mask, BOOL val=TRUE)
 
CoreExport void ClearMtlFlag (int mask)
 
CoreExport int TestMtlFlag (int mask)
 
BuildMaps Method
virtual int BuildMaps (TimeValue t, RenderMapsContext &rmc)
 
Requirement Methods
virtual CoreExport ULONG Requirements (int subMtlNum)
 
virtual ULONG LocalRequirements (int subMtlNum)
 
virtual CoreExport void MappingsRequired (int subMtlNum, BitArray &mapreq, BitArray &bumpreq)
 
virtual void LocalMappingsRequired (int subMtlNum, BitArray &mapreq, BitArray &bumpreq)
 
Methods to Access Sub Texture Maps of Materials or Texmaps
 
virtual BOOL IsMultiMtl ()
 
virtual int MapSlotType (int i)
 
CoreExport void DeactivateMapsInTree ()
 
Update/Reset/Validity
 
virtual void Update (TimeValue t, Interval &valid)=0
 
virtual void Reset ()=0
 
virtual Interval Validity (TimeValue t)=0
 
User Interface Method
 
virtual ParamDlgCreateParamDlg (HWND hwMtlEdit, IMtlParams *imp)=0
 
Loading and Saving Methods
CoreExport IOResult Save (ISave *isave)
 
CoreExport IOResult Load (ILoad *iload)
 
GBuffer (System) Methods
 
ULONG GetGBufID ()
 
void SetGBufID (ULONG id)
 
Enumerate Auxiliary Files Implementation
 
CoreExport void EnumAuxFiles (AssetEnumCallback &nameEnum, DWORD flags)
 
Postage Stamp Image Methods
 
virtual CoreExport PStampGetPStamp (int sz)
 
virtual CoreExport PStampCreatePStamp (int sz, BOOL Render=FALSE)
 
virtual CoreExport void DiscardPStamp (int sz)
 
Interactive Texture Display
 
virtual BOOL SupportTexDisplay ()
 
virtual DWORD_PTR GetActiveTexHandle (TimeValue t, TexHandleMaker &thmaker)
 
CoreExport void IncrActive ()
 
CoreExport void DecrActive ()
 
int Active ()
 
virtual void ActivateTexDisplay (BOOL onoff)
 
Multiple Map Display in the Viewports
 
virtual BOOL SupportsMultiMapsInViewport ()
 
virtual void SetupGfxMultiMaps (TimeValue t, Material *mtl, MtlMakerCallback &cb)
 
- Public Member Functions inherited from ReferenceTarget
virtual CoreExport void GetClassName (MSTR &s)
 Retrieves the (localizable) name of the plugin class. More...
 
virtual CoreExport SClass_ID SuperClassID ()
 Retrieves a constant representing the type of the plugin. More...
 
virtual BOOL IsRefTarget ()
 Checks if this is a ReferenceTarget. More...
 
CoreExport RefResult TestForLoop (const Interval &refInterval, RefMakerHandle hmaker)
 Tests for a cyclical reference. More...
 
CoreExport BOOL HasDependents ()
 Checks if a ReferenceTarget has references. More...
 
CoreExport BOOL HasRealDependents ()
 Checks if this has Real (Strong) Dependents. More...
 
void BeginDependencyTest ()
 Starts Dependency Test. More...
 
BOOL EndDependencyTest ()
 Ends Dependency Test. More...
 
virtual void RefAdded (RefMakerHandle rm)
 Called after a reference is made to a target. More...
 
virtual void RefAddedUndoRedo (RefMakerHandle rm)
 Called after a reference is made to a target because of undo or redo. More...
 
virtual void RefDeleted ()
 Called after a references to this is deleted. More...
 
virtual void RefDeletedUndoRedo ()
 Called after a references to this is deleted because of undo or redo. More...
 
CoreExport RefResult DeleteAllRefsToMe ()
 Deletes all references to this ReferenceTarget. More...
 
CoreExport RefResult TransferReferences (RefTargetHandle oldTarget, BOOL delOld=FALSE)
 Transfers all the references from oldTarget to this. More...
 
CoreExport int DoEnumDependents (DependentEnumProc *dep)
 Begins an enumeration that searches back in the dependency network. More...
 
virtual CoreExport RefTargetHandle Clone (RemapDir &remap)
 This method is used by 3ds Max to clone an object. More...
 
virtual CoreExport RefResult NotifyDependents (const Interval &changeInt, PartID partID, RefMessage message, SClass_ID sclass=NOTIFY_ALL, BOOL propagate=TRUE, RefTargetHandle hTarg=NULL, NotifyDependentsOption notifyDependentsOption=REFNOTIFY_ALLOW_OPTIMIZATIONS)
 Notify all dependent RefMakers concerned with the message. More...
 
void FlagDependents (TimeValue t, PartID which=PART_PUT_IN_FG)
 This sends the REFMSG_FLAGDEPENDENTS message up the pipeline. More...
 
virtual void NotifyForeground (TimeValue t)
 This method is called to flag dependents into the FG. More...
 
virtual void NotifyTarget (int message, ReferenceMaker *hMaker)
 Sends messages to ReferenceTargets. More...
 
CoreExport ReferenceTarget ()
 Constructor. More...
 
virtual CoreExport RefResult AutoDelete ()
 Deletes the object when it has no more real dependents. More...
 
CoreExport RefResult MaybeAutoDelete ()
 Deletes the object when it has no more real dependents. More...
 
- Public Member Functions inherited from ReferenceMaker
CoreExport RefResult ReplaceReference (int which, RefTargetHandle newtarg, BOOL delOld=TRUE)
 Used when cloning reference makers. More...
 
CoreExport RefResult DeleteAllRefsFromMe ()
 Deletes all references from this ReferenceMaker. More...
 
CoreExport RefResult DeleteAllRefs ()
 Deletes all references both to and from this item. More...
 
CoreExport RefResult DeleteReference (int i)
 Deletes the specified reference. More...
 
virtual BOOL CanTransferReference (int i)
 Tells whether this reference can be transfered. More...
 
CoreExport ReferenceSaveManagerGetReferenceSaveManager ()
 Access the ReferenceSaveManager of this ReferenceMaker. More...
 
virtual int RemapRefOnLoad (int iref)
 Used to load old files with references. More...
 
virtual CoreExport void RescaleWorldUnits (float f)
 Rescale size of all world units in reference hierarchy. More...
 
virtual CoreExport void SaveEnum (SaveEnumProc &sep, BOOL isNodeCall=0)
 The default save enumeration. More...
 
virtual CoreExport bool SpecifySaveReferences (ReferenceSaveManager &referenceSaveManager)
 Used to specify reference slot remapping during scene file save. More...
 
CoreExport int DoEnumDependents (DependentEnumProc *dep)
 Begins an enumeration that searches back in the dependency network. More...
 
CoreExport bool EnumRefHierarchy (RefEnumProc &proc, bool includeCustAttribs=true, bool includeIndirectRefs=true, bool includeNonPersistentRefs=true, bool preventDuplicatesViaFlag=true)
 This method provides a general purpose reference enumerator. More...
 
CoreExport int FindRef (RefTargetHandle rtarg)
 Get the index of the ReferenceTarget. More...
 
virtual BOOL IsRefMaker ()
 Tells whether it is a ReferenceMaker. More...
 
virtual BOOL IsRealDependency (ReferenceTarget *rtarg)
 Returns whether this is a "real" (strong) dependency or not. More...
 
virtual BOOL ShouldPersistWeakRef (RefTargetHandle rtarg)
 Specifies whether a weak reference is to be persisted on a partial load or save. More...
 
CoreExport ReferenceMaker ()
 Constructor. More...
 
CoreExport void DeleteMe ()
 Deletes an instance of this class. More...
 
virtual CoreExport int NumRefs ()
 Returns the total number of references this ReferenceMaker can hold. More...
 
virtual CoreExport RefTargetHandle GetReference (int i)
 Returns the 'i-th' reference. More...
 
- Public Member Functions inherited from Animatable
virtual void FreeCaches ()
 
virtual int NumChildren ()
 
virtual AnimatableChildAnim (int i)
 
virtual CoreExport MSTR NodeName ()
 
virtual void EditTrack ()
 
virtual CoreExport BOOL SubAnimSetKeyBufferPresent (int subNum)
 returns true if the sub-anim has a "Set Key" buffer present More...
 
virtual BOOL SetKeyBufferPresent ()
 returns true if there is a "Set Key" buffer present More...
 
virtual CoreExport void SubAnimCommitSetKeyBuffer (TimeValue t, int subNum)
 Commit any "Set Key" buffers on the given sub-anim. More...
 
virtual void CommitSetKeyBuffer (TimeValue t)
 Commit any "Set Key" buffers. More...
 
virtual CoreExport void SubAnimRevertSetKeyBuffer (int subNum)
 Revert any "Set Key" buffers on the given sub-anim. More...
 
virtual void RevertSetKeyBuffer ()
 Revert any "Set Key" buffers. More...
 
virtual LRESULT CALLBACK TrackViewWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 This function is obsolete. More...
 
virtual bool IsParamBlockDesc2Used (ParamBlockDesc2 *desc)
 Returns true if the passed description is being used. More...
 
virtual bool GetMacroRecorderName (bool used_as_rhs_value, MSTR &objectSpecifiedName)
 This method is called to access the object specified name to use for the Maxscript macrorecorder. More...
 
CoreExport Animatable ()
 Constructor. More...
 
virtual CoreExport void DeleteThis ()
 Deletes an instance of this class. More...
 
MSTR ClassName () const
 Returns the name of the plugin class. More...
 
virtual void BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev=NULL)
 
virtual void EndEditParams (IObjParam *ip, ULONG flags, Animatable *next=NULL)
 
virtual CoreExport void ReleaseInterface (ULONG id, void *i)
 
CoreExport void AppendProperty (AnimProperty *prop)
 A function to directly add arbitrary properties to this object developers should ensure that the properties ID does not conflict with any Max-specific IDs. More...
 
CoreExport AnimPropertyFindProperty (DWORD id)
 Find any property. More...
 
CoreExport void AddAppDataChunk (const Class_ID &cid, SClass_ID sid, DWORD sbid, DWORD len, void *data)
 Adds application/plugin specific (custom) data to an Animatable. More...
 
CoreExport AppDataChunkGetAppDataChunk (const Class_ID &cid, SClass_ID sid, DWORD sbid)
 Retrieves the application/plugin specific (custom) data stored with an Animatable. More...
 
CoreExport BOOL RemoveAppDataChunk (const Class_ID &cid, SClass_ID sid, DWORD sbid)
 Deletes the application/plugin specific (custom) data stored with an Animatable. More...
 
CoreExport void ClearAllAppData ()
 Deletes all application/plugin specific (custom) data stored with an Animatable. More...
 
virtual int NumSubs ()
 
virtual AnimatableSubAnim (int i)
 
virtual CoreExport MSTR SubAnimName (int i)
 
virtual BOOL CanDeleteSubAnim (int i)
 
virtual void DeleteSubAnim (int i)
 
virtual DWORD GetSubAnimCurveColor (int subNum)
 
virtual int SubNumToRefNum (int subNum)
 
virtual BOOL CanCopyAnim ()
 
CoreExport int HasSubElements (int type=0)
 
virtual int GetSubFCurveExtents (int subNum, ParamDimensionBase *dim, float &min, float &max, DWORD flags)
 The values max and min should be initialized before calling this function. More...
 
virtual ParamDimensionGetParamDimension (int i)
 
virtual BOOL SelectSubAnim (int subNum)
 
virtual BOOL BypassTreeView ()
 
virtual BOOL BypassTrackBar ()
 
virtual BOOL BypassPropertyLevel ()
 
virtual BOOL InvisibleProperty ()
 
virtual int NumKeys ()
 
virtual TimeValue GetKeyTime (int index)
 
virtual int GetKeyIndex (TimeValue t)
 
virtual BOOL GetNextKeyTime (TimeValue t, DWORD flags, TimeValue &nt)
 
virtual void CopyKeysFromTime (TimeValue src, TimeValue dst, DWORD flags)
 
virtual void DeleteKeyAtTime (TimeValue t)
 
virtual BOOL IsKeyAtTime (TimeValue t, DWORD flags)
 
virtual int GetKeyTimes (Tab< TimeValue > &times, Interval range, DWORD flags)
 
virtual int GetKeySelState (BitArray &sel, Interval range, DWORD flags)
 
CoreExport void OpenTreeEntry (int type, DWORD tv)
 
CoreExport void CloseTreeEntry (int type, DWORD tv)
 
CoreExport int IsTreeEntryOpen (int type, DWORD tv)
 
CoreExport BOOL GetSelInTrackView (DWORD tv)
 
CoreExport void SetSelInTrackView (DWORD tv, BOOL sel)
 
CoreExport BOOL InTrackViewSelSet (int which)
 
CoreExport void SetTrackViewSelSet (int which, BOOL inOut)
 
virtual BOOL AssignController (Animatable *control, int subAnim)
 
virtual BOOL CanAssignController (int subAnim)
 Return true if we can reassign the subanim specified. More...
 
virtual BOOL CanMakeUnique ()
 
CoreExport int EnumAnimTree (AnimEnum *animEnum, Animatable *client, int subNum)
 
virtual int RenderBegin (TimeValue t, ULONG flags=0)
 
virtual int RenderEnd (TimeValue t)
 
virtual CoreExport Interval GetTimeRange (DWORD flags)
 
virtual void EditTimeRange (Interval range, DWORD flags)
 
virtual void DeleteTime (Interval iv, DWORD flags)
 
virtual void ReverseTime (Interval iv, DWORD flags)
 
virtual void ScaleTime (Interval iv, float s)
 
virtual void InsertTime (TimeValue ins, TimeValue amount)
 
virtual BOOL SupportTimeOperations ()
 
virtual CoreExport void MapKeys (TimeMap *map, DWORD flags)
 
virtual void DeleteKeys (DWORD flags)
 
virtual void DeleteKeyByIndex (int index)
 
virtual void SelectKeys (TrackHitTab &sel, DWORD flags)
 
virtual void SelectSubKeys (int subNum, TrackHitTab &sel, DWORD flags)
 
virtual void SelectSubCurve (int subNum, BOOL sel)
 
virtual void SelectKeyByIndex (int i, BOOL sel)
 
virtual BOOL IsKeySelected (int i)
 
virtual void FlagKey (TrackHitRecord hit)
 
virtual int GetFlagKeyIndex ()
 
virtual int NumSelKeys ()
 
virtual void CloneSelectedKeys (BOOL offset=FALSE)
 
virtual void AddNewKey (TimeValue t, DWORD flags)
 
virtual void MoveKeys (ParamDimensionBase *dim, float delta, DWORD flags)
 
virtual void ScaleKeyValues (ParamDimensionBase *dim, float origin, float scale, DWORD flags)
 
virtual void SelectCurve (BOOL sel)
 
virtual BOOL IsCurveSelected ()
 Returns TRUE if the function curve is selected; otherwise returns FALSE. More...
 
virtual BOOL IsSubCurveSelected (int subNum)
 Returns the selected state of the sub-curve whose index is passed. More...
 
virtual int GetSelKeyCoords (TimeValue &t, float &val, DWORD flags)
 
virtual void SetSelKeyCoords (TimeValue t, float val, DWORD flags)
 
virtual int SetSelKeyCoordsExpr (ParamDimension *dim, const MCHAR *timeExpr, const MCHAR *valExpr, DWORD flags)
 
virtual void AdjustTangents (TrackHitRecord hit, ParamDimensionBase *dim, Rect &rcGraph, float tzoom, int tscroll, float vzoom, int vscroll, int dx, int dy, DWORD flags)
 
virtual void AdjustTangents (TrackHitRecord hit, ParamDimensionBase *dim, float angle, float length, DWORD flags)
 
virtual CoreExport BOOL IsAnimated ()
 
virtual BOOL CanCopyTrack (Interval iv, DWORD flags)
 
virtual BOOL CanPasteTrack (TrackClipObject *cobj, Interval iv, DWORD flags)
 
virtual TrackClipObjectCopyTrack (Interval iv, DWORD flags)
 
virtual void PasteTrack (TrackClipObject *cobj, Interval iv, DWORD flags)
 
virtual BOOL CanCopySubTrack (int subNum, Interval iv, DWORD flags)
 
virtual BOOL CanPasteSubTrack (int subNum, TrackClipObject *cobj, Interval iv, DWORD flags)
 
virtual TrackClipObjectCopySubTrack (int subNum, Interval iv, DWORD flags)
 
virtual void PasteSubTrack (int subNum, TrackClipObject *cobj, Interval iv, DWORD flags)
 
virtual int GetTrackVSpace (int lineHeight)
 
virtual int HitTestTrack (TrackHitTab &hits, Rect &rcHit, Rect &rcTrack, float zoom, int scroll, DWORD flags)
 
virtual int PaintTrack (ParamDimensionBase *dim, HDC hdc, Rect &rcTrack, Rect &rcPaint, float zoom, int scroll, DWORD flags)
 
virtual int PaintSubTrack (int subNum, ParamDimensionBase *dim, HDC hdc, Rect &rcTrack, Rect &rcPaint, float zoom, int scroll, DWORD flags)
 
virtual int PaintFCurves (ParamDimensionBase *dim, HDC hdc, Rect &rcGraph, Rect &rcPaint, float tzoom, int tscroll, float vzoom, int vscroll, DWORD flags)
 
virtual int HitTestFCurves (ParamDimensionBase *dim, TrackHitTab &hits, Rect &rcHit, Rect &rcGraph, float tzoom, int tscroll, float vzoom, int vscroll, DWORD flags)
 
virtual int PaintSubFCurves (int subNum, ParamDimensionBase *dim, HDC hdc, Rect &rcGraph, Rect &rcPaint, float tzoom, int tscroll, float vzoom, int vscroll, DWORD flags)
 
virtual int HitTestSubFCurves (int subNum, ParamDimensionBase *dim, TrackHitTab &hits, Rect &rcHit, Rect &rcGraph, float tzoom, int tscroll, float vzoom, int vscroll, DWORD flags)
 
virtual void EditTrackParams (TimeValue t, ParamDimensionBase *dim, const MCHAR *pname, HWND hParent, IObjParam *ip, DWORD flags)
 
virtual int TrackParamsType ()
 
virtual int GetFCurveExtents (ParamDimensionBase *dim, float &min, float &max, DWORD flags)
 This method is called to calculate the largest and smallest values of the anim. More...
 
CoreExport void AddNoteTrack (NoteTrack *note)
 
CoreExport void DeleteNoteTrack (NoteTrack *note, BOOL delNote=TRUE)
 
CoreExport BOOL HasNoteTracks ()
 
CoreExport int NumNoteTracks ()
 
CoreExport NoteTrackGetNoteTrack (int i)
 
virtual void FreeAllBitmaps ()
 
virtual void GetSystemNodes (INodeTab &nodes, SysNodeContext Context)
 
virtual BOOL IsSubClassOf (Class_ID classID)
 returns true if the animatable has sub-classed off the given class More...
 
virtual CoreExport void MouseCycleCompleted (TimeValue t)
 
virtual CoreExport void MouseCycleStarted (TimeValue t)
 
virtual int NumParamBlocks ()
 
virtual IParamBlock2GetParamBlock (int i)
 
virtual IParamBlock2GetParamBlockByID (short id)
 
CoreExport bool SvSaveData (ISave *isave, USHORT id)
 
CoreExport bool SvLoadData (ILoad *iLoad)
 
CoreExport DWORD SvGetRefIndex ()
 
CoreExport void SvSetRefIndex (DWORD i)
 
CoreExport bool SvDeleteRefIndex ()
 
CoreExport SvGraphNodeReference SvStdTraverseAnimGraph (IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags)
 
virtual CoreExport bool SvCanInitiateLink (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvCanConcludeLink (IGraphObjectManager *gom, IGraphNode *gNode, IGraphNode *gNodeChild)
 
virtual CoreExport bool SvCanRemoveThis (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvRemoveThis (IGraphObjectManager *gom, IGraphNode *gNode)
 Called when the user deletes this object in the schematic view... More...
 
virtual CoreExport bool SvIsHighlighted (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport COLORREF SvGetSwatchColor (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvIsInactive (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvLinkChild (IGraphObjectManager *gom, IGraphNode *gNodeThis, IGraphNode *gNodeChild)
 
virtual CoreExport bool SvEditProperties (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport MSTR SvGetTip (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport MSTR SvGetRefTip (IGraphObjectManager *gom, IGraphNode *gNode, IGraphNode *gNodeMaker)
 
virtual CoreExport bool SvCanDetach (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvDetach (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport MSTR SvGetRelTip (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Returns a string to be displayed in the tip window in the schematic view for a relationship from "gNodeMaker" to "gNodeTarget"... More...
 
virtual CoreExport bool SvCanDetachRel (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Returns true if this object can respond to the SvDetachRel(...) method... More...
 
virtual CoreExport bool SvDetachRel (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Detach this relationship. More...
 
virtual CoreExport bool SvHandleRelDoubleClick (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Called when this relationship is double-clicked in the schematic view... More...
 
CoreExport ICustAttribContainerGetCustAttribContainer ()
 This method returns a pointer to the custom attributes container interface class. More...
 
CoreExport void AllocCustAttribContainer ()
 This method allocates space for a custom attributes container. More...
 
CoreExport void DeleteCustAttribContainer ()
 This method deletes space used by a custom attributes container. More...
 
void SetAFlag (DWORD mask)
 
void ClearAFlag (DWORD mask)
 Clears one or more bits in the Animatable flags. More...
 
bool TestAFlag (DWORD mask) const
 Tests one or more bits in the Animatable flags. More...
 
void SetAFlagEx (DWORD mask)
 Sets one or more bits in the Animatable extended flags. More...
 
void ClearAFlagEx (DWORD mask)
 Clears one or more bits in the Animatable extended flags. More...
 
bool TestAFlagEx (DWORD mask) const
 Tests one or more bits in the Animatable extended flags. More...
 
CoreExport bool TestFlagBit (int index)
 Tests the specified flag bit. More...
 
CoreExport void SetFlagBit (int index, bool newValue=true)
 Sets the specified flag bit. More...
 
CoreExport void ClearFlagBit (int index)
 Clears the specified flag bit. More...
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
- Public Member Functions inherited from ISubMap
virtual ~ISubMap ()
 
virtual int NumSubTexmaps ()
 
virtual TexmapGetSubTexmap (int i)
 
virtual void SetSubTexmap (int i, Texmap *m)
 
virtual int SubTexmapOn (int i)
 
virtual CoreExport MSTR GetSubTexmapSlotName (int i)
 
CoreExport MSTR GetSubTexmapTVName (int i)
 
virtual BOOL SetDlgThing (ParamDlg *dlg)
 
CoreExport void CopySubTexmap (HWND hwnd, int ifrom, int ito)
 

Public Attributes

Quat meditRotate
 
ULONG gbufID
 

Friends

class Texmap
 

Additional Inherited Members

- Static Public Member Functions inherited from Animatable
static CoreExport BOOL IsDeleted (Animatable *anim)
 Debug method to determine whether an object has been deleted. More...
 
static CoreExport AnimHandle GetHandleByAnim (Animatable *anim)
 Get the unique handle for an Animatable object. More...
 
static CoreExport AnimatableGetAnimByHandle (AnimHandle handle)
 Get an Animatable object from its unique handle. More...
 
static CoreExport void EnumerateAllAnimatables (EnumAnimList &enumProcObject)
 Enumerator to enumerate across all animatables. More...
 
static CoreExport bool RegisterAppDataLoadCallback (const Class_ID &cid, SClass_ID sid, APPDATALOADPROC proc)
 Registers a callback proc that is called when an AppDataChunk is read from a scene file. More...
 
static CoreExport bool UnRegisterAppDataLoadCallback (const Class_ID &cid, SClass_ID sid, APPDATALOADPROC proc)
 Unregisters a callback proc that is called when an AppDataChunk is read from a scene file. More...
 
static CoreExport bool RegisterAppDataLoadCallback (DWORD sbid, APPDATALOADPROC proc)
 Registers a callback proc that is called when an AppDataChunk is read from a scene file. More...
 
static CoreExport bool UnRegisterAppDataLoadCallback (DWORD sbid, APPDATALOADPROC proc)
 Unregisters a callback proc that is called when an AppDataChunk is read from a scene file. More...
 
static CoreExport int RequestFlagBit ()
 Requests an unique flag bit index. More...
 
static CoreExport void ReleaseFlagBit (int index)
 Releases the flag bit index. More...
 
static CoreExport void ClearFlagBitInAllAnimatables (int index)
 Clears the specified flag bit in all Animatables. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
- Static Public Attributes inherited from Animatable
static const AnimHandle kInvalidAnimHandle = 0
 
- Protected Member Functions inherited from ReferenceTarget
virtual CoreExport int DoEnumDependentsImpl (DependentEnumProc *dep)
 Method to perform an enumeration on a ReferenceTarget. More...
 
virtual CoreExport ~ReferenceTarget ()=0
 Destructor. More...
 
- Protected Member Functions inherited from ReferenceMaker
virtual RefResult NotifyRefChanged (const Interval &changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message, BOOL propagate)=0
 Receives and responds to messages. More...
 
virtual CoreExport ~ReferenceMaker ()=0
 Destructor. More...
 
virtual CoreExport void SetReference (int i, RefTargetHandle rtarg)
 Stores a ReferenceTarget as its 'i-th' reference`. More...
 
void BlockEval ()
 
void UnblockEval ()
 
int Evaluating ()
 
CoreExport RefResult StdNotifyRefChanged (const Interval &changeInt, RefTargetHandle hTarget, PartID partID, RefMessage message, BOOL propagate, NotifyDependentsOption notifyDependentsOption)
 
- Protected Member Functions inherited from Animatable
virtual CoreExport ~Animatable ()=0
 Destructor. More...
 
- Protected Member Functions inherited from Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 
- Protected Attributes inherited from Animatable
DWORD aflag
 
AnimPropertyList aprops
 

Constructor & Destructor Documentation

Remarks
Constructor. The flags and G-buffer id are initialized.

Member Function Documentation

virtual CoreExport Class_ID ClassID ( )
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, class ID definititions in plugapi.h.

Reimplemented from Animatable.

MSTR& GetName ( )
inline
Remarks
Implemented by the System.

Returns the name of the material or texture.
179 { return name; }
CoreExport void SetName ( MSTR  s)
Remarks
Implemented by the System.

Stores the name of the material or texture.
virtual CoreExport MSTR GetFullName ( )
virtual
Remarks
Implemented by the System.

This method returns the name that appears in the track view. It returns the "Instance Name(class Name)". For example "Green Glass (Standard)". The default implementation should be used.
CoreExport void SetMtlFlag ( int  mask,
BOOL  val = TRUE 
)
Remarks
Implemented by the System.

Alters the flags, either setting or clearing them, using the mask and method passed.
Parameters
maskThe flags to alter. See Material Flags.
valIf TRUE the mask is ORed into the flags (mtlFlags |= mask); otherwise (mtlFlags &= ~mask).
CoreExport void ClearMtlFlag ( int  mask)
Remarks
Implemented by the System.

Clears the specified flags.
Parameters
maskThe flags to clear. See Material Flags.
CoreExport int TestMtlFlag ( int  mask)
Remarks
Implemented by the System.

Tests the specified flags. Returns nonzero if the flags are set; otherwise zero. See Material Flags.
Parameters
maskThe flags to test.
int GetMeditObjType ( )
inline
Remarks
This method is used internally.
217 { return (mtlFlags&MTL_MEDIT_OBJTYPE_MASK)>>MTL_OBJTYPE_SHIFT; }
#define MTL_MEDIT_OBJTYPE_MASK
Definition: MtlBase.h:43
#define MTL_OBJTYPE_SHIFT
Definition: MtlBase.h:41
void SetMeditObjType ( int  t)
inline
Remarks
This method is used internally.
219 { mtlFlags &= ~MTL_MEDIT_OBJTYPE_MASK; mtlFlags |= t<<MTL_OBJTYPE_SHIFT; }
#define MTL_MEDIT_OBJTYPE_MASK
Definition: MtlBase.h:43
#define MTL_OBJTYPE_SHIFT
Definition: MtlBase.h:41
int GetMeditTiling ( )
inline
Remarks
This method is used internally.
222 { return (mtlFlags&MTL_MEDIT_TILING_MASK)>>MTL_TILING_SHIFT; }
#define MTL_TILING_SHIFT
Definition: MtlBase.h:45
#define MTL_MEDIT_TILING_MASK
Definition: MtlBase.h:47
void SetMeditTiling ( int  t)
inline
Remarks
This method is used internally.
224 { mtlFlags &= ~MTL_MEDIT_TILING_MASK; mtlFlags |= t<<MTL_TILING_SHIFT; }
#define MTL_TILING_SHIFT
Definition: MtlBase.h:45
#define MTL_MEDIT_TILING_MASK
Definition: MtlBase.h:47
CoreExport BOOL AnyMulti ( )
Remarks
Implemented by the System.

This method may be called to recursively determine if there are any multi-materials or texmaps in the tree.
Returns
TRUE if the material or texture map has any mult-materials; otherwise FALSE.
BOOL TextureDisplayEnabled ( )
inline
Remarks
This method is used internally.

CoreExport int TestMtlFlag(int mask)
#define MTL_TEX_DISPLAY_ENABLED
Viewport display enabled for this material (see MTL_SUB_DISPLAY_ENABLED).
Definition: MtlBase.h:37
CoreExport MtlBase& operator= ( const MtlBase m)
Remarks
Implemented by the System.

Materials and Texmaps must use this operator to copy the common portion of themselves when cloning.
virtual int BuildMaps ( TimeValue  t,
RenderMapsContext rmc 
)
inlinevirtual
Remarks
This method is called for a plug-in to do any work it needs to do prior to rendering. For example this is used by the 3ds Max Mirror and Auto Reflect materials to render their bitmaps.
Parameters
tThe current time.
rmcProvides information about the view being rendered and can provide access to the global rendering environment information via RenderGlobalContext *gc = rmc.GetGlobalContext(). See Class RenderMapsContext and Class RenderGlobalContext.
Returns
Nonzero on success; zero on failure. In the case of failure the renderer is halted (rendering is cancelled).
258 { return 1; }
virtual CoreExport ULONG Requirements ( int  subMtlNum)
virtual
Remarks
This method returns the cumulative requirements of the material and its sub-materials and maps. The default implementation just ORs together the local requirements of the material with the requirements of all its children. Most materials will only need to implement LocalRequirements().
Parameters
subMtlNumSpecifies the number of the sub-material whose requirements should be returned. -1 may be used to return a value generated by looping over all the sub-materials and ORing together the requirements.
Returns
See Material Requirements Flags.
Default Implementation:
The default implementation automatically traverses the sub-material/map tree. On any MtlBase that returns TRUE for IsMultiMtl() it will only recursively call the sub material (or map) for the subMtlNum called. The exception to this is when subMtlNum<0: in this case all sub-mtls and submaps are enumerated. Therefore the LocalRequirements() method below only needs to consider the material or map itself, not the sub-mtls and sub-maps.
virtual ULONG LocalRequirements ( int  subMtlNum)
inlinevirtual
Remarks
Specifies various requirements for this material. The value returned from this method should not include requirements of its sub-materials and sub-maps.
Parameters
subMtlNumSpecifies the number of the sub-material whose requirements should be returned.
Returns
See Material Requirements Flags.
Default Implementation:
{ return 0; }
296 { return 0; }
virtual CoreExport void MappingsRequired ( int  subMtlNum,
BitArray mapreq,
BitArray bumpreq 
)
virtual
Remarks
This method gives the UVW channel requirements of the material and its tree. The default implementation just OR's together the local mapping requirements of the material with the requirements of all its children. For most materials, all they need to implement is the LocalMappingsRequired() method.
Parameters
subMtlNumSpecifies the number of the sub-material whose mapping information is retrieved.
mapreqThis array of bits is initialized to an empty set with MAX_MESHMAPS elements. Each bit corresponds to a mapping channel. Set a bit to one to indicate the material requires the corresponding UVW channel.
bumpreqThis array of bits is initialized to an empty set with MAX_MESHMAPS elements. Each bit corresponds to a mapping channel. Set a bit to one to indicate the material requires the corresponding bump mapping channel.
virtual void LocalMappingsRequired ( int  subMtlNum,
BitArray mapreq,
BitArray bumpreq 
)
inlinevirtual
Remarks
This method specifies UVW channel requirements for the material: This method should not include UVW channel requirements of any sub-materials and sub-maps.
Parameters
subMtlNumSpecifies the number of the sub-material whose mapping information is retrieved.
mapreqThis array of bits is initialized to an empty set with MAX_MESHMAPS elements. Each bit corresponds to a mapping channel. Set a bit to one to indicate the material requires the corresponding UVW channel.
bumpreqThis array of bits is initialized to an empty set with MAX_MESHMAPS elements. Each bit corresponds to a mapping channel. Set a bit to one to indicate the material requires the corresponding bump mapping channel.
Default Implementation:
{}
Sample Code:
All 2D textures that use UVGen or otherwise select mapping channels need to implement this method Here's an example:

void LocalMappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq)
{
uvGen->MappingsRequired(subMtlNum,mapreq,bumpreq);
}
All 3D textures that use the XYZGen to put up a coordinates rollup must implement this method. Here's an example:
void LocalMappingsRequired(int subMtlNum, BitArray & mapreq,BitArray &bumpreq)
{
xyzGen->MappingsRequired(subMtlNum,mapreq,bumpreq);
}
350 { }
virtual BOOL IsMultiMtl ( )
inlinevirtual
Remarks
This method returns TRUE for materials or textures that select sub-materials based on submaterial number (for example a mesh faceMtlIndex).

The only materials for which this method should return TRUE are those that choose to use one of their sub-maps or sub-mtls based on the submaterial number. For the majority of materials and maps, they should return FALSE, and in that case all of the submaterials and maps are enumerated by MtlBase::Requirements().
Default Implementation:
{ return FALSE; }
368 { return FALSE; }
virtual int MapSlotType ( int  i)
inlinevirtual
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.

Reimplemented in Texmap.

371 { return defaultSlotType; }
CoreExport void DeactivateMapsInTree ( )
Remarks
Implemented by the System.

This method must be called on a sub-material or sub-map when it is removed, in case it or any of its sub-maps are active in the viewport.
virtual void Update ( TimeValue  t,
Interval valid 
)
pure virtual
Remarks
A material has a Shade() method, and a texture map has a EvalColor() method. These are called by the renderer for every pixel. This method is called before rendering begins to allow the plug-in to evaluate anything prior to the render so it can store this information. In this way this information does not need to be calculated over and over for every pixel when Shade() or EvalColor() is called. This allows texture and material evaluation to be more efficient. It is generally called once at the start of each frame, or during interactive playback when the time changes. It is not guaranteed to get called on every frame, because if you returned a validity interval that covers several frames, your parent material won't bother to call you if the current frame is still in that interval.
Parameters
tThe current time.
validThe validity interval to update to reflect the validity interval of the material or texture at the time passed.
virtual void Reset ( )
pure virtual
Remarks
This method is called to reset the material or texmap back to its default values. This should be done by calling the Reset method of the material or texture map plugin's class descriptor (ClassDesc2::Reset). In addition, the plugin can execute any other initialization code it has. Example from maxsdk\samples\materials\dblsided.cpp
void DoubleSided::Reset() {
dblsidedCD.Reset(this, TRUE); // Resets all pb2's
Init();
}
Note
When migrating plugins from ClassDesc to ClassDesc2 and IParamBlock2, do not forget to update this method to call the class descriptor's Reset method. If the plugin's Reset tries to replace parameter block objects based on IParamBlock2 that use the P_AUTO_UI flag, the UI code will continue to hold a pointer to the replaced parameter block, and this will lead to problems.
virtual Interval Validity ( TimeValue  t)
pure virtual
Remarks
This method is called to determine the validity interval of the material or texture.
Parameters
tSpecifies the time about which to compute the validity interval.
Returns
The validity interval of the item at the specified time.
virtual ParamDlg* CreateParamDlg ( HWND  hwMtlEdit,
IMtlParams imp 
)
pure 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.

Note: The following is a discussion of this CreateParamDlg() method, and the SetDlgThing() method, and the way they relate to the ParamMap2 system. A good example for this discussion is a texture map which typically has several rollouts, say its texmap parameters, a UVW coordinates rollout, and an Output rollout.

The normal way for a texmap to implement these other (common) rollouts is for the it to create a UVGen instance and a TextureOutput instance as 'sub-objects' in the map and then ask them to put up their rollouts when it is asked to do so by the Materials Editor (in CreateParamDlg()). The Materials Editor requires a ParamDlg pointer back from the CreateParamDlg() on which it calls methods to control the UI, such as time change updates or loading up a new texmap of the same class into the UI when the user switches them, so that the whole UI doesn't need to be rebuilt.

Prior to the ParamMap2 system, a texmap would implement its own ParamDlg subclass and would keep track of the UVGen and TextureOutput ParamDialogs and pass on any time change or SetThing() calls to them. ParamMap2 introduced its own ParamDlg subclass (Class IAutoMParamDlg) that you can ask it to build for you and have manage all interaction with the Materials Editor automatically. As before, this still needs to know about the other (sub-object) ParamDlgs, and so it has the ability to keep a list of 'secondary' ParamDlgs to which it passes on the SetTime()s and SetThing()s.

When the Materials Editor asks the texmap to CreateParamDlg(), the texmap asks its ClassDesc2 to build one of these (ClassDesc2::CreateParamDlgs()). If the texmap itself has multiple ParamBlock2s, CreateParamDlgs() builds one ParamDlg per pblock/rollout, makes the first of them a 'master' and adds the rest as secondary ParamDlgs. The texmap then asks the UVGen and TextureOutput objects to CreateParamDlg() for their rollouts and adds them to the master IAutoMParamDlg also.

Now consider the need for the SetDlgThing() method below. It is related to the SetThing() method that the Materials Editor calls on the 'master' ParamDlg to switch into the UI a texmap of the same class as that currently in the UI. Normally, the master IAutoParamDlg would propagate the SetThing() to its registered secondary ParamDlgs. In the case of multiple paramblock2s in the texmap, this would be correct, since the 'thing' in this case is the incoming texmap. But this doesn't work for the secondary UVGen and TextureOutput ParamDlgs; their 'things' are the UVGen and TextureOutput subobjects of the incoming map. So, IAutoParamDlg first calls SetDlgThing() on the incoming texmap so that it gets a chance to call the correct SetThing()s on the sub-object ParamDlgs with the appropriate incoming sub-objects. A clear example of this is in Gradient::SetDlgThing() in /MAXSDK/SAMPLES/MATERIALS/GRADIENT.CPP. It is called once for each secondary ParamDlg. For those ParamDlgs that have special SetThing() requirements, it does the appropriate sub-object SetThing() and returns TRUE. If it does no special handling for a particular ParamDlg, it returns FALSE, signalling to the IAutoMParamDlg that it should do the standard SetThing() propagation for that dialog.

The Render Effects dialog has a similar arrangement to the Materials Editor for controlling Effect UI and so there is an IAutoEParamDlg that works exactly the same way as the IAuotMParamDlg.
Parameters
hwMtlEditThe window handle of the materials editor.
impThe interface pointer for calling methods in 3ds Max.
Returns
A pointer to the created instance of a class derived from ParamDlg.
CoreExport IOResult Save ( ISave isave)
virtual
Remarks
Implemented by the System.

This method saves the plug-in's data to disk.. The common MtlBase data must be saved as well. The base class method must be called in a chunk at the beginning of every Mtl and Texmap.
Parameters
isaveAn interface pointer available for saving data. See Class ISave, I/O Results.
Sample Code:
Note in the code below the base class method is called in a chunk before the rest of the plug-ins data is saved.
IOResult Gradient::Save(ISave *isave)
{
IOResult res;
// Save common stuff
isave->BeginChunk(MTL_HDR_CHUNK);
res = MtlBase::Save(isave);
if (res!=IO_OK) return res;
isave->EndChunk();
for (int i=0; i<NSUBTEX; i++) {
if (mapOn[i]==0) {
isave->BeginChunk(MAPOFF_CHUNK+i);
isave->EndChunk();
}
}
return IO_OK;
}

Reimplemented from ReferenceMaker.

CoreExport IOResult Load ( ILoad iload)
virtual
Remarks
Implemented by the System.

This method is called to load the material or texture from disk. The common MtlBase data must be loaded as well. See the code below.
Parameters
iloadAn interface pointer for calling methods to load data. See Class ILoad, I/O Results.
Sample Code:
IOResult Gradient::Load(ILoad *iload)
{
IOResult res;
int id;
while (IO_OK==(res=iload->OpenChunk())) {
switch(id = iload->CurChunkID()) {
case MTL_HDR_CHUNK:
res = MtlBase::Load(iload);
break;
case MAPOFF_CHUNK+0:
case MAPOFF_CHUNK+1:
case MAPOFF_CHUNK+2:
mapOn[id-MAPOFF_CHUNK] = 0;
break;
}
iload->CloseChunk();
if (res!=IO_OK)
return res;
}
iload->RegisterPostLoadCallback(new ParamBlockPLCB(versions,NUM_OLDVERSIONS,&curVersion,this,1));
return IO_OK;
}

Reimplemented from ReferenceMaker.

ULONG GetGBufID ( )
inline
Remarks
Implemented by the System.

Returns the G-buffer ID of this material.
568 { return gbufID; }
ULONG gbufID
Definition: MtlBase.h:169
void SetGBufID ( ULONG  id)
inline
Remarks
Implemented by the System.

Sets the G-buffer ID of this material.
571 { gbufID = id; }
ULONG gbufID
Definition: MtlBase.h:169
CoreExport void EnumAuxFiles ( AssetEnumCallback nameEnum,
DWORD  flags 
)
virtual
Remarks
This is an implementation of the Animatable method. This default implementation simply recurses, skipping inactive subTexmaps if appropriate.

Reimplemented from ReferenceMaker.

virtual CoreExport PStamp* GetPStamp ( int  sz)
virtual
Remarks
Implemented by the System.

Returns a pointer to the postage stamp image for the file.
Parameters
szOne of the following values:

PS_SMALL for small (32x32) images.
PS_LARGE for large (88x88) images.
PS_TINY for tiny (24x24) images.
virtual CoreExport PStamp* CreatePStamp ( int  sz,
BOOL  Render = FALSE 
)
virtual
Remarks
Implemented by the System.

Creates a postage stamp image and returns a pointer to it. If the postage stamp image already exists then it is simply returned.

Here's an example using this method to display a small material sample.

void DisplayMB(MtlBase *mb, HDC hdc, int x, int y) {
mb->CreatePStamp(0,TRUE); // create and render a small pstamp
PStamp *ps = mb->GetPStamp(0);
if (ps) {
int d = PSDIM(0);
int scanw = ByteWidth(d);
int nb = scanw*d;
UBYTE *workImg = new UBYTE[nb];
if (NULL == workImg)
return;
ps->GetImage(workImg);
Rect rect;
rect.left = x;
rect.top = y;
rect.right = x+d;
rect.bottom = y+d;
GetGPort()->DisplayMap(hdc, rect,0,0, workImg, scanw);
delete [] workImg;
}
}
Parameters
szOne of the following values:

PS_SMALL for small (32x32) images.
PS_LARGE for large (88x88) images.
PS_TINY for tiny (24x24) images.
RenderIf set to true, the postage stamp bitmap will have the MtlBase rendered into it automatically. The bitmap can then be retrieved using PStamp::GetImage, for drawing in the UI.
virtual CoreExport void DiscardPStamp ( int  sz)
virtual
Remarks
Implemented by the System.

Discards the postage stamp image.
Parameters
szOne of the following values:

PS_SMALL for small (32x32) images.
PS_LARGE for large (88x88) images.
PS_TINY for tiny (24x24) images.
CoreExport SvGraphNodeReference SvTraverseAnimGraph ( IGraphObjectManager gom,
Animatable owner,
int  id,
DWORD  flags 
)
virtual
Remarks
This method is available in release 3.0 and later only.

This method traverses the graph of objects in the 3ds Max scene, adding desired objects to the schematic view. Developers can specialize this behaviour by overriding this method and adding whatever objects are interesting to the schematic view. Objects are added to the schematic view by calling IGraphObjectManager::AddAnimatable(...). Reference lines are added to the schematic view by calling IGraphObjectManager::AddReference(...). Implementers of this method should call it recursively to process other objects in the scene.

See Class IGraphObjectManager.
Parameters
gomPoints to the schematic view window manager.
ownerThe owning animatable.
idThis is usually the sub-anim number (but can actually be any value the developer chooses).
flagsSee Flags for AddAnimatable() and SvTravereseAnimGraph().
Returns
A SvGraphNodeReference object.

Reimplemented from Animatable.

Reimplemented in Texmap, UVGen, XYZGen, and TextureOutput.

CoreExport bool SvHandleDoubleClick ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual
Remarks
This method is available in release 3.0 and later only.

This method is called when this node is double-clicked in the schematic view.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to the node in the schematic view.
Returns
true is handled; false if not interested in the event.
Default Implementation:
{ return false; }

Reimplemented from Animatable.

CoreExport MSTR SvGetName ( IGraphObjectManager gom,
IGraphNode gNode,
bool  isBeingEdited 
)
virtual
Remarks
Returns the name of the object as it appears in the schematic view.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to this node in the schematic view.
isBeingEditedTRUE if the item is being edited; FALSE if not.
Default Implementation:
{
Animatable *owner;
int subNum;
MSTR name;
owner = gNode->GetOwner();
subNum = gNode->GetID();
name = owner->SubAnimName(subNum);
return name;
}

Reimplemented from Animatable.

Reimplemented in UVGen, XYZGen, and TextureOutput.

CoreExport bool SvCanSetName ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual
Remarks
Return true to permit the object's name to be edited in the schematic view.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to this node in the schematic view.
Default Implementation:
{ return false; }

Reimplemented from Animatable.

CoreExport bool SvSetName ( IGraphObjectManager gom,
IGraphNode gNode,
const MSTR name 
)
virtual
Remarks
Called when the user changes the name of the object in the schematic view.
Parameters
gom<Points to the schematic view window manager.
gNodePoints to this node in the schematic view.
nameThe new name to set.
Returns
TRUE if the name was changed; FALSE if not.

Reimplemented from Animatable.

CoreExport COLORREF SvHighlightColor ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual
Remarks
This method is available in release 3.0 and later only.

Returns the highlight color for this node. The highlight color is used to outline nodes in the schematic view when SvIsHighlighted(...) returns true.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to this node in the schematic view.
Returns
See COLORREF-DWORD format.
Default Implementation:
{ return gom->SvGetUIColor(SV_UICLR_PLUGIN_HIGHLIGHT); }

Reimplemented from Animatable.

CoreExport bool SvIsSelected ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual

Returns true if the object is selected in its schematic view.

Reimplemented from Animatable.

CoreExport MultiSelectCallback* SvGetMultiSelectCallback ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual
Remarks
This method is called before a multiple select/deselect operation in the schematic view. Returns a callback used to perform the (de)selection. May return NULL if this object cannot be selected in some principle editor outside the schematic view.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to the node in the schematic view.
Returns
A pointer to the callback object. See Class MultiSelectCallback.
Default Implementation:
{ return NULL; }

Reimplemented from Animatable.

CoreExport bool SvCanSelect ( IGraphObjectManager gom,
IGraphNode gNode 
)
virtual
Remarks
Returns true if this object can be selected in some editor (viewport, material editor, plug-in specific editor, etc.). Selection is actually accomplished by via the SvGetMultiSelectCallback(...) mechanism described above.
Parameters
gomPoints to the schematic view window manager.
gNodePoints to the node in the schematic view.
Default Implementation:
{ return false; }

Reimplemented from Animatable.

virtual BOOL SupportTexDisplay ( )
inlinevirtual
Remarks
Returns TRUE if this texture supports being used in the interactive renderer; otherwise FALSE. If the texture does return TRUE it is expected to implement the methods ActivateTexDisplay() and GetActiveTexHandle().
Default Implementation:
{ return FALSE; }
656 { return FALSE; } // supports map display in viewport
virtual DWORD_PTR GetActiveTexHandle ( TimeValue  t,
TexHandleMaker thmaker 
)
inlinevirtual
Remarks
This method is called to retrieve a texture handle to this texture map.
Parameters
tThe time to return the texture handle.
thmakerThis class provides methods for creating a texture handle from a 3ds Max bitmap and a Windows DIB. It also has a method to retrieve the required size of the texture map. See Class TexHandleMaker.
Returns
The texture handle.
Default Implementation:
{return 0;}
665 {return 0;}
CoreExport void IncrActive ( )
Remarks
This method is used internally.
CoreExport void DecrActive ( )
Remarks
This method is used internally.
int Active ( )
inline
Remarks
This method is used internally.
671 { return activeCount; }
virtual void ActivateTexDisplay ( BOOL  onoff)
inlinevirtual
Remarks
This method is called when the usage of the texture the interactive renderer changes. This method must only be implemented if SupportTexDisplay() returns TRUE. This method does not cause the texture map to be drawn in the viewport but should be called with TRUE as the argument before this can occur. For viewport drawing of textures refer to Interface::ActivateTexture() and Interface::DeActivateTexture() instead.
Parameters
onoffTRUE if the texture is being used; FALSE if it is no longer being used.
Default Implementation:
{}
682 {}
CoreExport MtlBase* GetActiveMB ( )

Get the active MtlBase.

Previous to r9, activeMB was held as a raw pointer. Due to problems where the MtlBase was deleted without clearing this pointer, activeMB is now held indirectly. Methods GetActiveMB and SetActiveMB are used to get/set the activeMB;

Returns
The active MtlBase
CoreExport void SetActiveMB ( MtlBase activeMB)

Set the active MtlBase.

Parameters
[in]activeMBThe active MtlBase
virtual BOOL SupportsMultiMapsInViewport ( )
inlinevirtual
Remarks
Returns TRUE if this material supports the display of multi-maps in the viewports (interactive renderer); FALSE if it doesn't.
Default Implementation:
{ return FALSE; }
702 { return FALSE; }
virtual void SetupGfxMultiMaps ( TimeValue  t,
Material mtl,
MtlMakerCallback cb 
)
inlinevirtual
Remarks
This method is called to initialize the interactive renderer Material passed with the properties of this MtlBase.

If a MtlBase (material or texmap) wants to display multiple textures in the viewports, it implements

SupportsMultiMapsInViewport() to return TRUE, and implements SetupGfxMultiMaps to store the necessary information in the Material passed in, including the TextureInfo's for each texture.

The MtlMakerCallback passed in to SetupGfxMultiMaps provides functions to help in setting up the "Material" data structure. The function NumberTexturesSupported() lets you know the capabilities of the current hardware, so you can adapt accordingly. The function GetGfxTexInfoFromTexmap fills in the fields of a TextureInfo except the texHandle and texture ops.

The implementation of SetupGfxMultiMaps must create the "texHandle" for each of the textures described in its TextureInfo array. It typically does this by calling the submap's GetVPDisplayDIB() method, and then creates the texHandle by calling the callBack function MakeHandle(bmi). To avoid doing this calculation when not necessary it is best to save the texHandles along with their validity intervals. Then when SetupGfxMultiMaps is called, if valid texHandles are already in hand they can just be used without recomputing.
Parameters
tThe time at which to evaluate the material.
mtlPoints to the interactive renderer material to update.
cbThis callback object is provided as a helper to fill in the Material properties above. See Class MtlMakerCallback.
Default Implementation:
{}
732 {}
virtual CoreExport 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.

virtual BaseInterface* GetInterface ( Interface_ID  id)
inlinevirtual

Inherited from Animatable.

Returns a pointer to the Base Interface for the interface ID passed.

Parameters
id- The unique ID of the interface to get
Returns
A Pointer to the Interface

Reimplemented from ReferenceTarget.

737 { return ReferenceTarget::GetInterface(id); }
virtual CoreExport void * GetInterface(ULONG id)
Inherited from Animatable.
virtual ReferenceTarget* GetRefTarget ( )
inlinevirtual
Remarks
Implemented by the System.

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

Implements ISubMap.

738 {return this;}
virtual CoreExport int SetProperty ( ULONG  id,
void data 
)
virtual
Remarks
This is a general method for adding properties, when defining a new Interface would be too cumbersome. This method provides another way to extend the class without actually adding any methods. Sample code that implements this method to add properties to the property list is in /MAXSDK/SAMPLES/CONTROLLERS/PATHCTRL.CPP. See below.
Parameters
idThe id for the property.
dataA pointer to the data to store.
Returns
Nonzero if the property was set; otherwise zero.
Default Implementation:
{ return 0; }
Sample Code:
This code is from /MAXSDK/SAMPLES/CONTROLLERS/path_cnstrnt.cpp. It is used to save the inverse kinematics user interface parameters of the path controller. It saves the property data on the aprops property list. See the Data Members at the beginning of Animatable for details on aprops.

int PathPosition::SetProperty(ULONG id, void *data)
{
if (id==PROPID_JOINTPARAMS) {
if (!data) {
int index = aprops.FindProperty(id);
if (index>=0) {
aprops.Delete(index,1);
}
} else {
JointParamsPath *jp = (JointParamsPath*)GetProperty(id);
if (jp) {
*jp = *((JointParamsPath*)data);
delete (JointParamsPath*)data;
} else {
aprops.Append(1,(AnimProperty**)&data);
}
}
return 1;
} else
if (id==PROPID_INTERPUI) {
if (!data) {
int index = aprops.FindProperty(id);
if (index>=0) {
aprops.Delete(index,1);
}
} else {
if (ui) {
*ui = *((InterpCtrlUI*)data);
} else {
aprops.Append(1,(AnimProperty**)&data);
}
}
return 1;
} else {
return Animatable::SetProperty(id,data);
}
}

Reimplemented from Animatable.

virtual CoreExport void* GetProperty ( ULONG  id)
virtual
Remarks
This method is used to retrieve a property specified by the id passed (as stored by SetProperty()).

Note for 3ds Max version 1.1:

Two new property IDs have been added:

PROPID_CLEARCACHES: When passed to a texture map or material, the material should dump any of its caches. For example, the bitmap texture responds to this by freeing the bitmap from memory. For sample code see /MAXSDK/SAMPLES/MATERIALS/BMTEX.CPP.

PROPID_HAS_WSM: When passed to an INode, will return TRUE if the node has World Space Modifiers applied to it or FALSE if it does not. For sample code see /MAXSDK/SAMPLES/IMPEXP/3DSEXP.CPP.

Note for 3ds Max version 1.2:

A new id has been created and assigned the constant:

#define PROPID_EVAL_STEPSIZE_BUG_FIXED 0x1000.

This only effects the evaluation of objects when rendering them using motion blur. Motion blur works by evaluating the object numerous times (at fractions of a frame apart) and combining these images by blending them together.

Originally, 3ds Max would make these evaluations in reverse order within a sub-frame – from the last one, to the second to the last one, back to the first one. There is a problem with this for certain plug-ins that need to compute their state from time 0 forward. For these objects, the backwards approach may be too computationally intensive.

Both the forward and backward approaches exist in 3ds Max and the developer may choose which method to use. 3ds Max interrogates the object to see how it should handle the evaluation process – either going backwards or forwards. It calls this method with id set to the constant PROPID_EVAL_STEPSIZE_BUG_FIXED. If a plug-in implements this method to return nonzero, it means the plug-in works correctly using forward stepping, and 3ds Max will use that approach. If a plug-in does not implement this method and handle the id of PROPID_EVAL_STEPSIZE_BUG_FIXED it will return the default value of zero. This means the older method of backwards evaluation will be used.

Therefore, a plug-in object that wants to handle motion blur using forward stepping should implement this method, and if passed an id of PROPID_EVAL_STEPSIZE_BUG_FIXED, should return nonzero.
Parameters
idThe id of the property to retrieve.
Default Implementation:
{ return NULL; }
Sample Code:
This code is from /MAXSDK/SAMPLES/CONTROLLERS/PATHCTRL.CPP. It is used to restore the inverse kinematics user interface parameters of the path controller. It retrieves the property data on the aprops property list. See the Data Members at the beginning of Animatable for details on aprops.

void* PathPosition::GetProperty(ULONG id)
{
int index = aprops.FindProperty(id);
if (index>=0) {
return aprops[index];
} else {
return NULL;
}
} else {
}
}

Reimplemented from Animatable.

virtual CoreExport void BaseClone ( ReferenceTarget from,
ReferenceTarget to,
RemapDir remap 
)
virtual

This method copies base class data from an object to its clone.

This method is available in release 4.0 and later only. Virtual method.

Note
All plugins that implement a Clone() method have to call this BaseClone() method from that Clone() method with the old and the new object as parameters. The ordering in regards to when this method is called is unimportant, however this method must, of course, be called after the cloned object is created. This method allows base classes to copy their data into a new object created by the clone operation. As described in the Clone method, the Clone method should just create a new instance and then call the BaseClone method. The BaseClone method should then clones any references and sets any other necessary data. This allows classes that derive from this class to clone cleanly. See the Clone method documentation for a code example. All overrides of BaseClone() must call the base class implementation. The base class implementation copies the CustAttrib objects into the newly created object.
Parameters
from- Points to the old object to clone.
to- Points to the new object created.
remap- This class is used for remapping references during a Clone.

Reimplemented from ReferenceTarget.

virtual BOOL GetTransparencyHint ( TimeValue  t,
Interval valid 
)
inlinevirtual

Transparency hint indicates whether the material is potentially transparent for both rendering and viewport display, so that the renderers or viewport can decide whether to optimize it or not.

Parameters
tThe time to get the transparency hint at.
validThe validity interval of the returned value.
Returns
Nonzero if this material is potentially transparent; Zero if it isn't.
Default Implementation:
{ return TRUE; }
752 { return TRUE; }

Friends And Related Function Documentation

friend class Texmap
friend

Member Data Documentation

Quat meditRotate
ULONG gbufID