This reference page is linked to from the following overview topics: Lesson 3: the reference system, Lesson 4: Animation Controllers, Major New Features, Incremental Improvements, Plug-in Upgrade Guide, Reference System Changes, SuperClassID Cleanup, Overview: Parameter Blocks, Reference System Best Practices, Saving, Loading, and Deleting Parameter Blocks, Responding to Node Deletion, Recovering an ILayer or ILayerProperties from an INode, Reference System, How Plug-ins Observe Reference Targets, Writing Reference Makers, Creating and Changing References, Deleting References, Loading and Saving of References, Reference Messages, Handling Reference Messages, Strong References, Weak References, Reference Hierarchy Functions, Reference Object Lifetime Management, Guidelines for Changing the Reference Structure, Translation of Texture Map and Materials, Wrapping 3ds Max Objects, Extracting Wrapped Objects, Loading and Saving Plug-in Data, Exposing and Managing References, Implementing Clone in a Plug-in, Remapping References on Load, Supporting Save to Previous, Serializing Controllers, Making Controllers Lockable, Ring Array Classes, Ring Array Creation Process.
A scene entity that owns other scene entities and listens to messages from them.
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. For more information, see ReferenceMaker::Clone().
Note that RefMakerHandle is a typename for pointers to an object of type ReferenceMaker.
See the section on References for an overview of the 3ds Max reference architecture.
#include <ref.h>
Public Member Functions |
|
virtual void | GetClassName (MSTR &s) |
Retrieves the name of the plugin class.
|
|
virtual CoreExport SClass_ID | SuperClassID () |
Retrieves a constant representing the type
of the plugin. |
|
Making / Replacing / Deleting
References
|
|
CoreExport RefResult | ReplaceReference (int which, RefTargetHandle newtarg, BOOL delOld=TRUE) |
Used when cloning reference makers. |
|
CoreExport RefResult | DeleteAllRefsFromMe () |
Deletes all references from this
ReferenceMaker. |
|
virtual RefResult | DeleteAllRefsToMe () |
Deletes all refs to this RefMaker/RefTarget.
|
|
CoreExport RefResult | DeleteAllRefs () |
Deletes all references both to and from this
item. |
|
CoreExport RefResult | DeleteReference (int i) |
Deletes the specified reference. |
|
virtual BOOL | CanTransferReference (int i) |
Tells whether this reference can be
transfered. |
|
Loading and Saving Methods
|
|
CoreExport ReferenceSaveManager & | GetReferenceSaveManager () |
Access the
ReferenceSaveManager of this
ReferenceMaker. |
|
virtual CoreExport IOResult | Save (ISave *isave) |
Called for saving data. |
|
virtual CoreExport IOResult | Load (ILoad *iload) |
Called for loading data. |
|
virtual int | RemapRefOnLoad (int iref) |
Used to load old files with references.
|
|
virtual CoreExport void | RescaleWorldUnits (float f) |
Rescale size of all world units in reference
hierarchy. |
|
Dependent Notification Methods
|
|
virtual CoreExport RefResult | NotifyDependents (Interval changeInt, PartID partID, RefMessage message, SClass_ID sclass=NOTIFY_ALL, BOOL propagate=TRUE, RefTargetHandle hTarg=NULL) |
Send a notification all classes that
reference this class. |
|
Enumeration Methods
|
|
virtual CoreExport void | EnumAuxFiles (AssetEnumCallback &assetEnum, DWORD flags) |
Enumerate auxiliary files (e.g. bitmaps)
|
|
virtual CoreExport void | SaveEnum (SaveEnumProc &sep, BOOL isNodeCall=0) |
The default save enumeration. |
|
virtual CoreExport bool | SpecifySaveReferences (ReferenceSaveManager &referenceSaveManager) |
Used to specify reference slot remapping
during scene file save. |
|
CoreExport int | DoEnumDependents (DependentEnumProc *dep) |
Begins an enumeration that searches back in
the dependency network. |
|
virtual CoreExport int | DoEnumDependentsImpl (DependentEnumProc *dep) |
Method to perform an enumeration on a
ReferenceTarget. |
|
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. |
|
Finding and Checking Reference
Targets
|
|
CoreExport int | FindRef (RefTargetHandle rtarg) |
Get the index of the
ReferenceTarget. |
|
virtual BOOL | IsRefTarget () |
Tells whether it is a
ReferenceTarget. |
|
virtual BOOL | IsRefMaker () |
Tells whether it is a
ReferenceMaker. |
|
virtual BOOL | IsRealDependency (ReferenceTarget *rtarg) |
Returns whether this is a "real" (strong)
dependency or not. |
|
virtual BOOL | ShouldPersistWeakRef (RefTargetHandle rtarg) |
Specifies whether a weak reference is to be
persisted on a partial load or save. |
|
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 void * | GetInterface (ULONG id) |
Returns a pointer to the interface. |
|
virtual CoreExport BaseInterface * | GetInterface (Interface_ID id) |
Returns a pointer to the Base Interface. |
|
Protected Member Functions |
|
Dependent Notification
|
|
Methods used to respond to notifications |
|
virtual RefResult | NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)=0 |
Receives and responds to messages. |
|
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. |
|
CoreExport | ReferenceMaker () |
Constructor. |
|
CoreExport void | DeleteMe () |
Deletes an instance of this class. |
|
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`. |
|
virtual CoreExport int | NumRefs () |
Returns the total number of references this
ReferenceMaker can hold. |
|
virtual CoreExport RefTargetHandle | GetReference (int i) |
Returns the 'i-th' reference. |
|
Internal Methods |
|
Implemented by the
system.These method are used internally. |
|
void | BlockEval () |
void | UnblockEval () |
int | Evaluating () |
CoreExport RefResult | StdNotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID partID, RefMessage message, BOOL propagate=TRUE) |
virtual CoreExport ~ReferenceMaker | ( | ) | [protected, pure 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.
CoreExport ReferenceMaker | ( | ) |
Constructor.
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 | ) | [inline, virtual] |
Retrieves the name of the plugin class.
This name is usually used internally for debugging purposes. For Material plug-ins this method is used to put up the material "type" name in the Material Editor.
s | Reference to a string filled in with the name of the plugin class |
Reimplemented from Animatable.
Reimplemented in EaseCurveList, MultCurveList, DummyObject, SphereGizmoObject, CylGizmoObject, BoxGizmoObject, Texmap, Mtl, MtlLib, MtlBaseLib, LinearShape, SimpleManipulator, PatchObject, PolyObject, ReferenceTarget, SimpleOSMToWSMMod, SimpleOSMToWSMMod2, SimpleObject, SimpleWSMObject, SimpleParticle, SimpleShape, SimpleSpline, SplineShape, TriObject, MSCustAttrib, MSPluginSimpleObject, MSSimpleObjectXtnd, MSPluginSimpleManipulator, MSSimpleManipulatorXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, MSPluginTrackViewUtility, PFSimpleAction, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
{ s = _M("ReferenceMaker"); }
virtual CoreExport SClass_ID SuperClassID | ( | ) | [virtual] |
Retrieves a constant representing the type of the plugin.
Implements Animatable.
Reimplemented in EaseCurveList, MultCurveList, CustAttrib, CollisionPlane, CollisionSphere, CollisionMesh, IIndirectRefTargContainer, IKMasterControl, IKSlaveControl, ILayer, ILayerManager, Texmap, Mtl, UVGen, XYZGen, TextureOutput, MtlLib, MtlBaseLib, DADBitmapCarrier, IStdDualVS, MCDeviceBinding, NoteTrack, IMultiPassCameraEffect, CameraObject, LightObject, HelperObject, GeomObject, ShapeObject, WSMObject, Modifier, OSModifier, WSModifier, RadiosityEffect, ReferenceTarget, SingleRefMaker, Renderer, IRenderElement, MaxBakeElement, Sampler, Atmospheric, Effect, FilterKernel, BaseShader, ShadowType, SimpleOSMToWSMMod, SimpleOSMToWSMMod2, SingleWeakRefMaker, SoundObj, ToneOperator, BaseBehavior, MSCustAttrib, MSPluginShape, MSShapeXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, IXRefAtmospheric, and IXRefObject.
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.
which | - The virtual array index of the reference to replace. |
newtarg | - The new reference target |
delOld | - If TRUE, the old reference is deleted. |
CoreExport RefResult DeleteAllRefsFromMe | ( | ) |
Deletes all references from this ReferenceMaker.
Implemented by the System.
virtual RefResult DeleteAllRefsToMe | ( | ) | [inline, virtual] |
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.
Reimplemented in ReferenceTarget.
{ return REF_SUCCEED; }
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.
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.
i | - The virtual array index of the reference to delete. |
Reimplemented in RefMgr< T >.
virtual BOOL CanTransferReference | ( | int | i | ) | [inline, virtual] |
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.
i | - Currently not used. |
Reimplemented in SingleRefMaker, and RefMgrAddDeleteRestore< T >.
{ UNUSED_PARAM(i); return TRUE; }
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.
Reimplemented in EaseCurveList, MultCurveList, Control, CollisionPlane, CollisionSphere, CollisionMesh, MtlLib, MtlBaseLib, RefTargMonitorRefMaker, GizmoClass, SimpleManipulator, ShapeObject, PatchObject, SingleRefMaker, RefMgrAddDeleteRestore< T >, RefMgr< T >, SimpleMod, SimpleWSMMod, SimpleObject, SimpleWSMObject, SimpleOSMToWSMObject, SimpleParticle, SimpleShape, SimpleSpline, SplineShape, Wrangler, MSCustAttrib, MSPluginSimpleObject, MSSimpleObjectXtnd, MSPluginSimpleManipulator, MSSimpleManipulatorXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, MSPluginTrackViewUtility, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
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.
i | - The index of the reference to retrieve. Valid values are from 0 to NumRefs()-1. |
Reimplemented in EaseCurveList, MultCurveList, Control, CollisionPlane, CollisionSphere, CollisionMesh, MtlLib, MtlBaseLib, RefTargMonitorRefMaker, GizmoClass, SimpleManipulator, ShapeObject, PatchObject, SingleRefMaker, RefMgrAddDeleteRestore< T >, RefMgr< T >, SimpleMod, SimpleMod2, SimpleWSMMod, SimpleWSMMod2, SimpleObject, SimpleObject2, SimpleWSMObject, SimpleWSMObject2, SimpleOSMToWSMObject, SimpleParticle, SimpleShape, SimpleSpline, SplineShape, MSCustAttrib, MSPluginSimpleObject, MSSimpleObjectXtnd, MSPluginSimpleManipulator, MSSimpleManipulatorXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, MSPluginTrackViewUtility, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
virtual CoreExport void SetReference | ( | int | i, |
RefTargetHandle | rtarg | ||
) | [protected, virtual] |
Stores a ReferenceTarget as its 'i-th' reference`.
The plugin implements this method to store the reference handle passed to it as its 'i-th' reference. In its implementation of this method, the plugin should simply assign the reference handle passed in as a parameter to the member variable that holds the 'i-th' reference. Other reference handling methods such as ReferenceMaker::DeleteReference(), or ReferenceMaker::ReplaceReference() should not be called from within this method. The plugin itself or other plugins should not call this method directly. The system will call this method when a new reference is created or an existing one is replaced by calling ReferenceMaker::ReplaceReference().
i | - The index of the reference to store. Valid values are from 0 to NumRefs()-1. |
rtarg | - The reference handle to store. |
Reimplemented in EaseCurveList, MultCurveList, Control, GizmoObject, CollisionPlane, CollisionSphere, CollisionMesh, MtlLib, MtlBaseLib, RefTargMonitorRefMaker, GizmoClass, SimpleManipulator, ShapeObject, PatchObject, SingleRefMaker, RefMgrAddDeleteRestore< T >, RefMgr< T >, SimpleMod, SimpleMod2, SimpleWSMMod, SimpleWSMMod2, SimpleObject, SimpleObject2, SimpleWSMObject, SimpleWSMObject2, SimpleOSMToWSMObject, SimpleParticle, SimpleShape, SimpleSpline, SplineShape, MSCustAttrib, MSPluginSimpleObject, MSSimpleObjectXtnd, MSPluginSimpleManipulator, MSSimpleManipulatorXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, MSPluginTrackViewUtility, PFSimpleAction, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
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.
Called for saving data.
Called by the system to allow the plugin to save its data.
isave | - This pointer may be used to call methods to write data to disk. See the section on Loading and Saving for an overview of the load/save process. |
Reimplemented in EaseCurveList, MultCurveList, Control, DummyObject, MtlBase, MtlLib, MtlBaseLib, IProjectionModType, RefTargMonitorRefMaker, GizmoClass, LinearShape, DefNoteTrack, ShapeObject, Modifier, PatchObject, PolyObject, RadiosityEffect, IRenderElement, Sampler, SpecialFX, Atmospheric, Effect, FilterKernel, BaseShader, SimpleShape, SimpleSpline, SplineShape, ToneOperator, TriObject, Wrangler, MSCustAttrib, MSPluginShape, MSShapeXtnd, MSPluginSimpleObject, MSPluginSimpleManipulator, MSPluginModifier, MSPluginSimpleMod, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, PFSimpleAction, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSPluginSpecialFX< Effect8 >, and MSPluginSpecialFX< Atmospheric >.
Called for loading data.
Called by the system to allow the plug-in to load its data. See the section on Loading and Saving for an overview of the load - save process.
iload | - This interface pointer may be used to call methods to read data from disk. |
Reimplemented in EaseCurveList, MultCurveList, Control, DummyObject, MtlBase, MtlLib, MtlBaseLib, IProjectionModType, RefTargMonitorRefMaker, GizmoClass, LinearShape, DefNoteTrack, ShapeObject, Modifier, PatchObject, PolyObject, RadiosityEffect, IRenderElement, Sampler, SpecialFX, Atmospheric, Effect, FilterKernel, BaseShader, SimpleOSMToWSMObject, SimpleShape, SimpleSpline, SplineShape, ToneOperator, TriObject, Wrangler, MSCustAttrib, MSPluginShape, MSShapeXtnd, MSPluginSimpleObject, MSPluginSimpleManipulator, MSPluginModifier, MSPluginSimpleMod, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, PFSimpleAction, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSPluginSpecialFX< Effect8 >, and MSPluginSpecialFX< Atmospheric >.
virtual int RemapRefOnLoad | ( | int | iref | ) | [inline, virtual] |
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.
iref | - The input index of the reference. |
Reimplemented in ShapeObject, PatchObject, SplineShape, and PFSimpleAction.
{ 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.
f | - The scale factor. |
Reimplemented in DummyObject, LinearShape, ShapeObject, PatchObject, PolyObject, SplineShape, TriObject, MSPluginShape, and MSShapeXtnd.
virtual CoreExport RefResult NotifyDependents | ( | Interval | changeInt, |
PartID | partID, | ||
RefMessage | message, | ||
SClass_ID | sclass =
NOTIFY_ALL , |
||
BOOL | propagate = TRUE , |
||
RefTargetHandle | hTarg = NULL |
||
) | [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.
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.
assetEnum | - The Callback object that gets called on all Auxiliary files. |
flags | - Flags. |
Reimplemented from Animatable.
Reimplemented in MtlBase, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, and MSMtlXtnd.
virtual CoreExport void SaveEnum | ( | SaveEnumProc & | sep, |
BOOL | isNodeCall =
0 |
||
) | [virtual] |
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); } } 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); } } return Texmap::SpecifySaveReferences(referenceSaveManager); }
referenceSaveManager | The ReferenceSaveManager for the object |
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.
dep | - The callback object called for each dependent. |
Reimplemented in ReferenceTarget.
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.
dep | - The callback object called for each dependent. |
Reimplemented in RefTargMonitorRefMaker, and ReferenceTarget.
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.
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. |
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.
rtarg | - The reference target to find the index of. |
virtual BOOL IsRefTarget | ( | ) | [inline, virtual] |
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.
Reimplemented in ReferenceTarget.
{ return FALSE; }
virtual BOOL IsRefMaker | ( | ) | [inline, virtual] |
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.
Reimplemented from Animatable.
{ return TRUE; }
virtual BOOL IsRealDependency | ( | ReferenceTarget * | rtarg | ) | [inline, virtual] |
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.
rtarg | - A pointer to the reference target. |
Reimplemented in RefTargMonitorRefMaker, and SingleWeakRefMaker.
{ UNUSED_PARAM(rtarg); return TRUE;}
virtual BOOL ShouldPersistWeakRef | ( | RefTargetHandle | rtarg | ) | [inline, virtual] |
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.
rtarg | - The weak reference. |
{ UNUSED_PARAM(rtarg); return FALSE; }
virtual CoreExport void* GetInterface | ( | ULONG | id | ) | [virtual] |
Returns a pointer to the interface.
id | - The ID of the interface |
Reimplemented from Animatable.
Reimplemented in EaseCurveList, MultCurveList, Control, LockableStdControl, LockableControl, MtlBase, IDerivedObject, BaseObject, Object, LightObject, ShapeObject, WSMObject, PatchObject, PodObj, ReferenceTarget, IRenderElement, MaxRenderElement, MaxBakeElement, MaxBakeElement8, MaxBakeElement10, Effect8, Shader, SimpleObject, SimpleParticle, SplineShape, TriObject, MSCustAttrib, MSPluginSimpleObject, MSSimpleObjectXtnd, MSPluginSimpleManipulator, MSSimpleManipulatorXtnd, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, MSSimpleModXtnd, MSPluginTexmap, MSTexmapXtnd, MSPluginMtl, MSMtlXtnd, MSPluginTrackViewUtility, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
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.
id | - The unique ID of the interface to get |
Reimplemented from Animatable.
Reimplemented in MtlBase, INode, SimpleManipulator, BaseObject, Object, LightObject, ShapeObject, ReferenceTarget, Effect8, Shader, SimpleObject, TriObject, MSMtlXtnd, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSObjectXtnd< GenCamera, MSPluginCamera >, MSObjectXtnd< HelperObject, MSPluginHelper >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, MSObjectXtnd< ShapeObject, MSPluginShape >, MSObjectXtnd< GenLight, MSPluginLight >, MSPluginSpecialFX< Effect8 >, MSPluginSpecialFX< Atmospheric >, MSSpecialFXXtnd< Effect, MSPluginEffect >, and MSSpecialFXXtnd< Atmospheric, MSPluginAtmos >.
void BlockEval | ( | ) | [inline, protected] |
void UnblockEval | ( | ) | [inline, protected] |
int Evaluating | ( | ) | [inline, protected] |
{ return TestAFlag(A_EVALUATING); }
CoreExport RefResult StdNotifyRefChanged | ( | Interval | changeInt, |
RefTargetHandle | hTarget, | ||
PartID | partID, | ||
RefMessage | message, | ||
BOOL | propagate =
TRUE |
||
) | [protected] |
virtual RefResult NotifyRefChanged | ( | Interval | changeInt, |
RefTargetHandle | hTarget, | ||
PartID & | partID, | ||
RefMessage | message | ||
) | [protected, pure 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.
changeInt | - This is the interval of time over which the message is active. Currently, all plug-ins will receive FOREVER for this interval. |
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. |
Implemented in EaseCurveList, MultCurveList, GizmoObject, CollisionPlane, CollisionSphere, CollisionMesh, MtlLib, MtlBaseLib, DADBitmapCarrier, INodeTransformed, IProjectionModType, RefTargMonitorRefMaker, GizmoClass, LinearShape, SimpleManipulator, MCDeviceBinding, DefNoteTrack, IMultiPassCameraEffect, ShapeObject, PatchObject, SingleRefMakerPatchNode, SingleRefMakerPatchMtl, PolyObject, RadiosityEffect, SingleRefMaker, RefMgrAddDeleteRestore< T >, RefMgr< T >, IRenderElement, Sampler, Atmospheric, Effect, FilterKernel, BaseShader, SimpleMod, SimpleWSMMod, SimpleObject, SimpleWSMObject, SimpleParticle, SimpleShape, SimpleSpline, SingleWeakRefMaker, SplineShape, SingleRefMakerSplineNode, SingleRefMakerSplineMtl, ToneOperator, TriObject, MSCustAttrib, MSPluginSimpleObject, MSPluginSimpleManipulator, MSPluginModifier, MSPluginSimpleMod, MSPluginTexmap, MSPluginMtl, MSPluginTrackViewUtility, PFSimpleAction, MSPluginObject< ShapeObject >, MSPluginObject< HelperObject >, MSPluginObject< GeomObject >, MSPluginObject< GenCamera >, MSPluginObject< GenLight >, MSPluginSpecialFX< Effect8 >, and MSPluginSpecialFX< Atmospheric >.
friend class DeleteRefRestore
[friend] |
Reimplemented in ReferenceTarget.
friend class MakeRefRestore
[friend] |
Reimplemented in ReferenceTarget.
friend class ReferenceTarget
[friend] |
friend class ParamBlock
[friend] |
friend class RootNode
[friend] |
friend class BaseNode
[friend] |
friend class ILoadImp
[friend] |
Reimplemented from Animatable.
friend class RefMakerPLC
[friend] |
friend class RefList [friend] |
friend class LayerManagerRestore
[friend] |
friend class RepMtlRest
[friend] |
friend class MAXMaterialLibrary
[friend] |