Torque2D Reference
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
SimObject Class Reference

#include <simObject.h>

+ Inheritance diagram for SimObject:

Classes

struct  Notify
 

Public Types

enum  WriteFlags { SelectedOnly = BIT(0) }
 

Public Member Functions

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.
 
const char * tabComplete (const char *prevText, S32 baseLen, bool)
 
virtual void dump ()
 
virtual void dumpClassHierarchy ()
 
SimObjectclone (const bool copyDynamicFields)
 
virtual void copyTo (SimObject *object)
 
template<typename T >
bool isType (void)
 
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 
 DECLARE_CONOBJECT (SimObject)
 
- Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name.
 
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep.
 
bool setField (const char *fieldName, const char *value)
 Set the value of a field.
 
virtual ~ConsoleObject ()
 
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified.
 
AbstractClassRep::FieldListgetModifiableFieldList ()
 
bool & getDynamicGroupExpand ()
 
S32 getClassId (U32 netClassGroup) const
 
const char * getClassName () const
 

Static Public Member Functions

static void initPersistFields ()
 
- Static Public Member Functions inherited from ConsoleObject
static const char * lookupClassName (const U32 in_classTag)
 Get the classname from a class tag.
 
static void initPersistFields ()
 
static void consoleInit ()
 
static AbstractClassRepgetStaticClassRep ()
 Get the abstract class information for this class.
 
static AbstractClassRepgetParentStaticClassRep ()
 Get the abstract class information for this class's superclass.
 
static ConsoleObjectcreate (const char *in_pClassName)
 
static ConsoleObjectcreate (const U32 groupId, const U32 typeId, const U32 in_classId)
 

Protected Member Functions

virtual void onTamlPreWrite (void)
 Taml callbacks.
 
virtual void onTamlPostWrite (void)
 Called after Taml has finished writing the object.
 
virtual void onTamlPreRead (void)
 Called prior to Taml reading the object.
 
virtual void onTamlPostRead (const TamlCustomNodes &customNodes)
 
virtual void onTamlAddParent (SimObject *pParentObject)
 Called after Taml has finished reading the object and has added the object to any parent.
 
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Called during the writing of the object to allow custom properties to be written.
 
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read.
 
void linkNamespaces ()
 
void unlinkNamespaces ()
 
- Protected Member Functions inherited from ConsoleObject
 ConsoleObject ()
 
 ConsoleObject (const ConsoleObject &)
 

Static Protected Member Functions

static bool setClass (void *obj, const char *data)
 
static bool setSuperClass (void *obj, const char *data)
 
static bool writeObjectName (void *obj, StringTableEntry pFieldName)
 
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 bool setProtectedName (void *obj, const char *data)
 
- Static Protected Member Functions inherited from ConsoleObject
static void addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL)
 
static void endGroup (const char *in_pGroupname)
 
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
 
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
 
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs)
 
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const char *in_pFieldDocs)
 
static void addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, ConsoleTypeValidator *v, const char *in_pFieldDocs=NULL)
 
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
 
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
 
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL)
 
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const char *in_pFieldDocs=NULL)
 
static void addDepricatedField (const char *fieldName)
 
static bool removeField (const char *in_pFieldname)
 

Protected Attributes

SimObjectId mId
 Id number for this object.
 
StringTableEntry mIdString
 
NamespacemNameSpace
 
U32 mTypeMask
 
S32 mScriptCallbackGuard
 Whether the object is executing a script callback.
 
bool mCanSaveFieldDictionary
 true if dynamic fields (added at runtime) should be saved, defaults to true
 
StringTableEntry mInternalName
 Stores object Internal Name.
 
StringTableEntry mClassName
 Stores the class name to link script class namespaces.
 
StringTableEntry mSuperClassName
 Stores super class name to link script class namespaces.
 

Friends

class SimManager
 
class SimGroup
 
class SimNameDictionary
 
class SimManagerNameDictionary
 
class SimIdDictionary
 

Notification

static SimObject::NotifymNotifyFreeList = NULL
 
