.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Object: Object ====== **Inherited By:** :ref:`Reference`, :ref:`Physics2DServer`, :ref:`Input`, :ref:`Node`, :ref:`Geometry`, :ref:`ARVRPositionalTracker`, :ref:`TreeItem`, :ref:`PhysicsDirectBodyState`, :ref:`ARVRServer`, :ref:`PhysicsDirectSpaceState`, :ref:`Engine`, :ref:`Physics2DDirectSpaceState`, :ref:`MainLoop`, :ref:`InputMap`, :ref:`UndoRedo`, :ref:`PhysicsServer`, :ref:`ProjectSettings`, :ref:`ResourceSaver`, :ref:`Performance`, :ref:`ResourceLoader`, :ref:`AudioServer`, :ref:`VisualServer`, :ref:`IP`, :ref:`ClassDB`, :ref:`OS`, :ref:`EditorSelection`, :ref:`Physics2DDirectBodyState`, :ref:`TranslationServer`, :ref:`EditorFileSystemDirectory` **Category:** Core Brief Description ----------------- Base class for all non built-in types. Member Functions ---------------- +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`XL_MESSAGE` **(** :ref:`String` message **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_get` **(** :ref:`String` property **)** virtual | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`_get_property_list` **(** **)** virtual | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_init` **(** **)** virtual | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_notification` **(** :ref:`int` what **)** virtual | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_set` **(** :ref:`String` property, :ref:`Variant` value **)** virtual | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_user_signal` **(** :ref:`String` signal, :ref:`Array` arguments=Array() **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`call` **(** :ref:`String` method, :ref:`Variant` arg0=NULL, :ref:`Variant` arg1=NULL, :ref:`Variant` arg2=NULL, :ref:`Variant` arg3=NULL, :ref:`Variant` arg4=NULL, :ref:`Variant` arg5=NULL, :ref:`Variant` arg6=NULL, :ref:`Variant` arg7=NULL, :ref:`Variant` arg8=NULL, :ref:`Variant` arg9=NULL **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`call_deferred` **(** :ref:`String` method, :ref:`Variant` arg0=NULL, :ref:`Variant` arg1=NULL, :ref:`Variant` arg2=NULL, :ref:`Variant` arg3=NULL, :ref:`Variant` arg4=NULL **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`callv` **(** :ref:`String` method, :ref:`Array` arg_array **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_translate_messages` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`connect` **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method, :ref:`Array` binds=Array(), :ref:`int` flags=0 **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`disconnect` **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`emit_signal` **(** :ref:`String` signal, :ref:`Variant` arg0=NULL, :ref:`Variant` arg1=NULL, :ref:`Variant` arg2=NULL, :ref:`Variant` arg3=NULL, :ref:`Variant` arg4=NULL **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`free` **(** **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`get` **(** :ref:`String` property **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_instance_ID` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_meta` **(** :ref:`String` name **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringArray` | :ref:`get_meta_list` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_method_list` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_property_list` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Script` | :ref:`get_script` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_signal_connection_list` **(** :ref:`String` signal **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_signal_list` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_type` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_meta` **(** :ref:`String` name **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_method` **(** :ref:`String` method **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_user_signal` **(** :ref:`String` signal **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_blocking_signals` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_connected` **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_queued_for_deletion` **(** **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_type` **(** :ref:`String` type **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`notification` **(** :ref:`int` what, :ref:`bool` reversed=false **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`property_list_changed_notify` **(** **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set` **(** :ref:`String` property, :ref:`Variant` value **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_block_signals` **(** :ref:`bool` enable **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_message_translation` **(** :ref:`bool` enable **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_meta` **(** :ref:`String` name, :ref:`Variant` value **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_script` **(** :ref:`Script` script **)** | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`tr` **(** :ref:`String` message **)** const | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **script_changed** **(** **)** Numeric Constants ----------------- - **NOTIFICATION_POSTINITIALIZE** = **0** --- Called right when the object is initialized. Not available in script. - **NOTIFICATION_PREDELETE** = **1** --- Called before the object is about to be deleted. - **CONNECT_DEFERRED** = **1** --- Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time. - **CONNECT_PERSIST** = **2** --- Persisting connections are saved when the object is serialized to file. - **CONNECT_ONESHOT** = **4** --- One shot connections disconnect themselves after emission. 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 :ref:`free` function from the script or delete from C++). Some derivates add memory management, such as :ref:`Reference` (which keeps a reference count and deletes itself automatically when no longer referenced) and :ref:`Node`, which deletes the children tree when deleted. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in :ref:`_get_property_list` and handled in :ref:`_get` and :ref:`_set`. However, scripting languages and C++ have simpler means to export them. Objects also receive notifications (:ref:`_notification`). Notifications are a simple way to notify the object about simple events, so they can all be handled together. Member Function Description --------------------------- .. _class_Object__get: - void **_get** **(** :ref:`String` property **)** virtual Return a property, return null if the property does not exist. .. _class_Object__get_property_list: - :ref:`Array` **_get_property_list** **(** **)** virtual Return the property list, array of dictionaries, dictionaries must contain: name:String, type:int (see TYPE\_\* enum in :ref:`@Global Scope`) and optionally: hint:int (see PROPERTY_HINT\_\* in :ref:`@Global Scope`), hint_string:String, usage:int (see PROPERTY_USAGE\_\* in :ref:`@Global Scope`). .. _class_Object__init: - void **_init** **(** **)** virtual .. _class_Object__notification: - void **_notification** **(** :ref:`int` what **)** virtual Notification request, the notification id is received. .. _class_Object__set: - :ref:`bool` **_set** **(** :ref:`String` property, :ref:`Variant` value **)** virtual Set a property. Return true if the property was found. .. _class_Object_add_user_signal: - void **add_user_signal** **(** :ref:`String` signal, :ref:`Array` arguments=null **)** Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from :ref:`@Global Scope` TYPE\_\*). .. _class_Object_call: - :ref:`Variant` **call** **(** :ref:`String` method **)** vararg .. _class_Object_call_deferred: - :ref:`Variant` **call_deferred** **(** :ref:`String` method **)** vararg .. _class_Object_callv: - :ref:`Variant` **callv** **(** :ref:`String` method, :ref:`Array` arg_array **)** .. _class_Object_can_translate_messages: - :ref:`bool` **can_translate_messages** **(** **)** const Return true if this object can translate strings. .. _class_Object_connect: - :ref:`int` **connect** **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method, :ref:`Array` binds=null, :ref:`int` flags=null **)** Connect a signal to a method at a target (member function). Binds are optional and are passed as extra arguments to the call. Flags specify optional deferred or one shot connections, see enum CONNECT\_\*. A signal can only be connected once to a method, and it will throw an error if already connected. If you want to avoid this, use :ref:`is_connected` to check. .. _class_Object_disconnect: - void **disconnect** **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method **)** Disconnect a signal from a method. .. _class_Object_emit_signal: - :ref:`Variant` **emit_signal** **(** :ref:`String` signal **)** vararg .. _class_Object_free: - void **free** **(** **)** .. _class_Object_get: - :ref:`Variant` **get** **(** :ref:`String` property **)** const Get a property from the object. .. _class_Object_get_class: - :ref:`String` **get_class** **(** **)** const Return the class of the object as a string. .. _class_Object_get_incoming_connections: - :ref:`Array` **get_incoming_connections** **(** **)** const Returns an :ref:`Array` of dictionaries with informations about signals that are connected to this object. Inside each :ref:`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. .. _class_Object_get_instance_id: - :ref:`int` **get_instance_id** **(** **)** const Return the instance ID. All objects have a unique instance ID. .. _class_Object_get_meta: - :ref:`Variant` **get_meta** **(** :ref:`String` name **)** const Return a metadata from the object. .. _class_Object_get_meta_list: - :ref:`PoolStringArray` **get_meta_list** **(** **)** const Return the list of metadata in the object. .. _class_Object_get_method_list: - :ref:`Array` **get_method_list** **(** **)** const .. _class_Object_get_property_list: - :ref:`Array` **get_property_list** **(** **)** const Return the list of properties as an array of dictionaries, dictionaries contain: name:String, type:int (see TYPE\_\* enum in :ref:`@Global Scope`) and optionally: hint:int (see PROPERTY_HINT\_\* in :ref:`@Global Scope`), hint_string:String, usage:int (see PROPERTY_USAGE\_\* in :ref:`@Global Scope`). .. _class_Object_get_script: - :ref:`Reference` **get_script** **(** **)** const Return the object script (or null if it doesn't have one). .. _class_Object_get_signal_connection_list: - :ref:`Array` **get_signal_connection_list** **(** :ref:`String` signal **)** const .. _class_Object_get_signal_list: - :ref:`Array` **get_signal_list** **(** **)** const Return the list of signals as an array of dictionaries. .. _class_Object_has_meta: - :ref:`bool` **has_meta** **(** :ref:`String` name **)** const Return true if a metadata is found with the requested name. .. _class_Object_has_method: - :ref:`bool` **has_method** **(** :ref:`String` method **)** const .. _class_Object_has_user_signal: - :ref:`bool` **has_user_signal** **(** :ref:`String` signal **)** const .. _class_Object_is_blocking_signals: - :ref:`bool` **is_blocking_signals** **(** **)** const Return true if signal emission blocking is enabled. .. _class_Object_is_class: - :ref:`bool` **is_class** **(** :ref:`String` type **)** const Check the class of the object against a string (including inheritance). .. _class_Object_is_connected: - :ref:`bool` **is_connected** **(** :ref:`String` signal, :ref:`Object` target, :ref:`String` method **)** const Return true if a connection exists for a given signal and target/method. .. _class_Object_is_queued_for_deletion: - :ref:`bool` **is_queued_for_deletion** **(** **)** const .. _class_Object_notification: - void **notification** **(** :ref:`int` what, :ref:`bool` reversed=null **)** Notify the object of something. .. _class_Object_property_list_changed_notify: - void **property_list_changed_notify** **(** **)** .. _class_Object_set: - void **set** **(** :ref:`String` property, :ref:`Variant` value **)** Set property into the object. .. _class_Object_set_block_signals: - void **set_block_signals** **(** :ref:`bool` enable **)** If set to true, signal emission is blocked. .. _class_Object_set_message_translation: - void **set_message_translation** **(** :ref:`bool` enable **)** Define whether this object can translate strings (with calls to :ref:`tr`). Default is true. .. _class_Object_set_meta: - void **set_meta** **(** :ref:`String` name, :ref:`Variant` value **)** Set a metadata into the object. Metadata is serialized. Metadata can be *anything*. .. _class_Object_set_script: - void **set_script** **(** :ref:`Reference` script **)** Set a script into the object, scripts extend the object functionality. .. _class_Object_tr: - :ref:`String` **tr** **(** :ref:`String` message **)** const Translate a message. Only works if message translation is enabled (which it is by default). See :ref:`set_message_translation`.