Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
BehaviorComponent Class Reference

#include <behaviorComponent.h>

+ Inheritance diagram for BehaviorComponent:

Classes

struct  BehaviorPortConnection
 A behavior port connection. More...
 

Public Types

typedef Vector
< BehaviorPortConnection
typePortConnectionVector
 
typedef HashMap
< StringTableEntry,
typePortConnectionVector * > 
typeOutputNameConnectionHash
 
typedef HashMap< SimObjectId,
typeOutputNameConnectionHash * > 
typeInstanceConnectionHash
 

Public Member Functions

 BehaviorComponent ()
 
virtual ~BehaviorComponent ()
 
virtual bool onAdd ()
 SimObject overrides. More...
 
virtual void onRemove ()
 Called when the object is removed from the sim. More...
 
virtual void onDeleteNotify (SimObject *object)
 
virtual void copyTo (SimObject *object)
 
BehaviorInstancegetBehaviorByInstanceId (const U32 behaviorId)
 Behavior interface. More...
 
virtual bool addBehavior (BehaviorInstance *bi)
 
virtual bool removeBehavior (BehaviorInstance *bi, bool deleteBehavior=true)
 
virtual void clearBehaviors ()
 
virtual U32 getBehaviorCount () const
 
virtual const SimSetgetBehaviors () const
 
virtual BehaviorInstancegetBehavior (StringTableEntry behaviorTemplateName)
 
virtual BehaviorInstancegetBehavior (const U32 index)
 
virtual bool reOrder (BehaviorInstance *obj, U32 desiredIndex)
 
bool connect (BehaviorInstance *pOutputBehavior, BehaviorInstance *pInputBehavior, StringTableEntry pOutputName, StringTableEntry pInputName)
 Behavior connectivity. More...
 
bool disconnect (BehaviorInstance *pOutputBehavior, BehaviorInstance *pInputBehavior, StringTableEntry pOutputName, StringTableEntry pInputName)
 
bool raise (BehaviorInstance *pOutputBehavior, StringTableEntry pOutputName)
 
U32 getBehaviorConnectionCount (BehaviorInstance *pOutputBehavior, StringTableEntry pOutputName)
 
const BehaviorPortConnectiongetBehaviorConnection (BehaviorInstance *pOutputBehavior, StringTableEntry pOutputName, const U32 connectionIndex)
 
const typePortConnectionVectorgetBehaviorConnections (BehaviorInstance *pOutputBehavior, StringTableEntry pOutputName)
 
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 DynamicConsoleMethodComponent Overrides. More...
 
virtual const char * callOnBehaviors (U32 argc, const char *argv[])
 
virtual void write (Stream &stream, U32 tabStop, U32 flags=0)
 SimComponent overrides. More...
 
 DECLARE_CONOBJECT (BehaviorComponent)
 
- Public Member Functions inherited from DynamicConsoleMethodComponent
const char * callMethod (S32 argc, const char *methodName,...)
 Call Method format string. More...
 
virtual const char * callMethodArgList (U32 argc, const char *argv[], bool callThis=true)
 Call Method. More...
 
 DECLARE_CONOBJECT (DynamicConsoleMethodComponent)
 
- Public Member Functions inherited from SimComponent
 DECLARE_CONOBJECT (SimComponent)
 
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3)) More...
 
bool hasComponents () const
 Will return true if this object contains components. More...
 
const SimComponentgetOwner () const
 The component which owns this object. More...
 
virtual StringTableEntry getComponentName ()
 
virtual bool addComponent (SimComponent *component)
 Add Component to this one. More...
 
virtual bool removeComponent (SimComponent *component)
 Remove Component from this one. More...
 
virtual bool clearComponents ()
 Clear Child components of this one. More...
 
virtual bool onComponentAdd (SimComponent *target)
 
virtual void onComponentRemove (SimComponent *target)
 
U32 getComponentCount ()
 
SimComponentgetComponent (const U32 index)
 
virtual void setEnabled (const bool enabled)
 
bool isEnabled () const
 
virtual bool writeField (StringTableEntry fieldname, const char *value)
 
virtual void onUpdate (void)
 
virtual void onAddToScene (void)
 
virtual void onRemoveFromScene (void)
 
bool callMethodOnComponents (U32 argc, const char *argv[], const char **result)
 
- Public Member Functions inherited from SimObject
StringTableEntry getClassNamespace () const
 
StringTableEntry getSuperClassNamespace () const
 
void setClassNamespace (const char *classNamespace)
 
void setSuperClassNamespace (const char *superClassNamespace)
 
void pushScriptCallbackGuard (void)
 
void popScriptCallbackGuard (void)
 
S32 getScriptCallbackGuard (void)
 
virtual SimObjectfindObject (const char *name)
 
NamespacegetNamespace ()
 Return the object's namespace. More...
 
const char * tabComplete (const char *prevText, S32 baseLen, bool)
 
virtual void dump ()
 