static SimObject::NotifyallocNotify ()
 Get a free Notify structure.
 
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free.
 
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list.
 
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted.
 
void clearNotify (SimObject *obj)
 Notify an object when we are cleared.
 
void clearAllNotifications ()
 Remove all notifications for this object.
 
void processDeleteNotifies ()
 Send out deletion notifications.
 
void registerReference (SimObject **obj)
 
void unregisterReference (SimObject **obj)
 
void addListener (std::string objID)
 
void removeListener (std::string objID)
 
void removeAllListeners ()
 
void postEvent (std::string eventName, std::string data)
 

Accessors

static bool disableNameChanging = false
 
const char * getDataField (StringTableEntry slotName, const char *array)
 
virtual 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.
 
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true.
 
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true.
 
void setInternalName (const char *newname)
 
StringTableEntry getInternalName ()
 Get the internal of of this control.
 
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File.
 
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace.
 
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 () const
 
void setLocked (bool b)
 
bool isHidden () const
 
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)
 

Initialization

 SimObject ()
 
virtual ~SimObject ()
 
virtual bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3))
 

Events

virtual bool onAdd ()
 Called when the object is added to the sim.
 
virtual void onRemove ()
 Called when the object is removed from the sim.
 
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup.
 
virtual void onGroupRemove ()
 Called when the object is removed from a SimGroup.
 
virtual void onNameChange (const char *name)
 Called when the object's name is changed.
 
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
 
virtual void inspectPreApply ()
 
virtual void inspectPostApply ()
 
virtual void onDeleteNotify (SimObject *object)
 
virtual void onEditorEnable ()
 Called when the editor is activated.
 
virtual void onEditorDisable ()
 Called when the editor is deactivated.
 

Registration

SimObjects must be registered with the object system.

bool registerObject ()
 
bool registerObject (U32 id)
 
bool registerObject (const char *name)
 
bool registerObject (const char *name, U32 id)
 
void unregisterObject ()
 
void deleteObject ()
 

Sets

The object must be properly registered before you can add/remove it to/from a set.

All these functions accept either a name or ID to identify the set you wish to operate on. Then they call addObject or removeObject on the set, which sets up appropriate notifications.

An object may be in multiple sets at a time.

bool addToSet (SimObjectId)
 
bool addToSet (const char *)
 
bool removeFromSet (SimObjectId)
 
bool removeFromSet (const char *)
 

Serialization

virtual bool writeField (StringTableEntry fieldname, const char *value)
 
virtual void write (Stream &stream, U32 tabStop, U32 flags=0)
 
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)
 

Detailed Description

Base class for objects involved in the simulation.

Introduction

SimObject is a base class for most of the classes you'll encounter working in Torque. It provides fundamental services allowing "smart" object referencing, creation, destruction, organization, and location. Along with SimEvent, it gives you a flexible event-scheduling system, as well as laying the foundation for the in-game editors, GUI system, and other vital subsystems.

Subclassing

You will spend a lot of your time in Torque subclassing, or working with subclasses of, SimObject. SimObject is designed to be easy to subclass.

You should not need to override anything in a subclass except:

Of course, if you know what you're doing, go nuts! But in most cases, you shouldn't need to touch things not on that list.

When you subclass, you should define a typedef in the class, called Parent, that references the class you're inheriting from.

