mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 17:28:58 +00:00
classref: Sync with current master branch (96cdbbe)
This commit is contained in:
+70
-70
@@ -19,17 +19,17 @@ Base class for all other classes in the engine.
|
||||
Description
|
||||
-----------
|
||||
|
||||
An advanced :ref:`Variant<class_Variant>` type. All classes in the engine inherit from Object. Each class may define new properties, methods or signals, which are available to all inheriting classes. For example, a :ref:`Sprite2D<class_Sprite2D>` instance is able to call :ref:`Node.add_child<class_Node_method_add_child>` because it inherits from :ref:`Node<class_Node>`.
|
||||
An advanced :ref:`Variant<class_Variant>` type. All classes in the engine inherit from Object. Each class may define new properties, methods or signals, which are available to all inheriting classes. For example, a :ref:`Sprite2D<class_Sprite2D>` instance is able to call :ref:`Node.add_child()<class_Node_method_add_child>` because it inherits from :ref:`Node<class_Node>`.
|
||||
|
||||
You can create new instances, using ``Object.new()`` in GDScript, or ``new GodotObject`` in C#.
|
||||
|
||||
To delete an Object instance, call :ref:`free<class_Object_method_free>`. This is necessary for most classes inheriting Object, because they do not manage memory on their own, and will otherwise cause memory leaks when no longer in use. There are a few classes that perform memory management. For example, :ref:`RefCounted<class_RefCounted>` (and by extension :ref:`Resource<class_Resource>`) deletes itself when no longer referenced, and :ref:`Node<class_Node>` deletes its children when freed.
|
||||
To delete an Object instance, call :ref:`free()<class_Object_method_free>`. This is necessary for most classes inheriting Object, because they do not manage memory on their own, and will otherwise cause memory leaks when no longer in use. There are a few classes that perform memory management. For example, :ref:`RefCounted<class_RefCounted>` (and by extension :ref:`Resource<class_Resource>`) deletes itself when no longer referenced, and :ref:`Node<class_Node>` deletes its children when freed.
|
||||
|
||||
Objects can have a :ref:`Script<class_Script>` attached to them. Once the :ref:`Script<class_Script>` is instantiated, it effectively acts as an extension to the base class, allowing it to define and inherit new properties, methods and signals.
|
||||
|
||||
Inside a :ref:`Script<class_Script>`, :ref:`_get_property_list<class_Object_private_method__get_property_list>` may be overridden to customize properties in several ways. This allows them to be available to the editor, display as lists of options, sub-divide into groups, save on disk, etc. Scripting languages offer easier ways to customize properties, such as with the :ref:`@GDScript.@export<class_@GDScript_annotation_@export>` annotation.
|
||||
Inside a :ref:`Script<class_Script>`, :ref:`_get_property_list()<class_Object_private_method__get_property_list>` may be overridden to customize properties in several ways. This allows them to be available to the editor, display as lists of options, sub-divide into groups, save on disk, etc. Scripting languages offer easier ways to customize properties, such as with the :ref:`@GDScript.@export<class_@GDScript_annotation_@export>` annotation.
|
||||
|
||||
Godot is very dynamic. An object's script, and therefore its properties, methods and signals, can be changed at run-time. Because of this, there can be occasions where, for example, a property required by a method may not exist. To prevent run-time errors, see methods such as :ref:`set<class_Object_method_set>`, :ref:`get<class_Object_method_get>`, :ref:`call<class_Object_method_call>`, :ref:`has_method<class_Object_method_has_method>`, :ref:`has_signal<class_Object_method_has_signal>`, etc. Note that these methods are **much** slower than direct references.
|
||||
Godot is very dynamic. An object's script, and therefore its properties, methods and signals, can be changed at run-time. Because of this, there can be occasions where, for example, a property required by a method may not exist. To prevent run-time errors, see methods such as :ref:`set()<class_Object_method_set>`, :ref:`get()<class_Object_method_get>`, :ref:`call()<class_Object_method_call>`, :ref:`has_method()<class_Object_method_has_method>`, :ref:`has_signal()<class_Object_method_has_signal>`, etc. Note that these methods are **much** slower than direct references.
|
||||
|
||||
In GDScript, you can also check if a given property, method, or signal name exists in an object with the ``in`` operator:
|
||||
|
||||
@@ -41,15 +41,15 @@ In GDScript, you can also check if a given property, method, or signal name exis
|
||||
print("tree_entered" in node) # Prints true
|
||||
print("unknown" in node) # Prints false
|
||||
|
||||
Notifications are :ref:`int<class_int>` constants commonly sent and received by objects. For example, on every rendered frame, the :ref:`SceneTree<class_SceneTree>` notifies nodes inside the tree with a :ref:`Node.NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>`. The nodes receive it and may call :ref:`Node._process<class_Node_private_method__process>` to update. To make use of notifications, see :ref:`notification<class_Object_method_notification>` and :ref:`_notification<class_Object_private_method__notification>`.
|
||||
Notifications are :ref:`int<class_int>` constants commonly sent and received by objects. For example, on every rendered frame, the :ref:`SceneTree<class_SceneTree>` notifies nodes inside the tree with a :ref:`Node.NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>`. The nodes receive it and may call :ref:`Node._process()<class_Node_private_method__process>` to update. To make use of notifications, see :ref:`notification()<class_Object_method_notification>` and :ref:`_notification()<class_Object_private_method__notification>`.
|
||||
|
||||
Lastly, every object can also contain metadata (data about data). :ref:`set_meta<class_Object_method_set_meta>` can be useful to store information that the object itself does not depend on. To keep your code clean, making excessive use of metadata is discouraged.
|
||||
Lastly, every object can also contain metadata (data about data). :ref:`set_meta()<class_Object_method_set_meta>` can be useful to store information that the object itself does not depend on. To keep your code clean, making excessive use of metadata is discouraged.
|
||||
|
||||
\ **Note:** Unlike references to a :ref:`RefCounted<class_RefCounted>`, references to an object stored in a variable can become invalid without being set to ``null``. To check if an object has been deleted, do *not* compare it against ``null``. Instead, use :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`. It's also recommended to inherit from :ref:`RefCounted<class_RefCounted>` for classes storing data instead of **Object**.
|
||||
\ **Note:** Unlike references to a :ref:`RefCounted<class_RefCounted>`, references to an object stored in a variable can become invalid without being set to ``null``. To check if an object has been deleted, do *not* compare it against ``null``. Instead, use :ref:`@GlobalScope.is_instance_valid()<class_@GlobalScope_method_is_instance_valid>`. It's also recommended to inherit from :ref:`RefCounted<class_RefCounted>` for classes storing data instead of **Object**.
|
||||
|
||||
\ **Note:** The ``script`` is not exposed like most properties. To set or get an object's :ref:`Script<class_Script>` in code, use :ref:`set_script<class_Object_method_set_script>` and :ref:`get_script<class_Object_method_get_script>`, respectively.
|
||||
\ **Note:** The ``script`` is not exposed like most properties. To set or get an object's :ref:`Script<class_Script>` in code, use :ref:`set_script()<class_Object_method_set_script>` and :ref:`get_script()<class_Object_method_get_script>`, respectively.
|
||||
|
||||
\ **Note:** In a boolean context, an **Object** will evaluate to ``false`` if it is equal to ``null`` or it has been freed. Otherwise, an **Object** will always evaluate to ``true``. See also :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`.
|
||||
\ **Note:** In a boolean context, an **Object** will evaluate to ``false`` if it is equal to ``null`` or it has been freed. Otherwise, an **Object** will always evaluate to ``true``. See also :ref:`@GlobalScope.is_instance_valid()<class_@GlobalScope_method_is_instance_valid>`.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
@@ -211,7 +211,7 @@ Signals
|
||||
|
||||
**property_list_changed**\ (\ ) :ref:`🔗<class_Object_signal_property_list_changed>`
|
||||
|
||||
Emitted when :ref:`notify_property_list_changed<class_Object_method_notify_property_list_changed>` is called.
|
||||
Emitted when :ref:`notify_property_list_changed()<class_Object_method_notify_property_list_changed>` is called.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -256,7 +256,7 @@ Deferred connections trigger their :ref:`Callable<class_Callable>`\ s on idle ti
|
||||
|
||||
:ref:`ConnectFlags<enum_Object_ConnectFlags>` **CONNECT_PERSIST** = ``2``
|
||||
|
||||
Persisting connections are stored when the object is serialized (such as when using :ref:`PackedScene.pack<class_PackedScene_method_pack>`). In the editor, connections created through the Node dock are always persisting.
|
||||
Persisting connections are stored when the object is serialized (such as when using :ref:`PackedScene.pack()<class_PackedScene_method_pack>`). In the editor, connections created through the Node dock are always persisting.
|
||||
|
||||
.. _class_Object_constant_CONNECT_ONE_SHOT:
|
||||
|
||||
@@ -322,9 +322,9 @@ Method Descriptions
|
||||
|
||||
:ref:`Variant<class_Variant>` **_get**\ (\ property\: :ref:`StringName<class_StringName>`\ ) |virtual| :ref:`🔗<class_Object_private_method__get>`
|
||||
|
||||
Override this method to customize the behavior of :ref:`get<class_Object_method_get>`. Should return the given ``property``'s value, or ``null`` if the ``property`` should be handled normally.
|
||||
Override this method to customize the behavior of :ref:`get()<class_Object_method_get>`. Should return the given ``property``'s value, or ``null`` if the ``property`` should be handled normally.
|
||||
|
||||
Combined with :ref:`_set<class_Object_private_method__set>` and :ref:`_get_property_list<class_Object_private_method__get_property_list>`, this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property must be present in :ref:`get_property_list<class_Object_method_get_property_list>`, otherwise this method will not be called.
|
||||
Combined with :ref:`_set()<class_Object_private_method__set>` and :ref:`_get_property_list()<class_Object_private_method__get_property_list>`, this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property must be present in :ref:`get_property_list()<class_Object_method_get_property_list>`, otherwise this method will not be called.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -379,9 +379,9 @@ Combined with :ref:`_set<class_Object_private_method__set>` and :ref:`_get_prope
|
||||
|
||||
Override this method to provide a custom list of additional properties to handle by the engine.
|
||||
|
||||
Should return a property list, as an :ref:`Array<class_Array>` of dictionaries. The result is added to the array of :ref:`get_property_list<class_Object_method_get_property_list>`, and should be formatted in the same way. Each :ref:`Dictionary<class_Dictionary>` must at least contain the ``name`` and ``type`` entries.
|
||||
Should return a property list, as an :ref:`Array<class_Array>` of dictionaries. The result is added to the array of :ref:`get_property_list()<class_Object_method_get_property_list>`, and should be formatted in the same way. Each :ref:`Dictionary<class_Dictionary>` must at least contain the ``name`` and ``type`` entries.
|
||||
|
||||
You can use :ref:`_property_can_revert<class_Object_private_method__property_can_revert>` and :ref:`_property_get_revert<class_Object_private_method__property_get_revert>` to customize the default values of the properties added by this method.
|
||||
You can use :ref:`_property_can_revert()<class_Object_private_method__property_can_revert>` and :ref:`_property_get_revert()<class_Object_private_method__property_get_revert>` to customize the default values of the properties added by this method.
|
||||
|
||||
The example below displays a list of numbers shown as words going from ``ZERO`` to ``FIVE``, with ``number_count`` controlling the size of the list:
|
||||
|
||||
@@ -491,7 +491,7 @@ The example below displays a list of numbers shown as words going from ``ZERO``
|
||||
|
||||
|
||||
|
||||
\ **Note:** This method is intended for advanced purposes. For most common use cases, the scripting languages offer easier ways to handle properties. See :ref:`@GDScript.@export<class_@GDScript_annotation_@export>`, :ref:`@GDScript.@export_enum<class_@GDScript_annotation_@export_enum>`, :ref:`@GDScript.@export_group<class_@GDScript_annotation_@export_group>`, etc. If you want to customize exported properties, use :ref:`_validate_property<class_Object_private_method__validate_property>`.
|
||||
\ **Note:** This method is intended for advanced purposes. For most common use cases, the scripting languages offer easier ways to handle properties. See :ref:`@GDScript.@export<class_@GDScript_annotation_@export>`, :ref:`@GDScript.@export_enum<class_@GDScript_annotation_@export_enum>`, :ref:`@GDScript.@export_group<class_@GDScript_annotation_@export_group>`, etc. If you want to customize exported properties, use :ref:`_validate_property()<class_Object_private_method__validate_property>`.
|
||||
|
||||
\ **Note:** If the object's script is not :ref:`@GDScript.@tool<class_@GDScript_annotation_@tool>`, this method will not be called in the editor.
|
||||
|
||||
@@ -507,7 +507,7 @@ The example below displays a list of numbers shown as words going from ``ZERO``
|
||||
|
||||
Called when the object's script is instantiated, oftentimes after the object is initialized in memory (through ``Object.new()`` in GDScript, or ``new GodotObject`` in C#). It can be also defined to take in parameters. This method is similar to a constructor in most programming languages.
|
||||
|
||||
\ **Note:** If :ref:`_init<class_Object_private_method__init>` is defined with *required* parameters, the Object with script may only be created directly. If any other means (such as :ref:`PackedScene.instantiate<class_PackedScene_method_instantiate>` or :ref:`Node.duplicate<class_Node_method_duplicate>`) are used, the script's initialization will fail.
|
||||
\ **Note:** If :ref:`_init()<class_Object_private_method__init>` is defined with *required* parameters, the Object with script may only be created directly. If any other means (such as :ref:`PackedScene.instantiate()<class_PackedScene_method_instantiate>` or :ref:`Node.duplicate()<class_Node_method_duplicate>`) are used, the script's initialization will fail.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -519,7 +519,7 @@ Called when the object's script is instantiated, oftentimes after the object is
|
||||
|
||||
:ref:`Variant<class_Variant>` **_iter_get**\ (\ iter\: :ref:`Variant<class_Variant>`\ ) |virtual| :ref:`🔗<class_Object_private_method__iter_get>`
|
||||
|
||||
Returns the current iterable value. ``iter`` stores the iteration state, but unlike :ref:`_iter_init<class_Object_private_method__iter_init>` and :ref:`_iter_next<class_Object_private_method__iter_next>` the state is supposed to be read-only, so there is no :ref:`Array<class_Array>` wrapper.
|
||||
Returns the current iterable value. ``iter`` stores the iteration state, but unlike :ref:`_iter_init()<class_Object_private_method__iter_init>` and :ref:`_iter_next()<class_Object_private_method__iter_next>` the state is supposed to be read-only, so there is no :ref:`Array<class_Array>` wrapper.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -586,7 +586,7 @@ Moves the iterator to the next iteration. ``iter`` stores the iteration state. S
|
||||
|
||||
|void| **_notification**\ (\ what\: :ref:`int<class_int>`\ ) |virtual| :ref:`🔗<class_Object_private_method__notification>`
|
||||
|
||||
Called when the object receives a notification, which can be identified in ``what`` by comparing it with a constant. See also :ref:`notification<class_Object_method_notification>`.
|
||||
Called when the object receives a notification, which can be identified in ``what`` by comparing it with a constant. See also :ref:`notification()<class_Object_method_notification>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -621,7 +621,7 @@ Called when the object receives a notification, which can be identified in ``wha
|
||||
|
||||
:ref:`bool<class_bool>` **_property_can_revert**\ (\ property\: :ref:`StringName<class_StringName>`\ ) |virtual| :ref:`🔗<class_Object_private_method__property_can_revert>`
|
||||
|
||||
Override this method to customize the given ``property``'s revert behavior. Should return ``true`` if the ``property`` has a custom default value and is revertible in the Inspector dock. Use :ref:`_property_get_revert<class_Object_private_method__property_get_revert>` to specify the ``property``'s default value.
|
||||
Override this method to customize the given ``property``'s revert behavior. Should return ``true`` if the ``property`` has a custom default value and is revertible in the Inspector dock. Use :ref:`_property_get_revert()<class_Object_private_method__property_get_revert>` to specify the ``property``'s default value.
|
||||
|
||||
\ **Note:** This method must return consistently, regardless of the current value of the ``property``.
|
||||
|
||||
@@ -637,7 +637,7 @@ Override this method to customize the given ``property``'s revert behavior. Shou
|
||||
|
||||
Override this method to customize the given ``property``'s revert behavior. Should return the default value for the ``property``. If the default value differs from the ``property``'s current value, a revert icon is displayed in the Inspector dock.
|
||||
|
||||
\ **Note:** :ref:`_property_can_revert<class_Object_private_method__property_can_revert>` must also be overridden for this method to be called.
|
||||
\ **Note:** :ref:`_property_can_revert()<class_Object_private_method__property_can_revert>` must also be overridden for this method to be called.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -649,9 +649,9 @@ Override this method to customize the given ``property``'s revert behavior. Shou
|
||||
|
||||
:ref:`bool<class_bool>` **_set**\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) |virtual| :ref:`🔗<class_Object_private_method__set>`
|
||||
|
||||
Override this method to customize the behavior of :ref:`set<class_Object_method_set>`. Should set the ``property`` to ``value`` and return ``true``, or ``false`` if the ``property`` should be handled normally. The *exact* way to set the ``property`` is up to this method's implementation.
|
||||
Override this method to customize the behavior of :ref:`set()<class_Object_method_set>`. Should set the ``property`` to ``value`` and return ``true``, or ``false`` if the ``property`` should be handled normally. The *exact* way to set the ``property`` is up to this method's implementation.
|
||||
|
||||
Combined with :ref:`_get<class_Object_private_method__get>` and :ref:`_get_property_list<class_Object_private_method__get_property_list>`, this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property *must* be present in :ref:`get_property_list<class_Object_method_get_property_list>`, otherwise this method will not be called.
|
||||
Combined with :ref:`_get()<class_Object_private_method__get>` and :ref:`_get_property_list()<class_Object_private_method__get_property_list>`, this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property *must* be present in :ref:`get_property_list()<class_Object_method_get_property_list>`, otherwise this method will not be called.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -712,7 +712,7 @@ Combined with :ref:`_get<class_Object_private_method__get>` and :ref:`_get_prope
|
||||
|
||||
:ref:`String<class_String>` **_to_string**\ (\ ) |virtual| :ref:`🔗<class_Object_private_method__to_string>`
|
||||
|
||||
Override this method to customize the return value of :ref:`to_string<class_Object_method_to_string>`, and therefore the object's representation as a :ref:`String<class_String>`.
|
||||
Override this method to customize the return value of :ref:`to_string()<class_Object_method_to_string>`, and therefore the object's representation as a :ref:`String<class_String>`.
|
||||
|
||||
::
|
||||
|
||||
@@ -733,7 +733,7 @@ Override this method to customize the return value of :ref:`to_string<class_Obje
|
||||
|
||||
|void| **_validate_property**\ (\ property\: :ref:`Dictionary<class_Dictionary>`\ ) |virtual| :ref:`🔗<class_Object_private_method__validate_property>`
|
||||
|
||||
Override this method to customize existing properties. Every property info goes through this method, except properties added with :ref:`_get_property_list<class_Object_private_method__get_property_list>`. The dictionary contents is the same as in :ref:`_get_property_list<class_Object_private_method__get_property_list>`.
|
||||
Override this method to customize existing properties. Every property info goes through this method, except properties added with :ref:`_get_property_list()<class_Object_private_method__get_property_list>`. The dictionary contents is the same as in :ref:`_get_property_list()<class_Object_private_method__get_property_list>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -796,7 +796,7 @@ Override this method to customize existing properties. Every property info goes
|
||||
|
||||
|void| **add_user_signal**\ (\ signal\: :ref:`String<class_String>`, arguments\: :ref:`Array<class_Array>` = []\ ) :ref:`🔗<class_Object_method_add_user_signal>`
|
||||
|
||||
Adds a user-defined signal named ``signal``. Optional arguments for the signal can be added as an :ref:`Array<class_Array>` of dictionaries, each defining a ``name`` :ref:`String<class_String>` and a ``type`` :ref:`int<class_int>` (see :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`). See also :ref:`has_user_signal<class_Object_method_has_user_signal>` and :ref:`remove_user_signal<class_Object_method_remove_user_signal>`.
|
||||
Adds a user-defined signal named ``signal``. Optional arguments for the signal can be added as an :ref:`Array<class_Array>` of dictionaries, each defining a ``name`` :ref:`String<class_String>` and a ``type`` :ref:`int<class_int>` (see :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`). See also :ref:`has_user_signal()<class_Object_method_has_user_signal>` and :ref:`remove_user_signal()<class_Object_method_remove_user_signal>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -886,7 +886,7 @@ This method supports a variable number of arguments, so parameters can be passed
|
||||
|
||||
|
||||
|
||||
See also :ref:`Callable.call_deferred<class_Callable_method_call_deferred>`.
|
||||
See also :ref:`Callable.call_deferred()<class_Callable_method_call_deferred>`.
|
||||
|
||||
\ **Note:** In C#, ``method`` must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the ``MethodName`` class to avoid allocating a new :ref:`StringName<class_StringName>` on each call.
|
||||
|
||||
@@ -911,7 +911,7 @@ See also :ref:`Callable.call_deferred<class_Callable_method_call_deferred>`.
|
||||
|
||||
:ref:`Variant<class_Variant>` **callv**\ (\ method\: :ref:`StringName<class_StringName>`, arg_array\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Object_method_callv>`
|
||||
|
||||
Calls the ``method`` on the object and returns the result. Unlike :ref:`call<class_Object_method_call>`, this method expects all parameters to be contained inside ``arg_array``.
|
||||
Calls the ``method`` on the object and returns the result. Unlike :ref:`call()<class_Object_method_call>`, this method expects all parameters to be contained inside ``arg_array``.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -940,7 +940,7 @@ Calls the ``method`` on the object and returns the result. Unlike :ref:`call<cla
|
||||
|
||||
:ref:`bool<class_bool>` **can_translate_messages**\ (\ ) |const| :ref:`🔗<class_Object_method_can_translate_messages>`
|
||||
|
||||
Returns ``true`` if the object is allowed to translate messages with :ref:`tr<class_Object_method_tr>` and :ref:`tr_n<class_Object_method_tr_n>`. See also :ref:`set_message_translation<class_Object_method_set_message_translation>`.
|
||||
Returns ``true`` if the object is allowed to translate messages with :ref:`tr()<class_Object_method_tr>` and :ref:`tr_n()<class_Object_method_tr_n>`. See also :ref:`set_message_translation()<class_Object_method_set_message_translation>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -966,7 +966,7 @@ If this method is called during :ref:`NOTIFICATION_PREDELETE<class_Object_consta
|
||||
|
||||
Connects a ``signal`` by name to a ``callable``. Optional ``flags`` can be also added to configure the connection's behavior (see :ref:`ConnectFlags<enum_Object_ConnectFlags>` constants).
|
||||
|
||||
A signal can only be connected once to the same :ref:`Callable<class_Callable>`. If the signal is already connected, this method returns :ref:`@GlobalScope.ERR_INVALID_PARAMETER<class_@GlobalScope_constant_ERR_INVALID_PARAMETER>` and pushes an error message, unless the signal is connected with :ref:`CONNECT_REFERENCE_COUNTED<class_Object_constant_CONNECT_REFERENCE_COUNTED>`. To prevent this, use :ref:`is_connected<class_Object_method_is_connected>` first to check for existing connections.
|
||||
A signal can only be connected once to the same :ref:`Callable<class_Callable>`. If the signal is already connected, this method returns :ref:`@GlobalScope.ERR_INVALID_PARAMETER<class_@GlobalScope_constant_ERR_INVALID_PARAMETER>` and pushes an error message, unless the signal is connected with :ref:`CONNECT_REFERENCE_COUNTED<class_Object_constant_CONNECT_REFERENCE_COUNTED>`. To prevent this, use :ref:`is_connected()<class_Object_method_is_connected>` first to check for existing connections.
|
||||
|
||||
If the ``callable``'s object is freed, the connection will be lost.
|
||||
|
||||
@@ -1025,7 +1025,7 @@ Connecting signals is one of the most common operations in Godot and the API giv
|
||||
|
||||
\ **\ ``Object.connect()`` or ``Signal.connect()``?**\
|
||||
|
||||
As seen above, the recommended method to connect signals is not :ref:`connect<class_Object_method_connect>`. The code block below shows the four options for connecting signals, using either this legacy method or the recommended :ref:`Signal.connect<class_Signal_method_connect>`, and using either an implicit :ref:`Callable<class_Callable>` or a manually defined one.
|
||||
As seen above, the recommended method to connect signals is not :ref:`connect()<class_Object_method_connect>`. The code block below shows the four options for connecting signals, using either this legacy method or the recommended :ref:`Signal.connect()<class_Signal_method_connect>`, and using either an implicit :ref:`Callable<class_Callable>` or a manually defined one.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -1070,9 +1070,9 @@ While all options have the same outcome (``button``'s :ref:`BaseButton.button_do
|
||||
|
||||
\ **Binding and passing parameters:**\
|
||||
|
||||
The syntax to bind parameters is through :ref:`Callable.bind<class_Callable_method_bind>`, which returns a copy of the :ref:`Callable<class_Callable>` with its parameters bound.
|
||||
The syntax to bind parameters is through :ref:`Callable.bind()<class_Callable_method_bind>`, which returns a copy of the :ref:`Callable<class_Callable>` with its parameters bound.
|
||||
|
||||
When calling :ref:`emit_signal<class_Object_method_emit_signal>` or :ref:`Signal.emit<class_Signal_method_emit>`, the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters.
|
||||
When calling :ref:`emit_signal()<class_Object_method_emit_signal>` or :ref:`Signal.emit()<class_Signal_method_emit>`, the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -1126,7 +1126,7 @@ When calling :ref:`emit_signal<class_Object_method_emit_signal>` or :ref:`Signal
|
||||
|
||||
|void| **disconnect**\ (\ signal\: :ref:`StringName<class_StringName>`, callable\: :ref:`Callable<class_Callable>`\ ) :ref:`🔗<class_Object_method_disconnect>`
|
||||
|
||||
Disconnects a ``signal`` by name from a given ``callable``. If the connection does not exist, generates an error. Use :ref:`is_connected<class_Object_method_is_connected>` to make sure that the connection exists.
|
||||
Disconnects a ``signal`` by name from a given ``callable``. If the connection does not exist, generates an error. Use :ref:`is_connected()<class_Object_method_is_connected>` to make sure that the connection exists.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1138,7 +1138,7 @@ Disconnects a ``signal`` by name from a given ``callable``. If the connection do
|
||||
|
||||
:ref:`Error<enum_@GlobalScope_Error>` **emit_signal**\ (\ signal\: :ref:`StringName<class_StringName>`, ...\ ) |vararg| :ref:`🔗<class_Object_method_emit_signal>`
|
||||
|
||||
Emits the given ``signal`` by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see :ref:`add_user_signal<class_Object_method_add_user_signal>`). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
|
||||
Emits the given ``signal`` by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see :ref:`add_user_signal()<class_Object_method_add_user_signal>`). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
|
||||
|
||||
Returns :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVAILABLE>` if ``signal`` does not exist or the parameters are invalid.
|
||||
|
||||
@@ -1169,7 +1169,7 @@ Returns :ref:`@GlobalScope.ERR_UNAVAILABLE<class_@GlobalScope_constant_ERR_UNAVA
|
||||
|
||||
|void| **free**\ (\ ) :ref:`🔗<class_Object_method_free>`
|
||||
|
||||
Deletes the object from memory. Pre-existing references to the object become invalid, and any attempt to access them will result in a run-time error. Checking the references with :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>` will return ``false``.
|
||||
Deletes the object from memory. Pre-existing references to the object become invalid, and any attempt to access them will result in a run-time error. Checking the references with :ref:`@GlobalScope.is_instance_valid()<class_@GlobalScope_method_is_instance_valid>` will return ``false``.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1212,7 +1212,7 @@ Returns the :ref:`Variant<class_Variant>` value of the given ``property``. If th
|
||||
|
||||
:ref:`String<class_String>` **get_class**\ (\ ) |const| :ref:`🔗<class_Object_method_get_class>`
|
||||
|
||||
Returns the object's built-in class name, as a :ref:`String<class_String>`. See also :ref:`is_class<class_Object_method_is_class>`.
|
||||
Returns the object's built-in class name, as a :ref:`String<class_String>`. See also :ref:`is_class()<class_Object_method_is_class>`.
|
||||
|
||||
\ **Note:** This method ignores ``class_name`` declarations. If this object's script has defined a ``class_name``, the base, built-in class name is returned instead.
|
||||
|
||||
@@ -1269,7 +1269,7 @@ Gets the object's property indexed by the given ``property_path``. The path shou
|
||||
|
||||
\ **Note:** In C#, ``property_path`` must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the ``PropertyName`` class to avoid allocating a new :ref:`StringName<class_StringName>` on each call.
|
||||
|
||||
\ **Note:** This method does not support actual paths to nodes in the :ref:`SceneTree<class_SceneTree>`, only sub-property paths. In the context of nodes, use :ref:`Node.get_node_and_resource<class_Node_method_get_node_and_resource>` instead.
|
||||
\ **Note:** This method does not support actual paths to nodes in the :ref:`SceneTree<class_SceneTree>`, only sub-property paths. In the context of nodes, use :ref:`Node.get_node_and_resource()<class_Node_method_get_node_and_resource>` instead.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1281,7 +1281,7 @@ Gets the object's property indexed by the given ``property_path``. The path shou
|
||||
|
||||
:ref:`int<class_int>` **get_instance_id**\ (\ ) |const| :ref:`🔗<class_Object_method_get_instance_id>`
|
||||
|
||||
Returns the object's unique instance ID. This ID can be saved in :ref:`EncodedObjectAsID<class_EncodedObjectAsID>`, and can be used to retrieve this object instance with :ref:`@GlobalScope.instance_from_id<class_@GlobalScope_method_instance_from_id>`.
|
||||
Returns the object's unique instance ID. This ID can be saved in :ref:`EncodedObjectAsID<class_EncodedObjectAsID>`, and can be used to retrieve this object instance with :ref:`@GlobalScope.instance_from_id()<class_@GlobalScope_method_instance_from_id>`.
|
||||
|
||||
\ **Note:** This ID is only useful during the current session. It won't correspond to a similar object if the ID is sent over a network, or loaded from a file at a later time.
|
||||
|
||||
@@ -1297,7 +1297,7 @@ Returns the object's unique instance ID. This ID can be saved in :ref:`EncodedOb
|
||||
|
||||
Returns the object's metadata value for the given entry ``name``. If the entry does not exist, returns ``default``. If ``default`` is ``null``, an error is also generated.
|
||||
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier()<class_StringName_method_is_valid_identifier>` method.
|
||||
|
||||
\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
||||
|
||||
@@ -1351,7 +1351,7 @@ Returns this object's methods and their signatures as an :ref:`Array<class_Array
|
||||
|
||||
- ``return`` is the returned value, as a :ref:`Dictionary<class_Dictionary>`;
|
||||
|
||||
\ **Note:** The dictionaries of ``args`` and ``return`` are formatted identically to the results of :ref:`get_property_list<class_Object_method_get_property_list>`, although not all entries are used.
|
||||
\ **Note:** The dictionaries of ``args`` and ``return`` are formatted identically to the results of :ref:`get_property_list()<class_Object_method_get_property_list>`, although not all entries are used.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1421,7 +1421,7 @@ Returns an :ref:`Array<class_Array>` of connections for the given ``signal`` nam
|
||||
|
||||
Returns the list of existing signals as an :ref:`Array<class_Array>` of dictionaries.
|
||||
|
||||
\ **Note:** Due of the implementation, each :ref:`Dictionary<class_Dictionary>` is formatted very similarly to the returned values of :ref:`get_method_list<class_Object_method_get_method_list>`.
|
||||
\ **Note:** Due of the implementation, each :ref:`Dictionary<class_Dictionary>` is formatted very similarly to the returned values of :ref:`get_method_list()<class_Object_method_get_method_list>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1433,7 +1433,7 @@ Returns the list of existing signals as an :ref:`Array<class_Array>` of dictiona
|
||||
|
||||
:ref:`StringName<class_StringName>` **get_translation_domain**\ (\ ) |const| :ref:`🔗<class_Object_method_get_translation_domain>`
|
||||
|
||||
Returns the name of the translation domain used by :ref:`tr<class_Object_method_tr>` and :ref:`tr_n<class_Object_method_tr_n>`. See also :ref:`TranslationServer<class_TranslationServer>`.
|
||||
Returns the name of the translation domain used by :ref:`tr()<class_Object_method_tr>` and :ref:`tr_n()<class_Object_method_tr_n>`. See also :ref:`TranslationServer<class_TranslationServer>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1459,9 +1459,9 @@ Returns ``true`` if any connection exists on the given ``signal`` name.
|
||||
|
||||
:ref:`bool<class_bool>` **has_meta**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Object_method_has_meta>`
|
||||
|
||||
Returns ``true`` if a metadata entry is found with the given ``name``. See also :ref:`get_meta<class_Object_method_get_meta>`, :ref:`set_meta<class_Object_method_set_meta>` and :ref:`remove_meta<class_Object_method_remove_meta>`.
|
||||
Returns ``true`` if a metadata entry is found with the given ``name``. See also :ref:`get_meta()<class_Object_method_get_meta>`, :ref:`set_meta()<class_Object_method_set_meta>` and :ref:`remove_meta()<class_Object_method_remove_meta>`.
|
||||
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier()<class_StringName_method_is_valid_identifier>` method.
|
||||
|
||||
\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
||||
|
||||
@@ -1503,7 +1503,7 @@ Returns ``true`` if the given ``signal`` name exists in the object.
|
||||
|
||||
:ref:`bool<class_bool>` **has_user_signal**\ (\ signal\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Object_method_has_user_signal>`
|
||||
|
||||
Returns ``true`` if the given user-defined ``signal`` name exists. Only signals added with :ref:`add_user_signal<class_Object_method_add_user_signal>` are included. See also :ref:`remove_user_signal<class_Object_method_remove_user_signal>`.
|
||||
Returns ``true`` if the given user-defined ``signal`` name exists. Only signals added with :ref:`add_user_signal()<class_Object_method_add_user_signal>` are included. See also :ref:`remove_user_signal()<class_Object_method_remove_user_signal>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1515,7 +1515,7 @@ Returns ``true`` if the given user-defined ``signal`` name exists. Only signals
|
||||
|
||||
:ref:`bool<class_bool>` **is_blocking_signals**\ (\ ) |const| :ref:`🔗<class_Object_method_is_blocking_signals>`
|
||||
|
||||
Returns ``true`` if the object is blocking its signals from being emitted. See :ref:`set_block_signals<class_Object_method_set_block_signals>`.
|
||||
Returns ``true`` if the object is blocking its signals from being emitted. See :ref:`set_block_signals()<class_Object_method_set_block_signals>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1527,7 +1527,7 @@ Returns ``true`` if the object is blocking its signals from being emitted. See :
|
||||
|
||||
:ref:`bool<class_bool>` **is_class**\ (\ class\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Object_method_is_class>`
|
||||
|
||||
Returns ``true`` if the object inherits from the given ``class``. See also :ref:`get_class<class_Object_method_get_class>`.
|
||||
Returns ``true`` if the object inherits from the given ``class``. See also :ref:`get_class()<class_Object_method_get_class>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -1574,7 +1574,7 @@ Returns ``true`` if a connection exists between the given ``signal`` name and ``
|
||||
|
||||
:ref:`bool<class_bool>` **is_queued_for_deletion**\ (\ ) |const| :ref:`🔗<class_Object_method_is_queued_for_deletion>`
|
||||
|
||||
Returns ``true`` if the :ref:`Node.queue_free<class_Node_method_queue_free>` method was called for the object.
|
||||
Returns ``true`` if the :ref:`Node.queue_free()<class_Node_method_queue_free>` method was called for the object.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1586,7 +1586,7 @@ Returns ``true`` if the :ref:`Node.queue_free<class_Node_method_queue_free>` met
|
||||
|
||||
|void| **notification**\ (\ what\: :ref:`int<class_int>`, reversed\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_Object_method_notification>`
|
||||
|
||||
Sends the given ``what`` notification to all classes inherited by the object, triggering calls to :ref:`_notification<class_Object_private_method__notification>`, starting from the highest ancestor (the **Object** class) and going down to the object's script.
|
||||
Sends the given ``what`` notification to all classes inherited by the object, triggering calls to :ref:`_notification()<class_Object_private_method__notification>`, starting from the highest ancestor (the **Object** class) and going down to the object's script.
|
||||
|
||||
If ``reversed`` is ``true``, the call order is reversed.
|
||||
|
||||
@@ -1639,9 +1639,9 @@ Emits the :ref:`property_list_changed<class_Object_signal_property_list_changed>
|
||||
|
||||
:ref:`bool<class_bool>` **property_can_revert**\ (\ property\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Object_method_property_can_revert>`
|
||||
|
||||
Returns ``true`` if the given ``property`` has a custom default value. Use :ref:`property_get_revert<class_Object_method_property_get_revert>` to get the ``property``'s default value.
|
||||
Returns ``true`` if the given ``property`` has a custom default value. Use :ref:`property_get_revert()<class_Object_method_property_get_revert>` to get the ``property``'s default value.
|
||||
|
||||
\ **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement :ref:`_property_can_revert<class_Object_private_method__property_can_revert>` to customize the default value. If :ref:`_property_can_revert<class_Object_private_method__property_can_revert>` is not implemented, this method returns ``false``.
|
||||
\ **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement :ref:`_property_can_revert()<class_Object_private_method__property_can_revert>` to customize the default value. If :ref:`_property_can_revert()<class_Object_private_method__property_can_revert>` is not implemented, this method returns ``false``.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1653,9 +1653,9 @@ Returns ``true`` if the given ``property`` has a custom default value. Use :ref:
|
||||
|
||||
:ref:`Variant<class_Variant>` **property_get_revert**\ (\ property\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Object_method_property_get_revert>`
|
||||
|
||||
Returns the custom default value of the given ``property``. Use :ref:`property_can_revert<class_Object_method_property_can_revert>` to check if the ``property`` has a custom default value.
|
||||
Returns the custom default value of the given ``property``. Use :ref:`property_can_revert()<class_Object_method_property_can_revert>` to check if the ``property`` has a custom default value.
|
||||
|
||||
\ **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement :ref:`_property_get_revert<class_Object_private_method__property_get_revert>` to customize the default value. If :ref:`_property_get_revert<class_Object_private_method__property_get_revert>` is not implemented, this method returns ``null``.
|
||||
\ **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement :ref:`_property_get_revert()<class_Object_private_method__property_get_revert>` to customize the default value. If :ref:`_property_get_revert()<class_Object_private_method__property_get_revert>` is not implemented, this method returns ``null``.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1667,9 +1667,9 @@ Returns the custom default value of the given ``property``. Use :ref:`property_c
|
||||
|
||||
|void| **remove_meta**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Object_method_remove_meta>`
|
||||
|
||||
Removes the given entry ``name`` from the object's metadata. See also :ref:`has_meta<class_Object_method_has_meta>`, :ref:`get_meta<class_Object_method_get_meta>` and :ref:`set_meta<class_Object_method_set_meta>`.
|
||||
Removes the given entry ``name`` from the object's metadata. See also :ref:`has_meta()<class_Object_method_has_meta>`, :ref:`get_meta()<class_Object_method_get_meta>` and :ref:`set_meta()<class_Object_method_set_meta>`.
|
||||
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier()<class_StringName_method_is_valid_identifier>` method.
|
||||
|
||||
\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
||||
|
||||
@@ -1683,7 +1683,7 @@ Removes the given entry ``name`` from the object's metadata. See also :ref:`has_
|
||||
|
||||
|void| **remove_user_signal**\ (\ signal\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Object_method_remove_user_signal>`
|
||||
|
||||
Removes the given user signal ``signal`` from the object. See also :ref:`add_user_signal<class_Object_method_add_user_signal>` and :ref:`has_user_signal<class_Object_method_has_user_signal>`.
|
||||
Removes the given user signal ``signal`` from the object. See also :ref:`add_user_signal()<class_Object_method_add_user_signal>` and :ref:`has_user_signal()<class_Object_method_has_user_signal>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1726,7 +1726,7 @@ Assigns ``value`` to the given ``property``. If the property does not exist or t
|
||||
|
||||
|void| **set_block_signals**\ (\ enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Object_method_set_block_signals>`
|
||||
|
||||
If set to ``true``, the object becomes unable to emit signals. As such, :ref:`emit_signal<class_Object_method_emit_signal>` and signal connections will not work, until it is set to ``false``.
|
||||
If set to ``true``, the object becomes unable to emit signals. As such, :ref:`emit_signal()<class_Object_method_emit_signal>` and signal connections will not work, until it is set to ``false``.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1738,7 +1738,7 @@ If set to ``true``, the object becomes unable to emit signals. As such, :ref:`em
|
||||
|
||||
|void| **set_deferred**\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Object_method_set_deferred>`
|
||||
|
||||
Assigns ``value`` to the given ``property``, at the end of the current frame. This is equivalent to calling :ref:`set<class_Object_method_set>` through :ref:`call_deferred<class_Object_method_call_deferred>`.
|
||||
Assigns ``value`` to the given ``property``, at the end of the current frame. This is equivalent to calling :ref:`set()<class_Object_method_set>` through :ref:`call_deferred()<class_Object_method_call_deferred>`.
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -1812,7 +1812,7 @@ Assigns a new ``value`` to the property identified by the ``property_path``. The
|
||||
|
||||
|void| **set_message_translation**\ (\ enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Object_method_set_message_translation>`
|
||||
|
||||
If set to ``true``, allows the object to translate messages with :ref:`tr<class_Object_method_tr>` and :ref:`tr_n<class_Object_method_tr_n>`. Enabled by default. See also :ref:`can_translate_messages<class_Object_method_can_translate_messages>`.
|
||||
If set to ``true``, allows the object to translate messages with :ref:`tr()<class_Object_method_tr>` and :ref:`tr_n()<class_Object_method_tr_n>`. Enabled by default. See also :ref:`can_translate_messages()<class_Object_method_can_translate_messages>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1826,9 +1826,9 @@ If set to ``true``, allows the object to translate messages with :ref:`tr<class_
|
||||
|
||||
Adds or changes the entry ``name`` inside the object's metadata. The metadata ``value`` can be any :ref:`Variant<class_Variant>`, although some types cannot be serialized correctly.
|
||||
|
||||
If ``value`` is ``null``, the entry is removed. This is the equivalent of using :ref:`remove_meta<class_Object_method_remove_meta>`. See also :ref:`has_meta<class_Object_method_has_meta>` and :ref:`get_meta<class_Object_method_get_meta>`.
|
||||
If ``value`` is ``null``, the entry is removed. This is the equivalent of using :ref:`remove_meta()<class_Object_method_remove_meta>`. See also :ref:`has_meta()<class_Object_method_has_meta>` and :ref:`get_meta()<class_Object_method_get_meta>`.
|
||||
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier<class_StringName_method_is_valid_identifier>` method.
|
||||
\ **Note:** A metadata's name must be a valid identifier as per :ref:`StringName.is_valid_identifier()<class_StringName_method_is_valid_identifier>` method.
|
||||
|
||||
\ **Note:** Metadata that has a name starting with an underscore (``_``) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
||||
|
||||
@@ -1842,7 +1842,7 @@ If ``value`` is ``null``, the entry is removed. This is the equivalent of using
|
||||
|
||||
|void| **set_script**\ (\ script\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Object_method_set_script>`
|
||||
|
||||
Attaches ``script`` to the object, and instantiates it. As a result, the script's :ref:`_init<class_Object_private_method__init>` is called. A :ref:`Script<class_Script>` is used to extend the object's functionality.
|
||||
Attaches ``script`` to the object, and instantiates it. As a result, the script's :ref:`_init()<class_Object_private_method__init>` is called. A :ref:`Script<class_Script>` is used to extend the object's functionality.
|
||||
|
||||
If a script already exists, its instance is detached, and its property values and state are lost. Built-in property values are still kept.
|
||||
|
||||
@@ -1856,7 +1856,7 @@ If a script already exists, its instance is detached, and its property values an
|
||||
|
||||
|void| **set_translation_domain**\ (\ domain\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Object_method_set_translation_domain>`
|
||||
|
||||
Sets the name of the translation domain used by :ref:`tr<class_Object_method_tr>` and :ref:`tr_n<class_Object_method_tr_n>`. See also :ref:`TranslationServer<class_TranslationServer>`.
|
||||
Sets the name of the translation domain used by :ref:`tr()<class_Object_method_tr>` and :ref:`tr_n()<class_Object_method_tr_n>`. See also :ref:`TranslationServer<class_TranslationServer>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1868,7 +1868,7 @@ Sets the name of the translation domain used by :ref:`tr<class_Object_method_tr>
|
||||
|
||||
:ref:`String<class_String>` **to_string**\ (\ ) :ref:`🔗<class_Object_method_to_string>`
|
||||
|
||||
Returns a :ref:`String<class_String>` representing the object. Defaults to ``"<ClassName#RID>"``. Override :ref:`_to_string<class_Object_private_method__to_string>` to customize the string representation of the object.
|
||||
Returns a :ref:`String<class_String>` representing the object. Defaults to ``"<ClassName#RID>"``. Override :ref:`_to_string()<class_Object_private_method__to_string>` to customize the string representation of the object.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1882,11 +1882,11 @@ Returns a :ref:`String<class_String>` representing the object. Defaults to ``"<C
|
||||
|
||||
Translates a ``message``, using the translation catalogs configured in the Project Settings. Further ``context`` can be specified to help with the translation. Note that most :ref:`Control<class_Control>` nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
|
||||
|
||||
If :ref:`can_translate_messages<class_Object_method_can_translate_messages>` is ``false``, or no translation is available, this method returns the ``message`` without changes. See :ref:`set_message_translation<class_Object_method_set_message_translation>`.
|
||||
If :ref:`can_translate_messages()<class_Object_method_can_translate_messages>` is ``false``, or no translation is available, this method returns the ``message`` without changes. See :ref:`set_message_translation()<class_Object_method_set_message_translation>`.
|
||||
|
||||
For detailed examples, see :doc:`Internationalizing games <../tutorials/i18n/internationalizing_games>`.
|
||||
|
||||
\ **Note:** This method can't be used without an **Object** instance, as it requires the :ref:`can_translate_messages<class_Object_method_can_translate_messages>` method. To translate strings in a static context, use :ref:`TranslationServer.translate<class_TranslationServer_method_translate>`.
|
||||
\ **Note:** This method can't be used without an **Object** instance, as it requires the :ref:`can_translate_messages()<class_Object_method_can_translate_messages>` method. To translate strings in a static context, use :ref:`TranslationServer.translate()<class_TranslationServer_method_translate>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
@@ -1900,15 +1900,15 @@ For detailed examples, see :doc:`Internationalizing games <../tutorials/i18n/int
|
||||
|
||||
Translates a ``message`` or ``plural_message``, using the translation catalogs configured in the Project Settings. Further ``context`` can be specified to help with the translation.
|
||||
|
||||
If :ref:`can_translate_messages<class_Object_method_can_translate_messages>` is ``false``, or no translation is available, this method returns ``message`` or ``plural_message``, without changes. See :ref:`set_message_translation<class_Object_method_set_message_translation>`.
|
||||
If :ref:`can_translate_messages()<class_Object_method_can_translate_messages>` is ``false``, or no translation is available, this method returns ``message`` or ``plural_message``, without changes. See :ref:`set_message_translation()<class_Object_method_set_message_translation>`.
|
||||
|
||||
The ``n`` is the number, or amount, of the message's subject. It is used by the translation system to fetch the correct plural form for the current language.
|
||||
|
||||
For detailed examples, see :doc:`Localization using gettext <../tutorials/i18n/localization_using_gettext>`.
|
||||
|
||||
\ **Note:** Negative and :ref:`float<class_float>` numbers may not properly apply to some countable subjects. It's recommended to handle these cases with :ref:`tr<class_Object_method_tr>`.
|
||||
\ **Note:** Negative and :ref:`float<class_float>` numbers may not properly apply to some countable subjects. It's recommended to handle these cases with :ref:`tr()<class_Object_method_tr>`.
|
||||
|
||||
\ **Note:** This method can't be used without an **Object** instance, as it requires the :ref:`can_translate_messages<class_Object_method_can_translate_messages>` method. To translate strings in a static context, use :ref:`TranslationServer.translate_plural<class_TranslationServer_method_translate_plural>`.
|
||||
\ **Note:** This method can't be used without an **Object** instance, as it requires the :ref:`can_translate_messages()<class_Object_method_can_translate_messages>` method. To translate strings in a static context, use :ref:`TranslationServer.translate_plural()<class_TranslationServer_method_translate_plural>`.
|
||||
|
||||
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
||||
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
||||
|
||||
Reference in New Issue
Block a user