ReferenceMaker Class Reference

ReferenceMaker Class Referenceabstract
+ Related help topics:

#include <ref.h>

Class Description

A scene entity that owns other scene entities and listens to messages from them.

See also
Class SingleRefMaker, Class IRefTargContainer Any scene entity that makes references must be derived from this class. A reference creates a record of the dependency between a ReferenceMaker and a ReferenceTarget. 3ds Max uses a messaging system to notify dependent entities about changes. This class has a method that receives the notifications its targets send when they change. It has methods that return the number of references if has, and methods to get and set these references. Also, there are methods for creating, replacing and deleting the references. File input and output is handled via methods of this class (Load() and Save()).

A reference link is similar to the relationship that exists between an observer and its subjects in an observer design patters, except that reference links also mean ownership, unless otherwise specified.

Note that copying ReferenceMaker instances would not correctly establish reference hierarchy relationships between this destination object and the references held by the source object. Therefore copying of ReferenceMakers is prohibited. 3ds Max does not control the lifetime of ReferenceMakers but it does that of ReferenceTargets, therefore only cloning of ReferenceTargets is supported. For more information, see ReferenceTarget::Clone().

Note that RefMakerHandle is a typename for pointers to an object of type ReferenceMaker.

See the section on Reference System for an overview of the 3ds Max reference architecture.

+ Inheritance diagram for ReferenceMaker:

Public Member Functions

virtual 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...
 
Making / Replacing / Deleting References
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...
 
virtual RefResult DeleteAllRefsToMe ()
 Deletes all refs to this RefMaker/RefTarget. 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...
 
Loading and Saving Methods
CoreExport ReferenceSaveManagerGetReferenceSaveManager ()
 Access the ReferenceSaveManager of this ReferenceMaker. More...
 
virtual CoreExport IOResult Save (ISave *isave)
 Called for saving data. More...
 
virtual CoreExport IOResult Load (ILoad *iload)
 Called for loading data. 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...
 
Enumeration Methods
virtual CoreExport void EnumAuxFiles (AssetEnumCallback &assetEnum, DWORD flags)
 Enumerate auxiliary files (e.g. bitmaps) 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...
 
virtual CoreExport int DoEnumDependentsImpl (DependentEnumProc *dep)
 Method to perform an enumeration on a ReferenceTarget. 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...
 
Finding and Checking Reference Targets
CoreExport int FindRef (RefTargetHandle rtarg)
 Get the index of the ReferenceTarget. More...
 
virtual BOOL IsRefTarget ()
 Tells whether it is a 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...
 
Methods introduced in 3ds Max 4.2

Methods inherited from Animatable.

If your plugin utilizes this new mechanism, be sure that your clients are aware that they must run your plugin with 3ds max version 4.2 or higher.

virtual CoreExport voidGetInterface (ULONG id)
 Returns a pointer to the interface. More...
 
virtual CoreExport BaseInterfaceGetInterface (Interface_ID id)
 Returns a pointer to the Base Interface. 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 CoreExport Class_ID ClassID ()
 Retrieves a constant that uniquely identifies 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)
 
virtual CoreExport int SetProperty (ULONG id, void *data)
 
virtual CoreExport voidGetProperty (ULONG id)
 
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 ()
 
