2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2018-07-31 20:13:10 +02:00
<class name= "Object" category= "Core" version= "3.0.7" >
2017-09-12 22:42:36 +02:00
<brief_description >
Base class for all non built-in types.
</brief_description>
<description >
Base class for all non built-in types. Everything not a built-in type starts the inheritance chain from this class.
Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++).
2017-10-14 12:45:26 +02:00
Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
2017-09-12 22:42:36 +02:00
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
</description>
<tutorials >
</tutorials>
<demos >
</demos>
<methods >
<method name= "_get" qualifiers= "virtual" >
<return type= "void" >
</return>
<argument index= "0" name= "property" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns the given property. Returns [code]null[/code] if the [code]property[/code] does not exist.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "_get_property_list" qualifiers= "virtual" >
<return type= "Array" >
</return>
<description >
2017-11-15 18:45:34 +01:00
Returns the object's property list as an [Array] of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "_init" qualifiers= "virtual" >
<return type= "void" >
</return>
<description >
2017-11-08 00:23:34 +01:00
The virtual method called upon initialization.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "_notification" qualifiers= "virtual" >
<return type= "void" >
</return>
<argument index= "0" name= "what" type= "int" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Notify the object internally using an ID.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "_set" qualifiers= "virtual" >
<return type= "bool" >
</return>
<argument index= "0" name= "property" type= "String" >
</argument>
<argument index= "1" name= "value" type= "Variant" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "add_user_signal" >
<return type= "void" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<argument index= "1" name= "arguments" type= "Array" default= "[ ]" >
</argument>
<description >
2017-11-15 18:45:34 +01:00
Adds a user-defined [code]signal[/code]. Arguments are optional, but can be added as an [Array] of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "call" qualifiers= "vararg" >
<return type= "Variant" >
</return>
<argument index= "0" name= "method" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Calls the [code]method[/code] on the object and returns a result. Pass parameters as a comma separated list.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "call_deferred" qualifiers= "vararg" >
<return type= "Variant" >
</return>
<argument index= "0" name= "method" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Calls the [code]method[/code] on the object during idle time and returns a result. Pass parameters as a comma separated list.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "callv" >
<return type= "Variant" >
</return>
<argument index= "0" name= "method" type= "String" >
</argument>
<argument index= "1" name= "arg_array" type= "Array" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Calls the [code]method[/code] on the object and returns a result. Pass parameters as an [Array].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "can_translate_messages" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if the object can translate strings.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "connect" >
<return type= "int" enum= "Error" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<argument index= "1" name= "target" type= "Object" >
</argument>
<argument index= "2" name= "method" type= "String" >
</argument>
<argument index= "3" name= "binds" type= "Array" default= "[ ]" >
</argument>
<argument index= "4" name= "flags" type= "int" default= "0" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Connects a [code]signal[/code] to a [code]method[/code] on a [code]target[/code] object. Pass optional [code]binds[/code] to the call. Use [code]flags[/code] to set deferred or one shot connections. See [code]CONNECT_*[/code] constants. A [code]signal[/code] can only be connected once to a [code]method[/code]. It will throw an error if already connected. To avoid this, first use [method is_connected] to check for existing connections.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "disconnect" >
<return type= "void" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<argument index= "1" name= "target" type= "Object" >
</argument>
<argument index= "2" name= "method" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "emit_signal" qualifiers= "vararg" >
<return type= "Variant" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Emits the given [code]signal[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "free" >
<return type= "void" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Deletes the object from memory.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get" qualifiers= "const" >
<return type= "Variant" >
</return>
<argument index= "0" name= "property" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns a [Variant] for a [code]property[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_class" qualifiers= "const" >
<return type= "String" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's class as a [String].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_incoming_connections" qualifiers= "const" >
<return type= "Array" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns an [Array] of dictionaries with information about signals that are connected to the object.
2017-09-12 22:42:36 +02:00
Inside each [Dictionary] there are 3 fields:
- "source" is a reference to signal emitter.
- "signal_name" is name of connected signal.
- "method_name" is a name of method to which signal is connected.
</description>
</method>
2017-11-24 09:16:27 +01:00
<method name= "get_indexed" qualifiers= "const" >
<return type= "Variant" >
</return>
<argument index= "0" name= "property" type= "NodePath" >
</argument>
<description >
2018-08-11 15:42:44 +02:00
Get indexed object property by String.
Property indices get accessed with colon seperation, for example: [code]position:x[/code]
2017-11-24 09:16:27 +01:00
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "get_instance_id" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's unique instance ID.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_meta" qualifiers= "const" >
<return type= "Variant" >
</return>
<argument index= "0" name= "name" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's metadata for the given [code]name[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_meta_list" qualifiers= "const" >
<return type= "PoolStringArray" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's metadata as a [PoolStringArray].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_method_list" qualifiers= "const" >
<return type= "Array" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's methods and their signatures as an [Array].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_property_list" qualifiers= "const" >
<return type= "Array" >
</return>
<description >
2017-11-15 18:45:34 +01:00
Returns the list of properties as an [Array] of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_script" qualifiers= "const" >
<return type= "Reference" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the object's [Script] or [code]null[/code] if one doesn't exist.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_signal_connection_list" qualifiers= "const" >
<return type= "Array" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns an [Array] of connections for the given [code]signal[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_signal_list" qualifiers= "const" >
<return type= "Array" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns the list of signals as an [Array] of dictionaries.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "has_meta" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "name" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if a metadata is found with the given [code]name[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "has_method" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "method" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if the object contains the given [code]method[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "has_user_signal" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if the given user-defined [code]signal[/code] exists.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_blocking_signals" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if signal emission blocking is enabled.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_class" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "type" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if the object inherits from the given [code]type[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_connected" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "signal" type= "String" >
</argument>
<argument index= "1" name= "target" type= "Object" >
</argument>
<argument index= "2" name= "method" type= "String" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if a connection exists for a given [code]signal[/code], [code]target[/code], and [code]method[/code].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_queued_for_deletion" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2017-11-08 00:23:34 +01:00
Returns [code]true[/code] if the [code]queue_free[/code] method was called for the object.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "notification" >
<return type= "void" >
</return>
<argument index= "0" name= "what" type= "int" >
</argument>
<argument index= "1" name= "reversed" type= "bool" default= "false" >
</argument>
<description >
Notify the object of something.
</description>
</method>
<method name= "property_list_changed_notify" >
<return type= "void" >
</return>
<description >
</description>
</method>
<method name= "set" >
<return type= "void" >
</return>
<argument index= "0" name= "property" type= "String" >
</argument>
<argument index= "1" name= "value" type= "Variant" >
</argument>
<description >
Set property into the object.
</description>
</method>
<method name= "set_block_signals" >
<return type= "void" >
</return>
<argument index= "0" name= "enable" type= "bool" >
</argument>
<description >
If set to true, signal emission is blocked.
</description>
</method>
2017-11-24 09:16:27 +01:00
<method name= "set_indexed" >
<return type= "void" >
</return>
<argument index= "0" name= "property" type= "NodePath" >
</argument>
<argument index= "1" name= "value" type= "Variant" >
</argument>
<description >
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "set_message_translation" >
<return type= "void" >
</return>
<argument index= "0" name= "enable" type= "bool" >
</argument>
<description >
2017-11-08 00:23:34 +01:00
Define whether the object can translate strings (with calls to [method tr]). Default is true.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "set_meta" >
<return type= "void" >
</return>
<argument index= "0" name= "name" type= "String" >
</argument>
<argument index= "1" name= "value" type= "Variant" >
</argument>
<description >
Set a metadata into the object. Metadata is serialized. Metadata can be [i]anything[/i].
</description>
</method>
<method name= "set_script" >
<return type= "void" >
</return>
<argument index= "0" name= "script" type= "Reference" >
</argument>
<description >
Set a script into the object, scripts extend the object functionality.
</description>
</method>
<method name= "tr" qualifiers= "const" >
<return type= "String" >
</return>
<argument index= "0" name= "message" type= "String" >
</argument>
<description >
Translate a message. Only works if message translation is enabled (which it is by default). See [method set_message_translation].
</description>
</method>
</methods>
<signals >
<signal name= "script_changed" >
<description >
2018-04-17 16:18:57 +02:00
Emitted whenever the script of the Object is changed.
2017-09-12 22:42:36 +02:00
</description>
</signal>
</signals>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "NOTIFICATION_POSTINITIALIZE" value= "0" >
2017-09-12 22:42:36 +02:00
Called right when the object is initialized. Not available in script.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "NOTIFICATION_PREDELETE" value= "1" >
2017-09-12 22:42:36 +02:00
Called before the object is about to be deleted.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "CONNECT_DEFERRED" value= "1" enum= "ConnectFlags" >
2017-09-12 22:42:36 +02:00
Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "CONNECT_PERSIST" value= "2" enum= "ConnectFlags" >
2017-09-12 22:42:36 +02:00
Persisting connections are saved when the object is serialized to file.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "CONNECT_ONESHOT" value= "4" enum= "ConnectFlags" >
2017-09-12 22:42:36 +02:00
One shot connections disconnect themselves after emission.
</constant>
</constants>
</class>