virtual void dumpClassHierarchy ()
 
SimObjectclone (const bool copyDynamicFields)
 
template<typename T >
bool isType (void)
 
 DECLARE_CONOBJECT (SimObject)
 
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list. More...
 
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted. More...
 
void clearNotify (SimObject *obj)
 Notify an object when we are cleared. More...
 
void clearAllNotifications ()
 Remove all notifications for this object. More...
 
void processDeleteNotifies ()
 Send out deletion notifications. More...
 
void registerReference (SimObject **obj)
 
void unregisterReference (SimObject **obj)
 
const char * getDataField (StringTableEntry slotName, const char *array)
 
void setDataField (StringTableEntry slotName, const char *array, const char *value)
 
const char * getPrefixedDataField (StringTableEntry fieldName, const char *array)
 
void setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
 
const char * getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
 
void setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
 
StringTableEntry getDataFieldPrefix (StringTableEntry fieldName)
 
U32 getDataFieldType (StringTableEntry slotName, const char *array)
 
SimFieldDictionarygetFieldDictionary ()
 
void clearDynamicFields (void)
 Clear all dynamic fields. More...
 
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true. More...
 
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true. More...
 
void setInternalName (const char *newname)
 
StringTableEntry getInternalName ()
 Get the internal of of this control. More...
 
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File. More...
 
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace. More...
 
SimObjectId getId (void) const
 
StringTableEntry getIdString (void) const
 
U32 getType () const
 
const StringTableEntry getName (void) const
 
void setId (SimObjectId id)
 
void assignName (const char *name)
 
SimGroupgetGroup () const
 
bool isChildOfGroup (SimGroup *pGroup)
 
bool isProperlyAdded () const
 
bool isDeleted () const
 
bool isRemoved () const
 
bool isLocked ()
 
void setLocked (bool b)
 
bool isHidden ()
 
void setHidden (bool b)
 
void setProgenitorFile (const char *pFile)
 
StringTableEntry getProgenitorFile (void) const
 
void setPeriodicTimerID (const S32 timerID)
 
S32 getPeriodicTimerID (void) const
 
bool isPeriodicTimerActive (void) const
 
bool isSelected () const
 
bool isExpanded () const
 
void setSelected (bool sel)
 
void setExpanded (bool exp)
 
void setModDynamicFields (bool dyn)
 
void setModStaticFields (bool sta)
 
 SimObject (const U8 namespaceLinkMask=LinkSuperClassName|LinkClassName)
 
virtual ~SimObject ()
 
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup. More...
 
virtual void onGroupRemove ()
 Called when the object is removed from a SimGroup. More...
 
virtual void onNameChange (const char *name)
 Called when the object's name is changed. More...
 
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
 
virtual void inspectPreApply ()
 
virtual void inspectPostApply ()
 
virtual void onEditorEnable ()
 Called when the editor is activated. More...
 
virtual void onEditorDisable ()
 Called when the editor is deactivated. More...
 
bool registerObject ()
 
bool registerObject (U32 id)
 
bool registerObject (const char *name)
 
bool registerObject (const char *name, U32 id)
 
void unregisterObject ()
 
void deleteObject ()
 
bool addToSet (SimObjectId)
 
bool addToSet (const char *)
 
bool removeFromSet (SimObjectId)
 
bool removeFromSet (const char *)
 
virtual void writeFields (Stream &stream, U32 tabStop)
 
virtual bool writeObject (Stream *stream)
 
virtual bool readObject (Stream *stream)
 
virtual void buildFilterList ()
 
void addFieldFilter (const char *fieldName)
 
void removeFieldFilter (const char *fieldName)
 
void clearFieldFilters ()
 
bool isFiltered (const char *fieldName)
 
void assignFieldsFrom (SimObject *obj)
 
void assignDynamicFieldsFrom (SimObject *obj)
 
- Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name. More...
 
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep. More...
 
bool setField (const char *fieldName, const char *value)
 Set the value of a field. More...
 
virtual ~ConsoleObject ()
 
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified. More...
 
AbstractClassRep::FieldListgetModifiableFieldList ()
 
bool & getDynamicGroupExpand ()
 
S32 getClassId (U32 netClassGroup) const
 
const char * getClassName () const
 

Public Attributes

typeInstanceConnectionHash mBehaviorConnections
 

Protected Member Functions

virtual const char * _callMethod (U32 argc, const char *argv[], bool callThis=true)
 
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Taml callbacks. More...
 
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read. More...
 

Friends

class BehaviorInterface
 

Additional Inherited Members

- Static Public Member Functions inherited from SimComponent
static void initPersistFields ()
 
static bool setEnabled (void *obj, const char *data)
 
static bool writeEnabled (void *obj, StringTableEntry pFieldName)
 
- Protected Types inherited from SimComponent
typedef VectorPtr
< SimComponent * >::iterator 
SimComponentIterator
 Returns a const reference to private mComponentList. More...
 
