Torque2D Reference
|
#include <simObject.h>
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 SimObject * | findObject (const char *name) |
Namespace * | getNamespace () |
Return the object's namespace. More... | |
const char * | tabComplete (const char *prevText, S32 baseLen, bool) |
virtual void | dump () |
virtual void | dumpClassHierarchy () |
SimObject * | clone (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) | |
![]() | |
const AbstractClassRep::Field * | findField (StringTableEntry fieldName) const |
Get a reference to a field by name. More... | |
virtual AbstractClassRep * | getClassRep () const |
Gets the ClassRep. More... | |
bool | setField (const char *fieldName, const char *value) |
Set the value of a field. More... | |
virtual | ~ConsoleObject () |
const AbstractClassRep::FieldList & | getFieldList () const |
Get a list of all the fields. This information cannot be modified. More... | |
AbstractClassRep::FieldList & | getModifiableFieldList () |
bool & | getDynamicGroupExpand () |
S32 | getClassId (U32 netClassGroup) const |
const char * | getClassName () const |
Static Public Member Functions | |
static void | initPersistFields () |
![]() | |
static const char * | lookupClassName (const U32 in_classTag) |
Get the classname from a class tag. More... | |
static void | initPersistFields () |
static void | consoleInit () |
static ConsoleObject * | create (const char *in_pClassName) |
static ConsoleObject * | create (const U32 groupId, const U32 typeId, const U32 in_classId) |
static AbstractClassRep * | getStaticClassRep () |
Get the abstract class information for this class. More... | |
static AbstractClassRep * | getParentStaticClassRep () |
Get the abstract class information for this class's superclass. More... | |
Protected Member Functions | |
virtual void | onTamlPreWrite (void) |
Taml callbacks. More... | |
virtual void | onTamlPostWrite (void) |
Called after Taml has finished writing the object. More... | |
virtual void | onTamlPreRead (void) |
Called prior to Taml reading the object. More... | |
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. More... | |
virtual void | onTamlCustomWrite (TamlCustomNodes &customNodes) |
Called during the writing of the object to allow custom properties to be written. More... | |
virtual void | onTamlCustomRead (const TamlCustomNodes &customNodes) |
Called during the reading of the object to allow custom properties to be read. More... | |
void | linkNamespaces () |
void | unlinkNamespaces () |
![]() | |
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 | 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 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. More... | |
StringTableEntry | mIdString |
Namespace * | mNameSpace |
U32 | mTypeMask |
S32 | mScriptCallbackGuard |
Whether the object is executing a script callback. More... | |
bool | mCanSaveFieldDictionary |
true if dynamic fields (added at runtime) should be saved, defaults to true More... | |
StringTableEntry | mInternalName |
Stores object Internal Name. More... | |
StringTableEntry | mClassName |
Stores the class name to link script class namespaces. More... | |
StringTableEntry | mSuperClassName |
Stores super class name to link script class namespaces. More... | |
Friends | |
class | SimManager |
class | SimGroup |
class | SimNameDictionary |
class | SimManagerNameDictionary |
class | SimIdDictionary |
Notification | |
static SimObject::Notify * | mNotifyFreeList = NULL |
static SimObject::Notify * | allocNotify () |
Get a free Notify structure. More... | |
static void | freeNotify (SimObject::Notify *) |
Mark a Notify structure as free. More... | |
Notify * | removeNotify (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) |
Accessors | |
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) |
SimFieldDictionary * | getFieldDictionary () |
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) |
SimGroup * | getGroup () 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) |
Initialization | |
SimObject () | |
virtual | ~SimObject () |
virtual bool | processArguments (S32 argc, const char **argv) |
Process constructor options. (ie, new SimObject(1,2,3)) More... | |
Events | |
virtual bool | onAdd () |
Called when the object is added to the sim. More... | |
virtual void | onRemove () |
Called when the object is removed from the sim. More... | |
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 | onDeleteNotify (SimObject *object) |
virtual void | onEditorEnable () |
Called when the editor is activated. More... | |
virtual void | onEditorDisable () |
Called when the editor is deactivated. More... | |
Registration | |
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) |
Base class for objects involved in the simulation.
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.
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.
Then, when you override a method, put in:
Of course, you want to replace onAdd with the appropriate method call.
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).
Registering a SimObject performs these tasks:
Calling registerObject() and passing an ID or a name will cause the object to be assigned that name and/or ID before it is registered.
Congratulations, you have now registered your object! What now?
Well, hopefully, the SimObject will have a long, useful life. But eventually, it must die.
There are a two ways a SimObject can die.
When you unregister a SimObject, the following tasks are performed:
If you call deleteObject(), all of the above tasks are performed, in addition to some sanity checking to make sure the object was previously added properly, and isn't in the process of being deleted. After the object is unregistered, it de-allocates itself.
SimObjects are one of the building blocks for the in-game editors. They provide a basic interface for the editor to be able to list the fields of the object, update them safely and reliably, and inform the object things have changed.
This interface is implemented in the following areas:
(Note: you can check the variable gEditingMission to see if the mission editor is running; if so, you may want to render special indicators. For instance, the fxFoliageReplicator renders inner and outer radii when the mission editor is running.)
SimObject extends ConsoleObject by allowing you to to set arbitrary dynamic fields on the object, as well as statically defined fields. This is done through two methods, setDataField and getDataField, which deal with the complexities of allowing access to two different types of object fields.
Static fields take priority over dynamic fields. This is to be expected, as the role of dynamic fields is to allow data to be stored in addition to the predefined fields.
The fields in a SimObject are like properties (or fields) in a class.
Some fields may be arrays, which is what the array parameter is for; if it's non-null, then it is parsed with dAtoI and used as an index into the array. If you access something as an array which isn't, then you get an empty string.
You don't need to read any further than this. Right now, set/getDataField are called a total of 6 times through the entire Torque codebase. Therefore, you probably don't need to be familiar with the details of accessing them. You may want to look at Con::setData instead. Most of the time you will probably be accessing fields directly, or using the scripting language, which in either case means you don't need to do anything special.
The functions to get/set these fields are very straightforward:
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.
enum WriteFlags |
Enumerator | |
---|---|
SelectedOnly |
Passed to SimObject::write to indicate that only objects |
SimObject | ( | ) |
|
virtual |
void addFieldFilter | ( | const char * | fieldName | ) |
bool addToSet | ( | SimObjectId | spid | ) |
bool addToSet | ( | const char * | ObjectName | ) |
|
staticprotected |
Get a free Notify structure.
void assignDynamicFieldsFrom | ( | SimObject * | obj | ) |
Copy dynamic fields from another object onto this one.
Everything from obj will overwrite what's in this object.
obj | Object to copy from. |
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.
obj | Object to copy from. |
void assignName | ( | const char * | name | ) |
|
virtual |
void clearAllNotifications | ( | ) |
Remove all notifications for this object.
|
inline |
Clear all dynamic fields.
void clearFieldFilters | ( | ) |
SimObject * clone | ( | const bool | copyDynamicFields | ) |
|
virtual |
Reimplemented in SceneObject, ImageAsset, ParticleAssetEmitter, ParticlePlayer, Scroller, ShapeVector, BehaviorComponent, ImageFont, ParticleAsset, SkeletonObject, AssetBase, BuoyancyController, CompositeSprite, Trigger, PointForceController, SkeletonAsset, AudioAsset, AnimationAsset, WaveComposite, PickingSceneController, GroupedSceneController, SpriteBase, GuiSpriteCtrl, AmbientForceController, Sprite, and RenderProxy.
DECLARE_CONOBJECT | ( | SimObject | ) |
void deleteObject | ( | ) |
Unregister, mark as deleted, and free the object.
|
virtual |
|
virtual |
|
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 SimGroup, SimSet, and SceneObjectSet.
|
staticprotected |
Mark a Notify structure as free.
|
inline |
Get whether fields created at runtime should be saved. Default is true.
|
inline |
const char * getDataField | ( | StringTableEntry | slotName, |
const char * | array | ||
) |
Get the value of a field on the object.
See here for a detailed discussion of what this function does.
slotName | Field to access. |
array | String containing index into array (if field is an array); if NULL, it is ignored. |
StringTableEntry getDataFieldPrefix | ( | StringTableEntry | fieldName | ) |
U32 getDataFieldType | ( | StringTableEntry | slotName, |
const char * | array | ||
) |
Get the type of a field on the object.
slotName | Field to access. |
array | String containing index into array (if field is an array); if NULL, it is ignored. |
|
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.
|
inline |
|
inline |
|
inline |
StringTableEntry getInternalName | ( | ) |
Get the internal of of this control.
|
inline |
|
inline |
Return the object's namespace.
|
inline |
const char * getPrefixedDataField | ( | StringTableEntry | fieldName, |
const char * | array | ||
) |
const char * getPrefixedDynamicDataField | ( | StringTableEntry | fieldName, |
const char * | array, | ||
const S32 | fieldType = -1 |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented in BehaviorComponent, and DynamicConsoleMethodComponent.
|
static |
|
virtual |
Called after any property of the object is changed in the world editor.
Reimplemented in GuiControl, GuiMLTextCtrl, GuiIconButtonCtrl, GuiTextCtrl, GuiSceneObjectCtrl, GuiMessageVectorCtrl, GuiBitmapButtonCtrl, GuiBitmapCtrl, GuiToolboxButtonCtrl, GuiDynamicCtrlArrayControl, GuiControlArrayControl, and GuiGridControl.
|
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 GuiControl.
bool isChildOfGroup | ( | SimGroup * | pGroup | ) |
|
inline |
|
inline |
bool isFiltered | ( | const char * | fieldName | ) |
bool isHidden | ( | ) |
bool isLocked | ( | ) |
|
virtual |
Check if a method exists in the objects current namespace.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
virtual |
Called when the object is added to the sim.
Reimplemented in GuiControl, Scene, NetObject, GuiMLTextCtrl, SceneObject, GuiInspectorDynamicField, ImageAsset, GameConnection, GuiControlProfile, SceneWindow, GuiInspectorGroup, UndoScriptAction, GuiPopUpMenuCtrlEx, ModuleManager, SimDataBlock, GuiInspectorField, GuiRolloutCtrl, GuiPopUpMenuCtrl, Taml, GuiTabBookCtrl, AssetManager, SimComponent, Scroller, UInputManager, GuiFrameSetCtrl, GuiEditCtrl, BehaviorComponent, BehaviorTemplate, GuiFormCtrl, GuiTextEditCtrl, MessageVector, GuiInspector, ImageFont, ShapeVector, GuiCursor, TCPObject, GuiTextCtrl, GuiMessageVectorCtrl, SkeletonAsset, AnimationAsset, CompositeSprite, SimXMLDocument, Trigger, PopupMenu, StreamObject, ActionMap, BehaviorInstance, NameTags, FileStreamObject, and GuiControlListPopUp.
|
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 Scene, SimSet, ModuleManager, UInputManager, SceneObjectSet, BehaviorComponent, and ParticleAsset.
|
inlinevirtual |
Called when the editor is deactivated.
|
inlinevirtual |
Called when the editor is activated.
|
virtual |
Called when the object is added to a SimGroup.
|
virtual |
Called when the object is removed from a SimGroup.
|
virtual |
Called when the object's name is changed.
|
virtual |
Called when the object is removed from the sim.
Reimplemented in NetConnection, GuiControl, SimGroup, Scene, NetObject, SceneObject, ImageAsset, GameConnection, SceneWindow, UndoScriptAction, SimSet, ModuleManager, SimDataBlock, Taml, GuiTabBookCtrl, AssetManager, SimComponent, Scroller, UInputManager, GuiEditCtrl, GuiTextListCtrl, SceneObjectSet, BehaviorComponent, BehaviorTemplate, MessageVector, ImageFont, ShapeVector, GuiCursor, GuiMessageVectorCtrl, SkeletonAsset, AnimationAsset, CompositeSprite, SimXMLDocument, PopupMenu, and BehaviorInstance.
|
virtual |
Called when a static field is modified.
Reimplemented in SimDataBlock.
|
inlineprotectedvirtual |
Called after Taml has finished reading the object and has added the object to any parent.
Implements TamlCallbacks.
Reimplemented in ParticlePlayer.
|
inlineprotectedvirtual |
Called during the reading of the object to allow custom properties to be read.
Implements TamlCallbacks.
Reimplemented in Scene, ImageAsset, ParticleAssetEmitter, SceneObject, ParticleAsset, AssetTagsManifest, CompositeSprite, SkeletonAsset, BehaviorComponent, and AssetQuery.
|
inlineprotectedvirtual |
Called during the writing of the object to allow custom properties to be written.
Implements TamlCallbacks.
Reimplemented in Scene, ImageAsset, ParticleAssetEmitter, SceneObject, ParticleAsset, AssetTagsManifest, CompositeSprite, SkeletonAsset, BehaviorComponent, and AssetQuery.
|
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.
|
inlineprotectedvirtual |
Called after Taml has finished writing the object.
Implements TamlCallbacks.
Reimplemented in ImageAsset, AudioAsset, and SkeletonAsset.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Taml callbacks.
Implements TamlCallbacks.
Reimplemented in ImageAsset, AudioAsset, and SkeletonAsset.
|
inline |
|
virtual |
Process constructor options. (ie, new SimObject(1,2,3))
Reimplemented in SimGroup, SimComponent, TCPObject, ConsoleLogger, and SimXMLDocument.
void processDeleteNotifies | ( | ) |
Send out deletion notifications.
|
inline |
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.
bool registerObject | ( | U32 | id | ) |
Register the object, forcing the id.
id | ID to assign to the object. |
bool registerObject | ( | const char * | name | ) |
Register the object, assigning the name.
name | Name to assign to the object. |
bool registerObject | ( | const char * | name, |
U32 | id | ||
) |
Register the object, assigning a name and ID.
name | Name to assign to the object. |
id | ID to assign to the object. |
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.
obj | Pointer to your reference to the object. |
void removeFieldFilter | ( | const char * | fieldName | ) |
bool removeFromSet | ( | SimObjectId | sid | ) |
bool removeFromSet | ( | const char * | objectName | ) |
SimObject::Notify * removeNotify | ( | void * | ptr, |
Notify::Type | type | ||
) |
Remove a notification from the list.
|
virtual |
Save object as a TorqueScript File.
|
inline |
Set whether fields created at runtime should be saved. Default is true.
|
inlinestaticprotected |
void setClassNamespace | ( | const char * | classNamespace | ) |
void setDataField | ( | StringTableEntry | slotName, |
const char * | array, | ||
const char * | value | ||
) |
Set the value of a field on the object.
See here for a detailed discussion of what this function does.
slotName | Field to access. |
array | String containing index into array; if NULL, it is ignored. |
value | Value to store. |
|
inline |
void setHidden | ( | bool | b = true | ) |
void setId | ( | SimObjectId | id | ) |
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)
void setLocked | ( | bool | b = true | ) |
|
inline |
|
inline |
|
staticprotected |
|
inline |
void setPrefixedDataField | ( | StringTableEntry | fieldName, |
const char * | array, | ||
const char * | value | ||
) |
void setPrefixedDynamicDataField | ( | StringTableEntry | fieldName, |
const char * | array, | ||
const char * | value, | ||
const S32 | fieldType = -1 |
||
) |
|
inline |
|
inline |
|
inlinestaticprotected |
void setSuperClassNamespace | ( | const char * | superClassNamespace | ) |
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.
|
protected |
void unregisterObject | ( | ) |
Unregister the object from Sim.
This performs several operations:
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.
|
virtual |
Output the TorqueScript to recreate this object.
This calls writeFields internally.
stream | Stream to output to. |
tabStop | Indentation level for this object. |
flags | If SelectedOnly is passed here, then only objects marked as selected (using setSelected) will output themselves. |
Reimplemented in GuiControl, SimSet, SimComponent, BehaviorComponent, and NameTags.
|
inlinestaticprotected |
|
inlinestaticprotected |
|
virtual |
Determine whether or not a field should be written.
fieldname | The name of the field being written. |
value | The value of the field. |
Reimplemented in SceneObject, and SimComponent.
|
virtual |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
true if dynamic fields (added at runtime) should be saved, defaults to true
|
protected |
Stores the class name to link script class namespaces.
|
protected |
Id number for this object.
|
protected |
|
protected |
Stores object Internal Name.
|
protected |
|
staticprotected |
|
protected |
Whether the object is executing a script callback.
|
protected |
Stores super class name to link script class namespaces.
|
protected |