SimObject
Base class for almost all objects involved in the simulation.
Ungrouped
string
Optional global name of this object.
Object
string
Optional name that may be used to lookup this object within a SimSet.
Group hierarchy parent of the object.
string
Script class of object.
string
Script super-class of object.
string
Script class of object.
Persistence
bool
Whether the object can be saved out. If false, the object is purely transient in nature.
bool
True if dynamic fields (added at runtime) should be saved. Defaults to true.
pid
The universally unique identifier for the object.
Callbacks
void
Generic callback for when an object is edited.
Public Functions
void
assignFieldsFrom(SimObject fromObject)
Copy fields from another object onto this one. The objects must be of same type. Everything from the object will overwrite what's in this object; extra fields in this object will remain. This includes dynamic fields.
void
Assign a persistent ID to the object if it does not already have one.
string
call(string method, string args...)
Dynamically call a method on an object.
void
delete()
Delete and remove the object.
void
dump(bool detailed)
Dump a description of all fields and methods defined on this object to the console.
void
Dump the native C++ class hierarchy of this object's C++ class to the console.
void
Dump the hierarchy of this object up to RootGroup to the console.
List the methods defined on this object.
bool
Get whether the object will be included in saves.
string
Get the name of the C++ class which the object is an instance of.
string
Get the name of the class namespace assigned to this object.
Return some behind-the-scenes information on the object.
int
Get the line number at which the object is defined in its file.
string
getDynamicField(int index)
Get a value of a dynamic field by index.
int
Get the number of dynamic fields defined on the object.
string
getField(int index)
Retrieve the value of a static field by index.
int
Get the number of static fields on the object.
string
getFieldType(string fieldName)
Get the console type code of the given field.
string
getFieldValue(string fieldName, int index)
Return the value of the given field on this object.
string
Returns the filename the object is attached to.
int
getId()
Get the underlying unique numeric ID of the object.
string
Get the internal name of the object.
string
getName()
Get the global name of the object.
string
Get the name of the superclass namespace assigned to this object.
bool
isChildOfGroup(SimGroup group)
Test whether the object belongs directly or indirectly to the given group.
bool
Return true if the object is only used by the editor.
bool
Get whether the object has been marked as expanded. (in editor)
bool
isField(string fieldName)
Test whether the given field is defined on this object.
bool
isInNamespaceHierarchy(string name)
Test whether the namespace of this object is a direct or indirect child to the given namespace.
bool
isMemberOfClass(string className)
Test whether this object is a member of the specified class.
bool
isMethod(string methodName)
Test whether the given method is defined on this object.
bool
Get whether this object may be renamed.
bool
Get whether the object has been marked as selected. (in editor)
bool
save(string fileName, bool selectedOnly, string preAppendString)
Save out the object to the given file.
int
schedule(float time, string method, string args...)
Delay an invocation of a method.
void
setCanSave(bool value)
Set whether the object will be included in saves.
void
setClassNamespace(string name)
Assign a class namespace to this object.
void
setEditorOnly(bool value)
Set/clear the editor-only flag on this object.
void
setFieldType(string fieldName, string type)
Set the console type code for the given field.
bool
setFieldValue(string fieldName, string value, int index)
Set the value of the given field on this object.
void
setFilename(string fileName)
Sets the object's file name and path.
void
setHidden(bool value)
Hide/unhide the object.
void
setInternalName(string newInternalName)
Set the internal name of the object.
void
setIsExpanded(bool state)
Set whether the object has been marked as expanded. (in editor)
void
setIsSelected(bool state)
Set whether the object has been marked as selected. (in editor)
void
setLocked(bool value)
Lock/unlock the object in the editor.
void
setName(string newName)
Set the global name of the object.
void
setNameChangeAllowed(bool value)
Set whether this object can be renamed from its first name.
void
setSuperClassNamespace(string name)
Assign a superclass namespace to this object.
Detailed Description
Base class for almost all objects involved in the simulation.
Ungrouped
string Name
Optional global name of this object.
Object
string internalName
Optional name that may be used to lookup this object within a SimSet.
SimObject parentGroup
Group hierarchy parent of the object.
string class
Script class of object.
string superClass
Script super-class of object.
string className
Script class of object.
Editing
bool hidden
Whether the object is visible.
bool locked
Whether the object can be edited.
Persistence
bool canSave
Whether the object can be saved out. If false, the object is purely transient in nature.
bool canSaveDynamicFields
True if dynamic fields (added at runtime) should be saved. Defaults to true.
pid persistentId
The universally unique identifier for the object.
Callbacks
onInspectPostApply(SimObject obj)
Generic callback for when an object is edited.
Public Functions
assignFieldsFrom(SimObject fromObject)
Copy fields from another object onto this one. The objects must be of same type. Everything from the object will overwrite what's in this object; extra fields in this object will remain. This includes dynamic fields.
Parameters:
fromObject | The object from which to copy fields. |
assignPersistentId()
Assign a persistent ID to the object if it does not already have one.
call(string method, string args...)
Dynamically call a method on an object.
Parameters:
method | Name of method to call. |
args | Zero or more arguments for the method. |
The result of the method call.
clone()
Create a copy of this object.
An exact duplicate of this object.
deepClone()
Create a copy of this object and all its subobjects.
An exact duplicate of this object and all objects it references.
delete()
Delete and remove the object.
dump(bool detailed)
Dump a description of all fields and methods defined on this object to the console.
Parameters:
detailed | Whether to print detailed information about members. |
dumpClassHierarchy()
Dump the native C++ class hierarchy of this object's C++ class to the console.
dumpGroupHierarchy()
Dump the hierarchy of this object up to RootGroup to the console.
dumpMethods()
List the methods defined on this object.
Each description is a newline-separated vector with the following elements:
Minimum number of arguments.
Maximum number of arguments.
Prototype string.
Full script file path (if script method).
Line number of method definition in script (if script method).
Documentation string (not including prototype). This takes up the remainder of the vector.
return:An ArrayObject populated with (name,description) pairs of all methods defined on the object.
getCanSave()
Get whether the object will be included in saves.
True if the object will be saved; false otherwise.
getClassName()
Get the name of the C++ class which the object is an instance of.
The name of the C++ class of the object.
getClassNamespace()
Get the name of the class namespace assigned to this object.
The name of the 'class' namespace.
getDebugInfo()
Return some behind-the-scenes information on the object.
An ArrayObject filled with internal information about the object.
getDeclarationLine()
Get the line number at which the object is defined in its file.
The line number of the object's definition in script.
getDynamicField(int index)
Get a value of a dynamic field by index.
Parameters:
index | The index of the dynamic field. |
The value of the dynamic field at the given index or "".
getDynamicFieldCount()
Get the number of dynamic fields defined on the object.
The number of dynamic fields defined on the object.
getField(int index)
Retrieve the value of a static field by index.
Parameters:
index | The index of the static field. |
The value of the static field with the given index or "".
getFieldCount()
Get the number of static fields on the object.
The number of static fields defined on the object.
getFieldType(string fieldName)
Get the console type code of the given field.
The numeric type code for the underlying console type of the given field.
getFieldValue(string fieldName, int index)
Return the value of the given field on this object.
Parameters:
fieldName | The name of the field. If it includes a field index, the index is parsed out. |
index | Optional parameter to specify the index of an array field separately. |
The value of the given field or "" if undefined.
getFilename()
Returns the filename the object is attached to.
The name of the file the object is associated with; usually the file the object was loaded from.
getGroup()
Get the group that this object is contained in.
note:If not assigned to particular SimGroup, an object belongs to RootGroup.
The SimGroup object to which the object belongs.
getId()
Get the underlying unique numeric ID of the object.
note:Object IDs are unique only during single engine runs.
The unique numeric ID of the object.
getInternalName()
Get the internal name of the object.
The internal name of the object.
getName()
Get the global name of the object.
The global name assigned to the object.
getSuperClassNamespace()
Get the name of the superclass namespace assigned to this object.
The name of the 'superClass' namespace.
isChildOfGroup(SimGroup group)
Test whether the object belongs directly or indirectly to the given group.
Parameters:
group | The SimGroup object. |
True if the object is a child of the given group or a child of a group that the given group is directly or indirectly a child to.
isEditorOnly()
Return true if the object is only used by the editor.
True if this object exists only for the sake of editing.
isExpanded()
Get whether the object has been marked as expanded. (in editor)
True if the object is marked expanded.
isField(string fieldName)
Test whether the given field is defined on this object.
Parameters:
fieldName | The name of the field. |
True if the object implements the given field.
isInNamespaceHierarchy(string name)
Test whether the namespace of this object is a direct or indirect child to the given namespace.
Parameters:
name | The name of a namespace. |
True if the given namespace name is within the namespace hierarchy of this object.
isMemberOfClass(string className)
Test whether this object is a member of the specified class.
Parameters:
className | Name of a native C++ class. |
True if this object is an instance of the given C++ class or any of its super classes.
isMethod(string methodName)
Test whether the given method is defined on this object.
Parameters:
The | name of the method. |
True if the object implements the given method.
isNameChangeAllowed()
Get whether this object may be renamed.
True if this object can be renamed; false otherwise.
isSelected()
Get whether the object has been marked as selected. (in editor)
True if the object is currently selected.
save(string fileName, bool selectedOnly, string preAppendString)
Save out the object to the given file.
Parameters:
fileName | The name of the file to save to. |
selectedOnly | If true, only objects marked as selected will be saved out. |
preAppendString | Text which will be preprended directly to the object serialization. |
True | on success, false on failure. |
schedule(float time, string method, string args...)
Delay an invocation of a method.
Parameters:
time | The number of milliseconds after which to invoke the method. This is a soft limit. |
method | The method to call. |
args | The arguments with which to call the method. |
The numeric ID of the created schedule. Can be used to cancel the call.
setCanSave(bool value)
Set whether the object will be included in saves.
Parameters:
value | If true, the object will be included in saves; if false, it will be excluded. |
setClassNamespace(string name)
Assign a class namespace to this object.
Parameters:
name | The name of the 'class' namespace for this object. |
setEditorOnly(bool value)
Set/clear the editor-only flag on this object.
Parameters:
value | If true, the object is marked as existing only for the editor. |
setFieldType(string fieldName, string type)
Set the console type code for the given field.
Parameters:
fieldName | The name of the dynamic field to change to type for. |
type | The name of the console type. |
note:This only works for dynamic fields. Types of static fields cannot be changed.
setFieldValue(string fieldName, string value, int index)
Set the value of the given field on this object.
Parameters:
fieldName | The name of the field to assign to. If it includes an array index, the index will be parsed out. |
value | The new value to assign to the field. |
index | Optional argument to specify an index for an array field. |
True.
setFilename(string fileName)
Sets the object's file name and path.
Parameters:
fileName | The name of the file to associate this object with. |
setHidden(bool value)
Hide/unhide the object.
Parameters:
value | If true, the object will be hidden; if false, the object will be unhidden. |
setInternalName(string newInternalName)
Set the internal name of the object.
Parameters:
newInternalName | The new internal name for the object. |
setIsExpanded(bool state)
Set whether the object has been marked as expanded. (in editor)
Parameters:
state | True if the object is to be marked expanded; false if not. |
setIsSelected(bool state)
Set whether the object has been marked as selected. (in editor)
Parameters:
state | True if object is to be marked selected; false if not. |
setLocked(bool value)
Lock/unlock the object in the editor.
Parameters:
value | If true, the object will be locked; if false, the object will be unlocked. |
setName(string newName)
Set the global name of the object.
Parameters:
newName | The new global name to assign to the object. |
note:If name changing is disallowed on the object, the method will fail with a console error.
setNameChangeAllowed(bool value)
Set whether this object can be renamed from its first name.
Parameters:
value | If true, renaming is allowed for this object; if false, trying to change the name of the object will generate a console error. |
setSuperClassNamespace(string name)
Assign a superclass namespace to this object.
Parameters:
name | The name of the 'superClass' namespace for this object. |