classref: Sync with current master branch (29b3d9e)

This commit is contained in:
Godot Organization
2024-03-30 03:20:32 +00:00
parent a22c312b8f
commit e41630eb7e
36 changed files with 1183 additions and 204 deletions

View File

@@ -73,6 +73,8 @@ Properties
+-----------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
| :ref:`Node<class_Node>` | :ref:`owner<class_Node_property_owner>` | |
+-----------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
| :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` | :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>` | ``0`` |
+-----------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
| :ref:`ProcessMode<enum_Node_ProcessMode>` | :ref:`process_mode<class_Node_property_process_mode>` | ``0`` |
+-----------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------+
| :ref:`int<class_int>` | :ref:`process_physics_priority<class_Node_property_process_physics_priority>` | ``0`` |
@@ -207,6 +209,10 @@ Methods
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_node_ready<class_Node_method_is_node_ready>`\ (\ ) |const| |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_physics_interpolated<class_Node_method_is_physics_interpolated>`\ (\ ) |const| |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_physics_interpolated_and_enabled<class_Node_method_is_physics_interpolated_and_enabled>`\ (\ ) |const| |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_physics_processing<class_Node_method_is_physics_processing>`\ (\ ) |const| |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_physics_processing_internal<class_Node_method_is_physics_processing_internal>`\ (\ ) |const| |
@@ -251,6 +257,8 @@ Methods
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`request_ready<class_Node_method_request_ready>`\ (\ ) |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`reset_physics_interpolation<class_Node_method_reset_physics_interpolation>`\ (\ ) |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`rpc<class_Node_method_rpc>`\ (\ method\: :ref:`StringName<class_StringName>`, ...\ ) |vararg| |
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`rpc_config<class_Node_method_rpc_config>`\ (\ method\: :ref:`StringName<class_StringName>`, config\: :ref:`Variant<class_Variant>`\ ) |
@@ -552,6 +560,40 @@ Allows this node to process threaded messages created with :ref:`call_deferred_t
----
.. _enum_Node_PhysicsInterpolationMode:
.. rst-class:: classref-enumeration
enum **PhysicsInterpolationMode**:
.. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT:
.. rst-class:: classref-enumeration-constant
:ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_INHERIT** = ``0``
Inherits :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>` from the node's parent. This is the default for any newly created node.
.. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_ON:
.. rst-class:: classref-enumeration-constant
:ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_ON** = ``1``
Enables physics interpolation for this node and for children set to :ref:`PHYSICS_INTERPOLATION_MODE_INHERIT<class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT>`. This is the default for the root node.
.. _class_Node_constant_PHYSICS_INTERPOLATION_MODE_OFF:
.. rst-class:: classref-enumeration-constant
:ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **PHYSICS_INTERPOLATION_MODE_OFF** = ``2``
Disables physics interpolation for this node and for children set to :ref:`PHYSICS_INTERPOLATION_MODE_INHERIT<class_Node_constant_PHYSICS_INTERPOLATION_MODE_INHERIT>`.
.. rst-class:: classref-item-separator
----
.. _enum_Node_DuplicateFlags:
.. rst-class:: classref-enumeration
@@ -845,6 +887,14 @@ Notification received when the node is disabled. See :ref:`PROCESS_MODE_DISABLED
Notification received when the node is enabled again after being disabled. See :ref:`PROCESS_MODE_DISABLED<class_Node_constant_PROCESS_MODE_DISABLED>`.
.. _class_Node_constant_NOTIFICATION_RESET_PHYSICS_INTERPOLATION:
.. rst-class:: classref-constant
**NOTIFICATION_RESET_PHYSICS_INTERPOLATION** = ``2001``
Notification received when :ref:`reset_physics_interpolation<class_Node_method_reset_physics_interpolation>` is called on the node or its ancestors.
.. _class_Node_constant_NOTIFICATION_EDITOR_PRE_SAVE:
.. rst-class:: classref-constant
@@ -971,7 +1021,17 @@ Implemented only on iOS.
**NOTIFICATION_TRANSLATION_CHANGED** = ``2010``
Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like :ref:`Object.tr<class_Object_method_tr>`.
Notification received when translations may have changed. Can be triggered by the user changing the locale, changing :ref:`auto_translate_mode<class_Node_property_auto_translate_mode>` or when the node enters the scene tree. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like :ref:`Object.tr<class_Object_method_tr>`.
\ **Note:** This notification is received alongside :ref:`NOTIFICATION_ENTER_TREE<class_Node_constant_NOTIFICATION_ENTER_TREE>`, so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup translations for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using :ref:`is_node_ready<class_Node_method_is_node_ready>`.
::
func _notification(what):
if what == NOTIFICATION_TRANSLATION_CHANGED:
if not is_node_ready():
await ready # Wait until ready signal.
$Label.text = atr("%d Bananas") % banana_counter
.. _class_Node_constant_NOTIFICATION_WM_ABOUT:
@@ -1154,6 +1214,25 @@ The owner of this node. The owner must be an ancestor of this node. When packing
----
.. _class_Node_property_physics_interpolation_mode:
.. rst-class:: classref-property
:ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **physics_interpolation_mode** = ``0``
.. rst-class:: classref-property-setget
- |void| **set_physics_interpolation_mode**\ (\ value\: :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>`\ )
- :ref:`PhysicsInterpolationMode<enum_Node_PhysicsInterpolationMode>` **get_physics_interpolation_mode**\ (\ )
Allows enabling or disabling physics interpolation per node, offering a finer grain of control than turning physics interpolation on and off globally. See :ref:`ProjectSettings.physics/common/physics_interpolation<class_ProjectSettings_property_physics/common/physics_interpolation>` and :ref:`SceneTree.physics_interpolation<class_SceneTree_property_physics_interpolation>` for the global setting.
\ **Note:** When teleporting a node to a distant position you should temporarily disable interpolation with :ref:`reset_physics_interpolation<class_Node_method_reset_physics_interpolation>`.
.. rst-class:: classref-item-separator
----
.. _class_Node_property_process_mode:
.. rst-class:: classref-property
@@ -1440,7 +1519,7 @@ Usually used for initialization. For even earlier initialization, :ref:`Object._
|void| **_shortcut_input**\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) |virtual|
Called when an :ref:`InputEventKey<class_InputEventKey>` or :ref:`InputEventShortcut<class_InputEventShortcut>` hasn't been consumed by :ref:`_input<class_Node_private_method__input>` or any GUI :ref:`Control<class_Control>` item. It is called before :ref:`_unhandled_key_input<class_Node_private_method__unhandled_key_input>` and :ref:`_unhandled_input<class_Node_private_method__unhandled_input>`. The input event propagates up through the node tree until a node consumes it.
Called when an :ref:`InputEventKey<class_InputEventKey>`, :ref:`InputEventShortcut<class_InputEventShortcut>`, or :ref:`InputEventJoypadButton<class_InputEventJoypadButton>` hasn't been consumed by :ref:`_input<class_Node_private_method__input>` or any GUI :ref:`Control<class_Control>` item. It is called before :ref:`_unhandled_key_input<class_Node_private_method__unhandled_key_input>` and :ref:`_unhandled_input<class_Node_private_method__unhandled_input>`. The input event propagates up through the node tree until a node consumes it.
It is only called if shortcut processing is enabled, which is done automatically if this method is overridden, and can be toggled with :ref:`set_process_shortcut_input<class_Node_method_set_process_shortcut_input>`.
@@ -1581,7 +1660,7 @@ If ``persistent`` is ``true``, the group will be stored when saved inside a :ref
:ref:`String<class_String>` **atr**\ (\ message\: :ref:`String<class_String>`, context\: :ref:`StringName<class_StringName>` = ""\ ) |const|
Translates a ``message``, using the translation catalogs configured in the Project Settings. Further ``context`` can be specified to help with the translation.
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.
This method works the same as :ref:`Object.tr<class_Object_method_tr>`, with the addition of respecting the :ref:`auto_translate_mode<class_Node_property_auto_translate_mode>` state.
@@ -2296,6 +2375,36 @@ Returns ``true`` if the node is ready, i.e. it's inside scene tree and all its c
----
.. _class_Node_method_is_physics_interpolated:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_physics_interpolated**\ (\ ) |const|
Returns ``true`` if physics interpolation is enabled for this node (see :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>`).
\ **Note:** Interpolation will only be active if both the flag is set **and** physics interpolation is enabled within the :ref:`SceneTree<class_SceneTree>`. This can be tested using :ref:`is_physics_interpolated_and_enabled<class_Node_method_is_physics_interpolated_and_enabled>`.
.. rst-class:: classref-item-separator
----
.. _class_Node_method_is_physics_interpolated_and_enabled:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_physics_interpolated_and_enabled**\ (\ ) |const|
Returns ``true`` if physics interpolation is enabled (see :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>`) **and** enabled in the :ref:`SceneTree<class_SceneTree>`.
This is a convenience version of :ref:`is_physics_interpolated<class_Node_method_is_physics_interpolated>` that also checks whether physics interpolation is enabled globally.
See :ref:`SceneTree.physics_interpolation<class_SceneTree_property_physics_interpolation>` and :ref:`ProjectSettings.physics/common/physics_interpolation<class_ProjectSettings_property_physics/common/physics_interpolation>`.
.. rst-class:: classref-item-separator
----
.. _class_Node_method_is_physics_processing:
.. rst-class:: classref-method
@@ -2602,6 +2711,24 @@ Requests :ref:`_ready<class_Node_private_method__ready>` to be called again the
----
.. _class_Node_method_reset_physics_interpolation:
.. rst-class:: classref-method
|void| **reset_physics_interpolation**\ (\ )
When physics interpolation is active, moving a node to a radically different transform (such as placement within a level) can result in a visible glitch as the object is rendered moving from the old to new position over the physics tick.
That glitch can be prevented by calling this method, which temporarily disables interpolation until the physics tick is complete.
The notification :ref:`NOTIFICATION_RESET_PHYSICS_INTERPOLATION<class_Node_constant_NOTIFICATION_RESET_PHYSICS_INTERPOLATION>` will be received by the node and all children recursively.
\ **Note:** This function should be called **after** moving the node, rather than before.
.. rst-class:: classref-item-separator
----
.. _class_Node_method_rpc:
.. rst-class:: classref-method