- Static Protected Member Functions inherited from SimObject
static bool setClass (void *obj, const char *data)
 
static bool setSuperClass (void *obj, const char *data)
 
static bool writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
 
static bool writeInternalName (void *obj, StringTableEntry pFieldName)
 
static bool setParentGroup (void *obj, const char *data)
 
static bool writeParentGroup (void *obj, StringTableEntry pFieldName)
 
static bool writeSuperclass (void *obj, StringTableEntry pFieldName)
 
static bool writeClass (void *obj, StringTableEntry pFieldName)
 
static SimObject::NotifyallocNotify ()
 Get a free Notify structure. More...
 
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free. More...
 
- Protected Attributes inherited from SimComponent
bool mEnabled
 
- Static Protected Attributes inherited from SimObject
static SimObject::NotifymNotifyFreeList = NULL
 

Member Typedef Documentation

Behavior connection map. NOTE: This configuration provides more efficient raising of outputs as opposed to general administration.

Constructor & Destructor Documentation

virtual ~BehaviorComponent ( )
inlinevirtual

Member Function Documentation

const char * _callMethod ( U32  argc,
const char *  argv[],
bool  callThis = true 
)
protectedvirtual

Internal callMethod : Actually does component notification and script method execution

Attention
This method does some magic to the argc argv to make Con::execute act properly as such it's internal and should not be exposed or used except by this class

Reimplemented from DynamicConsoleMethodComponent.

bool addBehavior ( BehaviorInstance bi)
virtual
const char * callOnBehaviors ( U32  argc,
const char *  argv[] 
)
virtual

Reimplemented from DynamicConsoleMethodComponent.

void clearBehaviors ( )
virtual
bool connect ( BehaviorInstance pOutputBehavior,
BehaviorInstance pInputBehavior,
StringTableEntry  pOutputName,
StringTableEntry  pInputName 
)

Behavior connectivity.

void copyTo ( SimObject object)
virtual
DECLARE_CONOBJECT ( BehaviorComponent  )
bool disconnect ( BehaviorInstance pOutputBehavior,
BehaviorInstance pInputBehavior,
StringTableEntry  pOutputName,
StringTableEntry  pInputName 
)
BehaviorInstance * getBehavior ( StringTableEntry  behaviorTemplateName)
virtual
virtual BehaviorInstance* getBehavior ( const U32  index)
inlinevirtual
BehaviorInstance * getBehaviorByInstanceId ( const U32  behaviorId)

Behavior interface.

const BehaviorComponent::BehaviorPortConnection * getBehaviorConnection ( BehaviorInstance pOutputBehavior,
StringTableEntry  pOutputName,
const U32  connectionIndex 
)
U32 getBehaviorConnectionCount ( BehaviorInstance pOutputBehavior,
StringTableEntry  pOutputName 
)
const BehaviorComponent::typePortConnectionVector * getBehaviorConnections ( BehaviorInstance pOutputBehavior,
StringTableEntry  pOutputName 
)
virtual U32 getBehaviorCount ( ) const
inlinevirtual
virtual const SimSet& getBehaviors ( ) const
inlinevirtual
bool handlesConsoleMethod ( const char *  fname,
S32 *  routingId 
)
virtual
bool onAdd ( void  )
virtual

SimObject overrides.

Reimplemented from SimComponent.

Reimplemented in Scene, SceneObject, Scroller, ShapeVector, ImageFont, CompositeSprite, and Trigger.

void onDeleteNotify ( SimObject object)
virtual

Called when a SimObject is deleted.

When you are on the notification list for another object and it is deleted, this method is called.

Reimplemented from SimObject.

Reimplemented in Scene.

void onRemove ( )
virtual

Called when the object is removed from the sim.

Reimplemented from SimComponent.

Reimplemented in Scene, SceneObject, Scroller, ShapeVector, ImageFont, and CompositeSprite.

void onTamlCustomRead ( const TamlCustomNodes customNodes)
protectedvirtual

Called during the reading of the object to allow custom properties to be read.

Skip it.

Reimplemented from SimObject.

Reimplemented in Scene, SceneObject, and CompositeSprite.

void onTamlCustomWrite ( TamlCustomNodes customNodes)
protectedvirtual

Taml callbacks.

Reimplemented from SimObject.

Reimplemented in Scene, SceneObject, and CompositeSprite.

bool raise ( BehaviorInstance pOutputBehavior,
StringTableEntry  pOutputName 
)
bool removeBehavior ( BehaviorInstance bi,
bool  deleteBehavior = true 
)
virtual
bool reOrder ( BehaviorInstance obj,
U32  desiredIndex 
)
virtual
void write ( Stream stream,
U32  tabStop,
U32  flags = 0 
)
virtual

SimComponent overrides.

Reimplemented from SimComponent.

Friends And Related Function Documentation

friend class BehaviorInterface
friend

Member Data Documentation

typeInstanceConnectionHash mBehaviorConnections

The documentation for this class was generated from the following files: