Object¶
Interface | orca.core
Core engine host object.
Overview¶
The Object type is the root of the runtime type system. Every element that can appear in a scene, be manipulated through scripts, or participate in rendering and logic derives its basic functionality from Object. It establishes the fundamental contract that all other types extend, providing common lifecycle methods, hierarchy management, and component composition.
An Object is not tied to a specific visual or logical role by itself. Instead, it serves as a container for components, and these components define the actual capabilities of the instance. Higher-level types such as Node, Node2D, or ImageView are constructed by layering specialized components on top of the base Object.
Lifecycle¶
Manages object creation, initialization, update cycles, and destruction.
new() → nresults¶
Create new object.
Returns: nresults
awake()¶
Initializes the core component when it is loaded, an essential lifecycle method.
animate()¶
Runs object animations.
clear()¶
Clear all children of the object.
rebuild()¶
Rebuilds the object's body content asynchronously
Hierarchy¶
Navigates and manipulates the parent-child relationship tree.
addChild(Object, bool) → Object¶
Add a child object.
| Parameter | Type | Description |
|---|---|---|
child |
Object |
The child object to add to this object's hierarchy |
is_template |
bool |
If true, marks this object with the OF_TEMPLATE flag to indicate it contains template children |
Returns: Object — Returns added child object, for chaining calls
removeFromParent()¶
Destroys an object.
getParent() → Object¶
Gets the parent object in the hierarchy
Returns: Object — Pointer to parent object, or null if no parent
getFirstChild() → Object¶
Gets the first child object
Returns: Object — Pointer to first child object, or null if no children
getNext() → Object¶
Gets the next sibling object
Returns: Object — Pointer to next sibling object, or null if no next sibling
getRoot() → Object¶
Gets the root object of the hierarchy
Returns: Object — Pointer to root object
findChild(string, bool) → Object¶
Find a child object by name.
| Parameter | Type | Description |
|---|---|---|
name |
string |
The exact name of the child object to locate |
recursive |
bool |
If true, searches recursively through all descendants; if false, searches only immediate children |
Returns: Object — Pointer to the first child object found with the matching name, or null if no match is found
findByPath(string) → Object¶
Finds child object by hierarchical path
| Parameter | Type | Description |
|---|---|---|
name |
string |
Hierarchical path to the target object |
Returns: Object — Pointer to found object, or null if not found
findChildByID(uint) → Object¶
Finds a child object by its unique identifier
| Parameter | Type | Description |
|---|---|---|
id |
uint |
Unique identifier of the child object to find |
Returns: Object — Pointer to child object with matching ID, or null if not found
findChildByAlias(uint) → Object¶
Finds a child object by its alias identifier
| Parameter | Type | Description |
|---|---|---|
id |
uint |
Alias identifier of the child object to find |
Returns: Object — Pointer to child object with matching alias, or null if not found
findChildOfClass(uint) → Object¶
Finds a child object of a specific class
| Parameter | Type | Description |
|---|---|---|
classID |
uint |
The hashed identifier of the class to search for |
Returns: Object — Pointer to the matching child object, or null if not found
findParentOfClass(uint) → Object¶
Finds the nearest parent object of a specific class
| Parameter | Type | Description |
|---|---|---|
classID |
uint |
The hashed identifier of the class to search for |
Returns: Object — Pointer to the matching parent object, or null if not found
Messaging¶
Dispatches events and sends messages between objects.
post(string)¶
Posts a message asynchronously, bubbling through the object hierarchy.
| Parameter | Type | Description |
|---|---|---|
message |
string |
The name of the message to post |
send(string) → nresults¶
Sends a message synchronously to the current object and returns the result.
| Parameter | Type | Description |
|---|---|---|
message |
string |
The name of the message to send |
Returns: nresults — The LRESULT as integer, or nil if unhandled
Properties¶
Reads and writes typed properties, applying and observing changes.
updateProperties()¶
Updates object properties.
emitPropertyChangedEvents()¶
Emits onPropertyChanged events by comparing to previous values.
findImplicitProperty(string) → PropertyType¶
Looks up a property by context-driven syntax, like "Column" instead of "Grid.Column"
| Parameter | Type | Description |
|---|---|---|
name |
string |
The name of the property to find |
Returns: PropertyType — Pointer to a property type, null if not found
findExplicitProperty(string) → PropertyType¶
Looks up a property by full syntax, like "Grid.Column" instead of "Column"
| Parameter | Type | Description |
|---|---|---|
name |
string |
The full name of the property to find |
Returns: PropertyType — Pointer to a property type, null if not found
attachPropertyProgram(string, string, PropertyAttribute, BindingMode, bool) → bool¶
Attaches a property program to the specified property
| Parameter | Type | Description |
|---|---|---|
name |
string |
The full name of the property to attach the program to |
program |
string |
The program or expression to attach to the property |
attribute |
PropertyAttribute |
The attribute of the property to attach the program to (e.g., Value, Color, etc.) |
mode |
BindingMode |
The binding mode for the property program (e.g., OneWay, TwoWay, OneWayToSource) |
enabled |
bool |
Whether the property program is enabled |
Returns: bool — True if the property program was successfully attached, false otherwise
findPropertyByPath(string) → Property¶
Finds a property by navigating a hierarchical path
| Parameter | Type | Description |
|---|---|---|
path |
string |
Slash-separated path to the property (e.g., "Child1/Child2/PropertyName") |
Returns: Property — Pointer to the property if found, or null if the path is invalid
getProperties() → Property¶
Gets the properties collection
Returns: Property — Pointer to properties collection
getInteger(uint, int) → int¶
Gets an integer property value by identifier
| Parameter | Type | Description |
|---|---|---|
ident |
uint |
The hashed long identifier "ObjectClass.PropertyName" of the property to retrieve |
fallback |
int |
The value to return if the property is not found or incompatible |
Returns: int — The property value if found and compatible, otherwise the fallback value
Layout¶
Controls position, size, and dirty-flag propagation for layout passes.
setDirty()¶
Sets object dirty and queues it for recalculation
clearDirtyFlags()¶
Clears dirty flags, marks object as recalculated
Style¶
Manages style sheets and resolves computed style values.
addStyleRule(string)¶
Add a stylesheet to the object.
| Parameter | Type | Description |
|---|---|---|
source |
string |
Name or path of the stylesheet resource to load and apply to this object |
getStyle() → uint¶
Retrieves object style flags
Returns: uint — Current style flags as bitmask
setStyle(uint)¶
Sets object style flags
| Parameter | Type | Description |
|---|---|---|
style |
uint |
Style flags bitmask to apply |
Animation¶
Attaches, plays, and transitions keyframe animations on this object.
doTween(string, int, InterpolationMode, Easing)¶
Tween an object property over time.
| Parameter | Type | Description |
|---|---|---|
property |
string |
Property to tween |
duration |
int |
Duration of the tween in seconds |
ipo |
InterpolationMode |
Interpolation mode for the tween |
easing |
Easing |
Easing function for the tween |
addComponentByName(string)¶
Attaches a component class to this object.
| Parameter | Type | Description |
|---|---|---|
className |
string |
The class name of the component to attach (e.g. "AnimationPlayer") |
Focus and Input¶
Controls focus state, hover, modal presentation, and timers.
setFocus()¶
Set focus on the object.
isFocused() → bool¶
Checks if this object currently has focus
Returns: bool — True if this object has focus, false otherwise
setHover()¶
Sets the hover state for an object
showModal(Object) → nresults¶
Sets or clears the modal child object
| Parameter | Type | Description |
|---|---|---|
modal |
Object |
The object to set as modal, or null to clear the current modal |
Returns: nresults — Starts a coroutine
setTimer(int) → int¶
Set a timer on the object.
| Parameter | Type | Description |
|---|---|---|
duration |
int |
Duration of the timer in milliseconds |
Returns: int — Handle or identifier for the created timer, which can be used to control or cancel the timer before it expires
Identity and State¶
Accesses name, class, flags, aliases, text content, and Lua state.
getName() → string¶
Retrieves the object's name identifier
Returns: string — Current name of the object
setName(string)¶
Sets the object's name identifier
| Parameter | Type | Description |
|---|---|---|
name |
string |
New name to assign to the object |
getClassName() → string¶
Returns the object's class type name
Returns: string — Class name of the object type
setClassName(string)¶
Sets the class name of the object
| Parameter | Type | Description |
|---|---|---|
classID |
string |
The class name to assign to the object |
checkName(string) → bool¶
Checks if object has a specific name
| Parameter | Type | Description |
|---|---|---|
name |
string |
Name to check against |
Returns: bool — True if object name matches the provided string
getFlags() → uint¶
Gets the object flags
Returns: uint — Bitfield of object flags
setFlags(uint)¶
Sets the object flags
| Parameter | Type | Description |
|---|---|---|
flags |
uint |
New bitfield value for the object flags |
getIdentifier() → uint¶
Gets the identifier of the object
Returns: uint — Hashed identifier of the object
getAlias() → uint¶
Gets the alias identifier
Returns: uint — Alias identifier
getSourceFile() → string¶
Gets the source file path
Returns: string — Path to the source file
setSourceFile(string)¶
Sets the source file path of the object
| Parameter | Type | Description |
|---|---|---|
path |
string |
The file path to associate with the object |
getTextContent() → string¶
Gets the text content of the object
Returns: string — Text content of the object
setTextContent(string)¶
Sets the text content of the object
| Parameter | Type | Description |
|---|---|---|
text |
string |
The text content to display |
getTimestamp() → long¶
Gets the last modified timestamp
Returns: long — Timestamp of last dirty marking
getLuaObject() → uint¶
Gets the Lua object reference
Returns: uint — Lua registry index for the object
getDomain() → lua_State¶
Gets the domain of the object
Returns: lua_State — The domain of the object
Prefabs and Aliases¶
Loads prefab templates and manages named child aliases.
instantiate() → Object¶
Instantiates a new object from this prefab.
Returns: Object — Returns the instantiated object
loadPrefabs()¶
Loads and instantiates prefabs.
isPrefabView() → bool¶
Checks if this object is a prefab view container
Returns: bool — True if this object is a PrefabView, false otherwise
Messages¶
Create¶
Sent once when the component is first created and attached to an object.
Start¶
Sent after the entire object hierarchy has been loaded, signalling that the scene is ready for logic execution.
Animate¶
Requested when an animation update is needed.
ThemeChanged¶
Sent when the active theme is changed, allowing components to refresh their styled resources.
| Field | Type | Description |
|---|---|---|
recursive |
bool |
Whether to propagate the theme change to child objects |
PropertyChanged¶
Sent when a property value on the object changes.
| Field | Type | Description |
|---|---|---|
Property |
Property |
The property that changed |
Attached¶
Sent when the object is attached to a parent object in the hierarchy.
Release¶
Sent when the object is being released and its resources should be freed.
Destroy¶
Sent just before the object is destroyed and removed from the scene.
Timer¶
Sent on each timer tick registered for this object.
| Field | Type | Description |
|---|---|---|
timerId |
int |
Timer identifier returned by setTimer |