class mySubClass : public SimObject {
typedef SimObject Parent;
...
Definition consoleObject.h:481
Definition simObject.h:234

Then, when you override a method, put in:

bool mySubClass::onAdd()
{
if(!Parent::onAdd())
return false;
// ... do other things ...
}

Of course, you want to replace onAdd with the appropriate method call.

A SimObject's Life Cycle

SimObjects do not live apart. One of the primary benefits of using a SimObject is that you can uniquely identify it and easily find it (using its ID). Torque does this by keeping a global hierarchy of SimGroups - a tree - containing every registered SimObject. You can then query for a given object using Sim::findObject() (or SimSet::findObject() if you want to search only a specific set).

// Three examples of registering an object.
// Method 1:
AIClient *aiPlayer = new AIClient();
aiPlayer->registerObject();
// Method 2:
ActionMap* globalMap = new ActionMap;
globalMap->registerObject("GlobalActionMap");
// Method 3:
bool reg = mObj->registerObject(id);
Definition actionMap.h:50
bool registerObject()
Definition simObject.cc:93

Registering a SimObject performs these tasks:

For advanced users: There are two flags which control the behavior of these functions. The first is ModStaticFields, which controls whether or not the DataField functions look through the static fields (defined with addField; see ConsoleObject for details) of the class. The second is ModDynamicFields, which controls dynamically defined fields. They are set automatically by the console constructor code.

Member Enumeration Documentation

◆ WriteFlags

enum WriteFlags
Enumerator
SelectedOnly 

Passed to SimObject::write to indicate that only objects

Constructor & Destructor Documentation

◆ SimObject()

SimObject ( )

◆ ~SimObject()

~SimObject ( )
virtual

Member Function Documentation

◆ addFieldFilter()

void addFieldFilter ( const char *  fieldName)

◆ addListener()

void addListener ( std::string  objID)

◆ addToSet() [1/2]

bool addToSet ( const char *  ObjectName)

◆ addToSet() [2/2]

bool addToSet ( SimObjectId  spid)

◆ allocNotify()

SimObject::Notify * allocNotify ( )
staticprotected

Get a free Notify structure.

◆ assignDynamicFieldsFrom()

void assignDynamicFieldsFrom ( SimObject obj)

Copy dynamic fields from another object onto this one.

Everything from obj will overwrite what's in this object.

Parameters
objObject to copy from.

◆ assignFieldsFrom()

void assignFieldsFrom ( SimObject obj)

Copy fields from another object onto this one.

Objects must be of same type. Everything from obj will overwrite what's in this object; extra fields in this object will remain. This includes dynamic fields.

Parameters
objObject to copy from.

◆ assignName()

void assignName ( const char *  name)

◆ buildFilterList()

void buildFilterList ( )
virtual

◆ clearAllNotifications()

void clearAllNotifications ( )

Remove all notifications for this object.

◆ clearDynamicFields()

void clearDynamicFields ( void  )
inline

Clear all dynamic fields.

◆ clearFieldFilters()

void clearFieldFilters ( )

◆ clearNotify()

void clearNotify ( SimObject obj)

Notify an object when we are cleared.

◆ clone()

SimObject * clone ( const bool  copyDynamicFields)

◆ copyTo()

void copyTo ( SimObject object)
virtual

◆ DECLARE_CONOBJECT()

DECLARE_CONOBJECT ( SimObject  )

◆ deleteNotify()

void deleteNotify ( SimObject obj)

Notify an object when we are deleted.

◆ deleteObject()

void deleteObject ( )

Unregister, mark as deleted, and free the object.

◆ dump()

void dump ( )
virtual

◆ dumpClassHierarchy()

void dumpClassHierarchy ( )
virtual

◆ findObject()

SimObject * findObject ( const char *  name)
virtual

Find a named sub-object of this object.

This is subclassed in the SimGroup and SimSet classes.

For a single object, it just returns NULL, as normal objects cannot have children.

Reimplemented in SceneObjectSet, SimSet, and SimGroup.

◆ freeNotify()

void freeNotify ( SimObject::Notify note)
staticprotected

Mark a Notify structure as free.

◆ getCanSaveDynamicFields()

bool getCanSaveDynamicFields ( void  ) const
inline

Get whether fields created at runtime should be saved. Default is true.

◆ getClassNamespace()

StringTableEntry getClassNamespace ( ) const
inline

◆ getDataField()

const char * getDataField ( StringTableEntry  slotName,
const char *  array 
)

◆ getDataFieldPrefix()

StringTableEntry getDataFieldPrefix ( StringTableEntry  fieldName)

◆ getDataFieldType()

U32 getDataFieldType ( StringTableEntry  slotName,
const char *  array 
)

Get the type of a field on the object.

Parameters
slotNameField to access.
arrayString containing index into array (if field is an array); if NULL, it is ignored.

◆ getFieldDictionary()

SimFieldDictionary * getFieldDictionary ( )
inline

Get reference to the dictionary containing dynamic fields.

See here for a detailed discussion of what this function does.

This dictionary can be iterated over using a SimFieldDictionaryIterator.

◆ getGroup()

SimGroup * getGroup ( ) const
inline

◆ getId()

SimObjectId getId ( void  ) const
inline

◆ getIdString()

StringTableEntry getIdString ( void  ) const
inline

◆ getInternalName()

StringTableEntry getInternalName ( )

Get the internal of of this control.

◆ getName()

const StringTableEntry getName ( void  ) const
inline

◆ getNamespace()

Namespace * getNamespace ( )
inline

Return the object's namespace.

◆ getPeriodicTimerID()

S32 getPeriodicTimerID ( void  ) const
inline

◆ getPrefixedDataField()

const char * getPrefixedDataField ( StringTableEntry  fieldName,
const char *  array 
)

◆ getPrefixedDynamicDataField()

const char * getPrefixedDynamicDataField ( StringTableEntry  fieldName,
const char *  array,
const S32  fieldType = -1 
)

◆ getProgenitorFile()

StringTableEntry getProgenitorFile ( void  ) const
inline

◆ getScriptCallbackGuard()

S32 getScriptCallbackGuard ( void  )
inline

◆ getSuperClassNamespace()

StringTableEntry getSuperClassNamespace ( ) const
inline

◆ getType()

U32 getType ( ) const
inline

◆ handlesConsoleMethod()

virtual bool handlesConsoleMethod ( const char *  fname,
S32 *  routingId 
)
inlinevirtual

◆ initPersistFields()

void initPersistFields ( )
static

◆ inspectPostApply()

void inspectPostApply ( )
virtual

Called after any property of the object is changed in the world editor.

See also
inspectPreApply

Reimplemented in GuiSceneObjectCtrl, GuiChainCtrl, GuiFrameSetCtrl, GuiGridCtrl, GuiScrollCtrl, GuiInspector, GuiMenuBarCtrl, GuiMenuItemCtrl, GuiControl, GuiMessageVectorCtrl, and GuiTextEditCtrl.

◆ inspectPreApply()

void inspectPreApply ( )
virtual

Specifically, this is called by setDataField when a static field is modified, see the console details. Called before any property of the object is changed in the world editor.

The calling order here is:

Reimplemented in GuiChainCtrl, and GuiControl.

◆ isChildOfGroup()

bool isChildOfGroup ( SimGroup pGroup)

◆ isDeleted()

bool isDeleted ( ) const
inline

◆ isExpanded()

bool isExpanded ( ) const
inline

◆ isFiltered()

bool isFiltered ( const char *  fieldName)

◆ isHidden()

bool isHidden ( ) const
inline

◆ isLocked()

bool isLocked ( ) const
inline

◆ isMethod()

bool isMethod ( const char *  methodName)
virtual

Check if a method exists in the objects current namespace.

◆ isPeriodicTimerActive()

bool isPeriodicTimerActive ( void  ) const
inline

◆ isProperlyAdded()

bool isProperlyAdded ( ) const
inline

◆ isRemoved()

bool isRemoved ( ) const
inline

◆ isSelected()

bool isSelected ( ) const
inline

◆ isType()

template<typename T >
bool isType ( void  )
inline

◆ linkNamespaces()

void linkNamespaces ( )
protected

◆ onAdd()

bool onAdd ( void  )
virtual

◆ onDeleteNotify()

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 in ParticleAsset, Scene, Path, SceneObjectSet, BehaviorComponent, ModuleManager, UInputManager, and SimSet.

◆ onEditorDisable()

virtual void onEditorDisable ( )
inlinevirtual

Called when the editor is deactivated.

◆ onEditorEnable()

virtual void onEditorEnable ( )
inlinevirtual

Called when the editor is activated.

◆ onGroupAdd()

void onGroupAdd ( )
virtual

Called when the object is added to a SimGroup.

◆ onGroupRemove()

void onGroupRemove ( )
virtual

Called when the object is removed from a SimGroup.

Reimplemented in GuiControl.

◆ onNameChange()

void onNameChange ( const char *  name)
virtual

Called when the object's name is changed.

◆ onRemove()

void onRemove ( )
virtual

◆ onStaticModified()

void onStaticModified ( const char *  slotName,
const char *  newValue = NULL 
)
virtual

Called when a static field is modified.

Reimplemented in SimDataBlock.

◆ onTamlAddParent()

virtual void onTamlAddParent ( SimObject pParentObject)
inlineprotectedvirtual

Called after Taml has finished reading the object and has added the object to any parent.

Implements TamlCallbacks.

Reimplemented in ParticlePlayer.

◆ onTamlCustomRead()

virtual void onTamlCustomRead ( const TamlCustomNodes customNodes)
inlineprotectedvirtual

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

Implements TamlCallbacks.

Reimplemented in FontAsset, ImageAsset, ParticleAsset, ParticleAssetEmitter, Scene, CompositeSprite, SceneObject, AssetQuery, AssetTagsManifest, BehaviorComponent, and GuiFrameSetCtrl.

◆ onTamlCustomWrite()

virtual void onTamlCustomWrite ( TamlCustomNodes customNodes)
inlineprotectedvirtual

Called during the writing of the object to allow custom properties to be written.

Implements TamlCallbacks.

Reimplemented in FontAsset, ImageAsset, ParticleAsset, ParticleAssetEmitter, Scene, CompositeSprite, SceneObject, AssetQuery, AssetTagsManifest, BehaviorComponent, and GuiFrameSetCtrl.

◆ onTamlPostRead()

virtual void onTamlPostRead ( const TamlCustomNodes customNodes)
inlineprotectedvirtual

Called after Taml has finished reading the object. The custom properties is additionally passed here for object who want to process it at the end of reading.

Implements TamlCallbacks.

Reimplemented in Scene.

◆ onTamlPostWrite()

virtual void onTamlPostWrite ( void  )
inlineprotectedvirtual

Called after Taml has finished writing the object.

Implements TamlCallbacks.

Reimplemented in FontAsset, ImageAsset, and AudioAsset.

◆ onTamlPreRead()

virtual void onTamlPreRead ( void  )
inlineprotectedvirtual

Called prior to Taml reading the object.

Implements TamlCallbacks.

Reimplemented in Scene.

◆ onTamlPreWrite()

virtual void onTamlPreWrite ( void  )
inlineprotectedvirtual

Taml callbacks.

Implements TamlCallbacks.

Reimplemented in FontAsset, ImageAsset, and AudioAsset.

◆ popScriptCallbackGuard()

void popScriptCallbackGuard ( void  )
inline

◆ postEvent()

void postEvent ( std::string  eventName,
std::string  data 
)

◆ processArguments()

bool processArguments ( S32  argc,
const char **  argv 
)
virtual

Process constructor options. (ie, new SimObject(1,2,3))

Reimplemented in SimComponent, ConsoleLogger, TCPObject, SimXMLDocument, and SimGroup.

◆ processDeleteNotifies()

void processDeleteNotifies ( )

Send out deletion notifications.

◆ pushScriptCallbackGuard()

void pushScriptCallbackGuard ( void  )
inline

◆ readObject()

bool readObject ( Stream stream)
virtual

Reimplemented in SimSet.

◆ registerObject() [1/4]

bool registerObject ( )

Register an object with the object system.

This must be called if you want to keep the object around. In the rare case that you will delete the object immediately, or don't want to be able to use Sim::findObject to locate it, then you don't need to register it.

registerObject adds the object to the global ID and name dictionaries, after first assigning it a new ID number. It calls onAdd(). If onAdd fails, it unregisters the object and returns false.

If a subclass's onAdd doesn't eventually call SimObject::onAdd(), it will cause an assertion.

◆ registerObject() [2/4]

bool registerObject ( const char *  name)

Register the object, assigning the name.

See also
registerObject()
Parameters
nameName to assign to the object.

◆ registerObject() [3/4]

bool registerObject ( const char *  name,
U32  id 
)

Register the object, assigning a name and ID.

See also
registerObject()
Parameters
nameName to assign to the object.
idID to assign to the object.

◆ registerObject() [4/4]

bool registerObject ( U32  id)

Register the object, forcing the id.

See also
registerObject()
Parameters
idID to assign to the object.

◆ registerReference()

void registerReference ( SimObject **  obj)

Register a reference to this object.

You pass a pointer to your reference to this object.

When the object is deleted, it will null your pointer, ensuring you don't access old memory.

Parameters
objPointer to your reference to the object.

◆ removeAllListeners()

void removeAllListeners ( )

◆ removeFieldFilter()

void removeFieldFilter ( const char *  fieldName)

◆ removeFromSet() [1/2]

bool removeFromSet ( const char *  objectName)

◆ removeFromSet() [2/2]

bool removeFromSet ( SimObjectId  sid)

◆ removeListener()

void removeListener ( std::string  objID)

◆ removeNotify()

SimObject::Notify * removeNotify ( void *  ptr,
Notify::Type  type 
)

Remove a notification from the list.

◆ save()

bool save ( const char *  pcFilePath,
bool  bOnlySelected = false 
)
virtual

Save object as a TorqueScript File.

◆ setCanSaveDynamicFields()

void setCanSaveDynamicFields ( bool  bCanSave)
inline

Set whether fields created at runtime should be saved. Default is true.

◆ setClass()

static bool setClass ( void *  obj,
const char *  data 
)
inlinestaticprotected

◆ setClassNamespace()

void setClassNamespace ( const char *  classNamespace)

◆ setDataField()

void setDataField ( StringTableEntry  slotName,
const char *  array,
const char *  value 
)
virtual

Set the value of a field on the object.

See here for a detailed discussion of what this function does.

Parameters
slotNameField to access.
arrayString containing index into array; if NULL, it is ignored.
valueValue to store.

Reimplemented in GuiControl.

◆ setExpanded()

void setExpanded ( bool  exp)
inline

◆ setHidden()

void setHidden ( bool  b = true)

◆ setId()

void setId ( SimObjectId  id)

◆ setInternalName()

void setInternalName ( const char *  newname)

These functions support internal naming that is not namespace bound for locating child controls in a generic way.

Set the internal name of this control (Not linked to a namespace)

◆ setLocked()

void setLocked ( bool  b = true)

◆ setModDynamicFields()

void setModDynamicFields ( bool  dyn)
inline

◆ setModStaticFields()

void setModStaticFields ( bool  sta)
inline

◆ setParentGroup()

bool setParentGroup ( void *  obj,
const char *  data 
)
staticprotected

◆ setPeriodicTimerID()

void setPeriodicTimerID ( const S32  timerID)
inline

◆ setPrefixedDataField()

void setPrefixedDataField ( StringTableEntry  fieldName,
const char *  array,
const char *  value 
)

◆ setPrefixedDynamicDataField()

void setPrefixedDynamicDataField ( StringTableEntry  fieldName,
const char *  array,
const char *  value,
const S32  fieldType = -1 
)

◆ setProgenitorFile()

void setProgenitorFile ( const char *  pFile)
inline

◆ setProtectedName()

bool setProtectedName ( void *  obj,
const char *  data 
)
staticprotected

◆ setSelected()

void setSelected ( bool  sel)
inline

◆ setSuperClass()

static bool setSuperClass ( void *  obj,
const char *  data 
)
inlinestaticprotected

◆ setSuperClassNamespace()

void setSuperClassNamespace ( const char *  superClassNamespace)

◆ tabComplete()

const char * tabComplete ( const char *  prevText,
S32  baseLen,
bool  fForward 
)

Get next matching item in namespace.

This wraps a call to Namespace::tabComplete; it gets the next thing in the namespace, given a starting value and a base length of the string. See Namespace::tabComplete for details.

◆ unlinkNamespaces()

void unlinkNamespaces ( )
protected

◆ unregisterObject()

void unregisterObject ( )

Unregister the object from Sim.

This performs several operations:

