Torque2D Reference
|
#include <simComponent.h>
Public Member Functions | |
DECLARE_CONOBJECT (SimComponent) | |
SimComponent () | |
virtual | ~SimComponent () |
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 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 SimComponent * | getOwner () 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 () |
SimComponent * | getComponent (const U32 index) |
virtual void | setEnabled (const bool enabled) |
bool | isEnabled () const |
virtual void | write (Stream &stream, U32 tabStop, U32 flags=0) |
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) |
![]() | |
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) | |
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) |
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) |
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 | onDeleteNotify (SimObject *object) |
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) |
![]() | |
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 bool | setEnabled (void *obj, const char *data) |
static bool | writeEnabled (void *obj, StringTableEntry pFieldName) |
![]() | |
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 Types | |
typedef VectorPtr < SimComponent * >::iterator | SimComponentIterator |
Returns a const reference to private mComponentList. More... | |
![]() | |
enum | SimObjectNSLinkType { LinkClassName = BIT(0), LinkSuperClassName = BIT(1) } |
Protected Member Functions | |
SimComponent * | _getOwner () |
VectorPtr< SimComponent * > & | lockComponentList () |
void | unlockComponentList () |
virtual bool | onComponentRegister (SimComponent *owner) |
virtual void | onComponentUnRegister () |
![]() | |
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 &) | |
Protected Attributes | |
bool | mEnabled |
![]() | |
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... | |
U8 | mNSLinkMask |
Additional Inherited Members | |
![]() | |
enum | WriteFlags { SelectedOnly = BIT(0) } |
![]() | |
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::Notify * | allocNotify () |
Get a free Notify structure. More... | |
static void | freeNotify (SimObject::Notify *) |
Mark a Notify structure as free. More... | |
![]() | |
static SimObject::Notify * | mNotifyFreeList = NULL |
|
protected |
Returns a const reference to private mComponentList.
SimComponent | ( | ) |
Constructor Add this component
|
virtual |
Destructor Remove this component and destroy child references
|
inlineprotected |
|
virtual |
Add Component to this one.
bool callMethodOnComponents | ( | U32 | argc, |
const char * | argv[], | ||
const char ** | result | ||
) |
Call the given method and arguments on this component or, if not handled by this component, then on its children.
|
inlinevirtual |
Clear Child components of this one.
DECLARE_CONOBJECT | ( | SimComponent | ) |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
The component which owns this object.
|
inline |
Will return true if this object contains components.
|
static |
|
inline |
|
inlineprotected |
|
virtual |
Called when the object is added to the sim.
Reimplemented from SimObject.
Reimplemented in Scene, SceneObject, Scroller, BehaviorComponent, ShapeVector, ImageFont, CompositeSprite, and Trigger.
|
inlinevirtual |
|
virtual |
|
inlineprotectedvirtual |
onComponentRegister is called on each component by it's owner. If a component has no owner, onComponentRegister will not be called on it. The purpose of onComponentRegister is to allow a component to check for any external interfaces, or other dependencies which it needs to function. If any component in a component hierarchy returns false from it's onComponentRegister call the entire hierarchy is invalid, and SimObject::onAdd will fail on the top-level component. To put it another way, if a component contains other components, it will be registered successfully with Sim if each subcomponent returns true from onComponentRegister. If a component does not contain other components, it will not receive an onComponentRegister call.
Overloads of this method must pass the call along to their parent, as is shown in the example below.
|
virtual |
|
inlineprotectedvirtual |
onUnregister is called when the owner is unregistering. Your object should do cleanup here, as well as pass a call up the chain to the parent.
|
virtual |
Called when the object is removed from the sim.
Reimplemented from SimObject.
Reimplemented in Scene, SceneObject, Scroller, BehaviorComponent, ShapeVector, ImageFont, and CompositeSprite.
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Process constructor options. (ie, new SimObject(1,2,3))
Reimplemented from SimObject.
|
virtual |
Remove Component from this one.
|
inlinestatic |
|
inlinevirtual |
Reimplemented in SceneObject.
|
inlineprotected |
|
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 from SimObject.
Reimplemented in BehaviorComponent.
|
inlinestatic |
|
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 from SimObject.
Reimplemented in SceneObject.
|
protected |