virtual CoreExport SvGraphNodeReference SvTraverseAnimGraph (IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags)
 
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 MSTR SvGetName (IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
 
virtual CoreExport bool SvCanSetName (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvSetName (IGraphObjectManager *gom, IGraphNode *gNode, const MSTR &name)
 
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 SvIsSelected (IGraphObjectManager *gom, IGraphNode *gNode)
 Returns true if the object is selected in its schematic view. More...
 
virtual CoreExport bool SvIsHighlighted (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport COLORREF SvHighlightColor (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 SvHandleDoubleClick (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport MultiSelectCallbackSvGetMultiSelectCallback (IGraphObjectManager *gom, IGraphNode *gNode)
 
virtual CoreExport bool SvCanSelect (IGraphObjectManager *gom, IGraphNode *gNode)
 
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...
 

Protected Member Functions

Dependent Notification

Methods used to respond to notifications

virtual RefResult NotifyRefChanged (const Interval &changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message, BOOL propagate)=0
 Receives and responds to messages. More...
 
- Protected Member Functions inherited from Animatable
virtual CoreExport ~Animatable ()=0
 Destructor. More...
 
- Protected Member Functions inherited from Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 

Friends

class DeleteRefRestore
 
class MakeRefRestore
 
class ReferenceTarget
 
class ParamBlock
 
class RootNode
 
class BaseNode
 
class ILoadImp
 
class RefMakerPLC
 
class RefList
 
class LayerManagerRestore
 
class RepMtlRest
 
class MAXMaterialLibrary
 

Construction, deletion of instances

virtual CoreExport ~ReferenceMaker ()=0
 Destructor. More...
 
CoreExport ReferenceMaker ()
 Constructor. More...
 
CoreExport void DeleteMe ()
 Deletes an instance of this class. More...
 

Reference Access

3ds Max manages the access to an items references by using a virtual array.

ALL classes that make references MUST implement these three methods to handle access to their references

virtual CoreExport void SetReference (int i, RefTargetHandle rtarg)
 Stores a ReferenceTarget as its 'i-th' reference`. 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...
 

Dependent Notification Methods

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)
 Send a notification all classes that reference this class. More...
 

Internal Methods

Implemented by the system.

These method are used internally.

void BlockEval ()
 
void UnblockEval ()
 
int Evaluating ()
 
CoreExport RefResult StdNotifyRefChanged (const Interval &changeInt, RefTargetHandle hTarget, PartID partID, RefMessage message, BOOL propagate, NotifyDependentsOption notifyDependentsOption)
 

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 UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 
- Static Public Attributes inherited from Animatable
static const AnimHandle kInvalidAnimHandle = 0
 
- Protected Attributes inherited from Animatable
DWORD aflag
 
AnimPropertyList aprops
 

Constructor & Destructor Documentation

virtual CoreExport ~ReferenceMaker ( )
protectedpure virtual

Destructor.

Instances of class ReferenceMaker and classes derived from it should be deleted by calling ReferenceMaker::DeleteMe() on them, rather then calling the delete operator. This will ensure that the object drops all references it makes to other objects.

Constructor.

Member Function Documentation

CoreExport void DeleteMe ( )

Deletes an instance of this class.

Deletes all references to and from this object, sends REFMSG_TARGET_DELETED messages, and deletes the object. If the undo system is engaged (holding) it ensures that the operation is undo/redo-able. Note that this method should only be called by plugins when they need to delete plugin objects via ReferenceMaker pointers or in case the plugin to be deleted does not allow the system to automatically delete it. See ReferenceTarget::MaybeAutoDelete() and ReferenceTarget::AutoDelete() for more information.

virtual void GetClassName ( MSTR s)
inlinevirtual

Retrieves the (localizable) 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
sReference to a string filled in with the name of the plugin class

Reimplemented from Animatable.

Reimplemented in SingleRefMaker, INodeTransformed, ReferenceTarget, SingleRefMakerSplineMtl, SingleRefMakerSplineNode, SingleRefMakerPatchMtl, SingleRefMakerPatchNode, CollisionMesh, SimpleManipulator, CollisionSphere, PatchObject, CollisionPlane, SimpleParticle, SimpleOSMToWSMMod2, MultCurveList, SimpleOSMToWSMMod, SplineShape, EaseCurveList, AnimatableRolloutControl::ControllerHolder, SimpleWSMObject, MCDeviceBinding, PolyObject, TriObject, UnifiedRenderer, RefTargMonitorRefMaker, SimpleSpline, SimpleShape, Texmap, DefNoteTrack, LinearShape, MSCustAttrib, BoxGizmoObject, MtlBaseLib, MAXWrapper, DummyObject, PFSimpleAction, SimpleObjectBase, CylGizmoObject, SimplePolyObject, RefMgrAddDeleteRestore< T >, SingleWeakRefMaker, MtlLib, SphereGizmoObject, Mtl, and DADBitmapCarrier.

1177 { s = _M("ReferenceMaker"); }
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67
virtual CoreExport SClass_ID SuperClassID ( )
virtual
CoreExport RefResult ReplaceReference ( int  which,
RefTargetHandle  newtarg,
BOOL  delOld = TRUE 
)

Used when cloning reference makers.

This routine is used when cloning reference makers, to delete old reference and make a new one. In max r9, additional checks have have been added to ReplaceReference. If parameter which is < 0, REF_FAIL will be immediately returned. If parameter which is >= NumRefs, an attempt will be made to set the reference, and then another check will is made to see if which is >= NumRefs, and if so REF_FAIL is returned. There are 2 additional tests that can be enabled in order to ensure that plugins set up their references correctly. Both are executed at run-time when a plugin calls ReplaceReference:

  1. The first test ensures that all references of a plugin are initialized to NULL before it establishes its first reference. Whether to perform this check defaults to TRUE for Hybrid and Debug builds, false for Release builds. The 3DSMAX_REFCHECK_ENABLED environment variable can be used to overwrite the default behaviour. See bool UtilityInterface::GetBoolEnvironmentVariable() for the values this environment variable can take.

  2. The second test ensures that all references of a plugin have been set up correctly. This test can also detect "dangling" references, i.e. references that are non-NULL but point to non-existent reference targets. Whether to perform this check defaults to FALSE for all build configurations (Debug, Hybrid and Release). The 3DSMAX_REFCHECK_PARANOID_ENABLED environment variable, can be used to overwrite the default behaviour. See bool UtilityInterface::GetBoolEnvironmentVariable() for the values this environment variable can take.
    Parameters
    which- The virtual array index of the reference to replace.
    newtarg- The new reference target
    delOld- If TRUE, the old reference is deleted.
    Returns
    This is usually REF_SUCCEED indicating the reference was replaced, otherwise REF_FAIL.
CoreExport RefResult DeleteAllRefsFromMe ( )

Deletes all references from this ReferenceMaker.

Implemented by the System.

Returns
This is always REF_SUCCEED indicating the references were deleted.
virtual RefResult DeleteAllRefsToMe ( )
inlinevirtual

Deletes all refs to this RefMaker/RefTarget.

Implemented by the System. This method deletes all the references to this reference maker/reference target. This also sends the REFMSG_TARGET_DELETED message to all dependents.

Returns
This is REF_SUCCEED if the references were deleted; otherwise it is REF_FAIL.

Reimplemented in ReferenceTarget.

1230 { return REF_SUCCEED; }
The operation succeeded.
Definition: ref.h:745
CoreExport RefResult DeleteAllRefs ( )

Deletes all references both to and from this item.

Implemented by the System. Deletes all references both to and from this item.

Returns
This is REF_SUCCEED if the references were deleted; otherwise it is REF_FAIL.
CoreExport RefResult DeleteReference ( int  i)

Deletes the specified reference.

Implemented by the System. This method deletes the reference whose virtual array index is passed. The other reference indices are not affected, i.e. the number of references is not reduced nor are they reordered in any way. Note the system calls SetReference(i, NULL) to set that reference to NULL. Also, if this is the last reference to the item, the item itself is deleted by calling its DeleteThis() method.

Parameters
i- The virtual array index of the reference to delete.
Returns
This is REF_SUCCEED if the reference was deleted; otherwise it is REF_FAIL.
virtual BOOL CanTransferReference ( int  i)
inlinevirtual

Tells whether this reference can be transfered.

A ReferenceMaker can choose not to let ReferenceTarget::TransferReferences() affect it. Note that plugins probably should not use this. It is used by certain system objects that have references.

Parameters
i- Currently not used.
Returns
Default to return TRUE

Reimplemented in SingleRefMaker, RefMgrAddDeleteRestore< T >, and MAXWrapper.

1257 { UNUSED_PARAM(i); return TRUE; }
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18
virtual CoreExport int NumRefs ( )
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 in ShapeObject, SingleRefMaker, Control, CollisionMesh, SimpleManipulator, CollisionSphere, PatchObject, CollisionPlane, SimpleParticle, MultCurveList, SplineShape, GizmoClass, EaseCurveList, SimpleOSMToWSMObject, SimpleWSMMod, AnimatableRolloutControl::ControllerHolder, SimpleWSMObject, RefMgr< T >, SimpleMod2, SimpleObject2, SimpleMod, SimpleObject, UnifiedRenderer, MSCustAttrib, RefTargMonitorRefMaker, SimpleSpline, RefMgrAddDeleteRestore< T >, MtlBaseLib, SimpleShape, MAXWrapper, SimpleModBase, SimplePolyObject, MtlLib, GizmoObject, and PFSimpleAction.

virtual CoreExport RefTargetHandle GetReference ( int  i)
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 in ShapeObject, SingleRefMaker, Control, CollisionMesh, SimpleManipulator, CollisionSphere, PatchObject, CollisionPlane, SimpleParticle, MultCurveList, SplineShape, SimpleWSMMod2, GizmoClass, EaseCurveList, SimpleOSMToWSMObject, SimpleWSMObject2, SimpleWSMMod, AnimatableRolloutControl::ControllerHolder, RefMgr< T >, SimpleWSMObject, SimpleMod2, SimpleObject2, SimpleMod, SimpleObject, UnifiedRenderer, RefTargMonitorRefMaker, MSCustAttrib, SimpleSpline, RefMgrAddDeleteRestore< T >, MtlBaseLib, SimpleShape, MAXWrapper, SimpleModBase, SimplePolyObject, MtlLib, GizmoObject, and PFSimpleAction.

virtual CoreExport void SetReference ( int  i,
RefTargetHandle  rtarg 
)
protectedvirtual

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 in ShapeObject, SingleRefMaker, Control, CollisionMesh, SimpleManipulator, CollisionSphere, PatchObject, CollisionPlane, SimpleParticle, MultCurveList, SplineShape, SimpleWSMMod2, GizmoClass, EaseCurveList, SimpleOSMToWSMObject, SimpleWSMObject2, SimpleWSMMod, RefMgr< T >, AnimatableRolloutControl::ControllerHolder, SimpleWSMObject, SimpleMod2, SimpleObject2, SimpleMod, SimpleObject, UnifiedRenderer, RefTargMonitorRefMaker, MSCustAttrib, SimpleSpline, RefMgrAddDeleteRestore< T >, MtlBaseLib, SimpleShape, MAXWrapper, SimplePolyObject, SimpleModBase, MtlLib, GizmoObject, and PFSimpleAction.

CoreExport ReferenceSaveManager& GetReferenceSaveManager ( )

Access the ReferenceSaveManager of this ReferenceMaker.

The ReferenceSaveManager is used to specify and enumerate the save reference hierarchy for the ReferenceMaker. If a plugin needed to specify a save reference hierarchy different than its normal reference hierarchy, it would implement SpecifySaveReferences() and specify the save reference hierarchy through the ReferenceSaveManager in that implementation.

Returns
the ReferenceSaveManager for the ReferenceMaker.
virtual CoreExport IOResult Save ( ISave isave)
virtual

Called for saving data.

Called by the system to allow the plugin to save its data.

Parameters
isave- This pointer may be used to call methods to write data to disk. See the section on Loading and Saving Plug-in Data for an overview of the load/save process.
Returns
The default implementation is return IO_OK.
  • IO_OK means the result was acceptable, with no errors.
  • IO_ERROR This should be returned if an error occurred.

Reimplemented in Modifier, ShapeObject, Control, PatchObject, SplineShape, FilterKernel, MultCurveList, GizmoClass, Effect, MtlBase, EaseCurveList, IProjectionModType, Atmospheric, BaseShader, MAXWrapper, PolyObject, TriObject, IRenderElement, DefNoteTrack, SpecialFX, UnifiedRenderer, SimpleSpline, MSCustAttrib, SimpleShape, MtlBaseLib, LinearShape, RefTargMonitorRefMaker, MtlLib, Sampler, DummyObject, PFSimpleAction, RadiosityEffect, and ToneOperator.

virtual CoreExport IOResult Load ( ILoad iload)
virtual

Called for loading data.

Called by the system to allow the plug-in to load its data. See the section on Loading and Saving Plug-in Data for an overview of the load - save process.

Parameters
iload- This interface pointer may be used to call methods to read data from disk.
Returns
The default implementation is return IO_OK.
  • IO_OK means the result was acceptable, with no errors.
  • IO_ERROR This should be returned if an error occurred.

Reimplemented in Modifier, ShapeObject, Control, PatchObject, SplineShape, FilterKernel, MultCurveList, GizmoClass, MtlBase, Effect, EaseCurveList, SimpleOSMToWSMObject, IProjectionModType, Atmospheric, BaseShader, PolyObject, TriObject, IRenderElement, SpecialFX, DefNoteTrack, SimpleSpline, UnifiedRenderer, MSCustAttrib, SimpleShape, MtlBaseLib, LinearShape, RefTargMonitorRefMaker, MtlLib, Sampler, DummyObject, RadiosityEffect, PFSimpleAction, and ToneOperator.

virtual int RemapRefOnLoad ( int  iref)
inlinevirtual

Used to load old files with references.

Implement this if you have added or deleted references and are loading an old file that needs to have its references remapped. This method is used when you have modified a ReferenceMaker to add or delete references, and are loading old files. It gets called during the reference mapping process, after the Load() method is called. You determine what version is loading in the Load(), and store the version in a variable which you can look at in RemapRefOnLoad() to determine how to remap references. The default implementation of this method just returns the same value it is passed, so you don't need to implement it unless you have added or deleted references from your class. This method makes it a lot easier to load old files when the reference topology has changed.

Parameters
iref- The input index of the reference.
Returns
The output index of the reference.

Reimplemented in ShapeObject, PatchObject, SplineShape, and PFSimpleAction.

1356 { return iref; }
virtual CoreExport void RescaleWorldUnits ( float  f)
virtual

Rescale size of all world units in reference hierarchy.

This method is available in release 2.0 and later only. Must call ClearAFlagInHierarchy(rm, A_WORK1) or ClearAFlagInAllAnimatables(A_WORK1) before doing this on a reference hierarchy. This may be implemented to rescale the size of all world units in a reference hierarchy. Developers must call

before doing this on a reference hierarchy.

Parameters
f- The scale factor.

Reimplemented in ShapeObject, PatchObject, SplineShape, PolyObject, TriObject, LinearShape, and DummyObject.

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 
)
virtual

Send a notification all classes that reference this class.

Since a ReferenceMaker cannot have dependents, ReferenceMaker::NotifyDependents() is implemented to simply return REF_SUCCEED.

See also
ReferenceTarget::NotifyDependents for a detailed description of this method.

Reimplemented in ReferenceTarget.

virtual CoreExport void EnumAuxFiles ( AssetEnumCallback assetEnum,
DWORD  flags 
)
virtual

Enumerate auxiliary files (e.g. bitmaps)

Enumerate auxiliary files (e.g. bitmaps). The default implementation just calls itself on all references and calls Animatable::EnumAuxFiles to pick up Custom Attributes Entities which actually need to load aux files must implement this, possibly calling ReferenceMaker::EnumAuxFiles also to recurse. If you don't call ReferenceMaker::EnumAuxFiles call Animatable::EnumAuxFiles.

Parameters
assetEnum- The Callback object that gets called on all Auxiliary files.
flags- Flags.

Reimplemented from Animatable.

Reimplemented in MtlBase.

virtual CoreExport void SaveEnum ( SaveEnumProc sep,
BOOL  isNodeCall = 0 
)
virtual

The default save enumeration.

This method is used internally.

virtual CoreExport bool SpecifySaveReferences ( ReferenceSaveManager referenceSaveManager)
virtual

Used to specify reference slot remapping during scene file save.

Plugins that want to add, remove, or change the references held by the ReferenceMaker as stored to the scene file implement this method. The method implementation would modify the stored reference hierarchy through the specified ReferenceSaveManager. Plugins that implement this method must call SpecifySaveReferences() on their parent class after they have finished performing operations on the ReferenceSaveManager. The ReferenceSaveManager modifies the save hierarchy in the order that operations are performed on it, so operations on higher-indexed reference target slots should occur before operations on lower-indexed reference target slots. Otherwise, the indexing on the higher-indexed reference target slots may point at an incorrect slot. For example, if the plugin currently had slots 1,2,3 and then inserted slot 4 at position 3 and then removed slot 2, the plugin would end up with slots 1,4,3. If the order of the operations was reversed, the plugin would end up with slots 1,3,4. The ReferenceMaker level implementation finalizes the preparation of the ReferenceSaveManager to support the scene file save reference slot remapping.

// If using CopyParamBlock2ToParamBlock copy of values/controllers from pb2 to a new pb1
bool Swirl::SpecifySaveReferences(ReferenceSaveManager& referenceSaveManager)
{
// if saving to previous version that used pb1 instead of pb2...
DWORD saveVersion = GetSavingVersion();
if (saveVersion != 0 && saveVersion <= MAX_RELEASE_R13)
{
// create the pb1 instance
IParamBlock* paramBlock1 = CreateParameterBlock( pbdesc,swirl_num_params_ver1,1);
DbgAssert(paramBlock1 != NULL);
if (paramBlock1)
{
// copy data from the pb2 to the pb1
int numParamsCopied = CopyParamBlock2ToParamBlock(pblock,paramBlock1,pbdesc,swirl_num_params_ver1);
DbgAssert(numParamsCopied == swirl_num_params_ver1);
// register the reference slot replacement
referenceSaveManager.ReplaceReferenceSlot(PBLOCK_REF,paramBlock1);
// register transferring all refs to the pb2 to the pb1
ReferenceSaveManager& pb2_referenceSaveManager = pblock->GetReferenceSaveManager();
pb2_referenceSaveManager.SetReplacementReferenceTarget(paramBlock1);
}
}
return Texmap::SpecifySaveReferences(referenceSaveManager);
}
// If using CopyParamBlock2ToParamBlock copy of values/controllers from pb2 to a new pb1
bool Swirl::SpecifySaveReferences(ReferenceSaveManager& referenceSaveManager)
{
// if saving to previous version that used pb1 instead of pb2...
DWORD saveVersion = GetSavingVersion();
if (saveVersion != 0 && saveVersion <= MAX_RELEASE_R13)
{
ProcessPB2ToPB1SaveToPrevious(this, pblock, PBLOCK_REF, pbdesc,swirl_num_params_ver1,1);
}
return Texmap::SpecifySaveReferences(referenceSaveManager);
}
// If doing manual copy of values/controllers from pb2 to a new pb1
bool Swirl::SpecifySaveReferences(ReferenceSaveManager& referenceSaveManager)
{
// if saving to previous version that used pb1 instead of pb2...
DWORD saveVersion = GetSavingVersion();
if (saveVersion != 0 && saveVersion <= MAX_RELEASE_R13)
{
SuspendAll suspendAll(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
// create the pb1 instance
IParamBlock* paramBlock1 = CreateParameterBlock( pbdesc,swirl_num_params_ver1,1);
DbgAssert(paramBlock1);
if (paramBlock1)
{
// copy over each parameter value/controller
int color_params[] = {swirl_col1, swirl_col2};
for (int i = 0; i < _countof(color_params); i++)
{
int id = color_params[i];
Control* pb2Controller = pblock->GetController(ParamID(id));
if (pb2Controller)
paramBlock1->SetController(id, pb2Controller, FALSE);
else
{
// Note: Swirl pb2 params are TYPE_FRGBA, PB1 params are TYPE_RGBA
AColor pb2Color = pblock->GetAColor(id);
Color pb1Color = pb2Color;
paramBlock1->SetValue(id, 0, pb1Color);
}
}
int float_params[] = {swirl_hs, swirl_vs, swirl_cv, swirl_vg, swirl_hg, swirl_ls, swirl_rs};
for (int i = 0; i < _countof(float_params); i++)
{
int id = float_params[i];
Control* pb2Controller = pblock->GetController(ParamID(id));
if (pb2Controller)
paramBlock1->SetController(id, pb2Controller, FALSE);
else
{
float pb2Float = pblock->GetFloat(id);
paramBlock1->SetValue(id, 0, pb2Float);
}
}
int int_params[] = {swirl_h, swirl_lock};
for (int i = 0; i < _countof(int_params); i++)
{
int id = int_params[i];
Control* pb2Controller = pblock->GetController(ParamID(id));
if (pb2Controller)
paramBlock1->SetController(id, pb2Controller, FALSE);
else
{
int pb2Int = pblock->GetInt(id);
paramBlock1->SetValue(id, 0, pb2Int);
}
}
// register the reference slot replacement
referenceSaveManager.ReplaceReferenceSlot(PBLOCK_REF,paramBlock1);
// register transferring all refs to the pb2 to the pb1
ReferenceSaveManager& pb2_referenceSaveManager = pblock->GetReferenceSaveManager();
pb2_referenceSaveManager.SetReplacementReferenceTarget(paramBlock1);
}
}
return Texmap::SpecifySaveReferences(referenceSaveManager);
}
Parameters
referenceSaveManagerThe ReferenceSaveManager for the object
Returns
true if no errors processing any add, remove, or change operations registered with the ReferenceSaveManager. An error will occur if the reference slot index specified for an operation is invalid after performing any previously registered operations.

Reimplemented in ShapeObject.

CoreExport int DoEnumDependents ( DependentEnumProc dep)

Begins an enumeration that searches back in the dependency network.

Implemented by the System. See the documentation for ReferenceTarget for more details. When called on instances that derive from ReferenceTarget, the call is passed along to the ReferenceTarget::DoEnumDependents method. Otherwise this method returns 0.

See also
ReferenceTarget::DoEnumDependents(DependentEnumProc* dep)
Parameters
dep- The callback object called for each dependent.
Returns
Return 1 to stop the enumeration and 0 to continue. The default implementation for ReferenceMaker is return 0;
virtual CoreExport int DoEnumDependentsImpl ( DependentEnumProc dep)
virtual

Method to perform an enumeration on a ReferenceTarget.

Implemented by the System. See the documentation for ReferenceTarget for more details.

Parameters
dep- The callback object called for each dependent.
Returns
Return 1 to stop the enumeration and 0 to continue.
See also
ReferenceTarget::DoEnumDependentsImpl(DependentEnumProc* dep)

Reimplemented in ReferenceTarget, and RefTargMonitorRefMaker.

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.

This method provides a general purpose reference enumerator that calls RefEnumProc::proc() on each element in a reference hierarchy. This function walks down the reference hierarchy, recursively calling RefEnumProc::proc() on the references held by a reference, This function ensures that RefEnumProc::proc() is called only once on each reference. Processing each reference only once improves efficiency, and prevents potential infinite recursive loops when processing indirect references. To enumerate the up the reference hierarchy, see ReferenceTarget::DoEnumDependents.

Parameters
proc- The callback object whose proc() method is called for each element.
includeCustAttribs- Added in 3ds Max 6 SDK. Defaults to true. With includeCustAttribs set to true, RefEnumProc::proc will be called for the custom attributes applied to the reference maker.
includeIndirectRefs- Added in 3ds Max 9 SDK. Defaults to true. With includeIndirectRefs set to true, RefEnumProc::proc will be called for the indirect references held by the reference maker.
includeNonPersistentRefs- Added in 3ds Max 9 SDK. Defaults to true. With includeNonPersistentRefs set to false, RefEnumProc::proc will not be called on direct references from the reference maker unless IsRealDependency or ShouldPersistWeakRef returns true for that reference; and the proc method will not be called on indirect references from the reference maker unless ShouldPersistIndirectRef returns true for that indirect reference.
preventDuplicatesViaFlag- Added in 3ds Max 9 SDK. Defaults to true. With preventDuplicatesViaFlag set to true, processing of a duplicate reference is detected by requesting and clearing a flag bit on all animatables, and then testing/setting the flag bit prior to calling the proc on each reference maker. When set to false, a list of reference makers visited is maintained. If you expect to enumerate only a small number of references, this argument should be set to false. Note however that you do not know what references are held by the references you may enumerate into, so in most cases this argument should be true.
Returns
Returns false if the enumeration was terminated because the RefEnumProc's proc returned REF_ENUM_HALT, true otherwise
See also
Class RefEnumProc
ReferenceMaker::IsRealDependency(ReferenceTarget *rtarg)
ReferenceMaker::ShouldPersistWeakRef(RefTargetHandle rtarg)
IIndirectReferenceMaker::ShouldPersistIndirectRef(RefTargetHandle rtarg)
ReferenceTarget::DoEnumDependents(DependentEnumProc* dep)
CoreExport int FindRef ( RefTargetHandle  rtarg)

Get the index of the ReferenceTarget.

Implemented by the System. This method returns the virtual array index of the reference target passed.

Parameters
rtarg- The reference target to find the index of.
Returns
The virtual array index of the reference target to find. If the reference target is not found, -1 is returned.
virtual BOOL IsRefTarget ( )
inlinevirtual

Tells whether it is a ReferenceTarget.

This function differentiates things sub classed from ReferenceMaker from subclasses of ReferenceTarget. The implementation of this method (in ReferenceMaker) returns FALSE and its implementation in ReferenceTarget returns TRUE. This can be useful when tracing back up the reference hierarchy, to know when you run into something that was sub classed directly off of ReferenceMaker, and hence to stop the traversal at that point.

Returns
Default of FALSE.

Reimplemented in ReferenceTarget.

1648 { return FALSE; }
virtual BOOL IsRefMaker ( )
inlinevirtual

Tells whether it is a ReferenceMaker.

This function differentiates things sub classed from Animatable from subclasses of ReferenceMaker. The implementation of this method (in Animatable) returns FALSE and its implementation in ReferenceMaker returns TRUE.

Returns
Returns TRUE.

Reimplemented from Animatable.

1657 { return TRUE; }
virtual BOOL IsRealDependency ( ReferenceTarget rtarg)
inlinevirtual

Returns whether this is a "real" (strong) dependency or not.

Used Internally. When a reference target's last "real" (strong) reference is deleted the target is deleted. Any leftover "non-real" (weak) reference makers will receive a REFMSG_TARGET_DELETED notification. This method returns TRUE if the reference dependency is "real" (strong). Otherwise it returns FALSE. Certain references are not considered "real" (strong) dependencies. For instance, internally there are certain reference makers such as the object that handles editing key information in the motion branch. This object implements this method to return FALSE because it is not a "real" strong) reference dependency. It's just needed while the editing is taking place. Plugin developers don't need to concern themselves with this method because it is used internally.

Parameters
rtarg- A pointer to the reference target.
Returns
TRUE if the reference dependency is "real". Otherwise it returns FALSE. Default implementation is TRUE.

Reimplemented in RefTargMonitorRefMaker, MAXWrapper, and SingleWeakRefMaker.

1676 { UNUSED_PARAM(rtarg); return TRUE;}
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18
virtual BOOL ShouldPersistWeakRef ( RefTargetHandle  rtarg)
inlinevirtual

Specifies whether a weak reference is to be persisted on a partial load or save.

This method specifies the partial load/save behavior of a weak reference. This method will only be called if IsRealDependency returns FALSE. If this method returns true, and this ref maker is loaded/saved, the weak reference will be forced to be loaded/saved. If false, the reference will not be forced to be loaded/saved, but will be hooked back up if it is loaded.

The default implementation is to return FALSE. Otherwise, it is possible that on a partial load that this reference maker would hold the only reference to the target. If something else temporarily referenced the target, then the target will be deleted when that reference is dropped. From the user's perspective, this is a randomly occurring event.

Typical cases where an implementation of this method would return TRUE is when post load callbacks are used to check and process the references, checking for things like owner-less parameter blocks.

Parameters
rtarg- The weak reference.
Returns
Whether to force the load/save of the weak reference if this reference maker is saved.
1701 { UNUSED_PARAM(rtarg); return FALSE; }
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18
virtual CoreExport BaseInterface* GetInterface ( Interface_ID  id)
virtual

Returns a pointer to the Base Interface.

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

Parameters
id- The unique ID of the interface to get

Reimplemented from Animatable.

Reimplemented in ShapeObject, LightObject, Object, ReferenceTarget, INode, SimpleManipulator, Shader, MtlBase, Effect8, BaseObject, MAXWrapper, UnifiedRenderer, IRefTargContainer, MSCustAttrib, TriObject, SimplePolyObject, SimpleObjectBase, IIndirectRefTargContainer, PFSimpleTest, PFSimpleAction, and PFSimpleOperator.

void BlockEval ( )
inlineprotected
1727 { SetAFlag(A_EVALUATING); }
void SetAFlag(DWORD mask)
Definition: Animatable.h:259
#define A_EVALUATING
Used Internally.
Definition: AnimatableFlags.h:267
void UnblockEval ( )
inlineprotected
1728 { ClearAFlag(A_EVALUATING); }
void ClearAFlag(DWORD mask)
Clears one or more bits in the Animatable flags.
Definition: Animatable.h:264
#define A_EVALUATING
Used Internally.
Definition: AnimatableFlags.h:267
int Evaluating ( )
inlineprotected
1729 { return TestAFlag(A_EVALUATING); }
bool TestAFlag(DWORD mask) const
Tests one or more bits in the Animatable flags.
Definition: Animatable.h:272
#define A_EVALUATING
Used Internally.
Definition: AnimatableFlags.h:267
CoreExport RefResult StdNotifyRefChanged ( const Interval changeInt,
RefTargetHandle  hTarget,
PartID  partID,
RefMessage  message,
BOOL  propagate,
NotifyDependentsOption  notifyDependentsOption 
)
protected
virtual RefResult NotifyRefChanged ( const Interval changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message,
BOOL  propagate 
)
protectedpure virtual

Receives and responds to messages.

A plugin which makes references must implement a method to receive and respond to messages broadcast by its dependents. This is done by implementing NotifyRefChanged(). The plugin developer usually implements this method as a switch statement where each case is one of the messages the plugin needs to respond to. The Method StdNotifyRefChanged calls this, which can change the partID to new value. If it doesn't depend on the particular message& partID, it should return REF_DONTCARE.

  • For developer that need to update a dialog box with data about an object you reference note the following related to this method: This method may be called many times. For instance, say you have a dialog box that displays data about an object you reference. This method will get called many time during the drag operations on that object. If you updated the display every time you'd wind up with a lot of 'flicker' in the dialog box. Rather than updating the dialog box each time, you should just invalidate the window in response to the NotifyRefChanged() call. Then, as the user drags the mouse your window will still receive paint messages. If the scene is complex the user may have to pause (but not let up on the mouse) to allow the paint message to go through since they have a low priority. This is the way many windows in 3ds Max work.
Parameters
changeInt- This is the interval of time over which the message is active. Currently, all plug-ins will receive FOREVER for this interval, with the exception of REFMSG_FLAGDEPENDENTS notifications. In that case, changeInt.Start() is the timepoint to perform the dependency test.
hTarget- This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message.
partID- This contains information specific to the message passed in. Some messages don't use the partID at all. See the section List of Reference Messages for more information about the meaning of the partID for some common messages.
message- The message parameters passed into this method is the specific message which needs to be handled.
propagate- If called through ReferenceMaker::NotifyDependents(), the value of 'propagate' passed to it. Used if calling NotifyDependents() from within NotifyRefChanged().
Returns
The return value from this method is of type RefResult. This is usually REF_SUCCEED indicating the message was processed. Sometimes, the return value may be REF_STOP. This return value is used to stop the message from being propagated to the dependents of the item.

Implemented in ShapeObject, SingleRefMaker, IMultiPassCameraEffect, INodeTransformed, SingleRefMakerSplineMtl, SingleRefMakerSplineNode, CollisionMesh, SingleRefMakerPatchMtl, SingleRefMakerPatchNode, SimpleManipulator, CollisionSphere, CollisionPlane, FilterKernel, SimpleParticle, MultCurveList, GizmoClass, PatchObject, Effect, EaseCurveList, SimpleWSMMod, IProjectionModType, Atmospheric, SplineShape, RefMgr< T >, AnimatableRolloutControl::ControllerHolder, SimpleWSMObject, MCDeviceBinding, BaseShader, SimpleMod, IRenderElement, SimpleObject, DefNoteTrack, UnifiedRenderer, SimpleSpline, RefTargMonitorRefMaker, MSCustAttrib, MtlBaseLib, SimpleShape, MAXWrapper, RefMgrAddDeleteRestore< T >, SimpleModBase, SimplePolyObject, MtlLib, SimpleObjectBase, PolyObject, GizmoObject, Sampler, TriObject, PFSimpleAction, RadiosityEffect, SingleWeakRefMaker, ToneOperator, LinearShape, and DADBitmapCarrier.

Friends And Related Function Documentation

friend class DeleteRefRestore
friend
friend class MakeRefRestore
friend
friend class ReferenceTarget
friend
friend class ParamBlock
friend
friend class RootNode
friend
friend class BaseNode
friend
friend class ILoadImp
friend
friend class RefMakerPLC
friend
friend class RefList
friend
friend class LayerManagerRestore
friend
friend class RepMtlRest
friend
friend class MAXMaterialLibrary
friend