3ds Max C++ API Reference
Loading...
Searching...
No Matches
BaseBehavior Class Reference

All behaviors must inherit from this base class. More...

#include <bhvr.h>

+ Inheritance diagram for BaseBehavior:

Public Types

enum  BEHAVIOR_TYPE { FORCE = 0 , CONSTRAINT , ORIENTATION }
 

Public Member Functions

 BaseBehavior ()
 
Identification Functions

These functions are used to uniquely define the behavior and to describe its type.

SClass_ID SuperClassID ()
 Returns the super class id of the behavior.
 
virtual void SetName (const MCHAR *newname)
 Sets the name of the behavior.

 
virtual const MCHARGetName ()
 Gets the name of the behavior.

 
virtual BEHAVIOR_TYPE BehaviorType ()
 Returns the behavior's type, either FORCE, CONSTRAINT, or ORIENTATION.
 
virtual BOOL IsWeightable ()
 Queries whether or not the behavior may be modified by the behavior weight scalar.
 
virtual int CanConvertToMaxScript ()
 Queries whether or not the behavior can convert itself to a script.
 
Initialization Functions

These functions allow a behavior to initialize itself at different times during a simulation.

They also allow a behavior to keep track of data associated with delegates assigned to it during a simulation.

virtual void SetUpDelegates (INodeTab &participants)
 Sends the behavior a list of all delegates which will participate in the simulation.
 
virtual void BehaviorStarted (TimeValue t, INode *node)
 Notifies the behavior that it should start to act upon a particular delegate.
 
virtual void InitAtThisTime (TimeValue t)
 Initializes a behavior at the start of each simulation frame.
 
virtual void InitBeforeSim (int FirstFrame, INode *n, int SimStart, int AssignIndex)
 Initializes the behavior at the start of a simulation.
 
Performance Functions

These functions are called for each delegate assigned to a behavior, each frame during a simulation.

Depending on the value returned from the BehaviorType function, only one of the following three functions must be implemented.

virtual int Perform (INode *node, TimeValue t, int numsubsamples, BOOL DisplayHelpers, float BhvrWeight, PerformOut &out)
 This is the main function for FORCE behaviors.
 
virtual int Constraint (INode *node, TimeValue t, int numsubsamples, BOOL DesGoalExists, BOOL DisplayHelpers, BOOL finalSet, ConstraintInOut &inOut)
 This is the main function for CONSTRAINT behaviors.

 
virtual int Orient (const Point3 &vel, INode *node, TimeValue t, Quat &quat)
 This is the main function for ORIENTATION behaviors.

 
Display Functions

These functions provide an option to display an apparatus along with the behavior at all times - not just during solve.

The behavior can offer an option in its user interface to turn this on and off. Keep in mind this apparatus will be displayed as part of the crowd object, and so may enlarge the damaged rectangle significantly.

virtual int Display (TimeValue t, ViewExp *vpt)
 Using this function, a behavior can display text or graphics inside the viewports.
 
virtual void GetWorldBoundBox (TimeValue t, ViewExp *vpt, Box3 &box)
 Gets the world bounding box of what the behavior draws.
 
- Public Member Functions inherited from ReferenceTarget
CoreExport void GetClassName (MSTR &s, bool localized=true) const override
 Retrieves the name of the plugin class.
 
CoreExport SClass_ID SuperClassID () override
 Retrieves a constant representing the type of the plugin.
 
BOOL IsRefTarget () override
 Checks if this is a ReferenceTarget.
 
CoreExport RefResult TestForLoop (const Interval &refInterval, RefMakerHandle hmaker)
 Tests for a cyclical reference.
 
CoreExport BOOL HasDependents ()
 Checks if a ReferenceTarget has references.
 
CoreExport BOOL HasRealDependents ()
 Checks if this has Real (Strong) Dependents.
 
void BeginDependencyTest ()
 Starts Dependency Test.
 
BOOL EndDependencyTest ()
 Ends Dependency Test.
 
virtual void RefAdded (RefMakerHandle rm)
 Called after a reference is made to a target.
 