  • Sets the removed flag.
  • Call onRemove()
  • Clear out notifications.
  • Remove the object from...
  • Finally, cancel any pending events for this object (as it can't receive them now).

◆ unregisterReference()

void unregisterReference ( SimObject **  obj)

Unregister a reference to this object.

Remove a reference from the list, so that it won't get nulled inappropriately.

Call this when you're done with your reference to the object, especially if you're going to free the memory. Otherwise, you may erroneously get something overwritten.

See also
registerReference

◆ write()

void write ( Stream stream,
U32  tabStop,
U32  flags = 0 
)
virtual

Output the TorqueScript to recreate this object.

This calls writeFields internally.

Parameters
streamStream to output to.
tabStopIndentation level for this object.
flagsIf SelectedOnly is passed here, then only objects marked as selected (using setSelected) will output themselves.

Reimplemented in GuiControl, NameTags, BehaviorComponent, SimComponent, and SimSet.

◆ writeCanSaveDynamicFields()

static bool writeCanSaveDynamicFields ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

◆ writeClass()

static bool writeClass ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

◆ writeField()

bool writeField ( StringTableEntry  fieldname,
const char *  value 
)
virtual

Determine whether or not a field should be written.

Parameters
fieldnameThe name of the field being written.
valueThe value of the field.

Reimplemented in SceneObject, and SimComponent.

◆ writeFields()

void writeFields ( Stream stream,
U32  tabStop 
)
virtual

Write the fields of this object in TorqueScript.

Parameters
streamStream for output.
tabStopIndentation level for the fields.

Reimplemented in NameTags, and GuiFrameSetCtrl.

◆ writeInternalName()

static bool writeInternalName ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

◆ writeObject()

bool writeObject ( Stream stream)
virtual

Reimplemented in SimSet.

◆ writeObjectName()

static bool writeObjectName ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

◆ writeParentGroup()

static bool writeParentGroup ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

◆ writeSuperclass()

static bool writeSuperclass ( void *  obj,
StringTableEntry  pFieldName 
)
inlinestaticprotected

Friends And Related Symbol Documentation

◆ SimGroup

friend class SimGroup
friend

◆ SimIdDictionary

friend class SimIdDictionary
friend

◆ SimManager

friend class SimManager
friend

◆ SimManagerNameDictionary

friend class SimManagerNameDictionary
friend

◆ SimNameDictionary

friend class SimNameDictionary
friend

Member Data Documentation

◆ disableNameChanging

bool disableNameChanging = false
static

Get the value of a field on the object.

See here for a detailed discussion of what this function does.

Parameters
slotNameField to access.
arrayString containing index into array (if field is an array); if NULL, it is ignored.

◆ mCanSaveFieldDictionary

bool mCanSaveFieldDictionary
protected

true if dynamic fields (added at runtime) should be saved, defaults to true

◆ mClassName

StringTableEntry mClassName
protected

Stores the class name to link script class namespaces.

◆ mId

SimObjectId mId
protected

Id number for this object.

◆ mIdString

StringTableEntry mIdString
protected

◆ mInternalName

StringTableEntry mInternalName
protected

Stores object Internal Name.

◆ mNameSpace

Namespace* mNameSpace
protected

◆ mNotifyFreeList

SimObject::Notify * mNotifyFreeList = NULL
staticprotected

◆ mScriptCallbackGuard

S32 mScriptCallbackGuard
protected

Whether the object is executing a script callback.

◆ mSuperClassName

StringTableEntry mSuperClassName
protected

Stores super class name to link script class namespaces.

◆ mTypeMask

U32 mTypeMask
protected

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