virtual void RefAddedUndoRedo (RefMakerHandle rm)
 Called after a reference is made to a target because of undo or redo.
 
 __declspec (deprecated) virtual void RefDeleted() final
 
virtual void RefDeleted (ReferenceMaker *oldOwner)
 Called after a reference to this is deleted.
 
 __declspec (deprecated) virtual void RefDeletedUndoRedo() final
 
virtual void RefDeletedUndoRedo (RefMakerHandle oldOwner)
 Called after a reference to this is deleted because of undo or redo.
 
CoreExport RefResult DeleteAllRefsToMe () override
 Deletes all references to this ReferenceTarget.
 
CoreExport RefResult TransferReferences (RefTargetHandle oldTarget, BOOL delOld=FALSE)
 Transfers all the references from oldTarget to this.
 
CoreExport int DoEnumDependents (DependentEnumProc *dep)
 Begins an enumeration that searches back in the dependency network.
 
virtual CoreExport RefTargetHandle Clone (RemapDir &remap)
 This method is used by 3ds Max to clone an object.
 
virtual CoreExport void BaseClone (ReferenceTarget *from, ReferenceTarget *to, RemapDir &remap)
 This method copies base class data from an object to its clone.
 
CoreExport RefResult NotifyDependents (const Interval &changeInt, PartID partID, RefMessage message, SClass_ID sclass=NOTIFY_ALL, BOOL propagate=TRUE, RefTargetHandle hTarg=nullptr, NotifyDependentsOption notifyDependentsOption=REFNOTIFY_ALLOW_OPTIMIZATIONS) override
 Notify all dependent RefMakers concerned with the message.
 
void FlagDependents (TimeValue t, PartID which=PART_PUT_IN_FG)
 This sends the REFMSG_FLAGDEPENDENTS message up the pipeline.
 
virtual void NotifyForeground (TimeValue t)
 This method is called to flag dependents into the FG.
 
virtual void NotifyTarget (int message, ReferenceMaker *hMaker)
 Sends messages to ReferenceTargets.
 
CoreExport voidGetInterface (ULONG id) override
 Inherited from Animatable.
 
CoreExport BaseInterfaceGetInterface (Interface_ID id) override
 Inherited from Animatable.
 
CoreExport ReferenceTarget ()
 Constructor.
 
virtual CoreExport RefResult AutoDelete ()
 Deletes the object when it has no more real dependents.
 
CoreExport RefResult MaybeAutoDelete ()
 Deletes the object when it has no more real dependents.
 
- Public Member Functions inherited from ReferenceMaker
void GetClassName (MSTR &s, bool localized=true) const override
 Retrieves the name of the plugin class.
 
CoreExport SClass_ID SuperClassID () override
 Retrieves a constant representing the type of the plugin.
 
CoreExport RefResult ReplaceReference (int which, RefTargetHandle newtarg, BOOL delOld=TRUE)
 Used when cloning reference makers.
 
CoreExport RefResult DeleteAllRefsFromMe ()
 Deletes all references from this ReferenceMaker.
 
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.
 
CoreExport ReferenceSaveManagerGetReferenceSaveManager ()
 Access the ReferenceSaveManager of this ReferenceMaker.
 
virtual CoreExport IOResult Save (ISave *isave)
 Called for saving data.
 
virtual CoreExport IOResult Save (ISave *isave, ChannelMask)
 Access the ReferenceSaveManager of this ReferenceMaker.
 
virtual CoreExport IOResult Load (ILoad *iload)
 Called for loading data.
 
virtual CoreExport IOResult Load (ILoad *iload, ChannelMask)
 Access the ReferenceSaveManager of this ReferenceMaker.
 
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.
 
CoreExport void EnumAuxFiles (AssetEnumCallback &assetEnum, DWORD flags) override
 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.
 
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.
 
CoreExport int FindRef (RefTargetHandle rtarg)
 Get the index of the ReferenceTarget.
 
BOOL IsRefMaker () override
 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.
 
CoreExport ReferenceMaker ()
 Constructor.
 
CoreExport void DeleteMe ()
 Deletes an instance of this class.
 
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.
 
- 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
 
virtual BOOL SetKeyBufferPresent ()
 returns true if there is a "Set Key" buffer present
 
virtual CoreExport void SubAnimCommitSetKeyBuffer (TimeValue t, int subNum)
 Commit any "Set Key" buffers on the given sub-anim.
 
virtual void CommitSetKeyBuffer (TimeValue t)
 Commit any "Set Key" buffers.
 
virtual CoreExport void SubAnimRevertSetKeyBuffer (int subNum)
 Revert any "Set Key" buffers on the given sub-anim.
 
virtual void RevertSetKeyBuffer ()
 Revert any "Set Key" buffers.
 
virtual LRESULT CALLBACK TrackViewWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 This function is obsolete.
 
virtual BOOL IsRefMaker ()
 Tells whether it is a ReferenceMaker.
 
virtual bool IsParamBlockDesc2Used (ParamBlockDesc2 *desc)
 Returns true if the passed description is being used.
 
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.
 
CoreExport Animatable ()
 Constructor.
 
virtual CoreExport void DeleteThis ()
 Deletes an instance of this class.
 
MSTR ClassName (bool localized=true) const
 Returns the name of the plugin class.
 
virtual CoreExport Class_ID ClassID ()
 Retrieves a constant that uniquely identifies the plugin class.
 
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.
 
CoreExport AnimPropertyFindProperty (DWORD id)
 Find any property.
 
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.
 
CoreExport AppDataChunkGetAppDataChunk (const Class_ID &cid, SClass_ID sid, DWORD sbid)
 Retrieves the application/plugin specific (custom) data stored with an Animatable.
 
CoreExport BOOL RemoveAppDataChunk (const Class_ID &cid, SClass_ID sid, DWORD sbid)
 Deletes the application/plugin specific (custom) data stored with an Animatable.
 
CoreExport void ClearAllAppData ()
 Deletes all application/plugin specific (custom) data stored with an Animatable.
 
virtual int NumSubs ()
 
virtual AnimatableSubAnim (int i)
 
 __declspec (deprecated) virtual MSTR SubAnimName(int i) MAX_SEALED
 
virtual CoreExport MSTR SubAnimName (int i, bool localized)
 
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.
 
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.
 
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.
 
virtual BOOL IsSubCurveSelected (int subNum)
 Returns the selected state of the sub-curve whose index is passed.
 
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.
 
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
 
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...
 
virtual CoreExport bool SvIsSelected (IGraphObjectManager *gom, IGraphNode *gNode)
 Returns true if the object is selected in its schematic view.
 
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"...
 
virtual CoreExport bool SvCanDetachRel (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Returns true if this object can respond to the SvDetachRel(...) method...
 
virtual CoreExport bool SvDetachRel (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Detach this relationship.
 
virtual CoreExport bool SvHandleRelDoubleClick (IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
 Called when this relationship is double-clicked in the schematic view...
 
CoreExport ICustAttribContainerGetCustAttribContainer ()
 This method returns a pointer to the custom attributes container interface class.
 
CoreExport void AllocCustAttribContainer ()
 This method allocates space for a custom attributes container.
 
CoreExport void DeleteCustAttribContainer ()
 This method deletes space used by a custom attributes container.
 
void SetAFlag (DWORD mask)
 
void ClearAFlag (DWORD mask)
 Clears one or more bits in the Animatable flags.
 
bool TestAFlag (DWORD mask) const
 Tests one or more bits in the Animatable flags.
 
void SetAFlagEx (DWORD mask)
 Sets one or more bits in the Animatable extended flags.
 
void ClearAFlagEx (DWORD mask)
 Clears one or more bits in the Animatable extended flags.
 
bool TestAFlagEx (DWORD mask) const
 Tests one or more bits in the Animatable extended flags.
 
CoreExport bool TestFlagBit (int index)
 Tests the specified flag bit.
 
CoreExport void SetFlagBit (int index, bool newValue=true)
 Sets the specified flag bit.
 
CoreExport void ClearFlagBit (int index)
 Clears the specified flag bit.
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

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.
 
static CoreExport AnimHandle GetHandleByAnim (Animatable *anim)
 Get the unique handle for an Animatable object.
 
static CoreExport AnimatableGetAnimByHandle (AnimHandle handle)
 Get an Animatable object from its unique handle.
 
static CoreExport AnimHandle GetNextHandle ()
 Get the unique handle for the next Animatable object to be created.
 
static CoreExport void EnumerateAllAnimatables (EnumAnimList &enumProcObject)
 Enumerator to enumerate across all animatables.
 
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.
 
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.
 
static CoreExport bool RegisterAppDataLoadCallback (DWORD sbid, APPDATALOADPROC proc)
 Registers a callback proc that is called when an AppDataChunk is read from a scene file.
 
static CoreExport bool UnRegisterAppDataLoadCallback (DWORD sbid, APPDATALOADPROC proc)
 Unregisters a callback proc that is called when an AppDataChunk is read from a scene file.
 
static CoreExport void ClearAFlagInAllAnimatables (DWORD mask)
 Clears one or more bits in the Animatable flags in all Animatables.
 
static CoreExport void ClearAFlagExInAllAnimatables (DWORD mask)
 Clears one or more bits in the Animatable extended flags in all Animatables.
 
static CoreExport int RequestFlagBit ()
 Requests an unique flag bit index.
 
static CoreExport void ReleaseFlagBit (int index)
 Releases the flag bit index.
 
static CoreExport void ClearFlagBitInAllAnimatables (int index)
 Clears the specified flag bit in all Animatables.
 
- 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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 
- Static Public Attributes inherited from Animatable
static const AnimHandle kInvalidAnimHandle = 0
 
- Protected Member Functions inherited from ReferenceTarget
CoreExport int DoEnumDependentsImpl (DependentEnumProc *dep) override
 Method to perform an enumeration on a ReferenceTarget.
 
virtual CoreExport ~ReferenceTarget ()=0
 Destructor.
 
- Protected Member Functions inherited from ReferenceMaker
virtual CoreExport ~ReferenceMaker ()=0
 Destructor.
 
virtual CoreExport void SetReference (int i, RefTargetHandle rtarg)
 Stores a ReferenceTarget as its 'i-th' reference`.
 
void BlockEval ()
 Validates a given reference link between this reference maker and its reference target.
 
void UnblockEval ()
 Validates a given reference link between this reference maker and its reference target.
 
int Evaluating ()
 Validates a given reference link between this reference maker and its reference target.
 
CoreExport RefResult StdNotifyRefChanged (const Interval &changeInt, RefTargetHandle hTarget, PartID partID, RefMessage message, BOOL propagate, NotifyDependentsOption notifyDependentsOption)
 Validates a given reference link between this reference maker and its reference target.
 
- Protected Member Functions inherited from Animatable
virtual CoreExport ~Animatable ()=0
 Destructor.
 
- Protected Member Functions inherited from Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 
- Protected Attributes inherited from Animatable
DWORD aflag
 
AnimPropertyList aprops
 

Detailed Description

All behaviors must inherit from this base class.

Member Enumeration Documentation

◆ BEHAVIOR_TYPE

Enumerator
FORCE 
CONSTRAINT 
ORIENTATION 
60 {
61 FORCE = 0,
64 };
@ FORCE
Definition: bhvr.h:61
@ ORIENTATION
Definition: bhvr.h:63
@ CONSTRAINT
Definition: bhvr.h:62

Constructor & Destructor Documentation

◆ BaseBehavior()

BaseBehavior ( )
inline
66{}

Member Function Documentation

◆ SuperClassID()

SClass_ID SuperClassID ( )
inlinevirtual

Returns the super class id of the behavior.

The default implementation should be used, to make certain that the new behavior class is recognized by the Crowd system and appears in the list of available behaviors inside Crowd. Use ClassID to define your own class id specific to your behavior.

Returns
the behavior super class ID

Implements Animatable.

#define BEHAVIOR_SUPER_CLASS_ID
This is the super class id of all behaviors.
Definition: bhvr.h:25

◆ SetName()

virtual void SetName ( const MCHAR newname)
inlinevirtual

Sets the name of the behavior.

When the user changes the name of the behavior from the Crowd interface, this function is called. It should store the name in the behavior.

Parameters
[in]newname- the new name of the behavior.
87{}

◆ GetName()

virtual const MCHAR * GetName ( )
inlinevirtual

Gets the name of the behavior.

Usually this name will be stored internally within a paramblock. The name usually starts out being the same as the behavior's class name. The name can then be changed from within the Crowd system, which sets it by calling this function.

Returns
the behavior name
95{return NULL;}
#define NULL
Definition: autoptr.h:18

◆ BehaviorType()

virtual BEHAVIOR_TYPE BehaviorType ( )
inlinevirtual

Returns the behavior's type, either FORCE, CONSTRAINT, or ORIENTATION.

  • Force: Behaviors of this type force the delegates to move in a particular direction. Examples of force behaviors are Seek and Repel. Force behaviors work by returning a force vector in the direction that the behavior wants the delegate to go in, and in some cases the speed it should be traveling and the goal it is trying to reach.
  • Constraint: Behaviors of this type restrict the position and velocity of a delegate. An example of a constraint behavior is SurfaceFollow. Constraint behaviors set the velocity and sometimes may even change the delegate's position, in order to meet the constraint. The user can have only one active constraint behavior per delegate per frame.
  • Orientation: Behaviors of this type affect only the orientation of the delegates. An example of an orientation behavior is Orientation. These behaviors don't work with forces but instead return an orientation that the delegate should be at, represented by a quaternion. Any active orientation behavior will override the default orientation of the delegate. The velocity determines the default orientation. Like a constraint behavior, the user can have only one active orientation behavior per delegate per frame.
    Returns
    one of three possible values: force, constraint, or orientation
116{return FORCE;}

◆ IsWeightable()

virtual BOOL IsWeightable ( )
inlinevirtual

Queries whether or not the behavior may be modified by the behavior weight scalar.

For the user, this weight appears in the assignment dialog for each assignment.
Usually FORCE types are weightable, while CONSTRAINT and ORIENTATION behaviors aren't.

Returns
1 if the behavior is weightable, 0 if not.
124 {if (BehaviorType() == BaseBehavior::CONSTRAINT) return FALSE;
125 if (BehaviorType() == BaseBehavior::ORIENTATION) return FALSE;
126 return TRUE;}
virtual BEHAVIOR_TYPE BehaviorType()
Returns the behavior's type, either FORCE, CONSTRAINT, or ORIENTATION.
Definition: bhvr.h:116

◆ CanConvertToMaxScript()

virtual int CanConvertToMaxScript ( )
inlinevirtual

Queries whether or not the behavior can convert itself to a script.

This function is for future versions of Crowd. It is not used now.

Returns
true if the behavior can convert itself to maxScript, false if not
132{return FALSE;}

◆ SetUpDelegates()

virtual void SetUpDelegates ( INodeTab participants)
inlinevirtual

Sends the behavior a list of all delegates which will participate in the simulation.

At the beginning of a simulation, this function is called for each behavior in the simulation.
All active delegates assigned via an active assignment to any behavior or cognitive controller in the crowd system are included in the participants INodeTab.
So this function tells the behavior the maximum number of delegates that could possibly perform this behavior during the simulation, and which delegates those are.
With this information, the behavior can set up whatever data structures it requires to keep track of parameters on a per delegate basis. At the end of the simulation, this function is again called for each behavior, this time with an empty participants list, in order to allow the behavior to clear its data structures.

Parameters
[in]participants- a tab of all of the delegates in the simulation.
The delegates must be active, and they must be assigned, via an active assignment, to at least one behavior or cognitive controller.
154{}; //called at beginning of simulation.

◆ BehaviorStarted()

virtual void BehaviorStarted ( TimeValue  t,
INode node 
)
inlinevirtual

Notifies the behavior that it should start to act upon a particular delegate.

This function is called during a simulation, whenever a cognitive controller activates the behavior for a particular delegate. It allows a behavior to keep track of which delegates it is acting upon.

Parameters
[in]t- the current simulation time.
[in]node- the delegate which started the behavior
163{};

◆ InitAtThisTime()

virtual void InitAtThisTime ( TimeValue  t)
inlinevirtual

Initializes a behavior at the start of each simulation frame.

This function is called at the beginning of each frame of the simulation.
It allows the behavior to set up or clear out any information that it might need each frame.

Parameters
[in]t- the current simulation time
171{}

◆ InitBeforeSim()

virtual void InitBeforeSim ( int  FirstFrame,
INode n,
int  SimStart,
int  AssignIndex 
)
inlinevirtual

Initializes the behavior at the start of a simulation.

This function is called once just before the beginning of the simulation.
It is called so that the behavior knows which frame the simulation is actually starting at so it can perform any actions necessary to assure its repeatability. For example, if a behavior knows that the simulation is starting at frame 10 instead of frame 0, it may run it's random number generator 10 times so that the value it generates will be consistent with what it normally computes when the simulation starts from the beginning, as specified by the SimStart parameter.

Parameters
[in]FirstFrame- the value of the first frame for this particular run of the simulation. This is the same as Start Solve in the crowd solve rollout.
It is not in time ticks, but in frames.
[in]n- the delegate
[in]SimStart- the value of the frame when the simulation starts This is the same as Simulation Start in the crowd solve rollout.
It is not in time ticks, but in frames.
[in]AssignIndex- the index of the assignment used to apply this behavior to the delegate. If this equals -1, the behavior has been assigned using a cognitive controller.
The AssignIndex can be used as a parameter to the IDelegate class's IsAssignmentActive function, which allows you to find out if this assignment is active at a given time.
You may need this information to properly initialize a behavior before a simulation.
195{}

◆ Perform()

virtual int Perform ( INode node,
TimeValue  t,
int  numsubsamples,
BOOL  DisplayHelpers,
float  BhvrWeight,
PerformOut out 
)
inlinevirtual

This is the main function for FORCE behaviors.

It is called every frame for each delegate the behavior is acting upon.
It is within this function that the behavior may set any combination of the following: the force acting upon the delegate, the delegate's speed, or a goal towards which the delegate should move.

Parameters
[in]node- the delegate
[in]t- the current simulation time
[in]numsubsamples- how many subsamples are being computed per frame. Currently not used.
[in]DisplayHelpers- whether or not the behavior should display it's visual information. This parameter exists so that the Crowd system has global control over when the behavior information is displayed.
[in]BhvrWeight- A float value, greater than or equal to 0.0, that corresponds to the BehaviorWeight value in the Crowd Assignment dialog. This value should be used to scale the returned force value in the out parameter.
[out]out- A PerformOut structure that is used to pass out information that the behavior calculates.
The structure has 4 items that may be set, depending upon whether the behavior sets a force, a speed or a goal.
  • frc: If the behavior sets a force, the frc value should be filled with a vector normalized to the average speed of the delegate it is acting upon. Usually this normalized vector will be scaled also by the BhvrWeight parameter.
  • goal: If the behavior sets a goal, then the goal item should be set with the world space goal that the delegate is trying to reach. It is important to note that in order for the behavior to work with Biped crowds, it needs to set a goal. Even if the behavior doesn't appear to have a clear-cut goal, a goal may still be set for it by placing the goal along the force vector at some reasonable distance. The delegate's average speed works well.
  • speedwt: If the behavior sets a speed, then the speedwt should be set to the behavior's desired speed for the delegate at the current simulation time.
    The speedwt will be multipled by the delegate's average speed. (so a value of 1.0 is equal to the delegate's average speed).
  • speedAtGoalwt: The speedAtGoalWt is only used by delegates associated with bipeds.
    If the speedAtGoalWt equals 1.0, the biped will attempt to maintain its current speed.
    If it is 0.0, the biped will attempt to stop. If it is < 0, the biped will try to slow down.
    If it is > 1, the biped will try to speed up.
    Note that the behavior doesn't need to be setting a goal in order to set the speedAtGoalwt. This is how the SpeedVary function works. The instantaneous speed is the speed at the current time, while the speedAtGoalwt is the speed that it wants to reach at some time in the future.
Returns
0 if the behavior isn't active for this particular delegate, or if the behavior, for any reason, wishes to have no effect on the delegate at this time. Otherwise, it returns the union of three #defines, BHVR_SETS_FORCE, BHVR_SETS_GOAL, and BHVR_SETS_SPEED, depending upon whether or not the behavior sets a force, a goal or the speed. For example, a behavior that sets both a force and goal will return BHVR_SETS_FORCE | BHVR_SETS_GOAL.
Which of these values are returned determines which items in the PeformOut structure are valid.
248 {return FALSE;}

◆ Constraint()

virtual int Constraint ( INode node,
TimeValue  t,
int  numsubsamples,
BOOL  DesGoalExists,
BOOL  DisplayHelpers,
BOOL  finalSet,
ConstraintInOut inOut 
)
inlinevirtual

This is the main function for CONSTRAINT behaviors.

It is called multiple times per frame for each delegate the behavior is acting upon.
It is within this function that the behavior may set a modified velocity or modified position for a delegate.

Parameters
[in]node- the delegate
[in]t- the current simulation time
[in]numsubsamples- how many subsamples are being computed per frame. Currently not used.
[in]DesGoalExists- whether or not a goal currently exists for this delegate.
If it exists, it will be passed in via the inOut parameter.
[in]DisplayHelpers- whether or not the behavior should display it's visual information. This parameter exists so that the Crowd system has global control over when the behavior information is displayed.
[in]finalSet- whether or not this is the final time that the constraint will be called during the frame. Currently, each constraint behavior is called two times per frame (this may change in the future) - once after all of the forces have been assembled and just before a possible avoid behavior, and then once again at the end of the frame. It is called multiple times per frame so that the behavior may work correctly with any active avoid behavior. This flag lets the behavior know if it is the last time it will be called during that frame and thus should cache any information that it needs for the next frame calculation. Usually if the behavior isn't doing any sort of per frame caching it should just ignore this flag.
[in,out]&inOut- a ConstraintInOut structure that is used to pass in information that the behavior will modify and then pass out. The structure contains 4 parameters:
  • vel: the newly calculated velocity of the delegate
  • pos: the current position of the delegate
  • speed: the current speed of the delegate
  • desGoal: the current desired goal of the delegate
    The behavior may change one or all of these parameters. Note that the next position that the delegate will be at is nextPos = pos + normalized(vel)*Speed. So changing the current position doesn't actually change where it is, but it just changes the position that is used to calculate it's new position. Usually the behavior will change the velocity parameter, and it will only change the pos parameter if it needs to so that the Speed, and thus the energy of the delegate, doesn't change. Note that the velocity that you return should be normalized.
Returns
0 if the behavior isn't active for this particular delegate, or if the behavior, for any reason, wishes to have no effect on the delegate at this time. Otherwise, it returns 1.
293 {return FALSE;}

◆ Orient()

virtual int Orient ( const Point3 vel,
INode node,
TimeValue  t,
Quat quat 
)
inlinevirtual

This is the main function for ORIENTATION behaviors.

It is called every frame for each delegate the behavior is acting upon.
It is within this function that the behavior may set a quaternion representing the delegate's orientation.

Parameters
[in]vel- the current velocity of the delegate
[in]node- the delegate
[in]t- the current simulation time
[out]quat- The quaternion specifying the new orientation of the delegate
Returns
0 if the behavior isn't active for this particular delegate, or if the behavior, for any reason, wishes to have no effect on the delegate at this time. Otherwise, it returns 1.
306{return FALSE;}

◆ Display()

virtual int Display ( TimeValue  t,
ViewExp vpt 
)
inlinevirtual

Using this function, a behavior can display text or graphics inside the viewports.

This is typically used to display a bounding area or a target. Often the behavior will allow the user to turn on or off this display by providing a checkbox in its interface.

Parameters
[in]t- the time to display the object.
[in]vpt- an interface pointer that may be used to call functions associated with the viewports
Returns
1 if something is drawn, otherwise 0.
322{return 0;}

◆ GetWorldBoundBox()

virtual void GetWorldBoundBox ( TimeValue  t,
ViewExp vpt,
Box3 box 
)
inlinevirtual

Gets the world bounding box of what the behavior draws.

Parameters
[in]t- the time at which to compute the bounding box
[in]vpt- an interface pointer that may be used to call functions associated with the viewports
[out]box- the bounding box
328{}