Merge Sphinx translations with Weblate translations, sync classref

This commit is contained in:
Rémi Verschelde
2025-02-07 16:33:53 +01:00
parent bc452fe500
commit b2149a48eb
8847 changed files with 48335 additions and 78761 deletions

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/gdscript/doc_classes/@GDScript.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/gdscript/doc_classes/@GDScript.xml.
.. _class_@GDScript:
@@ -17,9 +17,9 @@
描述
----
GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
A list of utility functions and annotations accessible from any script written in GDScript.
全局函数和常量的列表见 :ref:`@GlobalScope<class_@GlobalScope>`\ 。
For the list of global functions and constants that can be accessed in any scripting language, see :ref:`@GlobalScope<class_@GlobalScope>`.
.. rst-class:: classref-introduction-group
@@ -43,7 +43,7 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`char<class_@GDScript_method_char>`\ (\ char\: :ref:`int<class_int>`\ ) |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`convert<class_@GDScript_method_convert>`\ (\ what\: :ref:`Variant<class_Variant>`, type\: :ref:`int<class_int>`\ ) |
| :ref:`Variant<class_Variant>` | :ref:`convert<class_@GDScript_method_convert>`\ (\ what\: :ref:`Variant<class_Variant>`, type\: :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`\ ) |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_Object>` | :ref:`dict_to_inst<class_@GDScript_method_dict_to_inst>`\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -691,9 +691,9 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
**@export_subgroup**\ (\ name\: :ref:`String<class_String>`, prefix\: :ref:`String<class_String>` = ""\ ) :ref:`🔗<class_@GDScript_annotation_@export_subgroup>`
为接下来的导出属性定义一个新的子分组,有助于在检查器面板中组织属性。子分组的运作方式与分组类似,不过需要依赖于一个父级分组。见 :ref:`@export_group<class_@GDScript_annotation_@export_group>`\ 。
Define a new subgroup for the following exported properties. This helps to organize properties in the Inspector dock. Subgroups work exactly like groups, except they need a parent group to exist. See :ref:`@export_group<class_@GDScript_annotation_@export_group>`.
另见 :ref:`@GlobalScope.PROPERTY_USAGE_SUBGROUP<class_@GlobalScope_constant_PROPERTY_USAGE_SUBGROUP>`\ 。
See also :ref:`@GlobalScope.PROPERTY_USAGE_SUBGROUP<class_@GlobalScope_constant_PROPERTY_USAGE_SUBGROUP>`.
::
@@ -705,7 +705,67 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
@export var car_label = "Speedy"
@export var car_number = 3
\ **注意:**\ 子分组不能嵌套,仅提供一层额外的分组深度。新的分组会结束前一个分组,类似地,后续的子分组也会打断之前的子分组。
\ **Note:** Subgroups cannot be nested, but you can use the slash separator (``/``) to achieve the desired effect:
::
@export_group("Car Properties")
@export_subgroup("Wheels", "wheel_")
@export_subgroup("Wheels/Front", "front_wheel_")
@export var front_wheel_strength = 10
@export var front_wheel_mobility = 5
@export_subgroup("Wheels/Rear", "rear_wheel_")
@export var rear_wheel_strength = 8
@export var rear_wheel_mobility = 3
@export_subgroup("Wheels", "wheel_")
@export var wheel_material: PhysicsMaterial
.. rst-class:: classref-item-separator
----
.. _class_@GDScript_annotation_@export_tool_button:
.. rst-class:: classref-annotation
**@export_tool_button**\ (\ text\: :ref:`String<class_String>`, icon\: :ref:`String<class_String>` = ""\ ) :ref:`🔗<class_@GDScript_annotation_@export_tool_button>`
Export a :ref:`Callable<class_Callable>` property as a clickable button with the label ``text``. When the button is pressed, the callable is called.
If ``icon`` is specified, it is used to fetch an icon for the button via :ref:`Control.get_theme_icon<class_Control_method_get_theme_icon>`, from the ``"EditorIcons"`` theme type. If ``icon`` is omitted, the default ``"Callable"`` icon is used instead.
Consider using the :ref:`EditorUndoRedoManager<class_EditorUndoRedoManager>` to allow the action to be reverted safely.
See also :ref:`@GlobalScope.PROPERTY_HINT_TOOL_BUTTON<class_@GlobalScope_constant_PROPERTY_HINT_TOOL_BUTTON>`.
::
@tool
extends Sprite2D
@export_tool_button("Hello") var hello_action = hello
@export_tool_button("Randomize the color!", "ColorRect")
var randomize_color_action = randomize_color
func hello():
print("Hello world!")
func randomize_color():
var undo_redo = EditorInterface.get_editor_undo_redo()
undo_redo.create_action("Randomized Sprite2D Color")
undo_redo.add_do_property(self, &"self_modulate", Color(randf(), randf(), randf()))
undo_redo.add_undo_property(self, &"self_modulate", self_modulate)
undo_redo.commit_action()
\ **Note:** The property is exported without the :ref:`@GlobalScope.PROPERTY_USAGE_STORAGE<class_@GlobalScope_constant_PROPERTY_USAGE_STORAGE>` flag because a :ref:`Callable<class_Callable>` cannot be properly serialized and stored in a file.
\ **Note:** In an exported project neither :ref:`EditorInterface<class_EditorInterface>` nor :ref:`EditorUndoRedoManager<class_EditorUndoRedoManager>` exist, which may cause some scripts to break. To prevent this, you can use :ref:`Engine.get_singleton<class_Engine_method_get_singleton>` and omit the static type from the variable declaration:
::
var undo_redo = Engine.get_singleton(&"EditorInterface").get_editor_undo_redo()
\ **Note:** Avoid storing lambda callables in member variables of :ref:`RefCounted<class_RefCounted>`-based classes (e.g. resources), as this can lead to memory leaks. Use only method callables and optionally :ref:`Callable.bind<class_Callable_method_bind>` or :ref:`Callable.unbind<class_Callable_method_unbind>`.
.. rst-class:: classref-item-separator
@@ -717,17 +777,17 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
**@icon**\ (\ icon_path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_@GDScript_annotation_@icon>`
为当前脚本添加自定义图标。\ ``icon_path`` 所指向的图标会在“场景”面板中该类的所有节点上显示,也会显示在各种编辑器对话框当中。
Add a custom icon to the current script. The icon specified at ``icon_path`` is displayed in the Scene dock for every node of that class, as well as in various editor dialogs.
::
@icon("res://path/to/class/icon.svg")
\ **注意:**\ 只有脚本可以带有自定义图标,不支持内部类。
\ **Note:** Only the script can have a custom icon. Inner classes are not supported.
\ **注意:**\ 由于注解描述的是它们的对象,因此 :ref:`@icon<class_@GDScript_annotation_@icon>` 注解必须放在类定义语句和继承语句之前。
\ **Note:** As annotations describe their subject, the :ref:`@icon<class_@GDScript_annotation_@icon>` annotation must be placed before the class definition and inheritance.
\ **注意:**\ 与其他注解不同,\ :ref:`@icon<class_@GDScript_annotation_@icon>` 注解的参数必须是字符串字面量(不支持常量表达式)。
\ **Note:** Unlike most other annotations, the argument of the :ref:`@icon<class_@GDScript_annotation_@icon>` annotation must be a string literal (constant expressions are not supported).
.. rst-class:: classref-item-separator
@@ -739,11 +799,11 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
**@onready**\ (\ ) :ref:`🔗<class_@GDScript_annotation_@onready>`
标记后续属性会在 :ref:`Node<class_Node>` 就绪时赋值。节点初始化(\ :ref:`Object._init<class_Object_private_method__init>`\ )时不会立即对这些属性赋值,而是会在即将调用 :ref:`Node._ready<class_Node_private_method__ready>` 之前进行计算与储存。
Mark the following property as assigned when the :ref:`Node<class_Node>` is ready. Values for these properties are not assigned immediately when the node is initialized (:ref:`Object._init<class_Object_private_method__init>`), and instead are computed and stored right before :ref:`Node._ready<class_Node_private_method__ready>`.
::
@onready var character_name: Label = $Label
@onready var character_name = $Label
.. rst-class:: classref-item-separator
@@ -823,15 +883,57 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
**@warning_ignore**\ (\ warning\: :ref:`String<class_String>`, ...\ ) |vararg| :ref:`🔗<class_@GDScript_annotation_@warning_ignore>`
将后续语句标记为忽略指定的 ``warning`` 警告。见\ :doc:`GDScript 警告系统》 <../tutorials/scripting/gdscript/warning_system>`\ 。
Mark the following statement to ignore the specified ``warning``. See :doc:`GDScript warning system <../tutorials/scripting/gdscript/warning_system>`.
::
func test():
print("你好")
print("hello")
return
@warning_ignore("unreachable_code")
print("无法到达")
print("unreachable")
See also :ref:`@warning_ignore_start<class_@GDScript_annotation_@warning_ignore_start>` and :ref:`@warning_ignore_restore<class_@GDScript_annotation_@warning_ignore_restore>`.
.. rst-class:: classref-item-separator
----
.. _class_@GDScript_annotation_@warning_ignore_restore:
.. rst-class:: classref-annotation
**@warning_ignore_restore**\ (\ warning\: :ref:`String<class_String>`, ...\ ) |vararg| :ref:`🔗<class_@GDScript_annotation_@warning_ignore_restore>`
Stops ignoring the listed warning types after :ref:`@warning_ignore_start<class_@GDScript_annotation_@warning_ignore_start>`. Ignoring the specified warning types will be reset to Project Settings. This annotation can be omitted to ignore the warning types until the end of the file.
\ **Note:** Unlike most other annotations, arguments of the :ref:`@warning_ignore_restore<class_@GDScript_annotation_@warning_ignore_restore>` annotation must be string literals (constant expressions are not supported).
.. rst-class:: classref-item-separator
----
.. _class_@GDScript_annotation_@warning_ignore_start:
.. rst-class:: classref-annotation
**@warning_ignore_start**\ (\ warning\: :ref:`String<class_String>`, ...\ ) |vararg| :ref:`🔗<class_@GDScript_annotation_@warning_ignore_start>`
Starts ignoring the listed warning types until the end of the file or the :ref:`@warning_ignore_restore<class_@GDScript_annotation_@warning_ignore_restore>` annotation with the given warning type.
::
func test():
var a = 1 # Warning (if enabled in the Project Settings).
@warning_ignore_start("unused_variable")
var b = 2 # No warning.
var c = 3 # No warning.
@warning_ignore_restore("unused_variable")
var d = 4 # Warning (if enabled in the Project Settings).
\ **Note:** To suppress a single warning, use :ref:`@warning_ignore<class_@GDScript_annotation_@warning_ignore>` instead.
\ **Note:** Unlike most other annotations, arguments of the :ref:`@warning_ignore_start<class_@GDScript_annotation_@warning_ignore_start>` annotation must be string literals (constant expressions are not supported).
.. rst-class:: classref-section-separator
@@ -848,6 +950,8 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`Color<class_Color>` **Color8**\ (\ r8\: :ref:`int<class_int>`, g8\: :ref:`int<class_int>`, b8\: :ref:`int<class_int>`, a8\: :ref:`int<class_int>` = 255\ ) :ref:`🔗<class_@GDScript_method_Color8>`
**已弃用:** Use :ref:`Color.from_rgba8<class_Color_method_from_rgba8>` instead.
返回一个由整数红通道(\ ``r8``\ )、整数绿通道(\ ``g8``\ )、整数蓝通道(\ ``b8``\ )和可选的整数 Alpha 通道(\ ``a8``\ )构造的 :ref:`Color<class_Color>`\ ,每个通道的最终值都会除以 ``255.0``\ 。如果你需要精确匹配 :ref:`Image<class_Image>` 中的颜色值,\ :ref:`Color8<class_@GDScript_method_Color8>` 比标准的 :ref:`Color<class_Color>` 构造函数更有用。
::
@@ -895,13 +999,13 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`String<class_String>` **char**\ (\ char\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GDScript_method_char>`
返回给定的 Unicode 码位与ASCII码兼容的单字符字符串作为一个\ :ref:`String<class_String>`\ )。
Returns a single character (as a :ref:`String<class_String>`) of the given Unicode code point (which is compatible with ASCII code).
::
a = char(65) # a 是“A”
a = char(65 + 32) # a 是“a”
a = char(8364) # a 是“€”
var upper = char(65) # upper is "A"
var lower = char(65 + 32) # lower is "a"
var euro = char(8364) # euro is "€"
.. rst-class:: classref-item-separator
@@ -911,7 +1015,7 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **convert**\ (\ what\: :ref:`Variant<class_Variant>`, type\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GDScript_method_convert>`
:ref:`Variant<class_Variant>` **convert**\ (\ what\: :ref:`Variant<class_Variant>`, type\: :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`\ ) :ref:`🔗<class_@GDScript_method_convert>`
**已弃用:** Use :ref:`@GlobalScope.type_convert<class_@GlobalScope_method_type_convert>` instead.
@@ -936,6 +1040,8 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`Object<class_Object>` **dict_to_inst**\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_@GDScript_method_dict_to_inst>`
**已弃用:** Consider using :ref:`JSON.to_native<class_JSON_method_to_native>` or :ref:`Object.get_property_list<class_Object_method_get_property_list>` instead.
将一个 ``dictionary`` (用 :ref:`inst_to_dict<class_@GDScript_method_inst_to_dict>` 创建的)转换回为一个 Object 实例。在反序列化时可能会很有用。
.. rst-class:: classref-item-separator
@@ -981,9 +1087,9 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`Dictionary<class_Dictionary>` **inst_to_dict**\ (\ instance\: :ref:`Object<class_Object>`\ ) :ref:`🔗<class_@GDScript_method_inst_to_dict>`
将传入的 ``instance`` 转换为字典,并将该字典返回,可用于序列化。
**已弃用:** Consider using :ref:`JSON.from_native<class_JSON_method_from_native>` or :ref:`Object.get_property_list<class_Object_method_get_property_list>` instead.
\ **注意:**\ 不能用于序列化附加了内置脚本的对象,也不能用于序列化在内置脚本中分配的对象。
Returns the passed ``instance`` converted to a Dictionary. Can be useful for serializing.
::
@@ -993,13 +1099,17 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
print(d.keys())
print(d.values())
输出:
Prints out:
.. code:: text
[@subpath, @path, foo]
[, res://test.gd, bar]
\ **Note:** This function can only be used to serialize objects with an attached :ref:`GDScript<class_GDScript>` stored in a separate file. Objects without an attached script, with a script written in another language, or with a built-in script are not supported.
\ **Note:** This function is not recursive, which means that nested objects will not be represented as dictionaries. Also, properties passed by reference (:ref:`Object<class_Object>`, :ref:`Dictionary<class_Dictionary>`, :ref:`Array<class_Array>`, and packed arrays) are copied by reference, not duplicated.
.. rst-class:: classref-item-separator
----
@@ -1010,17 +1120,17 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`bool<class_bool>` **is_instance_of**\ (\ value\: :ref:`Variant<class_Variant>`, type\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_@GDScript_method_is_instance_of>`
如果 ``value`` ``type`` 类型的实例,则返回 ``true``\ 。\ ``type`` 的值必须为下列值之一:
Returns ``true`` if ``value`` is an instance of ``type``. The ``type`` value must be one of the following:
- :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 枚举常量,如 :ref:`@GlobalScope.TYPE_INT<class_@GlobalScope_constant_TYPE_INT>`\ 。
- A constant from the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` enumeration, for example :ref:`@GlobalScope.TYPE_INT<class_@GlobalScope_constant_TYPE_INT>`.
- :ref:`ClassDB<class_ClassDB>` 中存在的派生自 :ref:`Object<class_Object>` 的类,如 :ref:`Node<class_Node>`\ 。
- An :ref:`Object<class_Object>`-derived class which exists in :ref:`ClassDB<class_ClassDB>`, for example :ref:`Node<class_Node>`.
- :ref:`Script<class_Script>`\ (可以用任何类,包括内部类)。
- A :ref:`Script<class_Script>` (you can use any class, including inner one).
\ ``type`` 可以不是常量,这一点与 ``is`` 的右操作数不同,\ ``is`` 运算符支持的功能更多(例如类型化数组)。如果你不需要动态类型检查,请使用该运算符,不要使用此方法。
Unlike the right operand of the ``is`` operator, ``type`` can be a non-constant value. The ``is`` operator supports more features (such as typed arrays). Use the operator instead of this method if you do not need dynamic type checking.
示例:
\ **Examples:**\
::
@@ -1029,9 +1139,9 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
print(is_instance_of(a, MyClass))
print(is_instance_of(a, MyClass.InnerClass))
\ **注意:**\ 如果 ``value`` 和/或 ``type`` 为已释放的对象(见 :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`\ ),或者 ``type`` 的数值不为以上选项中的任何一项,则此方法会报运行时错误。
\ **Note:** If ``value`` and/or ``type`` are freed objects (see :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`), or ``type`` is not one of the above options, this method will raise a runtime error.
另见 :ref:`@GlobalScope.typeof<class_@GlobalScope_method_typeof>`\ 、\ :ref:`type_exists<class_@GDScript_method_type_exists>`\ 、\ :ref:`Array.is_same_typed<class_Array_method_is_same_typed>`\ (以及其他 :ref:`Array<class_Array>` 方法)。
See also :ref:`@GlobalScope.typeof<class_@GlobalScope_method_typeof>`, :ref:`type_exists<class_@GDScript_method_type_exists>`, :ref:`Array.is_same_typed<class_Array_method_is_same_typed>` (and other :ref:`Array<class_Array>` methods).
.. rst-class:: classref-item-separator
@@ -1043,15 +1153,15 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`int<class_int>` **len**\ (\ var\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_@GDScript_method_len>`
返回给定 Variant ``var`` 的长度,该长度可以是 :ref:`String<class_String>` :ref:`StringName<class_StringName>` 的字符数,也可以是任意数组类型的元素数或 :ref:`Dictionary<class_Dictionary>` 的大小等。对于所有其他 Variant 类型,都会生成运行时错误并停止执行。
Returns the length of the given Variant ``var``. The length can be the character count of a :ref:`String<class_String>` or :ref:`StringName<class_StringName>`, the element count of any array type, or the size of a :ref:`Dictionary<class_Dictionary>`. For every other Variant type, a run-time error is generated and execution is stopped.
::
a = [1, 2, 3, 4]
len(a) # 返回 4
var a = [1, 2, 3, 4]
len(a) # Returns 4
b = "Hello!"
len(b) # 返回 6
var b = "Hello!"
len(b) # Returns 6
.. rst-class:: classref-item-separator
@@ -1154,28 +1264,28 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
:ref:`Array<class_Array>` **range**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GDScript_method_range>`
返回具有给定范围的数组。\ :ref:`range<class_@GDScript_method_range>` 可以通过三种方式调用:
Returns an array with the given range. :ref:`range<class_@GDScript_method_range>` can be called in three ways:
\ ``range(n: int)``\ :从 0 开始,每次加 1在到达 ``n`` *之前*\ 停止。\ **不包含**\ 参数 ``n``\ 。
\ ``range(n: int)``: Starts from 0, increases by steps of 1, and stops *before* ``n``. The argument ``n`` is **exclusive**.
\ ``range(b: int, n: int)``\ :从 ``b`` 开始,每次加 1在到达 ``n`` *之前*\ 停止。\ **包含**\ 参数 ``b``\ \ **不包含**\ 参数 ``n``\ 。
\ ``range(b: int, n: int)``: Starts from ``b``, increases by steps of 1, and stops *before* ``n``. The arguments ``b`` and ``n`` are **inclusive** and **exclusive**, respectively.
\ ``range(b: int, n: int, s: int)``\ :从 ``b`` 开始,以 ``s`` 为步长递增/递减,在到达 ``n`` *之前*\ 停止。\ **包含**\ 参数 ``b``\ \ **不包含**\ 参数 ``n``\ 。参数 ``s`` **可以**\ 为负数,但不能为 ``0``\ 。如果 ``s`` ``0``\ ,则会输出一条错误消息。
\ ``range(b: int, n: int, s: int)``: Starts from ``b``, increases/decreases by steps of ``s``, and stops *before* ``n``. The arguments ``b`` and ``n`` are **inclusive** and **exclusive**, respectively. The argument ``s`` **can** be negative, but not ``0``. If ``s`` is ``0``, an error message is printed.
\ :ref:`range<class_@GDScript_method_range>` 会先将所有参数转换为 :ref:`int<class_int>` 再进行处理。
\ :ref:`range<class_@GDScript_method_range>` converts all arguments to :ref:`int<class_int>` before processing.
\ **注意:**\ 如果没有满足条件的值,则返回空数组(例如 ``range(2, 5, -1)`` ``range(5, 5, 1)``\ )。
\ **Note:** Returns an empty array if no value meets the value constraint (e.g. ``range(2, 5, -1)`` or ``range(5, 5, 1)``).
示例:
\ **Examples:**\
::
print(range(4)) # 输出 [0, 1, 2, 3]
print(range(2, 5)) # 输出 [2, 3, 4]
print(range(0, 6, 2)) # 输出 [0, 2, 4]
print(range(4, 1, -1)) # 输出 [4, 3, 2]
print(range(4)) # Prints [0, 1, 2, 3]
print(range(2, 5)) # Prints [2, 3, 4]
print(range(0, 6, 2)) # Prints [0, 2, 4]
print(range(4, 1, -1)) # Prints [4, 3, 2]
要反向遍历 :ref:`Array<class_Array>`\ ,请使用:
To iterate over an :ref:`Array<class_Array>` backwards, use:
::
@@ -1183,7 +1293,7 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
for i in range(array.size() - 1, -1, -1):
print(array[i])
输出:
Output:
.. code:: text
@@ -1191,14 +1301,14 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
6
3
要遍历 :ref:`float<class_float>`\ ,请在循环中进行转换。
To iterate over :ref:`float<class_float>`, convert them in the loop.
::
for i in range (3, 0, -1):
print(i / 10.0)
输出:
Output:
.. code:: text

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/@GlobalScope.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/@GlobalScope.xml.
.. _class_@GlobalScope:
@@ -17,11 +17,11 @@
描述
----
全局范围的枚举常量和内置函数的列表。这是所有驻留在全局的,关于错误代码、键码、属性提示等的常量的集合。
A list of global scope enumerated constants and built-in functions. This is all that resides in the globals, constants regarding error codes, keycodes, property hints, etc.
单例也被记录在这里,因为它们可以从任何地方被访问。
Singletons are also documented here, since they can be accessed from anywhere.
对于可以在任何脚本中访问的与 GDScript 相关的条目,请参阅 :ref:`@GDScript<class_@GDScript>`\ 。
For the entries that can only be accessed from scripts written in GDScript, see :ref:`@GDScript<class_@GDScript>`.
.. note::
@@ -1425,7 +1425,7 @@ Help 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BACK** = ``4194376``
媒体返回键。不要与 Android 设备上的返回键相混淆。
Back key.
.. _class_@GlobalScope_constant_KEY_FORWARD:
@@ -1433,7 +1433,7 @@ Help 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_FORWARD** = ``4194377``
媒体前进键。
Forward key.
.. _class_@GlobalScope_constant_KEY_STOP:
@@ -1449,7 +1449,7 @@ Help 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_REFRESH** = ``4194379``
媒体刷新键。
Refresh key.
.. _class_@GlobalScope_constant_KEY_VOLUMEDOWN:
@@ -1753,7 +1753,7 @@ Mac 键盘上的“かな”键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_EXCLAM** = ``33``
! 键。
Exclamation mark (``!``) key.
.. _class_@GlobalScope_constant_KEY_QUOTEDBL:
@@ -1761,7 +1761,7 @@ Mac 键盘上的“かな”键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_QUOTEDBL** = ``34``
" 键。
Double quotation mark (``"``) key.
.. _class_@GlobalScope_constant_KEY_NUMBERSIGN:
@@ -1769,7 +1769,7 @@ Mac 键盘上的“かな”键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_NUMBERSIGN** = ``35``
# 键。
Number sign or *hash* (``#``) key.
.. _class_@GlobalScope_constant_KEY_DOLLAR:
@@ -1777,7 +1777,7 @@ Mac 键盘上的“かな”键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_DOLLAR** = ``36``
$ 键。
Dollar sign (``$``) key.
.. _class_@GlobalScope_constant_KEY_PERCENT:
@@ -1785,7 +1785,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_PERCENT** = ``37``
% 键。
Percent sign (``%``) key.
.. _class_@GlobalScope_constant_KEY_AMPERSAND:
@@ -1793,7 +1793,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_AMPERSAND** = ``38``
& 键。
Ampersand (``&``) key.
.. _class_@GlobalScope_constant_KEY_APOSTROPHE:
@@ -1801,7 +1801,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_APOSTROPHE** = ``39``
' 键。
Apostrophe (``'``) key.
.. _class_@GlobalScope_constant_KEY_PARENLEFT:
@@ -1809,7 +1809,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_PARENLEFT** = ``40``
( 键。
Left parenthesis (``(``) key.
.. _class_@GlobalScope_constant_KEY_PARENRIGHT:
@@ -1817,7 +1817,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_PARENRIGHT** = ``41``
) 键。
Right parenthesis (``)``) key.
.. _class_@GlobalScope_constant_KEY_ASTERISK:
@@ -1825,7 +1825,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_ASTERISK** = ``42``
\* 键。
Asterisk (``*``) key.
.. _class_@GlobalScope_constant_KEY_PLUS:
@@ -1833,7 +1833,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_PLUS** = ``43``
+ 键。
Plus (``+``) key.
.. _class_@GlobalScope_constant_KEY_COMMA:
@@ -1841,7 +1841,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_COMMA** = ``44``
, 键。
Comma (``,``) key.
.. _class_@GlobalScope_constant_KEY_MINUS:
@@ -1849,7 +1849,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_MINUS** = ``45``
- 键。
Minus (``-``) key.
.. _class_@GlobalScope_constant_KEY_PERIOD:
@@ -1857,7 +1857,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_PERIOD** = ``46``
. 键。
Period (``.``) key.
.. _class_@GlobalScope_constant_KEY_SLASH:
@@ -1865,7 +1865,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_SLASH** = ``47``
/ 键。
Slash (``/``) key.
.. _class_@GlobalScope_constant_KEY_0:
@@ -1953,7 +1953,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_COLON** = ``58``
: 键。
Colon (``:``) key.
.. _class_@GlobalScope_constant_KEY_SEMICOLON:
@@ -1961,7 +1961,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_SEMICOLON** = ``59``
; 键。
Semicolon (``;``) key.
.. _class_@GlobalScope_constant_KEY_LESS:
@@ -1969,7 +1969,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_LESS** = ``60``
< 键。
Less-than sign (``<``) key.
.. _class_@GlobalScope_constant_KEY_EQUAL:
@@ -1977,7 +1977,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_EQUAL** = ``61``
= 键。
Equal sign (``=``) key.
.. _class_@GlobalScope_constant_KEY_GREATER:
@@ -1985,7 +1985,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_GREATER** = ``62``
> 键。
Greater-than sign (``>``) key.
.. _class_@GlobalScope_constant_KEY_QUESTION:
@@ -1993,7 +1993,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_QUESTION** = ``63``
? 键。
Question mark (``?``) key.
.. _class_@GlobalScope_constant_KEY_AT:
@@ -2001,7 +2001,7 @@ $ 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_AT** = ``64``
@ 键。
At sign (``@``) key.
.. _class_@GlobalScope_constant_KEY_A:
@@ -2217,7 +2217,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BRACKETLEFT** = ``91``
[ 键。
Left bracket (``[lb]``) key.
.. _class_@GlobalScope_constant_KEY_BACKSLASH:
@@ -2225,7 +2225,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BACKSLASH** = ``92``
\\ 键。
Backslash (``\``) key.
.. _class_@GlobalScope_constant_KEY_BRACKETRIGHT:
@@ -2233,7 +2233,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BRACKETRIGHT** = ``93``
] 键。
Right bracket (``[rb]``) key.
.. _class_@GlobalScope_constant_KEY_ASCIICIRCUM:
@@ -2241,7 +2241,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_ASCIICIRCUM** = ``94``
^ 键。
Caret (``^``) key.
.. _class_@GlobalScope_constant_KEY_UNDERSCORE:
@@ -2249,7 +2249,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_UNDERSCORE** = ``95``
\_ 键。
Underscore (``_``) key.
.. _class_@GlobalScope_constant_KEY_QUOTELEFT:
@@ -2257,7 +2257,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_QUOTELEFT** = ``96``
` 键。
Backtick (`````) key.
.. _class_@GlobalScope_constant_KEY_BRACELEFT:
@@ -2265,7 +2265,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BRACELEFT** = ``123``
{ 键。
Left brace (``{``) key.
.. _class_@GlobalScope_constant_KEY_BAR:
@@ -2273,7 +2273,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BAR** = ``124``
| 键。
Vertical bar or *pipe* (``|``) key.
.. _class_@GlobalScope_constant_KEY_BRACERIGHT:
@@ -2281,7 +2281,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_BRACERIGHT** = ``125``
} 键。
Right brace (``}``) key.
.. _class_@GlobalScope_constant_KEY_ASCIITILDE:
@@ -2289,7 +2289,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_ASCIITILDE** = ``126``
~ 键。
Tilde (``~``) key.
.. _class_@GlobalScope_constant_KEY_YEN:
@@ -2297,7 +2297,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_YEN** = ``165``
¥ 键。
Yen symbol (``¥``) key.
.. _class_@GlobalScope_constant_KEY_SECTION:
@@ -2305,7 +2305,7 @@ Z 键。
:ref:`Key<enum_@GlobalScope_Key>` **KEY_SECTION** = ``167``
§ 键。
Section sign (``§``) key.
.. rst-class:: classref-item-separator
@@ -2329,7 +2329,7 @@ flags **KeyModifierMask**: :ref:`🔗<enum_@GlobalScope_KeyModifierMask>`
.. rst-class:: classref-enumeration-constant
:ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>` **KEY_MODIFIER_MASK** = ``532676608``
:ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>` **KEY_MODIFIER_MASK** = ``2130706432``
修饰键掩码。
@@ -3043,11 +3043,9 @@ enum **Error**: :ref:`🔗<enum_@GlobalScope_Error>`
:ref:`Error<enum_@GlobalScope_Error>` **OK** = ``0``
返回 :ref:`Error<enum_@GlobalScope_Error>` 的方法会在没有错误发生时返回 :ref:`OK<class_@GlobalScope_constant_OK>`\ 。
Methods that return :ref:`Error<enum_@GlobalScope_Error>` return :ref:`OK<class_@GlobalScope_constant_OK>` when no error occurred.
由于 :ref:`OK<class_@GlobalScope_constant_OK>` 的值为 0并且所有其他错误常数都是正整数因此返回值也可以用于布尔检查。
\ **示例:**\
Since :ref:`OK<class_@GlobalScope_constant_OK>` has value ``0``, and all other error constants are positive integers, it can also be used in boolean checks.
::
@@ -3055,11 +3053,11 @@ enum **Error**: :ref:`🔗<enum_@GlobalScope_Error>`
if error != OK:
printerr("Failure!")
# 或者,等价于:
# Or, alternatively:
if error:
printerr("Still failing!")
\ **注意:**\ 许多函数不返回错误代码,但会将错误信息打印到标准输出。
\ **Note:** Many functions do not return an error code, but will print error messages to standard output.
.. _class_@GlobalScope_constant_FAILED:
@@ -3669,74 +3667,74 @@ enum **PropertyHint**: :ref:`🔗<enum_@GlobalScope_PropertyHint>`
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_TYPE_STRING** = ``23``
如果属性为 :ref:`String<class_String>`\ ,则提示该属性代表特定的类型(类)。这样就能使用创建对话框选择类型。该属性中存放的是所选类型,是一个字符串。
If a property is :ref:`String<class_String>`, hints that the property represents a particular type (class). This allows to select a type from the create dialog. The property will store the selected type as a string.
如果属性为 :ref:`Array<class_Array>`\ ,则提示编辑器如何显示其中的元素。\ ``hint_string`` 必须使用 ``":"`` ``"/"`` 对内嵌的类型进行编码。
If a property is :ref:`Array<class_Array>`, hints the editor how to show elements. The ``hint_string`` must encode nested types using ``":"`` and ``"/"``.
.. tabs::
.. code-tab:: gdscript
# elem_type 数组。
# Array of elem_type.
hint_string = "%d:" % [elem_type]
hint_string = "%d/%d:%s" % [elem_type, elem_hint, elem_hint_string]
# elem_type 二维数组(elem_type 数组的数组)。
# Two-dimensional array of elem_type (array of arrays of elem_type).
hint_string = "%d:%d:" % [TYPE_ARRAY, elem_type]
hint_string = "%d:%d/%d:%s" % [TYPE_ARRAY, elem_type, elem_hint, elem_hint_string]
# elem_type 三维数组elem_type 数组的数组的数组)。
# Three-dimensional array of elem_type (array of arrays of arrays of elem_type).
hint_string = "%d:%d:%d:" % [TYPE_ARRAY, TYPE_ARRAY, elem_type]
hint_string = "%d:%d:%d/%d:%s" % [TYPE_ARRAY, TYPE_ARRAY, elem_type, elem_hint, elem_hint_string]
.. code-tab:: csharp
// elem_type 数组。
// Array of elemType.
hintString = $"{elemType:D}:";
hintString = $"{elemType:}/{elemHint:D}:{elemHintString}";
// elem_type 二维数组(elem_type 数组的数组)。
// Two-dimensional array of elemType (array of arrays of elemType).
hintString = $"{Variant.Type.Array:D}:{elemType:D}:";
hintString = $"{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}";
// elem_type 三维数组(elem_type 数组的数组的数组)。
// Three-dimensional array of elemType (array of arrays of arrays of elemType).
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}:";
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}";
示例:
\ **Examples:**\
.. tabs::
.. code-tab:: gdscript
hint_string = "%d:" % [TYPE_INT] # 整数数组。
hint_string = "%d/%d:1,10,1" % [TYPE_INT, PROPERTY_HINT_RANGE] # 整数数组(范围为 1 10)。
hint_string = "%d/%d:Zero,One,Two" % [TYPE_INT, PROPERTY_HINT_ENUM] # 整数数组(枚举)。
hint_string = "%d/%d:Zero,One,Three:3,Six:6" % [TYPE_INT, PROPERTY_HINT_ENUM] # 整数数组(枚举)。
hint_string = "%d/%d:*.png" % [TYPE_STRING, PROPERTY_HINT_FILE] # 字符串数组(文件路径)。
hint_string = "%d/%d:Texture2D" % [TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # 纹理数组。
hint_string = "%d:" % [TYPE_INT] # Array of integers.
hint_string = "%d/%d:1,10,1" % [TYPE_INT, PROPERTY_HINT_RANGE] # Array of integers (in range from 1 to 10).
hint_string = "%d/%d:Zero,One,Two" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum).
hint_string = "%d/%d:Zero,One,Three:3,Six:6" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum).
hint_string = "%d/%d:*.png" % [TYPE_STRING, PROPERTY_HINT_FILE] # Array of strings (file paths).
hint_string = "%d/%d:Texture2D" % [TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Array of textures.
hint_string = "%d:%d:" % [TYPE_ARRAY, TYPE_FLOAT] # 浮点数二维数组。
hint_string = "%d:%d/%d:" % [TYPE_ARRAY, TYPE_STRING, PROPERTY_HINT_MULTILINE_TEXT] # 多行字符串二维数组。
hint_string = "%d:%d/%d:-1,1,0.1" % [TYPE_ARRAY, TYPE_FLOAT, PROPERTY_HINT_RANGE] # 浮点数二维数组(范围为 -1 到 1
hint_string = "%d:%d/%d:Texture2D" % [TYPE_ARRAY, TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # 纹理二维数组。
hint_string = "%d:%d:" % [TYPE_ARRAY, TYPE_FLOAT] # Two-dimensional array of floats.
hint_string = "%d:%d/%d:" % [TYPE_ARRAY, TYPE_STRING, PROPERTY_HINT_MULTILINE_TEXT] # Two-dimensional array of multiline strings.
hint_string = "%d:%d/%d:-1,1,0.1" % [TYPE_ARRAY, TYPE_FLOAT, PROPERTY_HINT_RANGE] # Two-dimensional array of floats (in range from -1 to 1).
hint_string = "%d:%d/%d:Texture2D" % [TYPE_ARRAY, TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Two-dimensional array of textures.
.. code-tab:: csharp
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Range:D}:1,10,1"; // 整数数组(范围为 1 10)。
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Two"; // 整数数组(枚举)。
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Three:3,Six:6"; // 整数数组(枚举)。
hintString = $"{Variant.Type.String:D}/{PropertyHint.File:D}:*.png"; // 字符串数组(文件路径)。
hintString = $"{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // 纹理数组。
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Range:D}:1,10,1"; // Array of integers (in range from 1 to 10).
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Two"; // Array of integers (an enum).
hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Three:3,Six:6"; // Array of integers (an enum).
hintString = $"{Variant.Type.String:D}/{PropertyHint.File:D}:*.png"; // Array of strings (file paths).
hintString = $"{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Array of textures.
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}:"; // 浮点数二维数组。
hintString = $"{Variant.Type.Array:D}:{Variant.Type.String:D}/{PropertyHint.MultilineText:D}:"; // 多行字符串二维数组。
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}/{PropertyHint.Range:D}:-1,1,0.1"; // 浮点数二维数组(范围为 -1 到 1
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // 纹理二维数组。
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}:"; // Two-dimensional array of floats.
hintString = $"{Variant.Type.Array:D}:{Variant.Type.String:D}/{PropertyHint.MultilineText:D}:"; // Two-dimensional array of multiline strings.
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}/{PropertyHint.Range:D}:-1,1,0.1"; // Two-dimensional array of floats (in range from -1 to 1).
hintString = $"{Variant.Type.Array:D}:{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Two-dimensional array of textures.
\ **注意:**\ 后缀冒号是必须的,否则无法正确识别内置类型。
\ **Note:** The trailing colon is required for properly detecting built-in types.
.. _class_@GlobalScope_constant_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE:
@@ -3806,6 +3804,14 @@ enum **PropertyHint**: :ref:`🔗<enum_@GlobalScope_PropertyHint>`
提示属性是一个 :ref:`Array<class_Array>`\ ,其存储类型在提示字符串中指定。
.. _class_@GlobalScope_constant_PROPERTY_HINT_DICTIONARY_TYPE:
.. rst-class:: classref-enumeration-constant
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_DICTIONARY_TYPE** = ``38``
Hints that a property is a :ref:`Dictionary<class_Dictionary>` with the stored types specified in the hint string.
.. _class_@GlobalScope_constant_PROPERTY_HINT_LOCALE_ID:
.. rst-class:: classref-enumeration-constant
@@ -3846,11 +3852,34 @@ enum **PropertyHint**: :ref:`🔗<enum_@GlobalScope_PropertyHint>`
提示字符串属性为密码,每一个字符都会被替换为秘密字符。
.. _class_@GlobalScope_constant_PROPERTY_HINT_TOOL_BUTTON:
.. rst-class:: classref-enumeration-constant
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_TOOL_BUTTON** = ``39``
Hints that a :ref:`Callable<class_Callable>` property should be displayed as a clickable button. When the button is pressed, the callable is called. The hint string specifies the button text and optionally an icon from the ``"EditorIcons"`` theme type.
.. code:: text
"Click me!" - A button with the text "Click me!" and the default "Callable" icon.
"Click me!,ColorRect" - A button with the text "Click me!" and the "ColorRect" icon.
\ **Note:** A :ref:`Callable<class_Callable>` cannot be properly serialized and stored in a file, so it is recommended to use :ref:`PROPERTY_USAGE_EDITOR<class_@GlobalScope_constant_PROPERTY_USAGE_EDITOR>` instead of :ref:`PROPERTY_USAGE_DEFAULT<class_@GlobalScope_constant_PROPERTY_USAGE_DEFAULT>`.
.. _class_@GlobalScope_constant_PROPERTY_HINT_ONESHOT:
.. rst-class:: classref-enumeration-constant
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_ONESHOT** = ``40``
Hints that a property will be changed on its own after setting, such as :ref:`AudioStreamPlayer.playing<class_AudioStreamPlayer_property_playing>` or :ref:`GPUParticles3D.emitting<class_GPUParticles3D_property_emitting>`.
.. _class_@GlobalScope_constant_PROPERTY_HINT_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_MAX** = ``38``
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_MAX** = ``42``
代表 :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` 枚举的大小。
@@ -3966,7 +3995,7 @@ flags **PropertyUsageFlags**: :ref:`🔗<enum_@GlobalScope_PropertyUsageFlags>`
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_SCRIPT_VARIABLE** = ``4096``
该属性是一个脚本变量,应该被序列化并保存在场景文件中。
The property is a script variable. :ref:`PROPERTY_USAGE_SCRIPT_VARIABLE<class_@GlobalScope_constant_PROPERTY_USAGE_SCRIPT_VARIABLE>` can be used to distinguish between exported script variables from built-in variables (which don't have this usage flag). By default, :ref:`PROPERTY_USAGE_SCRIPT_VARIABLE<class_@GlobalScope_constant_PROPERTY_USAGE_SCRIPT_VARIABLE>` is **not** applied to variables that are created by overriding :ref:`Object._get_property_list<class_Object_private_method__get_property_list>` in a script.
.. _class_@GlobalScope_constant_PROPERTY_USAGE_STORE_IF_NULL:
@@ -4000,7 +4029,7 @@ flags **PropertyUsageFlags**: :ref:`🔗<enum_@GlobalScope_PropertyUsageFlags>`
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_CLASS_IS_ENUM** = ``65536``
该属性是一个枚举,即它仅从其关联的枚举中获取被命名的整数常量。
The property is a variable of enum type, i.e. it only takes named integer constants from its associated enumeration.
.. _class_@GlobalScope_constant_PROPERTY_USAGE_NIL_IS_VARIANT:
@@ -5322,7 +5351,7 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`float<class_float>` **angle_difference**\ (\ from\: :ref:`float<class_float>`, to\: :ref:`float<class_float>`\ ) :ref:`🔗<class_@GlobalScope_method_angle_difference>`
返回两个角度之间的差,范围为 ``[-PI, +PI]`` 。当 ``from`` ``to`` 相反时,如果 ``from`` 小于 ``to``\ ,则返回 ``-PI`` ,否则返回 ``PI``
Returns the difference between the two angles (in radians), in the range of ``[-PI, +PI]``. When ``from`` and ``to`` are opposite, returns ``-PI`` if ``from`` is smaller than ``to``, or ``PI`` otherwise.
.. rst-class:: classref-item-separator
@@ -5707,21 +5736,21 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`float<class_float>` **ease**\ (\ x\: :ref:`float<class_float>`, curve\: :ref:`float<class_float>`\ ) :ref:`🔗<class_@GlobalScope_method_ease>`
基于用 ``curve`` 定义的缓动函数返回 ``x`` “缓动后”的值,该缓动函数是基于指数的缓动。\ ``curve`` 可以是任意浮点数,具体数值会导致以下行为:
Returns an "eased" value of ``x`` based on an easing function defined with ``curve``. This easing function is based on an exponent. The ``curve`` can be any floating-point number, with specific values leading to the following behaviors:
.. code:: text
- 低于 -1.0(开区间):缓入缓出
- -1.0:线性
- -1.0 0.0 之间(开区间):缓出缓入
- 0.0:恒定
- 0.0 1.0 之间(开区间):缓出
- 1.0:线性
- 大于 1.0(开区间):缓入
- Lower than -1.0 (exclusive): Ease in-out
- -1.0: Linear
- Between -1.0 and 0.0 (exclusive): Ease out-in
- 0.0: Constant
- Between 0.0 to 1.0 (exclusive): Ease out
- 1.0: Linear
- Greater than 1.0 (exclusive): Ease in
\ `ease() 曲线值速查表 <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png>`__\
\ `ease() curve values cheatsheet <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png>`__\
另见 :ref:`smoothstep<class_@GlobalScope_method_smoothstep>`\ 。如果你需要执行更高级的过渡,请使用 :ref:`Tween.interpolate_value<class_Tween_method_interpolate_value>`\ 。
See also :ref:`smoothstep<class_@GlobalScope_method_smoothstep>`. If you need to perform more advanced transitions, use :ref:`Tween.interpolate_value<class_Tween_method_interpolate_value>`.
.. rst-class:: classref-item-separator
@@ -5733,14 +5762,14 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`String<class_String>` **error_string**\ (\ error\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GlobalScope_method_error_string>`
为给定的 :ref:`Error<enum_@GlobalScope_Error>` 代码返回一个人类可读的名称。
Returns a human-readable name for the given :ref:`Error<enum_@GlobalScope_Error>` code.
::
print(OK) # 输出 0
print(error_string(OK)) # 输出 OK
print(error_string(ERR_BUSY)) # 输出 Busy
print(error_string(ERR_OUT_OF_MEMORY)) # 输出 Out of memory
print(OK) # Prints 0
print(error_string(OK)) # Prints "OK"
print(error_string(ERR_BUSY)) # Prints "Busy"
print(error_string(ERR_OUT_OF_MEMORY)) # Prints "Out of memory"
.. rst-class:: classref-item-separator
@@ -5898,31 +5927,31 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`Object<class_Object>` **instance_from_id**\ (\ instance_id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GlobalScope_method_instance_from_id>`
返回 ``instance_id`` 所对应的 :ref:`Object<class_Object>`\ 。所有对象都有唯一的实例 ID。参见 :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`\ 。
Returns the :ref:`Object<class_Object>` that corresponds to ``instance_id``. All Objects have a unique instance ID. See also :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
.. tabs::
.. code-tab:: gdscript
var foo = "bar"
var drink = "water"
func _ready():
var id = get_instance_id()
var inst = instance_from_id(id)
print(inst.foo) # 输出 bar
var instance = instance_from_id(id)
print(instance.foo) # Prints "water"
.. code-tab:: csharp
public partial class MyNode : Node
{
public string Foo { get; set; } = "bar";
public string Drink { get; set; } = "water";
public override void _Ready()
{
ulong id = GetInstanceId();
var inst = (MyNode)InstanceFromId(Id);
GD.Print(inst.Foo); // 输出 bar
var instance = (MyNode)InstanceFromId(Id);
GD.Print(instance.Drink); // Prints "water"
}
}
@@ -6084,17 +6113,17 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`Variant<class_Variant>` **lerp**\ (\ from\: :ref:`Variant<class_Variant>`, to\: :ref:`Variant<class_Variant>`, weight\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_@GlobalScope_method_lerp>`
通过 ``weight`` 中定义的因子在两个值之间进行线性插值。要执行插值,\ ``weight`` 应介于 ``0.0`` ``1.0`` 之间(包含)。但是,超出此范围的值也是允许的,并可用于执行\ *外推*\ 。如果不需要,请在该函数的结果上使用 :ref:`clamp<class_@GlobalScope_method_clamp>`\ 。
Linearly interpolates between two values by the factor defined in ``weight``. To perform interpolation, ``weight`` should be between ``0.0`` and ``1.0`` (inclusive). However, values outside this range are allowed and can be used to perform *extrapolation*. If this is not desired, use :ref:`clampf<class_@GlobalScope_method_clampf>` to limit ``weight``.
\ ``from`` ``to`` 必须是同一类型。支持的类型:\ :ref:`int<class_int>`\ 、\ :ref:`float<class_float>`\ 、\ :ref:`Vector2<class_Vector2>`\ 、\ :ref:`Vector3<class_Vector3>`\ 、\ :ref:`Vector4<class_Vector4>`\ 、\ :ref:`Color<class_Color>`\ 、\ :ref:`Quaternion<class_Quaternion>`\ 、\ :ref:`Basis<class_Basis>`\ 。
Both ``from`` and ``to`` must be the same type. Supported types: :ref:`int<class_int>`, :ref:`float<class_float>`, :ref:`Vector2<class_Vector2>`, :ref:`Vector3<class_Vector3>`, :ref:`Vector4<class_Vector4>`, :ref:`Color<class_Color>`, :ref:`Quaternion<class_Quaternion>`, :ref:`Basis<class_Basis>`, :ref:`Transform2D<class_Transform2D>`, :ref:`Transform3D<class_Transform3D>`.
::
lerp(0, 4, 0.75) # 返回 3.0
lerp(0, 4, 0.75) # Returns 3.0
另请参阅执行本操作的逆操作的 :ref:`inverse_lerp<class_@GlobalScope_method_inverse_lerp>`\ 。要使用 :ref:`lerp<class_@GlobalScope_method_lerp>` 执行缓动插值,请将其与 :ref:`ease<class_@GlobalScope_method_ease>` :ref:`smoothstep<class_@GlobalScope_method_smoothstep>` 结合使用。另见 :ref:`remap<class_@GlobalScope_method_remap>`\ ,可将一系列连续的值映射到另一个值。
See also :ref:`inverse_lerp<class_@GlobalScope_method_inverse_lerp>` which performs the reverse of this operation. To perform eased interpolation with :ref:`lerp<class_@GlobalScope_method_lerp>`, combine it with :ref:`ease<class_@GlobalScope_method_ease>` or :ref:`smoothstep<class_@GlobalScope_method_smoothstep>`. See also :ref:`remap<class_@GlobalScope_method_remap>` to map a continuous series of values to another.
\ **注意:**\ 为了更好的类型安全,请使用 :ref:`lerpf<class_@GlobalScope_method_lerpf>`\ 、\ :ref:`Vector2.lerp<class_Vector2_method_lerp>`\ 、\ :ref:`Vector3.lerp<class_Vector3_method_lerp>`\ 、\ :ref:`Vector4.lerp<class_Vector4_method_lerp>`\ 、\ :ref:`Color.lerp<class_Color_method_lerp>`\ 、\ :ref:`Quaternion.slerp<class_Quaternion_method_slerp>` :ref:`Basis.slerp<class_Basis_method_slerp>`\ 。
\ **Note:** For better type safety, use :ref:`lerpf<class_@GlobalScope_method_lerpf>`, :ref:`Vector2.lerp<class_Vector2_method_lerp>`, :ref:`Vector3.lerp<class_Vector3_method_lerp>`, :ref:`Vector4.lerp<class_Vector4_method_lerp>`, :ref:`Color.lerp<class_Color_method_lerp>`, :ref:`Quaternion.slerp<class_Quaternion_method_slerp>`, :ref:`Basis.slerp<class_Basis_method_slerp>`, :ref:`Transform2D.interpolate_with<class_Transform2D_method_interpolate_with>`, or :ref:`Transform3D.interpolate_with<class_Transform3D_method_interpolate_with>`.
.. rst-class:: classref-item-separator
@@ -6150,15 +6179,12 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
:ref:`float<class_float>` **linear_to_db**\ (\ lin\: :ref:`float<class_float>`\ ) :ref:`🔗<class_@GlobalScope_method_linear_to_db>`
从线性能量转换为分贝(音频)。这可用于实现按预期运行的音量滑块(因为音量不是线性的)。
Converts from linear energy to decibels (audio). Since volume is not normally linear, this can be used to implement volume sliders that behave as expected.
\ **示例:**\
\ **Example:** Change the Master bus's volume through a :ref:`Slider<class_Slider>` node, which ranges from ``0.0`` to ``1.0``:
::
# “Slider”引用的是 HSlider、VSlider 等继承自 Range 的节点。
# 必须将其范围配置为 0 到 1。
# 如果只想修改特定总线的音量,请修改总线名称。
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db($Slider.value))
.. rst-class:: classref-item-separator
@@ -6414,7 +6440,7 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
|void| **print**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_print>`
以尽可能最佳的方式将一个或多个任意类型的参数转换为字符串,并将其打印到控制台。
Converts one or more arguments of any type to string in the best way possible and prints them to the console.
.. tabs::
@@ -6422,16 +6448,16 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
.. code-tab:: gdscript
var a = [1, 2, 3]
print("a", "b", a) # 输出 ab[1, 2, 3]
print("a", "b", a) # Prints "ab[1, 2, 3]"
.. code-tab:: csharp
var a = new Godot.Collections.Array { 1, 2, 3 };
GD.Print("a", "b", a); // 输出 ab[1, 2, 3]
Godot.Collections.Array a = [1, 2, 3];
GD.Print("a", "b", a); // Prints "ab[1, 2, 3]"
\ **注意:**\ 请考虑使用 :ref:`push_error<class_@GlobalScope_method_push_error>` :ref:`push_warning<class_@GlobalScope_method_push_warning>` 来打印错误和警告消息,而不是 :ref:`print<class_@GlobalScope_method_print>` :ref:`print_rich<class_@GlobalScope_method_print_rich>`\ 。这将它们与用于调试目的的打印消息区分开来,同时还会在打印错误或警告时显示堆栈跟踪。
\ **Note:** Consider using :ref:`push_error<class_@GlobalScope_method_push_error>` and :ref:`push_warning<class_@GlobalScope_method_push_warning>` to print error and warning messages instead of :ref:`print<class_@GlobalScope_method_print>` or :ref:`print_rich<class_@GlobalScope_method_print_rich>`. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. See also :ref:`Engine.print_to_stdout<class_Engine_property_print_to_stdout>` and :ref:`ProjectSettings.application/run/disable_stdout<class_ProjectSettings_property_application/run/disable_stdout>`.
.. rst-class:: classref-item-separator
@@ -6443,34 +6469,32 @@ enum **Variant.Operator**: :ref:`🔗<enum_@GlobalScope_Variant.Operator>`
|void| **print_rich**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_print_rich>`
以尽可能最佳的方式将一个或多个任意类型的参数转换为字符串,并将其打印到控制台。
Converts one or more arguments of any type to string in the best way possible and prints them to the console.
支持以下 BBCode 标签: ``b``\ 、\ ``i``\ 、\ ``u``\ 、\ ``s``\ 、\ ``indent``\ 、\ ``code``\ 、\ ``url``\ 、\ ``center``\ 、\ ``right``\ 、\ ``color``\ 、\ ``bgcolor``\ 、\ ``fgcolor``\ 。
The following BBCode tags are supported: ``b``, ``i``, ``u``, ``s``, ``indent``, ``code``, ``url``, ``center``, ``right``, ``color``, ``bgcolor``, ``fgcolor``.
颜色标签仅支持以下颜色名称:\ ``black``\ 、\ ``red``\ 、\ ``green``\ 、\ ``yellow``\ 、\ ``blue``\ 、\ ``magenta``\ 、\ ``pink``\ 、\ ``purple``\ 、\ ``cyan``\ 、\ ``white``\ 、\ ``orange``\ 、\ ``gray``\ 。不支持十六进制颜色代码。
URL tags only support URLs wrapped by a URL tag, not URLs with a different title.
URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的 URL。
当打印到标准输出时,支持的 BBCode 子集被转换为 ANSI 转义码以供终端仿真器显示。对 ANSI 转义码的支持可能因终端仿真器而异,尤其是斜体和删除线。在标准输出中,\ ``code`` 会使用较弱的文本表示,但字体不变。不支持的标签在标准输出中会原样保留。
When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Support for ANSI escape codes varies across terminal emulators, especially for italic and strikethrough. In standard output, ``code`` is represented with faint text but without any font change. Unsupported tags are left as-is in standard output.
.. tabs::
.. code-tab:: gdscript
print_rich("[color=green][b]Hello world![/b][/color]") # 输出绿色的粗体“Hello world!
print_rich("[color=green][b]Hello world![/b][/color]") # Prints "Hello world!", in green with a bold font.
.. code-tab:: csharp
GD.PrintRich("[color=green][b]Hello world![/b][/color]"); // 输出绿色的粗体“Hello world!
GD.PrintRich("[color=green][b]Hello world![/b][/color]"); // Prints "Hello world!", in green with a bold font.
\ **注意:**\ 请考虑使用 :ref:`push_error<class_@GlobalScope_method_push_error>` :ref:`push_warning<class_@GlobalScope_method_push_warning>` 来打印错误和警告消息,而不是 :ref:`print<class_@GlobalScope_method_print>` :ref:`print_rich<class_@GlobalScope_method_print_rich>`\ 。这将它们与用于调试目的的打印消息区分开来,同时还会在打印错误或警告时显示堆栈跟踪。
\ **Note:** Consider using :ref:`push_error<class_@GlobalScope_method_push_error>` and :ref:`push_warning<class_@GlobalScope_method_push_warning>` to print error and warning messages instead of :ref:`print<class_@GlobalScope_method_print>` or :ref:`print_rich<class_@GlobalScope_method_print_rich>`. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
\ **注意:**\ 在 Windows 中,只有 Windows 10 及后续版本能够在标准输出中正确显示 ANSI 转义码。
\ **Note:** On Windows, only Windows 10 and later correctly displays ANSI escape codes in standard output.
\ **注意:**\ 在编辑器中显示的输出支持可点击的 ``[url=address]文本[/url]`` 标签。点击时, ``[url]`` 标签的 ``address`` 值由 :ref:`OS.shell_open<class_OS_method_shell_open>` 处理。
\ **Note:** Output displayed in the editor supports clickable ``[url=address]text[/url]`` tags. The ``[url]`` tag's ``address`` value is handled by :ref:`OS.shell_open<class_OS_method_shell_open>` when clicked.
.. rst-class:: classref-item-separator
@@ -6519,26 +6543,26 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
|void| **printraw**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_printraw>`
以尽可能最佳的方式将一个或多个参数作为字符串输出到操作系统终端。与 :ref:`print<class_@GlobalScope_method_print>` 不同的是,最后不会自动添加换行符。
Prints one or more arguments to strings in the best way possible to the OS terminal. Unlike :ref:`print<class_@GlobalScope_method_print>`, no newline is automatically added at the end.
\ **注意:**\ 操作系统终端与编辑器的“输出”面板\ *不同*\ 。从终端运行 Godot 时可以看到发送至操作系统终端的输出。在 Windows 上,需要用到 ``console.exe`` 可执行文件。
\ **Note:** The OS terminal is *not* the same as the editor's Output dock. The output sent to the OS terminal can be seen when running Godot from a terminal. On Windows, this requires using the ``console.exe`` executable.
.. tabs::
.. code-tab:: gdscript
# Prints "ABC" to terminal.
printraw("A")
printraw("B")
printraw("C")
# 输出 ABC 到终端
.. code-tab:: csharp
// Prints "ABC" to terminal.
GD.PrintRaw("A");
GD.PrintRaw("B");
GD.PrintRaw("C");
// 输出 ABC 到终端
@@ -6552,18 +6576,18 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
|void| **prints**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_prints>`
将一个或多个参数打印到控制台,每个参数之间有一个空格。
Prints one or more arguments to the console with a space between each argument.
.. tabs::
.. code-tab:: gdscript
prints("A", "B", "C") # 输出 A B C
prints("A", "B", "C") # Prints "A B C"
.. code-tab:: csharp
GD.PrintS("A", "B", "C"); // 输出 A B C
GD.PrintS("A", "B", "C"); // Prints "A B C"
@@ -6577,18 +6601,18 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
|void| **printt**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_printt>`
将一个或多个参数打印到控制台,每个参数之间有一个制表符。
Prints one or more arguments to the console with a tab between each argument.
.. tabs::
.. code-tab:: gdscript
printt("A", "B", "C") # 输出 A B C
printt("A", "B", "C") # Prints "A B C"
.. code-tab:: csharp
GD.PrintT("A", "B", "C"); // 输出 A B C
GD.PrintT("A", "B", "C"); // Prints "A B C"
@@ -6602,22 +6626,22 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
|void| **push_error**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_push_error>`
将错误消息推送到 Godot 的内置调试器和 OS 终端。
Pushes an error message to Godot's built-in debugger and to the OS terminal.
.. tabs::
.. code-tab:: gdscript
push_error("test error") # 向调试器和终端打印 “test error” 作为错误调用
push_error("test error") # Prints "test error" to debugger and terminal as an error.
.. code-tab:: csharp
GD.PushError("test error"); // 向调试器和终端打印 “test error” 作为错误调用
GD.PushError("test error"); // Prints "test error" to debugger and terminal as an error.
\ **注意:**\ 该函数不会暂停项目执行。要在调试版本中打印错误消息并暂停项目执行,请改用 ``assert(false, "test error")``\ 。
\ **Note:** This function does not pause project execution. To print an error message and pause project execution in debug builds, use ``assert(false, "test error")`` instead.
.. rst-class:: classref-item-separator
@@ -6629,18 +6653,18 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
|void| **push_warning**\ (\ ...\ ) |vararg| :ref:`🔗<class_@GlobalScope_method_push_warning>`
将警告消息推送到 Godot 的内置调试器和 OS 终端。
Pushes a warning message to Godot's built-in debugger and to the OS terminal.
.. tabs::
.. code-tab:: gdscript
push_warning("test warning") # 以警告的形式向调试器和终端输出 “test warning”
push_warning("test warning") # Prints "test warning" to debugger and terminal as a warning.
.. code-tab:: csharp
GD.PushWarning("test warning"); // 以警告的形式向调试器和终端输出 “test warning”
GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as a warning.
@@ -6672,16 +6696,16 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
:ref:`PackedInt64Array<class_PackedInt64Array>` **rand_from_seed**\ (\ seed\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GlobalScope_method_rand_from_seed>`
给定一个 ``seed``\ ,返回一个大小为 ``2``:ref:`PackedInt64Array<class_PackedInt64Array>`\ ,其中第一个元素是随机化的 :ref:`int<class_int>` 值,第二个元素与 ``seed`` 相同。传入相同的 ``seed`` 会一致地返回相同的数组。
Given a ``seed``, returns a :ref:`PackedInt64Array<class_PackedInt64Array>` of size ``2``, where its first element is the randomized :ref:`int<class_int>` value, and the second element is the same as ``seed``. Passing the same ``seed`` consistently returns the same array.
\ **注意:**\ 这里的“种子”是指伪随机数发生器的内部状态,目前实现为一个 64 位整数。
\ **Note:** "Seed" here refers to the internal state of the pseudo random number generator, currently implemented as a 64 bit integer.
::
var a = rand_from_seed(4)
print(a[0]) # 输出 2879024997
print(a[1]) # 输出 4
print(a[0]) # Prints 2879024997
print(a[1]) # Prints 4
.. rst-class:: classref-item-separator
@@ -7020,13 +7044,13 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
:ref:`int<class_int>` **signi**\ (\ x\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GlobalScope_method_signi>`
如果 ``x`` 为负,则返回 ``-1``\ ;如果 ``x`` 为正,则返回 ``1``\ ;如果 ``x`` 为零,则返回 ``0``\ 。
Returns ``-1`` if ``x`` is negative, ``1`` if ``x`` is positive, and ``0`` if ``x`` is zero.
::
signi(-6) # 返回 -1
signi(0) # 返回 0
signi(6) # 返回 1
signi(-6) # Returns -1
signi(0) # Returns 0
signi(6) # Returns 1
.. rst-class:: classref-item-separator
@@ -7072,22 +7096,26 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
:ref:`float<class_float>` **smoothstep**\ (\ from\: :ref:`float<class_float>`, to\: :ref:`float<class_float>`, x\: :ref:`float<class_float>`\ ) :ref:`🔗<class_@GlobalScope_method_smoothstep>`
返回 ``x````0````1`` 之间平滑插值的结果,基于 ``x`` 相对于边 ``from`` ``to`` 的位置。
Returns a smooth cubic Hermite interpolation between ``0`` and ``1``.
如果 ``x <= from``\ ,则返回值为 ``0``\ ;如果 ``x >= to``\ ,则返回值为 ``1``\ 。如果 ``x`` 位于 ``from`` ``to`` 之间,则返回值遵循一条将 ``x`` 映射到 ``0`` ``1`` 之间的 S 形曲线。
For positive ranges (when ``from <= to``) the return value is ``0`` when ``x <= from``, and ``1`` when ``x >= to``. If ``x`` lies between ``from`` and ``to``, the return value follows an S-shaped curve that smoothly transitions from ``0`` to ``1``.
这条 S 形曲线是三次 Hermite 插值器,由 ``f(y) = 3*y^2 - 2*y^3`` 给出,其中 ``y = (x-from) / (to-from)``\ 。
For negative ranges (when ``from > to``) the function is mirrored and returns ``1`` when ``x <= to`` and ``0`` when ``x >= from``.
This S-shaped curve is the cubic Hermite interpolator, given by ``f(y) = 3*y^2 - 2*y^3`` where ``y = (x-from) / (to-from)``.
::
smoothstep(0, 2, -5.0) # 返回 0.0
smoothstep(0, 2, 0.5) # 返回 0.15625
smoothstep(0, 2, 1.0) # 返回 0.5
smoothstep(0, 2, 2.0) # 返回 1.0
smoothstep(0, 2, -5.0) # Returns 0.0
smoothstep(0, 2, 0.5) # Returns 0.15625
smoothstep(0, 2, 1.0) # Returns 0.5
smoothstep(0, 2, 2.0) # Returns 1.0
与曲线值为 ``-1.6521``:ref:`ease<class_@GlobalScope_method_ease>` 相比,\ :ref:`smoothstep<class_@GlobalScope_method_smoothstep>` 返回最平滑的曲线,导数没有突然变化。如果需要执行更高级的过渡,请使用 :ref:`Tween<class_Tween>`:ref:`AnimationPlayer<class_AnimationPlayer>`\ 。
Compared to :ref:`ease<class_@GlobalScope_method_ease>` with a curve value of ``-1.6521``, :ref:`smoothstep<class_@GlobalScope_method_smoothstep>` returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use :ref:`Tween<class_Tween>` or :ref:`AnimationPlayer<class_AnimationPlayer>`.
\ `smoothstep() ease(x, -1.6521) 返回值的比较 <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png>`__
\ `Comparison between smoothstep() and ease(x, -1.6521) return values <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png>`__\
\ `Smoothstep() return values with positive, zero, and negative ranges <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_range.webp>`__
.. rst-class:: classref-item-separator
@@ -7305,15 +7333,15 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
:ref:`String<class_String>` **type_string**\ (\ type\: :ref:`int<class_int>`\ ) :ref:`🔗<class_@GlobalScope_method_type_string>`
返回类型 ``type`` 的人类可读名称,参数使用 :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 的值。
Returns a human-readable name of the given ``type``, using the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
::
print(TYPE_INT) # 输出 2
print(type_string(TYPE_INT)) # 输出“int”。
print(type_string(TYPE_STRING)) # 输出“String”。
print(TYPE_INT) # Prints 2
print(type_string(TYPE_INT)) # Prints "int"
print(type_string(TYPE_STRING)) # Prints "String"
另见 :ref:`typeof<class_@GlobalScope_method_typeof>`\ 。
See also :ref:`typeof<class_@GlobalScope_method_typeof>`.
.. rst-class:: classref-item-separator
@@ -7325,19 +7353,19 @@ URL 标签仅支持在 URL 标签中包含 URL不支持使用不同标题的
:ref:`int<class_int>` **typeof**\ (\ variable\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_@GlobalScope_method_typeof>`
返回变量 ``variable`` 的内部类型,使用的是 :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 中的值。
Returns the internal type of the given ``variable``, using the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
::
var json = JSON.new()
json.parse('["a", "b", "c"]')
var result = json.get_data()
if typeof(result) == TYPE_ARRAY:
print(result[0]) # 输出 a
if result is Array:
print(result[0]) # Prints "a"
else:
print("出乎意料的结果")
print("Unexpected result!")
另见 :ref:`type_string<class_@GlobalScope_method_type_string>`\ 。
See also :ref:`type_string<class_@GlobalScope_method_type_string>`.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AABB.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AABB.xml.
.. _class_AABB:
@@ -103,7 +103,7 @@ AABB
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_shortest_axis_size<class_AABB_method_get_shortest_axis_size>`\ (\ ) |const| |
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`get_support<class_AABB_method_get_support>`\ (\ dir\: :ref:`Vector3<class_Vector3>`\ ) |const| |
| :ref:`Vector3<class_Vector3>` | :ref:`get_support<class_AABB_method_get_support>`\ (\ direction\: :ref:`Vector3<class_Vector3>`\ ) |const| |
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_volume<class_AABB_method_get_volume>`\ (\ ) |const| |
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -163,7 +163,7 @@ AABB
:ref:`Vector3<class_Vector3>` **end** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_AABB_property_end>`
终点。通常是边界框的前方右上角,等价于 ``position + size``\ 。设置该点会影响 :ref:`size<class_AABB_property_size>`\ 。
The ending point. This is usually the corner on the top-right and back of the bounding box, and is equivalent to ``position + size``. Setting this point affects the :ref:`size<class_AABB_property_size>`.
.. rst-class:: classref-item-separator
@@ -175,7 +175,7 @@ AABB
:ref:`Vector3<class_Vector3>` **position** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_AABB_property_position>`
原点。通常是边界框的背面左下角。
The origin point. This is usually the corner on the bottom-left and forward of the bounding box.
.. rst-class:: classref-item-separator
@@ -187,9 +187,9 @@ AABB
:ref:`Vector3<class_Vector3>` **size** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_AABB_property_size>`
边界框的宽度、高度、深度,相对于 :ref:`position<class_AABB_property_position>`\ 。设置该值会影响终点 :ref:`end<class_AABB_property_end>`\ 。
The bounding box's width, height, and depth starting from :ref:`position<class_AABB_property_position>`. Setting this value also affects the :ref:`end<class_AABB_property_end>` point.
\ **注意:**\ 建议将宽度、高度、深度设置为非负数,因为 Godot 中的大多数方法假设 :ref:`position<class_AABB_property_position>` 为背面的左下角、\ :ref:`end<class_AABB_property_end>` 为正面的右上角。要获取等价且大小非负的边界框,请使用 :ref:`abs<class_AABB_method_abs>`\ 。
\ **Note:** It's recommended setting the width, height, and depth to non-negative values. This is because most methods in Godot assume that the :ref:`position<class_AABB_property_position>` is the bottom-left-forward corner, and the :ref:`end<class_AABB_property_end>` is the top-right-back corner. To get an equivalent bounding box with non-negative size, use :ref:`abs<class_AABB_method_abs>`.
.. rst-class:: classref-section-separator
@@ -243,7 +243,7 @@ AABB
:ref:`AABB<class_AABB>` **abs**\ (\ ) |const| :ref:`🔗<class_AABB_method_abs>`
返回一个与该边界框等效的 **AABB**\ ,其宽度、高度和深度被修改为非负值。
Returns an **AABB** equivalent to this bounding box, with its width, height, and depth modified to be non-negative values.
.. tabs::
@@ -252,19 +252,19 @@ AABB
var box = AABB(Vector3(5, 0, 5), Vector3(-20, -10, -5))
var absolute = box.abs()
print(absolute.position) # 打印 (-15, -10, 0)
print(absolute.size) # 打印 (20, 10, 5)
print(absolute.position) # Prints (-15.0, -10.0, 0.0)
print(absolute.size) # Prints (20.0, 10.0, 5.0)
.. code-tab:: csharp
var box = new Aabb(new Vector3(5, 0, 5), new Vector3(-20, -10, -5));
var absolute = box.Abs();
GD.Print(absolute.Position); // 打印 (-15, -10, 0)
GD.Print(absolute.Size); // 打印 (20, 10, 5)
GD.Print(absolute.Position); // Prints (-15, -10, 0)
GD.Print(absolute.Size); // Prints (20, 10, 5)
\ **注意:**\ 当 :ref:`size<class_AABB_property_size>` 为负时,建议使用该方法,因为 Godot 中的大多数其他方法都假设 :ref:`size<class_AABB_property_size>` 的分量大于 ``0``\ 。
\ **Note:** It's recommended to use this method when :ref:`size<class_AABB_property_size>` is negative, as most other methods in Godot assume that the :ref:`size<class_AABB_property_size>`'s components are greater than ``0``.
.. rst-class:: classref-item-separator
@@ -313,7 +313,7 @@ AABB
:ref:`AABB<class_AABB>` **expand**\ (\ to_point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_AABB_method_expand>`
返回该边界框的副本,如有必要,该边界框被扩展为将边与给定的 ``to_point`` 对齐。
Returns a copy of this bounding box expanded to align the edges with the given ``to_point``, if necessary.
.. tabs::
@@ -323,24 +323,24 @@ AABB
var box = AABB(Vector3(0, 0, 0), Vector3(5, 2, 5))
box = box.expand(Vector3(10, 0, 0))
print(box.position) # 打印 (0, 0, 0)
print(box.size) # 打印 (10, 2, 5)
print(box.position) # Prints (0.0, 0.0, 0.0)
print(box.size) # Prints (10.0, 2.0, 5.0)
box = box.expand(Vector3(-5, 0, 5))
print(box.position) # 打印 (-5, 0, 0)
print(box.size) # 打印 (15, 2, 5)
print(box.position) # Prints (-5.0, 0.0, 0.0)
print(box.size) # Prints (15.0, 2.0, 5.0)
.. code-tab:: csharp
var box = new Aabb(new Vector3(0, 0, 0), new Vector3(5, 2, 5));
box = box.Expand(new Vector3(10, 0, 0));
GD.Print(box.Position); // 打印 (0, 0, 0)
GD.Print(box.Size); // 打印 (10, 2, 5)
GD.Print(box.Position); // Prints (0, 0, 0)
GD.Print(box.Size); // Prints (10, 2, 5)
box = box.Expand(new Vector3(-5, 0, 5));
GD.Print(box.Position); // 打印 (-5, 0, 0)
GD.Print(box.Size); // 打印 (15, 2, 5)
GD.Print(box.Position); // Prints (-5, 0, 0)
GD.Print(box.Size); // Prints (15, 2, 5)
@@ -378,7 +378,7 @@ AABB
:ref:`Vector3<class_Vector3>` **get_longest_axis**\ (\ ) |const| :ref:`🔗<class_AABB_method_get_longest_axis>`
返回该边界框的 :ref:`size<class_AABB_property_size>` 的最长归一化轴,作为 :ref:`Vector3<class_Vector3>`\ \ :ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`\ 、\ :ref:`Vector3.UP<class_Vector3_constant_UP>` :ref:`Vector3.BACK<class_Vector3_constant_BACK>`\ )。
Returns the longest normalized axis of this bounding box's :ref:`size<class_AABB_property_size>`, as a :ref:`Vector3<class_Vector3>` (:ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`, :ref:`Vector3.UP<class_Vector3_constant_UP>`, or :ref:`Vector3.BACK<class_Vector3_constant_BACK>`).
.. tabs::
@@ -387,21 +387,21 @@ AABB
var box = AABB(Vector3(0, 0, 0), Vector3(2, 4, 8))
print(box.get_longest_axis()) # 打印 (0, 0, 1)
print(box.get_longest_axis_index()) # 打印 2
print(box.get_longest_axis_size()) # 打印 8
print(box.get_longest_axis()) # Prints (0.0, 0.0, 1.0)
print(box.get_longest_axis_index()) # Prints 2
print(box.get_longest_axis_size()) # Prints 8.0
.. code-tab:: csharp
var box = new Aabb(new Vector3(0, 0, 0), new Vector3(2, 4, 8));
GD.Print(box.GetLongestAxis()); // 打印 (0, 0, 1)
GD.Print(box.GetLongestAxisIndex()); // 打印 2
GD.Print(box.GetLongestAxisSize()); // 打印 8
GD.Print(box.GetLongestAxis()); // Prints (0, 0, 1)
GD.Print(box.GetLongestAxisIndex()); // Prints Z
GD.Print(box.GetLongestAxisSize()); // Prints 8
另见 :ref:`get_longest_axis_index<class_AABB_method_get_longest_axis_index>` :ref:`get_longest_axis_size<class_AABB_method_get_longest_axis_size>`\ 。
See also :ref:`get_longest_axis_index<class_AABB_method_get_longest_axis_index>` and :ref:`get_longest_axis_size<class_AABB_method_get_longest_axis_size>`.
.. rst-class:: classref-item-separator
@@ -441,7 +441,7 @@ AABB
:ref:`Vector3<class_Vector3>` **get_shortest_axis**\ (\ ) |const| :ref:`🔗<class_AABB_method_get_shortest_axis>`
返回该边界框的 :ref:`size<class_AABB_property_size>` 的最短归一化轴,作为 :ref:`Vector3<class_Vector3>`\ \ :ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`\ 、\ :ref:`Vector3.UP<class_Vector3_constant_UP>` :ref:`Vector3.BACK<class_Vector3_constant_BACK>`\ )。
Returns the shortest normalized axis of this bounding box's :ref:`size<class_AABB_property_size>`, as a :ref:`Vector3<class_Vector3>` (:ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`, :ref:`Vector3.UP<class_Vector3_constant_UP>`, or :ref:`Vector3.BACK<class_Vector3_constant_BACK>`).
.. tabs::
@@ -450,21 +450,21 @@ AABB
var box = AABB(Vector3(0, 0, 0), Vector3(2, 4, 8))
print(box.get_shortest_axis()) # 打印 (1, 0, 0)
print(box.get_shortest_axis_index()) # 打印 0
print(box.get_shortest_axis_size()) # 打印 2
print(box.get_shortest_axis()) # Prints (1.0, 0.0, 0.0)
print(box.get_shortest_axis_index()) # Prints 0
print(box.get_shortest_axis_size()) # Prints 2.0
.. code-tab:: csharp
var box = new Aabb(new Vector3(0, 0, 0), new Vector3(2, 4, 8));
GD.Print(box.GetShortestAxis()); // 打印 (1, 0, 0)
GD.Print(box.GetShortestAxisIndex()); // 打印 0
GD.Print(box.GetShortestAxisSize()); // 打印 2
GD.Print(box.GetShortestAxis()); // Prints (1, 0, 0)
GD.Print(box.GetShortestAxisIndex()); // Prints X
GD.Print(box.GetShortestAxisSize()); // Prints 2
另见 :ref:`get_shortest_axis_index<class_AABB_method_get_shortest_axis_index>` :ref:`get_shortest_axis_size<class_AABB_method_get_shortest_axis_size>`\ 。
See also :ref:`get_shortest_axis_index<class_AABB_method_get_shortest_axis_index>` and :ref:`get_shortest_axis_size<class_AABB_method_get_shortest_axis_size>`.
.. rst-class:: classref-item-separator
@@ -502,7 +502,7 @@ AABB
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **get_support**\ (\ dir\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_AABB_method_get_support>`
:ref:`Vector3<class_Vector3>` **get_support**\ (\ direction\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_AABB_method_get_support>`
返回给定方向上最远的边界框的顶点位置。该点在碰撞检测算法中通常被称为支撑点。
@@ -528,7 +528,7 @@ AABB
:ref:`AABB<class_AABB>` **grow**\ (\ by\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_AABB_method_grow>`
返回该边界框的副本,该边界框在所有边上扩展给定量 ``by``\ 。负数会缩小该框。
Returns a copy of this bounding box extended on all sides by the given amount ``by``. A negative amount shrinks the box instead.
.. tabs::
@@ -536,22 +536,22 @@ AABB
.. code-tab:: gdscript
var a = AABB(Vector3(4, 4, 4), Vector3(8, 8, 8)).grow(4)
print(a.position) # 打印 (0, 0, 0)
print(a.size) # 打印 (16, 16, 16)
print(a.position) # Prints (0.0, 0.0, 0.0)
print(a.size) # Prints (16.0, 16.0, 16.0)
var b = AABB(Vector3(0, 0, 0), Vector3(8, 4, 2)).grow(2)
print(b.position) # 打印 (-2, -2, -2)
print(b.size) # 打印 (12, 8, 6)
print(b.position) # Prints (-2.0, -2.0, -2.0)
print(b.size) # Prints (12.0, 8.0, 6.0)
.. code-tab:: csharp
var a = new Aabb(new Vector3(4, 4, 4), new Vector3(8, 8, 8)).Grow(4);
GD.Print(a.Position); // 打印 (0, 0, 0)
GD.Print(a.Size); // 打印 (16, 16, 16)
GD.Print(a.Position); // Prints (0, 0, 0)
GD.Print(a.Size); // Prints (16, 16, 16)
var b = new Aabb(new Vector3(0, 0, 0), new Vector3(8, 4, 2)).Grow(2);
GD.Print(b.Position); // 打印 (-2, -2, -2)
GD.Print(b.Size); // 打印 (12, 8, 6)
GD.Print(b.Position); // Prints (-2, -2, -2)
GD.Print(b.Size); // Prints (12, 8, 6)
@@ -603,7 +603,7 @@ AABB
:ref:`AABB<class_AABB>` **intersection**\ (\ with\: :ref:`AABB<class_AABB>`\ ) |const| :ref:`🔗<class_AABB_method_intersection>`
返回该边界框与 ``with`` 之间的交集。如果框不相交,则返回空的 **AABB**\ 。如果框在边相交,则返回没有体积的平 **AABB**\ (请参阅 :ref:`has_surface<class_AABB_method_has_surface>` :ref:`has_volume<class_AABB_method_has_volume>`\ )。
Returns the intersection between this bounding box and ``with``. If the boxes do not intersect, returns an empty **AABB**. If the boxes intersect at the edge, returns a flat **AABB** with no volume (see :ref:`has_surface<class_AABB_method_has_surface>` and :ref:`has_volume<class_AABB_method_has_volume>`).
.. tabs::
@@ -614,8 +614,8 @@ AABB
var box2 = AABB(Vector3(2, 0, 2), Vector3(8, 4, 4))
var intersection = box1.intersection(box2)
print(intersection.position) # 打印 (2, 0, 2)
print(intersection.size) # 打印 (3, 2, 4)
print(intersection.position) # Prints (2.0, 0.0, 2.0)
print(intersection.size) # Prints (3.0, 2.0, 4.0)
.. code-tab:: csharp
@@ -623,12 +623,12 @@ AABB
var box2 = new Aabb(new Vector3(2, 0, 2), new Vector3(8, 4, 4));
var intersection = box1.Intersection(box2);
GD.Print(intersection.Position); // 打印 (2, 0, 2)
GD.Print(intersection.Size); // 打印 (3, 2, 4)
GD.Print(intersection.Position); // Prints (2, 0, 2)
GD.Print(intersection.Size); // Prints (3, 2, 4)
\ **注意:**\ 如果你只需要知道两个边界框是否相交,请改用 :ref:`intersects<class_AABB_method_intersects>`\ 。
\ **Note:** If you only need to know whether two bounding boxes are intersecting, use :ref:`intersects<class_AABB_method_intersects>`, instead.
.. rst-class:: classref-item-separator
@@ -692,7 +692,7 @@ AABB
:ref:`bool<class_bool>` **is_equal_approx**\ (\ aabb\: :ref:`AABB<class_AABB>`\ ) |const| :ref:`🔗<class_AABB_method_is_equal_approx>`
如果该边界框和 ``aabb`` 近似相等,则返回 ``true``\ ,判断方法是通过在 :ref:`position<class_AABB_property_position>`:ref:`size<class_AABB_property_size>` 上调用 :ref:`Vector3.is_equal_approx<class_Vector3_method_is_equal_approx>`\ 。
Returns ``true`` if this bounding box and ``aabb`` are approximately equal, by calling :ref:`Vector3.is_equal_approx<class_Vector3_method_is_equal_approx>` on the :ref:`position<class_AABB_property_position>` and the :ref:`size<class_AABB_property_size>`.
.. rst-class:: classref-item-separator
@@ -704,7 +704,7 @@ AABB
:ref:`bool<class_bool>` **is_finite**\ (\ ) |const| :ref:`🔗<class_AABB_method_is_finite>`
如果该边界框的值是有限的,则返回 ``true``\ ,判断方法是通过在 :ref:`position<class_AABB_property_position>` 和 :ref:`size<class_AABB_property_size>` 上调用 :ref:`Vector3.is_finite<class_Vector3_method_is_finite>`\ 。
Returns ``true`` if this bounding box's values are finite, by calling :ref:`Vector3.is_finite<class_Vector3_method_is_finite>` on the :ref:`position<class_AABB_property_position>` and the :ref:`size<class_AABB_property_size>`.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AcceptDialog.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AcceptDialog.xml.
.. _class_AcceptDialog:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AESContext.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AESContext.xml.
.. _class_AESContext:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatableBody2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatableBody2D.xml.
.. _class_AnimatableBody2D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatableBody3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatableBody3D.xml.
.. _class_AnimatableBody3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedSprite2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedSprite2D.xml.
.. _class_AnimatedSprite2D:
@@ -413,18 +413,15 @@ AnimatedSprite2D
|void| **set_frame_and_progress**\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimatedSprite2D_method_set_frame_and_progress>`
设置 :ref:`frame<class_AnimatedSprite2D_property_frame>` 时会隐式将 :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` 重置为 ``0.0``\ ,但这个方法可以避免。
Sets :ref:`frame<class_AnimatedSprite2D_property_frame>` the :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to the given values. Unlike setting :ref:`frame<class_AnimatedSprite2D_property_frame>`, this method does not reset the :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to ``0.0`` implicitly.
如果你想要把当前的 :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` 带到其他 :ref:`frame<class_AnimatedSprite2D_property_frame>` 中,就会非常有用。
\ **示例:**\
\ **Example:** Change the animation while keeping the same :ref:`frame<class_AnimatedSprite2D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>`:
.. tabs::
.. code-tab:: gdscript
# 更改动画的同时保留帧索引和进度。
var current_frame = animated_sprite.get_frame()
var current_progress = animated_sprite.get_frame_progress()
animated_sprite.play("walk_another_skin")

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedSprite3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedSprite3D.xml.
.. _class_AnimatedSprite3D:
@@ -333,18 +333,15 @@ AnimatedSprite3D
|void| **set_frame_and_progress**\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimatedSprite3D_method_set_frame_and_progress>`
设置 :ref:`frame<class_AnimatedSprite3D_property_frame>` 时会隐式将 :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` 重置为 ``0.0``\ ,但这个方法可以避免。
Sets :ref:`frame<class_AnimatedSprite3D_property_frame>` the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to the given values. Unlike setting :ref:`frame<class_AnimatedSprite3D_property_frame>`, this method does not reset the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to ``0.0`` implicitly.
如果你想要把当前的 :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` 带到其他 :ref:`frame<class_AnimatedSprite3D_property_frame>` 中,就会非常有用。
\ **示例:**\
\ **Example:** Change the animation while keeping the same :ref:`frame<class_AnimatedSprite3D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>`:
.. tabs::
.. code-tab:: gdscript
# 更改动画的同时保留帧索引和进度。
var current_frame = animated_sprite.get_frame()
var current_progress = animated_sprite.get_frame_progress()
animated_sprite.play("walk_another_skin")

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedTexture.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedTexture.xml.
.. _class_AnimatedTexture:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Animation.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Animation.xml.
.. _class_Animation:
@@ -85,6 +85,8 @@ Animation
.. table::
:widths: auto
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_marker<class_Animation_method_add_marker>`\ (\ name\: :ref:`StringName<class_StringName>`, time\: :ref:`float<class_float>`\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`add_track<class_Animation_method_add_track>`\ (\ type\: :ref:`TrackType<enum_Animation_TrackType>`, at_position\: :ref:`int<class_int>` = -1\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -140,16 +142,34 @@ Animation
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`find_track<class_Animation_method_find_track>`\ (\ path\: :ref:`NodePath<class_NodePath>`, type\: :ref:`TrackType<enum_Animation_TrackType>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_marker_at_time<class_Animation_method_get_marker_at_time>`\ (\ time\: :ref:`float<class_float>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`get_marker_color<class_Animation_method_get_marker_color>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_marker_names<class_Animation_method_get_marker_names>`\ (\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_marker_time<class_Animation_method_get_marker_time>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_next_marker<class_Animation_method_get_next_marker>`\ (\ time\: :ref:`float<class_float>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_prev_marker<class_Animation_method_get_prev_marker>`\ (\ time\: :ref:`float<class_float>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>`\ (\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_marker<class_Animation_method_has_marker>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`method_track_get_params<class_Animation_method_method_track_get_params>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`optimize<class_Animation_method_optimize>`\ (\ allowed_velocity_err\: :ref:`float<class_float>` = 0.01, allowed_angular_err\: :ref:`float<class_float>` = 0.01, precision\: :ref:`int<class_int>` = 3\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`position_track_insert_key<class_Animation_method_position_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, position\: :ref:`Vector3<class_Vector3>`\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`position_track_interpolate<class_Animation_method_position_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_marker<class_Animation_method_remove_marker>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_track<class_Animation_method_remove_track>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`rotation_track_insert_key<class_Animation_method_rotation_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, rotation\: :ref:`Quaternion<class_Quaternion>`\ ) |
@@ -160,6 +180,8 @@ Animation
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`scale_track_interpolate<class_Animation_method_scale_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_marker_color<class_Animation_method_set_marker_color>`\ (\ name\: :ref:`StringName<class_StringName>`, color\: :ref:`Color<class_Color>`\ ) |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`track_find_key<class_Animation_method_track_find_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, find_mode\: :ref:`FindMode<enum_Animation_FindMode>` = 0, limit\: :ref:`bool<class_bool>` = false, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`track_get_interpolation_loop_wrap<class_Animation_method_track_get_interpolation_loop_wrap>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
@@ -581,6 +603,18 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
方法说明
--------
.. _class_Animation_method_add_marker:
.. rst-class:: classref-method
|void| **add_marker**\ (\ name\: :ref:`StringName<class_StringName>`, time\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Animation_method_add_marker>`
Adds a marker to this Animation.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_add_track:
.. rst-class:: classref-method
@@ -915,6 +949,78 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
----
.. _class_Animation_method_get_marker_at_time:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_marker_at_time**\ (\ time\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Animation_method_get_marker_at_time>`
Returns the name of the marker located at the given time.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_marker_color:
.. rst-class:: classref-method
:ref:`Color<class_Color>` **get_marker_color**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Animation_method_get_marker_color>`
Returns the given marker's color.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_marker_names:
.. rst-class:: classref-method
:ref:`PackedStringArray<class_PackedStringArray>` **get_marker_names**\ (\ ) |const| :ref:`🔗<class_Animation_method_get_marker_names>`
Returns every marker in this Animation, sorted ascending by time.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_marker_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_marker_time**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Animation_method_get_marker_time>`
Returns the given marker's time.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_next_marker:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_next_marker**\ (\ time\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Animation_method_get_next_marker>`
Returns the closest marker that comes after the given time. If no such marker exists, an empty string is returned.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_prev_marker:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_prev_marker**\ (\ time\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Animation_method_get_prev_marker>`
Returns the closest marker that comes before the given time. If no such marker exists, an empty string is returned.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_track_count:
.. rst-class:: classref-method
@@ -927,6 +1033,18 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
----
.. _class_Animation_method_has_marker:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_marker**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Animation_method_has_marker>`
Returns ``true`` if this Animation contains a marker with the given name.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_method_track_get_name:
.. rst-class:: classref-method
@@ -951,6 +1069,18 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
----
.. _class_Animation_method_optimize:
.. rst-class:: classref-method
|void| **optimize**\ (\ allowed_velocity_err\: :ref:`float<class_float>` = 0.01, allowed_angular_err\: :ref:`float<class_float>` = 0.01, precision\: :ref:`int<class_int>` = 3\ ) :ref:`🔗<class_Animation_method_optimize>`
Optimize the animation and all its tracks in-place. This will preserve only as many keys as are necessary to keep the animation within the specified bounds.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_position_track_insert_key:
.. rst-class:: classref-method
@@ -975,6 +1105,18 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
----
.. _class_Animation_method_remove_marker:
.. rst-class:: classref-method
|void| **remove_marker**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Animation_method_remove_marker>`
Removes the marker with the given name from this Animation.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_remove_track:
.. rst-class:: classref-method
@@ -1035,6 +1177,18 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
----
.. _class_Animation_method_set_marker_color:
.. rst-class:: classref-method
|void| **set_marker_color**\ (\ name\: :ref:`StringName<class_StringName>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Animation_method_set_marker_color>`
Sets the given marker's color.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_find_key:
.. rst-class:: classref-method

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationLibrary.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationLibrary.xml.
.. _class_AnimationLibrary:
@@ -43,6 +43,8 @@ AnimationLibrary
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_animation_list<class_AnimationLibrary_method_get_animation_list>`\ (\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_animation_list_size<class_AnimationLibrary_method_get_animation_list_size>`\ (\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_animation<class_AnimationLibrary_method_has_animation>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_animation<class_AnimationLibrary_method_remove_animation>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
@@ -150,6 +152,18 @@ AnimationLibrary
----
.. _class_AnimationLibrary_method_get_animation_list_size:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_animation_list_size**\ (\ ) |const| :ref:`🔗<class_AnimationLibrary_method_get_animation_list_size>`
Returns the key count for the :ref:`Animation<class_Animation>`\ s stored in the library.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_has_animation:
.. rst-class:: classref-method

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationMixer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationMixer.xml.
.. _class_AnimationMixer:
@@ -55,6 +55,8 @@ AnimationMixer
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+--------------------+
| :ref:`bool<class_bool>` | :ref:`reset_on_save<class_AnimationMixer_property_reset_on_save>` | ``true`` |
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+--------------------+
| :ref:`bool<class_bool>` | :ref:`root_motion_local<class_AnimationMixer_property_root_motion_local>` | |
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+--------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` | ``NodePath("")`` |
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+--------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`root_node<class_AnimationMixer_property_root_node>` | ``NodePath("..")`` |
@@ -300,9 +302,33 @@ enum **AnimationCallbackModeDiscrete**: :ref:`🔗<enum_AnimationMixer_Animation
:ref:`AnimationCallbackModeDiscrete<enum_AnimationMixer_AnimationCallbackModeDiscrete>` **ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS** = ``2``
在和 :ref:`Animation.INTERPOLATION_NEAREST<class_Animation_constant_INTERPOLATION_NEAREST>` 混合时,始终将 :ref:`Animation.UPDATE_DISCRETE<class_Animation_constant_UPDATE_DISCRETE>` 轨道值视为 :ref:`Animation.UPDATE_CONTINUOUS<class_Animation_constant_UPDATE_CONTINUOUS>`\ 。这是 :ref:`AnimationTree<class_AnimationTree>` 的默认行为。
Always treat the :ref:`Animation.UPDATE_DISCRETE<class_Animation_constant_UPDATE_DISCRETE>` track value as :ref:`Animation.UPDATE_CONTINUOUS<class_Animation_constant_UPDATE_CONTINUOUS>` with :ref:`Animation.INTERPOLATION_NEAREST<class_Animation_constant_INTERPOLATION_NEAREST>`. This is the default behavior for :ref:`AnimationTree<class_AnimationTree>`.
如果值轨道具有非数字类型键值,则在和 :ref:`Animation.UPDATE_DISCRETE<class_Animation_constant_UPDATE_DISCRETE>` 混合时,会在内部转换为使用 :ref:`ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE>`\ 。
If a value track has un-interpolatable type key values, it is internally converted to use :ref:`ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE>` with :ref:`Animation.UPDATE_DISCRETE<class_Animation_constant_UPDATE_DISCRETE>`.
Un-interpolatable type list:
- :ref:`@GlobalScope.TYPE_NIL<class_@GlobalScope_constant_TYPE_NIL>`\
- :ref:`@GlobalScope.TYPE_NODE_PATH<class_@GlobalScope_constant_TYPE_NODE_PATH>`\
- :ref:`@GlobalScope.TYPE_RID<class_@GlobalScope_constant_TYPE_RID>`\
- :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TYPE_OBJECT>`\
- :ref:`@GlobalScope.TYPE_CALLABLE<class_@GlobalScope_constant_TYPE_CALLABLE>`\
- :ref:`@GlobalScope.TYPE_SIGNAL<class_@GlobalScope_constant_TYPE_SIGNAL>`\
- :ref:`@GlobalScope.TYPE_DICTIONARY<class_@GlobalScope_constant_TYPE_DICTIONARY>`\
- :ref:`@GlobalScope.TYPE_PACKED_BYTE_ARRAY<class_@GlobalScope_constant_TYPE_PACKED_BYTE_ARRAY>`\
\ :ref:`@GlobalScope.TYPE_BOOL<class_@GlobalScope_constant_TYPE_BOOL>` and :ref:`@GlobalScope.TYPE_INT<class_@GlobalScope_constant_TYPE_INT>` are treated as :ref:`@GlobalScope.TYPE_FLOAT<class_@GlobalScope_constant_TYPE_FLOAT>` during blending and rounded when the result is retrieved.
It is same for arrays and vectors with them such as :ref:`@GlobalScope.TYPE_PACKED_INT32_ARRAY<class_@GlobalScope_constant_TYPE_PACKED_INT32_ARRAY>` or :ref:`@GlobalScope.TYPE_VECTOR2I<class_@GlobalScope_constant_TYPE_VECTOR2I>`, they are treated as :ref:`@GlobalScope.TYPE_PACKED_FLOAT32_ARRAY<class_@GlobalScope_constant_TYPE_PACKED_FLOAT32_ARRAY>` or :ref:`@GlobalScope.TYPE_VECTOR2<class_@GlobalScope_constant_TYPE_VECTOR2>`. Also note that for arrays, the size is also interpolated.
\ :ref:`@GlobalScope.TYPE_STRING<class_@GlobalScope_constant_TYPE_STRING>` and :ref:`@GlobalScope.TYPE_STRING_NAME<class_@GlobalScope_constant_TYPE_STRING_NAME>` are interpolated between character codes and lengths, but note that there is a difference in algorithm between interpolation between keys and interpolation by blending.
.. rst-class:: classref-section-separator
@@ -450,6 +476,23 @@ enum **AnimationCallbackModeDiscrete**: :ref:`🔗<enum_AnimationMixer_Animation
----
.. _class_AnimationMixer_property_root_motion_local:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **root_motion_local** :ref:`🔗<class_AnimationMixer_property_root_motion_local>`
.. rst-class:: classref-property-setget
- |void| **set_root_motion_local**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_root_motion_local**\ (\ )
If ``true``, :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>` value is extracted as a local translation value before blending. In other words, it is treated like the translation is done after the rotation.
.. rst-class:: classref-item-separator
----
.. _class_AnimationMixer_property_root_motion_track:
.. rst-class:: classref-property
@@ -647,32 +690,32 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
:ref:`Vector3<class_Vector3>` **get_root_motion_position**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_position>`
将具有 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的位置的运动增量,检索为一个可以在其他地方使用的 :ref:`Vector3<class_Vector3>`\ 。
Retrieve the motion delta of position with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Vector3<class_Vector3>` that can be used elsewhere.
如果 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 不是 :ref:`Animation.TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>` 类型轨道的路径,则返回 ``Vector3(0, 0, 0)``\ 。
If :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` is not a path to a track of type :ref:`Animation.TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`, returns ``Vector3(0, 0, 0)``.
另见 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>`:ref:`RootMotionView<class_RootMotionView>`\ 。
See also :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` and :ref:`RootMotionView<class_RootMotionView>`.
最基本的示例是将位置应用于 :ref:`CharacterBody3D<class_CharacterBody3D>`\
The most basic example is applying position to :ref:`CharacterBody3D<class_CharacterBody3D>`:
.. tabs::
.. code-tab:: gdscript
var current_rotation: Quaternion
var current_rotation
func _process(delta):
if Input.is_action_just_pressed("animate"):
current_rotation = get_quaternion()
state_machine.travel("Animate")
var velocity: Vector3 = current_rotation * animation_tree.get_root_motion_position() / delta
var velocity = current_rotation * animation_tree.get_root_motion_position() / delta
set_velocity(velocity)
move_and_slide()
通过将其与 :ref:`get_root_motion_rotation_accumulator<class_AnimationMixer_method_get_root_motion_rotation_accumulator>` 结合使用,你可以更正确地应用根运动位置来考虑节点的旋转。
By using this in combination with :ref:`get_root_motion_rotation_accumulator<class_AnimationMixer_method_get_root_motion_rotation_accumulator>`, you can apply the root motion position more correctly to account for the rotation of the node.
.. tabs::
@@ -683,7 +726,26 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
set_quaternion(get_quaternion() * animation_tree.get_root_motion_rotation())
var velocity: Vector3 = (animation_tree.get_root_motion_rotation_accumulator().inverse() * get_quaternion()) * animation_tree.get_root_motion_position() / delta
var velocity = (animation_tree.get_root_motion_rotation_accumulator().inverse() * get_quaternion()) * animation_tree.get_root_motion_position() / delta
set_velocity(velocity)
move_and_slide()
If :ref:`root_motion_local<class_AnimationMixer_property_root_motion_local>` is ``true``, return the pre-multiplied translation value with the inverted rotation.
In this case, the code can be written as follows:
.. tabs::
.. code-tab:: gdscript
func _process(delta):
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
set_quaternion(get_quaternion() * animation_tree.get_root_motion_rotation())
var velocity = get_quaternion() * animation_tree.get_root_motion_position() / delta
set_velocity(velocity)
move_and_slide()
@@ -699,30 +761,30 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
:ref:`Vector3<class_Vector3>` **get_root_motion_position_accumulator**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_position_accumulator>`
检索具有 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的位置轨道的混合值,返回的是可以在其他地方使用的 :ref:`Vector3<class_Vector3>`\ 。
Retrieve the blended value of the position tracks with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Vector3<class_Vector3>` that can be used elsewhere.
在想要遵循动画的初始动画帧值的情况下很有用。
This is useful in cases where you want to respect the initial key values of the animation.
例如,如果前一帧播放的是一个只有单个动画帧 ``Vector3(0, 0, 0)`` 的动画,然后下一帧播放的是一个只有单个动画帧\ ``Vector3(1, 0, 1)`` 的动画,它们之间的差异可以这样计算:
For example, if an animation with only one key ``Vector3(0, 0, 0)`` is played in the previous frame and then an animation with only one key ``Vector3(1, 0, 1)`` is played in the next frame, the difference can be calculated as follows:
.. tabs::
.. code-tab:: gdscript
var prev_root_motion_position_accumulator: Vector3
var prev_root_motion_position_accumulator
func _process(delta):
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
var current_root_motion_position_accumulator: Vector3 = animation_tree.get_root_motion_position_accumulator()
var difference: Vector3 = current_root_motion_position_accumulator - prev_root_motion_position_accumulator
var current_root_motion_position_accumulator = animation_tree.get_root_motion_position_accumulator()
var difference = current_root_motion_position_accumulator - prev_root_motion_position_accumulator
prev_root_motion_position_accumulator = current_root_motion_position_accumulator
transform.origin += difference
不过,如果动画是循环播放的,就可能会发生预料之外的不连续变化,所以这只对一些简单的情况有用。
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.
.. rst-class:: classref-item-separator
@@ -764,32 +826,32 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
:ref:`Quaternion<class_Quaternion>` **get_root_motion_rotation_accumulator**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_rotation_accumulator>`
检索带有 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的旋转轨道的混合值,作为一个 :ref:`Quaternion<class_Quaternion>`\ ,可以在其他地方使用。
Retrieve the blended value of the rotation tracks with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Quaternion<class_Quaternion>` that can be used elsewhere.
这里必须正确地结合根运动位置,并且要考虑到旋转。参考 :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`\ 。
This is necessary to apply the root motion position correctly, taking rotation into account. See also :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`.
并且,当你想重视动画的初始动画帧的值时,这会很有用。
Also, this is useful in cases where you want to respect the initial key values of the animation.
比如说,如果一个动画在上一帧只播放一个 ``Quaternion(0, 0, 0, 1)`` 动画帧,并且一个动画在下一帧只播放了一个动画帧的 ``Quaternion(0, 0.707, 0, 0.707)`` 时,它们相差的值可以这样求出:
For example, if an animation with only one key ``Quaternion(0, 0, 0, 1)`` is played in the previous frame and then an animation with only one key ``Quaternion(0, 0.707, 0, 0.707)`` is played in the next frame, the difference can be calculated as follows:
.. tabs::
.. code-tab:: gdscript
var prev_root_motion_rotation_accumulator: Quaternion
var prev_root_motion_rotation_accumulator
func _process(delta):
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
var current_root_motion_rotation_accumulator: Quaternion = animation_tree.get_root_motion_rotation_accumulator()
var difference: Quaternion = prev_root_motion_rotation_accumulator.inverse() * current_root_motion_rotation_accumulator
var current_root_motion_rotation_accumulator = animation_tree.get_root_motion_rotation_accumulator()
var difference = prev_root_motion_rotation_accumulator.inverse() * current_root_motion_rotation_accumulator
prev_root_motion_rotation_accumulator = current_root_motion_rotation_accumulator
transform.basis *= Basis(difference)
然而,当一个动画循环时,可能会得到一个意料之外的变化,所以这个只在一些简单情况下才有用。
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.
.. rst-class:: classref-item-separator
@@ -801,21 +863,21 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
:ref:`Vector3<class_Vector3>` **get_root_motion_scale**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_scale>`
获取 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的缩放运动增量,类型为 :ref:`Vector3<class_Vector3>`\ ,可以在其他地方使用。
Retrieve the motion delta of scale with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Vector3<class_Vector3>` that can be used elsewhere.
如果 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 不是类型为 :ref:`Animation.TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>` 的轨道的路径,则返回 ``Vector3(0, 0, 0)``
If :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` is not a path to a track of type :ref:`Animation.TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>`, returns ``Vector3(0, 0, 0)``.
另见 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` :ref:`RootMotionView<class_RootMotionView>`\ 。
See also :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` and :ref:`RootMotionView<class_RootMotionView>`.
最基本的例子是对 :ref:`CharacterBody3D<class_CharacterBody3D>` 应用缩放。
The most basic example is applying scale to :ref:`CharacterBody3D<class_CharacterBody3D>`:
.. tabs::
.. code-tab:: gdscript
var current_scale: Vector3 = Vector3(1, 1, 1)
var scale_accum: Vector3 = Vector3(1, 1, 1)
var current_scale = Vector3(1, 1, 1)
var scale_accum = Vector3(1, 1, 1)
func _process(delta):
if Input.is_action_just_pressed("animate"):
@@ -837,28 +899,28 @@ AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这
:ref:`Vector3<class_Vector3>` **get_root_motion_scale_accumulator**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_scale_accumulator>`
检索带有 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的缩放轨道的混合值,作为一个 :ref:`Vector3<class_Vector3>`\ ,可以在其他地方使用。
Retrieve the blended value of the scale tracks with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Vector3<class_Vector3>` that can be used elsewhere.
例如,如果一个动画在前一帧只播放了一个动画帧 ``Vector3(1, 1, 1)``\ ,并且一个动画在后一帧只播放了一个动画帧 ``Vector3(2, 2, 2)``\ ,他们之间相差的值可以这样求出:
For example, if an animation with only one key ``Vector3(1, 1, 1)`` is played in the previous frame and then an animation with only one key ``Vector3(2, 2, 2)`` is played in the next frame, the difference can be calculated as follows:
.. tabs::
.. code-tab:: gdscript
var prev_root_motion_scale_accumulator: Vector3
var prev_root_motion_scale_accumulator
func _process(delta):
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
var current_root_motion_scale_accumulator: Vector3 = animation_tree.get_root_motion_scale_accumulator()
var difference: Vector3 = current_root_motion_scale_accumulator - prev_root_motion_scale_accumulator
var current_root_motion_scale_accumulator = animation_tree.get_root_motion_scale_accumulator()
var difference = current_root_motion_scale_accumulator - prev_root_motion_scale_accumulator
prev_root_motion_scale_accumulator = current_root_motion_scale_accumulator
transform.basis = transform.basis.scaled(difference)
然而,当一个动画循环时,可能会得到一个意料之外的变化,所以这个只在一些简单情况下才有用。
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNode.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNode.xml.
.. _class_AnimationNode:
@@ -12,7 +12,7 @@ AnimationNode
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
**派生:** :ref:`AnimationNodeOutput<class_AnimationNodeOutput>`, :ref:`AnimationNodeSync<class_AnimationNodeSync>`, :ref:`AnimationNodeTimeScale<class_AnimationNodeTimeScale>`, :ref:`AnimationNodeTimeSeek<class_AnimationNodeTimeSeek>`, :ref:`AnimationRootNode<class_AnimationRootNode>`
**派生:** :ref:`AnimationNodeExtension<class_AnimationNodeExtension>`, :ref:`AnimationNodeOutput<class_AnimationNodeOutput>`, :ref:`AnimationNodeSync<class_AnimationNodeSync>`, :ref:`AnimationNodeTimeScale<class_AnimationNodeTimeScale>`, :ref:`AnimationNodeTimeSeek<class_AnimationNodeTimeSeek>`, :ref:`AnimationRootNode<class_AnimationRootNode>`
:ref:`AnimationTree<class_AnimationTree>` 节点的基类。与场景节点无关。
@@ -77,7 +77,7 @@ AnimationNode
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`_is_parameter_read_only<class_AnimationNode_private_method__is_parameter_read_only>`\ (\ parameter\: :ref:`StringName<class_StringName>`\ ) |virtual| |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_process<class_AnimationNode_private_method__process>`\ (\ time\: :ref:`float<class_float>`, seek\: :ref:`bool<class_bool>`, is_external_seeking\: :ref:`bool<class_bool>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| |const| |
| :ref:`float<class_float>` | :ref:`_process<class_AnimationNode_private_method__process>`\ (\ time\: :ref:`float<class_float>`, seek\: :ref:`bool<class_bool>`, is_external_seeking\: :ref:`bool<class_bool>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`add_input<class_AnimationNode_method_add_input>`\ (\ name\: :ref:`String<class_String>`\ ) |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -95,8 +95,12 @@ AnimationNode
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_parameter<class_AnimationNode_method_get_parameter>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_processing_animation_tree_instance_id<class_AnimationNode_method_get_processing_animation_tree_instance_id>`\ (\ ) |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_path_filtered<class_AnimationNode_method_is_path_filtered>`\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_process_testing<class_AnimationNode_method_is_process_testing>`\ (\ ) |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_input<class_AnimationNode_method_remove_input>`\ (\ index\: :ref:`int<class_int>`\ ) |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_filter_path<class_AnimationNode_method_set_filter_path>`\ (\ path\: :ref:`NodePath<class_NodePath>`, enable\: :ref:`bool<class_bool>`\ ) |
@@ -313,7 +317,7 @@ enum **FilterAction**: :ref:`🔗<enum_AnimationNode_FilterAction>`
.. rst-class:: classref-method
:ref:`float<class_float>` **_process**\ (\ time\: :ref:`float<class_float>`, seek\: :ref:`bool<class_bool>`, is_external_seeking\: :ref:`bool<class_bool>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| |const| :ref:`🔗<class_AnimationNode_private_method__process>`
:ref:`float<class_float>` **_process**\ (\ time\: :ref:`float<class_float>`, seek\: :ref:`bool<class_bool>`, is_external_seeking\: :ref:`bool<class_bool>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| :ref:`🔗<class_AnimationNode_private_method__process>`
**已弃用:** Currently this is mostly useless as there is a lack of many APIs to extend AnimationNode by GDScript. It is planned that a more flexible API using structures will be provided in the future.
@@ -425,13 +429,39 @@ enum **FilterAction**: :ref:`🔗<enum_AnimationNode_FilterAction>`
----
.. _class_AnimationNode_method_get_processing_animation_tree_instance_id:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_processing_animation_tree_instance_id**\ (\ ) |const| :ref:`🔗<class_AnimationNode_method_get_processing_animation_tree_instance_id>`
Returns the object id of the :ref:`AnimationTree<class_AnimationTree>` that owns this node.
\ **Note:** This method should only be called from within the :ref:`AnimationNodeExtension._process_animation_node<class_AnimationNodeExtension_private_method__process_animation_node>` method, and will return an invalid id otherwise.
.. rst-class:: classref-item-separator
----
.. _class_AnimationNode_method_is_path_filtered:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_path_filtered**\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) |const| :ref:`🔗<class_AnimationNode_method_is_path_filtered>`
返回给定路径是否被过滤。
Returns ``true`` if the given path is filtered.
.. rst-class:: classref-item-separator
----
.. _class_AnimationNode_method_is_process_testing:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_process_testing**\ (\ ) |const| :ref:`🔗<class_AnimationNode_method_is_process_testing>`
Returns ``true`` if this animation node is being processed in test-only mode.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAdd2.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAdd2.xml.
.. _class_AnimationNodeAdd2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAdd3.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAdd3.xml.
.. _class_AnimationNodeAdd3:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAnimation.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAnimation.xml.
.. _class_AnimationNodeAnimation:
@@ -40,6 +40,8 @@ AnimationNodeAnimation
.. table::
:widths: auto
+-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`advance_on_start<class_AnimationNodeAnimation_property_advance_on_start>` | ``false`` |
+-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+
| :ref:`StringName<class_StringName>` | :ref:`animation<class_AnimationNodeAnimation_property_animation>` | ``&""`` |
+-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+
@@ -96,6 +98,25 @@ enum **PlayMode**: :ref:`🔗<enum_AnimationNodeAnimation_PlayMode>`
属性说明
--------
.. _class_AnimationNodeAnimation_property_advance_on_start:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **advance_on_start** = ``false`` :ref:`🔗<class_AnimationNodeAnimation_property_advance_on_start>`
.. rst-class:: classref-property-setget
- |void| **set_advance_on_start**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_advance_on_start**\ (\ )
If ``true``, on receiving a request to play an animation from the start, the first frame is not drawn, but only processed, and playback starts from the next frame.
See also the notes of :ref:`AnimationPlayer.play<class_AnimationPlayer_method_play>`.
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeAnimation_property_animation:
.. rst-class:: classref-property

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlend2.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlend2.xml.
.. _class_AnimationNodeBlend2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlend3.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlend3.xml.
.. _class_AnimationNodeBlend3:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendSpace1D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendSpace1D.xml.
.. _class_AnimationNodeBlendSpace1D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendSpace2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendSpace2D.xml.
.. _class_AnimationNodeBlendSpace2D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendTree.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendTree.xml.
.. _class_AnimationNodeBlendTree:

View File

@@ -0,0 +1,94 @@
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeExtension.xml.
.. _class_AnimationNodeExtension:
AnimationNodeExtension
======================
**实验性:** This class may be changed or removed in future versions.
**继承:** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Base class for extending :ref:`AnimationRootNode<class_AnimationRootNode>`\ s from GDScript, C#, or C++.
.. rst-class:: classref-introduction-group
描述
----
**AnimationNodeExtension** exposes the APIs of :ref:`AnimationRootNode<class_AnimationRootNode>` to allow users to extend it from GDScript, C#, or C++. This class is not meant to be used directly, but to be extended by other classes. It is used to create custom nodes for the :ref:`AnimationTree<class_AnimationTree>` system.
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`_process_animation_node<class_AnimationNodeExtension_private_method__process_animation_node>`\ (\ playback_info\: :ref:`PackedFloat64Array<class_PackedFloat64Array>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_remaining_time<class_AnimationNodeExtension_method_get_remaining_time>`\ (\ node_info\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`, break_loop\: :ref:`bool<class_bool>`\ ) |static| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_looping<class_AnimationNodeExtension_method_is_looping>`\ (\ node_info\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |static| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_AnimationNodeExtension_private_method__process_animation_node:
.. rst-class:: classref-method
:ref:`PackedFloat32Array<class_PackedFloat32Array>` **_process_animation_node**\ (\ playback_info\: :ref:`PackedFloat64Array<class_PackedFloat64Array>`, test_only\: :ref:`bool<class_bool>`\ ) |virtual| :ref:`🔗<class_AnimationNodeExtension_private_method__process_animation_node>`
A version of the :ref:`AnimationNode._process<class_AnimationNode_private_method__process>` method that is meant to be overridden by custom nodes. It returns a :ref:`PackedFloat32Array<class_PackedFloat32Array>` with the processed animation data.
The :ref:`PackedFloat64Array<class_PackedFloat64Array>` parameter contains the playback information, containing the following values encoded as floating point numbers (in order): playback time and delta, start and end times, whether a seek was requested (encoded as a float greater than ``0``), whether the seek request was externally requested (encoded as a float greater than ``0``), the current :ref:`LoopedFlag<enum_Animation_LoopedFlag>` (encoded as a float), and the current blend weight.
The function must return a :ref:`PackedFloat32Array<class_PackedFloat32Array>` of the node's time info, containing the following values (in order): animation length, time position, delta, :ref:`LoopMode<enum_Animation_LoopMode>` (encoded as a float), whether the animation is about to end (encoded as a float greater than ``0``) and whether the animation is infinite (encoded as a float greater than ``0``). All values must be included in the returned array.
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeExtension_method_get_remaining_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_remaining_time**\ (\ node_info\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`, break_loop\: :ref:`bool<class_bool>`\ ) |static| :ref:`🔗<class_AnimationNodeExtension_method_get_remaining_time>`
Returns the animation's remaining time for the given node info. For looping animations, it will only return the remaining time if ``break_loop`` is ``true``, a large integer value will be returned otherwise.
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeExtension_method_is_looping:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_looping**\ (\ node_info\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |static| :ref:`🔗<class_AnimationNodeExtension_method_is_looping>`
Returns ``true`` if the animation for the given ``node_info`` is looping.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeOneShot.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeOneShot.xml.
.. _class_AnimationNodeOneShot:
@@ -272,7 +272,7 @@ enum **MixMode**: :ref:`🔗<enum_AnimationNodeOneShot_MixMode>`
- |void| **set_fadein_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- :ref:`Curve<class_Curve>` **get_fadein_curve**\ (\ )
确定如何缓动动画之间的淡入淡出。如果为空,过渡将是线性的。
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit :ref:`Curve<class_Curve>`.
.. rst-class:: classref-item-separator
@@ -308,7 +308,7 @@ enum **MixMode**: :ref:`🔗<enum_AnimationNodeOneShot_MixMode>`
- |void| **set_fadeout_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- :ref:`Curve<class_Curve>` **get_fadeout_curve**\ (\ )
确定如何缓动动画之间的淡入淡出。如果为空,过渡将是线性的。
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit :ref:`Curve<class_Curve>`.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeOutput.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeOutput.xml.
.. _class_AnimationNodeOutput:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachine.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachine.xml.
.. _class_AnimationNodeStateMachine:
@@ -19,9 +19,7 @@ AnimationNodeStateMachine
描述
----
包含表示动画状态的多个 :ref:`AnimationRootNode<class_AnimationRootNode>`\ ,以图的形式连接。可以使用最短路径算法,将节点过渡配置为自动发生或通过代码发生。要以编程的方式控制过渡,请从 :ref:`AnimationTree<class_AnimationTree>` 节点获取 :ref:`AnimationNodeStateMachinePlayback<class_AnimationNodeStateMachinePlayback>` 对象。
\ **示例:**\
Contains multiple :ref:`AnimationRootNode<class_AnimationRootNode>`\ s representing animation states, connected in a graph. State transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the :ref:`AnimationNodeStateMachinePlayback<class_AnimationNodeStateMachinePlayback>` object from the :ref:`AnimationTree<class_AnimationTree>` node to control it programmatically.
.. tabs::

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachinePlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachinePlayback.xml.
.. _class_AnimationNodeStateMachinePlayback:
@@ -19,9 +19,7 @@ AnimationNodeStateMachinePlayback
描述
----
允许控制使用 :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` 创建的 :ref:`AnimationTree<class_AnimationTree>` 状态机。使用 ``$AnimationTree.get("parameters/playback")`` 检索。
\ **示例:**\
Allows control of :ref:`AnimationTree<class_AnimationTree>` state machines created with :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>`. Retrieve with ``$AnimationTree.get("parameters/playback")``.
.. tabs::

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachineTransition.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachineTransition.xml.
.. _class_AnimationNodeStateMachineTransition:
@@ -146,7 +146,7 @@ enum **AdvanceMode**: :ref:`🔗<enum_AnimationNodeStateMachineTransition_Advanc
:ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **ADVANCE_MODE_AUTO** = ``2``
如果 :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` 检查为真,则自动使用该过渡(如果已分配)。
Automatically use this transition if the :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` and :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` checks are ``true`` (if assigned).
.. rst-class:: classref-section-separator
@@ -215,7 +215,7 @@ enum **AdvanceMode**: :ref:`🔗<enum_AnimationNodeStateMachineTransition_Advanc
- |void| **set_advance_mode**\ (\ value\: :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>`\ )
- :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **get_advance_mode**\ (\ )
决定在使用 :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>` 时该过渡是否应该被禁用/启用,或者如果 :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` 检查为真则自动行进(如果已分配)。
Determines whether the transition should be disabled, enabled when using :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>`, or traversed automatically if the :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` and :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` checks are ``true`` (if assigned).
.. rst-class:: classref-item-separator
@@ -300,7 +300,7 @@ enum **AdvanceMode**: :ref:`🔗<enum_AnimationNodeStateMachineTransition_Advanc
- |void| **set_xfade_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- :ref:`Curve<class_Curve>` **get_xfade_curve**\ (\ )
缓动曲线可以更好地控制此状态和下一个状态之间的交叉淡入淡出。
Ease curve for better control over cross-fade between this state and the next. Should be a unit :ref:`Curve<class_Curve>`.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeSub2.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeSub2.xml.
.. _class_AnimationNodeSub2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeSync.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeSync.xml.
.. _class_AnimationNodeSync:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTimeScale.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTimeScale.xml.
.. _class_AnimationNodeTimeScale:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTimeSeek.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTimeSeek.xml.
.. _class_AnimationNodeTimeSeek:
@@ -55,6 +55,40 @@ AnimationNodeTimeSeek
- :doc:`使用 AnimationTree <../tutorials/animation/animation_tree>`
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+-------------------------+------------------------------------------------------------------------------+----------+
| :ref:`bool<class_bool>` | :ref:`explicit_elapse<class_AnimationNodeTimeSeek_property_explicit_elapse>` | ``true`` |
+-------------------------+------------------------------------------------------------------------------+----------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_AnimationNodeTimeSeek_property_explicit_elapse:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **explicit_elapse** = ``true`` :ref:`🔗<class_AnimationNodeTimeSeek_property_explicit_elapse>`
.. rst-class:: classref-property-setget
- |void| **set_explicit_elapse**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_explicit_elapse**\ (\ )
If ``true``, some processes are executed to handle keys between seeks, such as calculating root motion and finding the nearest discrete key.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTransition.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTransition.xml.
.. _class_AnimationNodeTransition:
@@ -163,7 +163,7 @@ AnimationNodeTransition
- |void| **set_xfade_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- :ref:`Curve<class_Curve>` **get_xfade_curve**\ (\ )
确定如何缓动动画之间的淡入淡出。如果为空,过渡将是线性的。
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit :ref:`Curve<class_Curve>`.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationPlayer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationPlayer.xml.
.. _class_AnimationPlayer:
@@ -99,6 +99,12 @@ AnimationPlayer
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`get_root<class_AnimationPlayer_method_get_root>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_section_end_time<class_AnimationPlayer_method_get_section_end_time>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_section_start_time<class_AnimationPlayer_method_get_section_start_time>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_section<class_AnimationPlayer_method_has_section>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationPlayer_method_is_playing>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`pause<class_AnimationPlayer_method_pause>`\ (\ ) |
@@ -107,10 +113,20 @@ AnimationPlayer
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section<class_AnimationPlayer_method_play_section>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_backwards<class_AnimationPlayer_method_play_section_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_with_markers<class_AnimationPlayer_method_play_section_with_markers>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_with_markers_backwards<class_AnimationPlayer_method_play_section_with_markers_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_with_capture<class_AnimationPlayer_method_play_with_capture>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", duration\: :ref:`float<class_float>` = -1.0, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false, trans_type\: :ref:`TransitionType<enum_Tween_TransitionType>` = 0, ease_type\: :ref:`EaseType<enum_Tween_EaseType>` = 0\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`queue<class_AnimationPlayer_method_queue>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`reset_section<class_AnimationPlayer_method_reset_section>`\ (\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`seek<class_AnimationPlayer_method_seek>`\ (\ seconds\: :ref:`float<class_float>`, update\: :ref:`bool<class_bool>` = false, update_only\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_blend_time<class_AnimationPlayer_method_set_blend_time>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`, sec\: :ref:`float<class_float>`\ ) |
@@ -121,6 +137,10 @@ AnimationPlayer
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_root<class_AnimationPlayer_method_set_root>`\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_section<class_AnimationPlayer_method_set_section>`\ (\ start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_section_with_markers<class_AnimationPlayer_method_set_section_with_markers>`\ (\ start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &""\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`stop<class_AnimationPlayer_method_stop>`\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -572,6 +592,42 @@ enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMetho
----
.. _class_AnimationPlayer_method_get_section_end_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_section_end_time**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_section_end_time>`
Returns the end time of the section currently being played.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_section_start_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_section_start_time**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_section_start_time>`
Returns the start time of the section currently being played.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_has_section:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_section**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_has_section>`
Returns ``true`` if an animation is currently playing with section.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_is_playing:
.. rst-class:: classref-method
@@ -630,6 +686,62 @@ enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMetho
----
.. _class_AnimationPlayer_method_play_section:
.. rst-class:: classref-method
|void| **play_section**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play_section>`
Plays the animation with key ``name`` and the section starting from ``start_time`` and ending on ``end_time``. See also :ref:`play<class_AnimationPlayer_method_play>`.
Setting ``start_time`` to a value outside the range of the animation means the start of the animation will be used instead, and setting ``end_time`` to a value outside the range of the animation means the end of the animation will be used instead. ``start_time`` cannot be equal to ``end_time``.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_backwards:
.. rst-class:: classref-method
|void| **play_section_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_backwards>`
Plays the animation with key ``name`` and the section starting from ``start_time`` and ending on ``end_time`` in reverse.
This method is a shorthand for :ref:`play_section<class_AnimationPlayer_method_play_section>` with ``custom_speed = -1.0`` and ``from_end = true``, see its description for more information.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_with_markers:
.. rst-class:: classref-method
|void| **play_section_with_markers**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_with_markers>`
Plays the animation with key ``name`` and the section starting from ``start_marker`` and ending on ``end_marker``.
If the start marker is empty, the section starts from the beginning of the animation. If the end marker is empty, the section ends on the end of the animation. See also :ref:`play<class_AnimationPlayer_method_play>`.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_with_markers_backwards:
.. rst-class:: classref-method
|void| **play_section_with_markers_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_with_markers_backwards>`
Plays the animation with key ``name`` and the section starting from ``start_marker`` and ending on ``end_marker`` in reverse.
This method is a shorthand for :ref:`play_section_with_markers<class_AnimationPlayer_method_play_section_with_markers>` with ``custom_speed = -1.0`` and ``from_end = true``, see its description for more information.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_with_capture:
.. rst-class:: classref-method
@@ -669,6 +781,18 @@ enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMetho
----
.. _class_AnimationPlayer_method_reset_section:
.. rst-class:: classref-method
|void| **reset_section**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_reset_section>`
Resets the current section if section is set.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_seek:
.. rst-class:: classref-method
@@ -739,6 +863,32 @@ enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMetho
----
.. _class_AnimationPlayer_method_set_section:
.. rst-class:: classref-method
|void| **set_section**\ (\ start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_set_section>`
Changes the start and end times of the section being played. The current playback position will be clamped within the new section. See also :ref:`play_section<class_AnimationPlayer_method_play_section>`.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_section_with_markers:
.. rst-class:: classref-method
|void| **set_section_with_markers**\ (\ start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &""\ ) :ref:`🔗<class_AnimationPlayer_method_set_section_with_markers>`
Changes the start and end markers of the section being played. The current playback position will be clamped within the new section. See also :ref:`play_section_with_markers<class_AnimationPlayer_method_play_section_with_markers>`.
If the argument is empty, the section uses the beginning or end of the animation. If both are empty, it means that the section is not set.
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_stop:
.. rst-class:: classref-method

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationRootNode.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationRootNode.xml.
.. _class_AnimationRootNode:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationTree.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationTree.xml.
.. _class_AnimationTree:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Area2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Area2D.xml.
.. _class_Area2D:
@@ -142,18 +142,18 @@ Area2D
**area_shape_entered**\ (\ area_rid\: :ref:`RID<class_RID>`, area\: :ref:`Area2D<class_Area2D>`, area_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Area2D_signal_area_shape_entered>`
当收到的 ``area``:ref:`Shape2D<class_Shape2D>` 进入这个区域的形状时发出。要求 :ref:`monitoring<class_Area2D_property_monitoring>` 被设置为 ``true``
Emitted when a :ref:`Shape2D<class_Shape2D>` of the received ``area`` enters a shape of this area. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
\ ``local_shape_index`` ``area_shape_index`` 分别包含来自这个区域和另一个区域的交互形状的索引。\ ``area_rid`` 包含另一个区域的 :ref:`RID<class_RID>`\ 。这些值可以与 :ref:`PhysicsServer2D<class_PhysicsServer2D>` 一起使用。
\ ``local_shape_index`` and ``area_shape_index`` contain indices of the interacting shapes from this area and the other area, respectively. ``area_rid`` contains the :ref:`RID<class_RID>` of the other area. These values can be used with the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
\ **从形状索引中获取** :ref:`CollisionShape2D<class_CollisionShape2D>`\ **节点的例子:**\
\ **Example:** Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node from the shape index:
.. tabs::
.. code-tab:: gdscript
var other_shape_owner = area.shape_find_owner( area_shape_index)
var other_shape_owner = area.shape_find_owner(area_shape_index)
var other_shape_node = area.shape_owner_get_owner(other_shape_owner)
var local_shape_owner = shape_find_owner(local_shape_index)
@@ -209,11 +209,11 @@ Area2D
**body_shape_entered**\ (\ body_rid\: :ref:`RID<class_RID>`, body\: :ref:`Node2D<class_Node2D>`, body_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Area2D_signal_body_shape_entered>`
当收到的 ``body`` :ref:`Shape2D<class_Shape2D>` 进入这个区域的形状时发出。\ ``body`` 可以是一个 :ref:`PhysicsBody2D<class_PhysicsBody2D>` 或一个 :ref:`TileMap<class_TileMap>`\ 。如果 :ref:`TileMap<class_TileMap>` :ref:`TileSet<class_TileSet>` 配置了碰撞形状,则会被检测到。要求 :ref:`monitoring<class_Area2D_property_monitoring>` 被设置为 ``true``
Emitted when a :ref:`Shape2D<class_Shape2D>` of the received ``body`` enters a shape of this area. ``body`` can be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>`. :ref:`TileMap<class_TileMap>`\ s are detected if their :ref:`TileSet<class_TileSet>` has collision shapes configured. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
\ ``local_shape_index`` ``body_shape_index`` 分别包含来自这个区域和交互体的交互形状的指数。\ ``body_rid`` 包含体的 :ref:`RID<class_RID>`\ 。这些值可以与 :ref:`PhysicsServer2D<class_PhysicsServer2D>` 一起使用。
\ ``local_shape_index`` and ``body_shape_index`` contain indices of the interacting shapes from this area and the interacting body, respectively. ``body_rid`` contains the :ref:`RID<class_RID>` of the body. These values can be used with the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
\ **从形状索引中获取** :ref:`CollisionShape2D<class_CollisionShape2D>` **节点的例子。**\
\ **Example:** Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node from the shape index:
.. tabs::

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Area3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Area3D.xml.
.. _class_Area3D:
@@ -156,18 +156,18 @@ Area3D
**area_shape_entered**\ (\ area_rid\: :ref:`RID<class_RID>`, area\: :ref:`Area3D<class_Area3D>`, area_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Area3D_signal_area_shape_entered>`
当收到的 ``area``:ref:`Shape3D<class_Shape3D>` 进入这个区域的形状时发出。要求 :ref:`monitoring<class_Area3D_property_monitoring>` 被设置为 ``true``
Emitted when a :ref:`Shape3D<class_Shape3D>` of the received ``area`` enters a shape of this area. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``.
\ ``local_shape_index`` ``area_shape_index`` 分别包含来自这个区域和另一个区域的交互形状的索引。\ ``area_rid`` 包含另一个区域的 :ref:`RID<class_RID>`\ 。这些值可以与 :ref:`PhysicsServer3D<class_PhysicsServer3D>` 一起使用。
\ ``local_shape_index`` and ``area_shape_index`` contain indices of the interacting shapes from this area and the other area, respectively. ``area_rid`` contains the :ref:`RID<class_RID>` of the other area. These values can be used with the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
\ **从形状索引中获取** :ref:`CollisionShape3D<class_CollisionShape3D>` **节点的例子。**\
\ **Example:** Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node from the shape index:
.. tabs::
.. code-tab:: gdscript
var other_shape_owner = area.shape_find_owner( area_shape_index)
var other_shape_owner = area.shape_find_owner(area_shape_index)
var other_shape_node = area.shape_owner_get_owner(other_shape_owner)
var local_shape_owner = shape_find_owner(local_shape_index)
@@ -223,11 +223,11 @@ Area3D
**body_shape_entered**\ (\ body_rid\: :ref:`RID<class_RID>`, body\: :ref:`Node3D<class_Node3D>`, body_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Area3D_signal_body_shape_entered>`
当接收到的物体 ``body`` 中的某个 :ref:`Shape3D<class_Shape3D>` 进入此区域中的某个形状时发出。\ ``body`` 可以是 :ref:`PhysicsBody3D<class_PhysicsBody3D>` :ref:`GridMap<class_GridMap>`\ 。\ :ref:`GridMap<class_GridMap>` :ref:`MeshLibrary<class_MeshLibrary>` 配置有碰撞形状时才能够被检测到。要求将 :ref:`monitoring<class_Area3D_property_monitoring>` 设置为 ``true``\ 。
Emitted when a :ref:`Shape3D<class_Shape3D>` of the received ``body`` enters a shape of this area. ``body`` can be a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or a :ref:`GridMap<class_GridMap>`. :ref:`GridMap<class_GridMap>`\ s are detected if their :ref:`MeshLibrary<class_MeshLibrary>` has collision shapes configured. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``.
\ ``local_shape_index`` ``body_shape_index`` 分别对应此区域中以及交互物体中正在进行交互的形状的索引。\ ``body_rid`` 包含该物体的 :ref:`RID<class_RID>`\ 。这些值可以在 :ref:`PhysicsServer3D<class_PhysicsServer3D>` 中使用。
\ ``local_shape_index`` and ``body_shape_index`` contain indices of the interacting shapes from this area and the interacting body, respectively. ``body_rid`` contains the :ref:`RID<class_RID>` of the body. These values can be used with the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
\ **根据形状索引获取** :ref:`CollisionShape3D<class_CollisionShape3D>` **节点的示例:**\
\ **Example:** Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node from the shape index:
.. tabs::

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Array.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Array.xml.
.. _class_Array:
@@ -17,9 +17,7 @@ Array
描述
----
An array data structure that can contain a sequence of elements of any :ref:`Variant<class_Variant>` type. Elements are accessed by a numerical index starting at 0. Negative indices are used to count from the back (-1 is the last element, -2 is the second to last, etc.).
\ **Example:**\
An array data structure that can contain a sequence of elements of any :ref:`Variant<class_Variant>` type. Elements are accessed by a numerical index starting at ``0``. Negative indices are used to count from the back (``-1`` is the last element, ``-2`` is the second to last, etc.).
.. tabs::
@@ -37,7 +35,7 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
.. code-tab:: csharp
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
Godot.Collections.Array array = ["First", 2, 3, "Last"];
GD.Print(array[0]); // Prints "First"
GD.Print(array[2]); // Prints 3
GD.Print(array[^1]); // Prints "Last"
@@ -133,8 +131,12 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`find<class_Array_method_find>`\ (\ what\: :ref:`Variant<class_Variant>`, from\: :ref:`int<class_int>` = 0\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`find_custom<class_Array_method_find_custom>`\ (\ method\: :ref:`Callable<class_Callable>`, from\: :ref:`int<class_int>` = 0\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`front<class_Array_method_front>`\ (\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get<class_Array_method_get>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_typed_builtin<class_Array_method_get_typed_builtin>`\ (\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_typed_class_name<class_Array_method_get_typed_class_name>`\ (\ ) |const| |
@@ -185,6 +187,10 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`rfind<class_Array_method_rfind>`\ (\ what\: :ref:`Variant<class_Variant>`, from\: :ref:`int<class_int>` = -1\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`rfind_custom<class_Array_method_rfind_custom>`\ (\ method\: :ref:`Callable<class_Callable>`, from\: :ref:`int<class_int>` = -1\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set<class_Array_method_set>`\ (\ index\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`\ ) |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`shuffle<class_Array_method_shuffle>`\ (\ ) |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`size<class_Array_method_size>`\ (\ ) |const| |
@@ -408,9 +414,9 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`bool<class_bool>` **all**\ (\ method\: :ref:`Callable<class_Callable>`\ ) |const| :ref:`🔗<class_Array_method_all>`
对数组中的每个元素调用给定的 :ref:`Callable<class_Callable>`\ ,如果 :ref:`Callable<class_Callable>` 为数组中的 *所有* 元素返回 ``true``\ ,则返回 ``true``\ 。如果 :ref:`Callable<class_Callable>` 为一个或多个数组元素返回 ``false``\ ,则此方法返回 ``false``\ 。
Calls the given :ref:`Callable<class_Callable>` on each element in the array and returns ``true`` if the :ref:`Callable<class_Callable>` returns ``true`` for *all* elements in the array. If the :ref:`Callable<class_Callable>` returns ``false`` for one array element or more, this method returns ``false``.
``method`` 应采用一个 :ref:`Variant<class_Variant>` 参数(当前数组元素)并返回一个 :ref:`bool<class_bool>`\ 。
The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the current array element) and return a :ref:`bool<class_bool>`.
.. tabs::
@@ -421,13 +427,13 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
return number > 5
func _ready():
print([6, 10, 6].all(greater_than_5)) # 输出 true 3/3 元素被评估为真)。
print([4, 10, 4].all(greater_than_5)) # 输出 false 1/3 元素被评估为真)。
print([4, 4, 4].all(greater_than_5)) # 输出 false 0/3 元素被评估为真)。
print([].all(greater_than_5)) # 输出 true 0/0 元素被评估为真)。
print([6, 10, 6].all(greater_than_5)) # Prints true (3/3 elements evaluate to true).
print([4, 10, 4].all(greater_than_5)) # Prints false (1/3 elements evaluate to true).
print([4, 4, 4].all(greater_than_5)) # Prints false (0/3 elements evaluate to true).
print([].all(greater_than_5)) # Prints true (0/0 elements evaluate to true).
# 与上面的第一行相同,但使用 lambda 函数。
print([6, 10, 6].all(func(element): return element > 5)) # 输出 true
# Same as the first line above, but using a lambda function.
print([6, 10, 6].all(func(element): return element > 5)) # Prints true
.. code-tab:: csharp
@@ -438,26 +444,26 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
public override void _Ready()
{
// 输出 true 3/3 元素被评估为真)。
// Prints True (3/3 elements evaluate to true).
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(GreaterThan5));
// 输出 false 1/3 元素被评估为真)。
// Prints False (1/3 elements evaluate to true).
GD.Print(new Godot.Collections.Array>int< { 4, 10, 4 }.All(GreaterThan5));
// 输出 false 0/3 元素被评估为真)。
// Prints False (0/3 elements evaluate to true).
GD.Print(new Godot.Collections.Array>int< { 4, 4, 4 }.All(GreaterThan5));
// 输出 true 0/0 元素被评估为真)。
// Prints True (0/0 elements evaluate to true).
GD.Print(new Godot.Collections.Array>int< { }.All(GreaterThan5));
// 与上面的第一行相同,但使用 lambda 函数。
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // 输出 true
// Same as the first line above, but using a lambda function.
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // Prints True
}
另请参见 :ref:`any<class_Array_method_any>`\ 、\ :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`map<class_Array_method_map>` :ref:`reduce<class_Array_method_reduce>`\ 。
See also :ref:`any<class_Array_method_any>`, :ref:`filter<class_Array_method_filter>`, :ref:`map<class_Array_method_map>` and :ref:`reduce<class_Array_method_reduce>`.
\ **注意:**\ 与依赖 :ref:`filter<class_Array_method_filter>` 返回的数组大小不同,此方法会尽可能早地返回以提高性能(尤其是对于大型数组)。
\ **Note:** Unlike relying on the size of an array returned by :ref:`filter<class_Array_method_filter>`, this method will return as early as possible to improve performance (especially with large arrays).
\ **注意:**\ 对于空数组,此方法 `总是 <https://en.wikipedia.org/wiki/Vacuous_truth>`__ 返回 ``true``\ 。
\ **Note:** For an empty array, this method `always <https://en.wikipedia.org/wiki/Vacuous_truth>`__ returns ``true``.
.. rst-class:: classref-item-separator
@@ -639,7 +645,9 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`int<class_int>` **count**\ (\ value\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`🔗<class_Array_method_count>`
返回元素在数组中出现的次数。
Returns the number of times an element is in the array.
To count how many elements in an array satisfy a condition, see :ref:`reduce<class_Array_method_reduce>`.
.. rst-class:: classref-item-separator
@@ -683,9 +691,9 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
|void| **fill**\ (\ value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_fill>`
将该数组中的所有元素都设置为给定的 ``value``\ 。
Assigns the given ``value`` to all elements in the array.
该方法通常与 :ref:`resize<class_Array_method_resize>` 一起使用,用于创建给定大小的数组并对其元素进行初始化:
This method can often be combined with :ref:`resize<class_Array_method_resize>` to create an array with a given size and initialized elements:
.. tabs::
@@ -695,18 +703,18 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
var array = []
array.resize(5)
array.fill(2)
print(array) # 输出 [2, 2, 2, 2, 2]
print(array) # Prints [2, 2, 2, 2, 2]
.. code-tab:: csharp
var array = new Godot.Collections.Array();
Godot.Collections.Array array = [];
array.Resize(5);
array.Fill(2);
GD.Print(array); // 输出 [2, 2, 2, 2, 2]
GD.Print(array); // Prints [2, 2, 2, 2, 2]
\ **注意:**\ 如果 ``value`` 是通过引用传递的 :ref:`Variant<class_Variant>`\ \ :ref:`Object<class_Object>` 派生类、\ **Array**\ 、\ :ref:`Dictionary<class_Dictionary>` 等),则会用同一个 ``value`` 的引用填充该数组,即不会创建副本。
\ **Note:** If ``value`` is a :ref:`Variant<class_Variant>` passed by reference (:ref:`Object<class_Object>`-derived, **Array**, :ref:`Dictionary<class_Dictionary>`, etc.), the array will be filled with references to the same ``value``, which are not duplicates.
.. rst-class:: classref-item-separator
@@ -751,6 +759,35 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
\ **注意:**\ 出于性能方面的考虑,搜索时会使用到 ``what``:ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`\ 。例如该方法不会认为 ``7``\ \ :ref:`int<class_int>`\ )和 ``7.0``\ \ :ref:`float<class_float>`\ )相等。
.. rst-class:: classref-item-separator
----
.. _class_Array_method_find_custom:
.. rst-class:: classref-method
:ref:`int<class_int>` **find_custom**\ (\ method\: :ref:`Callable<class_Callable>`, from\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_Array_method_find_custom>`
Returns the index of the **first** element in the array that causes ``method`` to return ``true``, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the end of the array.
\ ``method`` is a callable that takes an element of the array, and returns a :ref:`bool<class_bool>`.
\ **Note:** If you just want to know whether the array contains *anything* that satisfies ``method``, use :ref:`any<class_Array_method_any>`.
.. tabs::
.. code-tab:: gdscript
func is_even(number):
return number % 2 == 0
func _ready():
print([1, 3, 4, 7].find_custom(is_even.bind())) # Prints 2
.. rst-class:: classref-item-separator
----
@@ -769,6 +806,18 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
----
.. _class_Array_method_get:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Array_method_get>`
Returns the element at the given ``index`` in the array. This is the same as using the ``[]`` operator (``array[index]``).
.. rst-class:: classref-item-separator
----
.. _class_Array_method_get_typed_builtin:
.. rst-class:: classref-method
@@ -811,37 +860,37 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`bool<class_bool>` **has**\ (\ value\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`🔗<class_Array_method_has>`
如果该数组包含给定的 ``value``\ ,则返回 ``true``\ 。
Returns ``true`` if the array contains the given ``value``.
.. tabs::
.. code-tab:: gdscript
print(["inside", 7].has("inside")) # 输出 true
print(["inside", 7].has("outside")) # 输出 false
print(["inside", 7].has(7)) # 输出 true
print(["inside", 7].has("7")) # 输出 false
print(["inside", 7].has("inside")) # Prints true
print(["inside", 7].has("outside")) # Prints false
print(["inside", 7].has(7)) # Prints true
print(["inside", 7].has("7")) # Prints false
.. code-tab:: csharp
var arr = new Godot.Collections.Array { "inside", 7 };
// 按照 C# 惯例,该方法重命名为 `Contains`
GD.Print(arr.Contains("inside")); // 输出 true
GD.Print(arr.Contains("outside")); // 输出 false
GD.Print(arr.Contains(7)); // 输出 true
GD.Print(arr.Contains("7")); // 输出 false
Godot.Collections.Array arr = ["inside", 7];
// By C# convention, this method is renamed to `Contains`.
GD.Print(arr.Contains("inside")); // Prints True
GD.Print(arr.Contains("outside")); // Prints False
GD.Print(arr.Contains(7)); // Prints True
GD.Print(arr.Contains("7")); // Prints False
GDScript 中,这相当于 ``in`` 运算符:
In GDScript, this is equivalent to the ``in`` operator:
::
if 4 in [2, 4, 6, 8]:
print("4 is here!") # 将被输出。
print("4 is here!") # Will be printed.
\ **注意:**\ 出于性能原因,搜索会受到 ``value`` :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 的影响。例如,对于该方法,\ ``7``\ \ :ref:`int<class_int>`\ )和 ``7.0``\ \ :ref:`float<class_float>`\ )不被视为相等。
\ **Note:** For performance reasons, the search is affected by the ``value``'s :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`. For example, ``7`` (:ref:`int<class_int>`) and ``7.0`` (:ref:`float<class_float>`) are not considered equal for this method.
.. rst-class:: classref-item-separator
@@ -1007,24 +1056,24 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`Variant<class_Variant>` **pick_random**\ (\ ) |const| :ref:`🔗<class_Array_method_pick_random>`
从该数组中返回一个随机元素。如果数组为空,则生成一个错误并返回 ``null``\ 。
Returns a random element from the array. Generates an error and returns ``null`` if the array is empty.
.. tabs::
.. code-tab:: gdscript
# 可能输出 1、2、3.25、或 "Hi"
# May print 1, 2, 3.25, or "Hi".
print([1, 2, 3.25, "Hi"].pick_random())
.. code-tab:: csharp
var array = new Godot.Collections.Array { 1, 2, 3.25f, "Hi" };
GD.Print(array.PickRandom()); // 可能输出 1、2、3.25、或 "Hi"
Godot.Collections.Array array = [1, 2, 3.25f, "Hi"];
GD.Print(array.PickRandom()); // May print 1, 2, 3.25, or "Hi".
\ **注意:**\ 与引擎中的许多类似函数(例如 :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>`:ref:`shuffle<class_Array_method_shuffle>`\ )一样,该方法使用通用的全局随机种子。要从该方法获得可预测的结果,请参阅 :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`\ 。
\ **Note:** Like many similar functions in the engine (such as :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>` or :ref:`shuffle<class_Array_method_shuffle>`), this method uses a common, global random seed. To get a predictable outcome from this method, see :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`.
.. rst-class:: classref-item-separator
@@ -1102,9 +1151,9 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`Variant<class_Variant>` **reduce**\ (\ method\: :ref:`Callable<class_Callable>`, accum\: :ref:`Variant<class_Variant>` = null\ ) |const| :ref:`🔗<class_Array_method_reduce>`
为数组中的每个元素调用给定的 :ref:`Callable<class_Callable>`\ ,将结果累积在 ``accum`` 中,然后返回它。
Calls the given :ref:`Callable<class_Callable>` for each element in array, accumulates the result in ``accum``, then returns it.
\ ``method`` 接受两个参数:\ ``accum`` 的当前值,以及当前的数组元素。如果 ``accum`` ``null``\ (默认值),则会从第二个元素开始迭代,将第一个元素作为 ``accum`` 的初始值。
The ``method`` takes two arguments: the current value of ``accum`` and the current array element. If ``accum`` is ``null`` (as by default), the iteration will start from the second element, with the first one used as initial value of ``accum``.
::
@@ -1112,26 +1161,39 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
return accum + number
func _ready():
print([1, 2, 3].reduce(sum, 0)) # 输出 6
print([1, 2, 3].reduce(sum, 10)) # 输出 16
print([1, 2, 3].reduce(sum, 0)) # Prints 6
print([1, 2, 3].reduce(sum, 10)) # Prints 16
# 与上面相同,但使用 lambda 函数。
# Same as above, but using a lambda function.
print([1, 2, 3].reduce(func(accum, number): return accum + number, 10))
如果 :ref:`max<class_Array_method_max>` 不理想,也可以使用该方法来实现自定义比较器:
If :ref:`max<class_Array_method_max>` is not desirable, this method may also be used to implement a custom comparator:
::
func _ready():
var arr = [Vector2(5, 0), Vector2(3, 4), Vector2(1, 2)]
var arr = [Vector2i(5, 0), Vector2i(3, 4), Vector2i(1, 2)]
var longest_vec = arr.reduce(func(max, vec): return vec if is_length_greater(vec, max) else max)
print(longest_vec) # 输出 Vector2(3, 4).
print(longest_vec) # Prints (3, 4)
func is_length_greater(a, b):
return a.length() > b.length()
另见 :ref:`map<class_Array_method_map>`\ 、\ :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`any<class_Array_method_any>`\ 、\ :ref:`all<class_Array_method_all>`\ 。
This method can also be used to count how many elements in an array satisfy a certain condition, similar to :ref:`count<class_Array_method_count>`:
::
func is_even(number):
return number % 2 == 0
func _ready():
var arr = [1, 2, 3, 4, 5]
# If the current element is even, increment count, otherwise leave count the same.
var even_count = arr.reduce(func(count, next): return count + 1 if is_even(next) else count, 0)
print(even_count) # Prints 2
See also :ref:`map<class_Array_method_map>`, :ref:`filter<class_Array_method_filter>`, :ref:`any<class_Array_method_any>`, and :ref:`all<class_Array_method_all>`.
.. rst-class:: classref-item-separator
@@ -1195,6 +1257,30 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
----
.. _class_Array_method_rfind_custom:
.. rst-class:: classref-method
:ref:`int<class_int>` **rfind_custom**\ (\ method\: :ref:`Callable<class_Callable>`, from\: :ref:`int<class_int>` = -1\ ) |const| :ref:`🔗<class_Array_method_rfind_custom>`
Returns the index of the **last** element of the array that causes ``method`` to return ``true``, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the beginning of the array. This method is the reverse of :ref:`find_custom<class_Array_method_find_custom>`.
.. rst-class:: classref-item-separator
----
.. _class_Array_method_set:
.. rst-class:: classref-method
|void| **set**\ (\ index\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_set>`
Sets the value of the element at the given ``index`` to the given ``value``. This will not change the size of the array, it only changes the value at an index already in the array. This is the same as using the ``[]`` operator (``array[index] = value``).
.. rst-class:: classref-item-separator
----
.. _class_Array_method_shuffle:
.. rst-class:: classref-method
@@ -1256,7 +1342,7 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
|void| **sort**\ (\ ) :ref:`🔗<class_Array_method_sort>`
按升序对数组进行排序。最终顺序取决于元素之间的“小于”(\ ``>``\ )比较。
Sorts the array in ascending order. The final order is dependent on the "less than" (``<``) comparison between elements.
.. tabs::
@@ -1265,17 +1351,17 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
var numbers = [10, 5, 2.5, 8]
numbers.sort()
print(numbers) # 输出 [2.5, 5, 8, 10]
print(numbers) # Prints [2.5, 5, 8, 10]
.. code-tab:: csharp
var numbers = new Godot.Collections.Array { 10, 5, 2.5, 8 };
Godot.Collections.Array numbers = [10, 5, 2.5, 8];
numbers.Sort();
GD.Print(numbers); // 输出 [2.5, 5, 8, 10]
GD.Print(numbers); // Prints [2.5, 5, 8, 10]
\ **注意:**\ 使用的排序算法并不\ `稳定 <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__\ 。这意味着等效元素(例如 ``2`` ``2.0``\ )在调用 :ref:`sort<class_Array_method_sort>` 时可能会改变其顺序。
\ **Note:** The sorting algorithm used is not `stable <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__. This means that equivalent elements (such as ``2`` and ``2.0``) may have their order changed when calling :ref:`sort<class_Array_method_sort>`.
.. rst-class:: classref-item-separator
@@ -1348,7 +1434,7 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`Array<class_Array>` **operator +**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_sum_Array>`
``right`` 数组追加到左操作数,会创建一个新的 **Array**\ 。这也称为数组拼接。
Appends the ``right`` array to the left operand, creating a new **Array**. This is also known as an array concatenation.
.. tabs::
@@ -1357,18 +1443,18 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
var array1 = ["One", 2]
var array2 = [3, "Four"]
print(array1 + array2) # 输出 ["One", 2, 3, "Four"]
print(array1 + array2) # Prints ["One", 2, 3, "Four"]
.. code-tab:: csharp
// 请注意C# 的原生数组类型无法进行拼接。
var array1 = new Godot.Collections.Array{"One", 2};
var array2 = new Godot.Collections.Array{3, "Four"};
GD.Print(array1 + array2); // 输出 ["One", 2, 3, "Four"]
// Note that concatenation is not possible with C#'s native Array type.
Godot.Collections.Array array1 = ["One", 2];
Godot.Collections.Array array2 = [3, "Four"];
GD.Print(array1 + array2); // Prints ["One", 2, 3, "Four"]
\ **注意:**\ 对于已有数组,\ :ref:`append_array<class_Array_method_append_array>` 比使用 ``+=`` 运算符的拼接和赋值效率高得多。
\ **Note:** For existing arrays, :ref:`append_array<class_Array_method_append_array>` is much more efficient than concatenation and assignment with the ``+=`` operator.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/ArrayMesh.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ArrayMesh.xml.
.. _class_ArrayMesh:
@@ -19,9 +19,9 @@ ArrayMesh
描述
----
**ArrayMesh** 是用来构造 :ref:`Mesh<class_Mesh>` 的,其属性指定为数组。
The **ArrayMesh** is used to construct a :ref:`Mesh<class_Mesh>` by specifying the attributes as arrays.
最基本的例子是创建单个三角形:
The most basic example is the creation of a single triangle:
.. tabs::
@@ -33,44 +33,44 @@ ArrayMesh
vertices.push_back(Vector3(1, 0, 0))
vertices.push_back(Vector3(0, 0, 1))
# 初始化 ArrayMesh
# Initialize the ArrayMesh.
var arr_mesh = ArrayMesh.new()
var arrays = []
arrays.resize(Mesh.ARRAY_MAX)
arrays[Mesh.ARRAY_VERTEX] = vertices
# 创建 Mesh
# Create the Mesh.
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
var m = MeshInstance3D.new()
m.mesh = arr_mesh
.. code-tab:: csharp
var vertices = new Vector3[]
{
Vector3[] vertices =
[
new Vector3(0, 1, 0),
new Vector3(1, 0, 0),
new Vector3(0, 0, 1),
};
];
// 初始化 ArrayMesh
// Initialize the ArrayMesh.
var arrMesh = new ArrayMesh();
var arrays = new Godot.Collections.Array();
Godot.Collections.Array arrays = [];
arrays.Resize((int)Mesh.ArrayType.Max);
arrays[(int)Mesh.ArrayType.Vertex] = vertices;
// 创建 Mesh
// Create the Mesh.
arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, arrays);
var m = new MeshInstance3D();
m.Mesh = arrMesh;
这个 :ref:`MeshInstance3D<class_MeshInstance3D>` 就可以添加到要显示的 :ref:`SceneTree<class_SceneTree>` 中了。
The :ref:`MeshInstance3D<class_MeshInstance3D>` is ready to be added to the :ref:`SceneTree<class_SceneTree>` to be shown.
程序几何体生成请参阅 :ref:`ImmediateMesh<class_ImmediateMesh>`\ 、\ :ref:`MeshDataTool<class_MeshDataTool>`\ 、\ :ref:`SurfaceTool<class_SurfaceTool>`\ 。
See also :ref:`ImmediateMesh<class_ImmediateMesh>`, :ref:`MeshDataTool<class_MeshDataTool>` and :ref:`SurfaceTool<class_SurfaceTool>` for procedural geometry generation.
\ **注意:**\ Godot 对三角形图元模式的正面使用顺时针\ `环绕顺序 <https://learnopengl-cn.github.io/04%20Advanced%20OpenGL/04%20Face%20culling/>`__\ 。
\ **Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
.. rst-class:: classref-introduction-group
@@ -134,6 +134,8 @@ ArrayMesh
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` | :ref:`surface_get_primitive_type<class_ArrayMesh_method_surface_get_primitive_type>`\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| |
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`surface_remove<class_ArrayMesh_method_surface_remove>`\ (\ surf_idx\: :ref:`int<class_int>`\ ) |
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`surface_set_name<class_ArrayMesh_method_surface_set_name>`\ (\ surf_idx\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) |
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`surface_update_attribute_region<class_ArrayMesh_method_surface_update_attribute_region>`\ (\ surf_idx\: :ref:`int<class_int>`, offset\: :ref:`int<class_int>`, data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
@@ -228,19 +230,19 @@ ArrayMesh
|void| **add_surface_from_arrays**\ (\ primitive\: :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`, arrays\: :ref:`Array<class_Array>`, blend_shapes\: :ref:`Array<class_Array>`\[:ref:`Array<class_Array>`\] = [], lods\: :ref:`Dictionary<class_Dictionary>` = {}, flags\: |bitfield|\[:ref:`ArrayFormat<enum_Mesh_ArrayFormat>`\] = 0\ ) :ref:`🔗<class_ArrayMesh_method_add_surface_from_arrays>`
创建一个新的表面。\ :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>` 将成为这个新表面的 ``surf_idx``\ 。
Creates a new surface. :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>` will become the ``surf_idx`` for this new surface.
创建表面以使用 ``primitive`` 进行渲染,它可以是 :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` 中定义的任何值。
Surfaces are created to be rendered using a ``primitive``, which may be any of the values defined in :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`.
\ ``arrays`` 参数是数组的数组。每个 :ref:`Mesh.ARRAY_MAX<class_Mesh_constant_ARRAY_MAX>` 元素都包含一个数组,其中包含此表面的一些网格数据,如 :ref:`ArrayType<enum_Mesh_ArrayType>` 的相应成员所描述的一样;如果它未被使用,则为 ``null``\ 。例如,\ ``arrays[0]`` 是顶点数组。始终需要第一个顶点子数组;其他的是可选的。添加索引数组会将此表面置于“索引模式”,其中顶点和其他数组成为数据源,索引数组定义顶点顺序。所有子数组的长度必须与顶点数组的长度相同(或者是顶点数组长度的精确倍数,当子数组的多个元素对应于单个顶点时);或者为空,如果使用了 :ref:`Mesh.ARRAY_INDEX<class_Mesh_constant_ARRAY_INDEX>` 则除外。
The ``arrays`` argument is an array of arrays. Each of the :ref:`Mesh.ARRAY_MAX<class_Mesh_constant_ARRAY_MAX>` elements contains an array with some of the mesh data for this surface as described by the corresponding member of :ref:`ArrayType<enum_Mesh_ArrayType>` or ``null`` if it is not used by the surface. For example, ``arrays[0]`` is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for :ref:`Mesh.ARRAY_INDEX<class_Mesh_constant_ARRAY_INDEX>` if it is used.
\ ``blend_shapes`` 参数是每个混合形状的顶点数据数组。 每个元素都是与 ``arrays`` 具有相同结构的数组,但是 :ref:`Mesh.ARRAY_VERTEX<class_Mesh_constant_ARRAY_VERTEX>`\ 、\ :ref:`Mesh.ARRAY_NORMAL<class_Mesh_constant_ARRAY_NORMAL>` :ref:`Mesh.ARRAY_TANGENT<class_Mesh_constant_ARRAY_TANGENT>` 这些条目,当且仅当在 ``arrays`` 被设置且所有其他条目都是 ``null`` 时,会被设置。
The ``blend_shapes`` argument is an array of vertex data for each blend shape. Each element is an array of the same structure as ``arrays``, but :ref:`Mesh.ARRAY_VERTEX<class_Mesh_constant_ARRAY_VERTEX>`, :ref:`Mesh.ARRAY_NORMAL<class_Mesh_constant_ARRAY_NORMAL>`, and :ref:`Mesh.ARRAY_TANGENT<class_Mesh_constant_ARRAY_TANGENT>` are set if and only if they are set in ``arrays`` and all other entries are ``null``.
\ ``lods`` 参数是一个带有 :ref:`float<class_float>` 键和 :ref:`PackedInt32Array<class_PackedInt32Array>` 值的字典。字典中的每个条目代表了表面的一个 LOD 级别,其中值是用于 LOD 级别的 :ref:`Mesh.ARRAY_INDEX<class_Mesh_constant_ARRAY_INDEX>` 数组,键大致与使用 LOD 统计信息的距离成正比。即,增加 LOD 的关键点也会增加在使用 LOD 之前对象必须与相机的距离。
The ``lods`` argument is a dictionary with :ref:`float<class_float>` keys and :ref:`PackedInt32Array<class_PackedInt32Array>` values. Each entry in the dictionary represents an LOD level of the surface, where the value is the :ref:`Mesh.ARRAY_INDEX<class_Mesh_constant_ARRAY_INDEX>` array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of an LOD also increases the distance that the objects has to be from the camera before the LOD is used.
\ ``flags`` 参数是根据需要按位或的:\ :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` 的一个值左移 ``ARRAY_FORMAT_CUSTOMn_SHIFT``\ ,用于每个正在使用的自定义通道,\ :ref:`Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE<class_Mesh_constant_ARRAY_FLAG_USE_DYNAMIC_UPDATE>`\ 、\ :ref:`Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS<class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS>`:ref:`Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY<class_Mesh_constant_ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY>`\ 。
The ``flags`` argument is the bitwise OR of, as required: One value of :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` left shifted by ``ARRAY_FORMAT_CUSTOMn_SHIFT`` for each custom channel in use, :ref:`Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE<class_Mesh_constant_ARRAY_FLAG_USE_DYNAMIC_UPDATE>`, :ref:`Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS<class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS>`, or :ref:`Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY<class_Mesh_constant_ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY>`.
\ **注意:**\ 使用索引时,建议只使用点、线或三角形。
\ **Note:** When using indices, it is recommended to only use points, lines, or triangles.
.. rst-class:: classref-item-separator
@@ -402,6 +404,18 @@ ArrayMesh
----
.. _class_ArrayMesh_method_surface_remove:
.. rst-class:: classref-method
|void| **surface_remove**\ (\ surf_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ArrayMesh_method_surface_remove>`
Removes the surface at the given index from the Mesh, shifting surfaces with higher index down by one.
.. rst-class:: classref-item-separator
----
.. _class_ArrayMesh_method_surface_set_name:
.. rst-class:: classref-method

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/ArrayOccluder3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ArrayOccluder3D.xml.
.. _class_ArrayOccluder3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AspectRatioContainer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AspectRatioContainer.xml.
.. _class_AspectRatioContainer:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStar2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStar2D.xml.
.. _class_AStar2D:
@@ -34,7 +34,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_compute_cost<class_AStar2D_private_method__compute_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_point<class_AStar2D_method_add_point>`\ (\ id\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`, weight_scale\: :ref:`float<class_float>` = 1.0\ ) |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -110,7 +110,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
.. rst-class:: classref-method
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar2D_private_method__estimate_cost>`
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar2D_private_method__estimate_cost>`
估算某个点和路径终点之间的成本时调用。
@@ -285,9 +285,11 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
:ref:`PackedInt64Array<class_PackedInt64Array>` **get_id_path**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStar2D_method_get_id_path>`
返回一个数组,其中包含构成由 AStar2D 在给定点之间找到的路径的点的 ID。数组从路径的起点到终点进行排序。
Returns an array with the IDs of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有能够到达目标的有效路径,并且 ``allow_partial_path`` 为\ ``true``\ ,则返回能够到达的最接近目标点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish.
.. tabs::
@@ -296,7 +298,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
var astar = AStar2D.new()
astar.add_point(1, Vector2(0, 0))
astar.add_point(2, Vector2(0, 1), 1) # 默认权重为 1
astar.add_point(2, Vector2(0, 1), 1) # Default weight is 1
astar.add_point(3, Vector2(1, 1))
astar.add_point(4, Vector2(2, 0))
@@ -305,13 +307,13 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
astar.connect_points(4, 3, false)
astar.connect_points(1, 4, false)
var res = astar.get_id_path(1, 3) # 返回 [1, 2, 3]
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
.. code-tab:: csharp
var astar = new AStar2D();
astar.AddPoint(1, new Vector2(0, 0));
astar.AddPoint(2, new Vector2(0, 1), 1); // 默认权重为 1
astar.AddPoint(2, new Vector2(0, 1), 1); // Default weight is 1
astar.AddPoint(3, new Vector2(1, 1));
astar.AddPoint(4, new Vector2(2, 0));
@@ -319,11 +321,11 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
long[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]
如果将第2个点的权重更改为 3则结果将改为 ``[1, 4, 3]``\ ,因为现在即使距离更长,通过第 4 点也比通过第 2 点“更容易”。
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
.. rst-class:: classref-item-separator
@@ -414,11 +416,13 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
:ref:`PackedVector2Array<class_PackedVector2Array>` **get_point_path**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStar2D_method_get_point_path>`
返回一个数组,其中包含 AStar2D 在给定点之间找到的路径中的点。数组从路径的起点到终点进行排序。
Returns an array with the points that are in the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有通往目标的有效路径并且 ``allow_partial_path`` ``true``\ ,则会返回通往距离目标最近的可达点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **注意:**\ 该方法不是线程安全的。如果从 :ref:`Thread<class_Thread>` 调用,它将返回一个空的 :ref:`PackedVector2Array<class_PackedVector2Array>` 并打印一条错误消息。
\ **Note:** This method is not thread-safe. If called from a :ref:`Thread<class_Thread>`, it will return an empty array and will print an error message.
Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish.
.. rst-class:: classref-item-separator
@@ -490,7 +494,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
|void| **reserve_space**\ (\ num_nodes\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AStar2D_method_reserve_space>`
在内部为 ``num_nodes`` 个点保留空间,如果你想要一次性添加大量的点且数量已知,例如网格,那么就会很有用。新容量必须大于或等于旧容量。
Reserves space internally for ``num_nodes`` points. Useful if you're adding a known large number of points at once, such as points on a grid. The new capacity must be greater or equal to the old capacity.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStar3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStar3D.xml.
.. _class_AStar3D:
@@ -19,46 +19,60 @@ A\* 的一种实现,用于寻找 3D 空间中连接图中的两个顶点之间
描述
----
A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一组给定的边(线段),在顶点(点)之间绘制短路径的过程。由于其性能和准确性,它被广泛使用。Godot A\* 实现默认使用 3D 空间中的点和欧几里德距离。
A\* (A star) is a computer algorithm used in pathfinding and graph traversal, the process of plotting short paths among vertices (points), passing through a given set of edges (segments). It enjoys widespread use due to its performance and accuracy. Godot's A\* implementation uses points in 3D space and Euclidean distances by default.
你需要使用 :ref:`add_point<class_AStar3D_method_add_point>` 手动添加点,并使用 :ref:`connect_points<class_AStar3D_method_connect_points>` 手动创建线段。完成后,可以使用 :ref:`are_points_connected<class_AStar3D_method_are_points_connected>` 函数,测试两点之间是否存在路径,通过 :ref:`get_id_path<class_AStar3D_method_get_id_path>` 获取包含索引的路径,或使用 :ref:`get_point_path<class_AStar3D_method_get_point_path>` 获取包含实际坐标的路径。
You must add points manually with :ref:`add_point<class_AStar3D_method_add_point>` and create segments manually with :ref:`connect_points<class_AStar3D_method_connect_points>`. Once done, you can test if there is a path between two points with the :ref:`are_points_connected<class_AStar3D_method_are_points_connected>` function, get a path containing indices by :ref:`get_id_path<class_AStar3D_method_get_id_path>`, or one containing actual coordinates with :ref:`get_point_path<class_AStar3D_method_get_point_path>`.
也可以使用非欧几里德距离。为此,创建一个扩展 **AStar3D** 的类,并覆盖方法 :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`\ 。两者都接受两个索引并返回一个长度,如以下示例所示。
It is also possible to use non-Euclidean distances. To do so, create a script that extends **AStar3D** and override the methods :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` and :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`. Both should take two point IDs and return the distance between the corresponding points.
\ **Example:** Use Manhattan distance instead of Euclidean distance:
.. tabs::
.. code-tab:: gdscript
class MyAStar:
class_name MyAStar3D
extends AStar3D
func _compute_cost(u, v):
return abs(u - v)
var u_pos = get_point_position(u)
var v_pos = get_point_position(v)
return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
func _estimate_cost(u, v):
return min(0, abs(u - v) - 1)
var u_pos = get_point_position(u)
var v_pos = get_point_position(v)
return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
.. code-tab:: csharp
public partial class MyAStar : AStar3D
using Godot;
[GlobalClass]
public partial class MyAStar3D : AStar3D
{
public override float _ComputeCost(long fromId, long toId)
{
return Mathf.Abs((int)(fromId - toId));
Vector3 fromPoint = GetPointPosition(fromId);
Vector3 toPoint = GetPointPosition(toId);
return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) + Mathf.Abs(fromPoint.Z - toPoint.Z);
}
public override float _EstimateCost(long fromId, long toId)
{
return Mathf.Min(0, Mathf.Abs((int)(fromId - toId)) - 1);
Vector3 fromPoint = GetPointPosition(fromId);
Vector3 toPoint = GetPointPosition(toId);
return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) + Mathf.Abs(fromPoint.Z - toPoint.Z);
}
}
\ :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` 应该返回距离的下限,即 ``_estimate_cost(u, v) <= _compute_cost(u, v)``\ 。这可以作为算法的提示,因为自定义 :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` 可能计算量很大。如果不是这种情况,请使 :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` 返回与 :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` 相同的值,以便为算法提供最准确的信息。
\ :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` should return a lower bound of the distance, i.e. ``_estimate_cost(u, v) <= _compute_cost(u, v)``. This serves as a hint to the algorithm because the custom :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` might be computation-heavy. If this is not the case, make :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` return the same value as :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` to provide the algorithm with the most accurate information.
如果使用默认的 :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`:ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` 方法,或者如果提供的 :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` 方法返回成本的下限,则 A\* 返回的路径将是成本最低的路径。这里,路径的代价等于路径中所有段的 :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` 结果乘以各个段端点的权重 ``weight_scale`` 之和。如果使用默认方法,并且所有点的 ``weight_scale`` 设置为 ``1.0``\ ,则这等于路径中所有段的欧几里德距离之和。
If the default :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` and :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` methods are used, or if the supplied :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>` method returns a lower bound of the cost, then the paths returned by A\* will be the lowest-cost paths. Here, the cost of a path equals the sum of the :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>` results of all segments in the path multiplied by the ``weight_scale``\ s of the endpoints of the respective segments. If the default methods are used and the ``weight_scale``\ s of all points are set to ``1.0``, then this equals the sum of Euclidean distances of all segments in the path.
.. rst-class:: classref-reftable-group
@@ -71,7 +85,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_point<class_AStar3D_method_add_point>`\ (\ id\: :ref:`int<class_int>`, position\: :ref:`Vector3<class_Vector3>`, weight_scale\: :ref:`float<class_float>` = 1.0\ ) |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -147,7 +161,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
.. rst-class:: classref-method
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar3D_private_method__estimate_cost>`
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar3D_private_method__estimate_cost>`
估算某个点和路径终点之间的成本时调用。
@@ -322,9 +336,11 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
:ref:`PackedInt64Array<class_PackedInt64Array>` **get_id_path**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStar3D_method_get_id_path>`
返回一个数组,其中包含构成 AStar3D 在给定点之间找到的路径中的点的 ID。数组从路径的起点到终点排序。
Returns an array with the IDs of the points that form the path found by AStar3D between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有能够到达目标的有效路径,并且 ``allow_partial_path`` 为\ ``true``\ ,则返回能够到达的最接近目标点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish.
.. tabs::
@@ -333,7 +349,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
var astar = AStar3D.new()
astar.add_point(1, Vector3(0, 0, 0))
astar.add_point(2, Vector3(0, 1, 0), 1) # 默认权重为 1
astar.add_point(2, Vector3(0, 1, 0), 1) # Default weight is 1
astar.add_point(3, Vector3(1, 1, 0))
astar.add_point(4, Vector3(2, 0, 0))
@@ -342,24 +358,24 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
astar.connect_points(4, 3, false)
astar.connect_points(1, 4, false)
var res = astar.get_id_path(1, 3) # 返回 [1, 2, 3]
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
.. code-tab:: csharp
var astar = new AStar3D();
astar.AddPoint(1, new Vector3(0, 0, 0));
astar.AddPoint(2, new Vector3(0, 1, 0), 1); // 默认权重为 1
astar.AddPoint(2, new Vector3(0, 1, 0), 1); // Default weight is 1
astar.AddPoint(3, new Vector3(1, 1, 0));
astar.AddPoint(4, new Vector3(2, 0, 0));
astar.ConnectPoints(1, 2, false);
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
long[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]
如果将第2个点的权重更改为 3则结果将改为 ``[1, 4, 3]``\ ,因为现在即使距离更长,但通过第 4 点也比通过第 2 点“更容易”。
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
.. rst-class:: classref-item-separator
@@ -449,11 +465,13 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
:ref:`PackedVector3Array<class_PackedVector3Array>` **get_point_path**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStar3D_method_get_point_path>`
返回一个数组,其中包含 AStar3D 在给定点之间找到的路径中的点。数组从路径的起点到终点进行排序。
Returns an array with the points that are in the path found by AStar3D between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有通往目标的有效路径并且 ``allow_partial_path`` ``true``\ ,则会返回通往距离目标最近的可达点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **注意:**\ 这种方法不是线程安全的。如果从 :ref:`Thread<class_Thread>` 调用,它将返回一个空的 :ref:`PackedVector3Array<class_PackedVector3Array>`\ ,并打印一条错误消息。
\ **Note:** This method is not thread-safe. If called from a :ref:`Thread<class_Thread>`, it will return an empty array and will print an error message.
Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStarGrid2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStarGrid2D.xml.
.. _class_AStarGrid2D:
@@ -19,9 +19,9 @@ A\* 的一种实现,用于寻找疏松 2D 网格中两点之间的最短路径
描述
----
**AStarGrid2D** :ref:`AStar2D<class_AStar2D>` 的变种,针对疏松 2D 网格进行了优化。因为不需要手动创建点并进行连接,所以用起来更加简单。这个类还支持使用不同的启发方法、斜向移动模式、跳跃模式,从而加速运算。
**AStarGrid2D** is a variant of :ref:`AStar2D<class_AStar2D>` that is specialized for partial 2D grids. It is simpler to use because it doesn't require you to manually create points and connect them together. This class also supports multiple types of heuristics, modes for diagonal movement, and a jumping mode to speed up calculations.
要使用 **AStarGrid2D**\ ,你只需要设置网格的 :ref:`region<class_AStarGrid2D_property_region>`\ \ :ref:`cell_size<class_AStarGrid2D_property_cell_size>` 可以不设置,最后调用 :ref:`update<class_AStarGrid2D_method_update>` 方法即可:
To use **AStarGrid2D**, you only need to set the :ref:`region<class_AStarGrid2D_property_region>` of the grid, optionally set the :ref:`cell_size<class_AStarGrid2D_property_cell_size>`, and then call the :ref:`update<class_AStarGrid2D_method_update>` method:
.. tabs::
@@ -32,8 +32,8 @@ A\* 的一种实现,用于寻找疏松 2D 网格中两点之间的最短路径
astar_grid.region = Rect2i(0, 0, 32, 32)
astar_grid.cell_size = Vector2(16, 16)
astar_grid.update()
print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # 输出 (0, 0), (1, 1), (2, 2), (3, 3), (3, 4)
print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # 输出 (0, 0), (16, 16), (32, 32), (48, 48), (48, 64)
print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # Prints [(0, 0), (1, 1), (2, 2), (3, 3), (3, 4)]
print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # Prints [(0, 0), (16, 16), (32, 32), (48, 48), (48, 64)]
.. code-tab:: csharp
@@ -41,12 +41,12 @@ A\* 的一种实现,用于寻找疏松 2D 网格中两点之间的最短路径
astarGrid.Region = new Rect2I(0, 0, 32, 32);
astarGrid.CellSize = new Vector2I(16, 16);
astarGrid.Update();
GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // 输出 (0, 0), (1, 1), (2, 2), (3, 3), (3, 4)
GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // 输出 (0, 0), (16, 16), (32, 32), (48, 48), (48, 64)
GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // Prints [(0, 0), (1, 1), (2, 2), (3, 3), (3, 4)]
GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // Prints [(0, 0), (16, 16), (32, 32), (48, 48), (48, 64)]
要从寻路网格中移除某个点,必须使用 :ref:`set_point_solid<class_AStarGrid2D_method_set_point_solid>` 将其设置为“实心”。
To remove a point from the pathfinding grid, it must be set as "solid" with :ref:`set_point_solid<class_AStarGrid2D_method_set_point_solid>`.
.. rst-class:: classref-reftable-group
@@ -84,39 +84,41 @@ A\* 的一种实现,用于寻找疏松 2D 网格中两点之间的最短路径
.. table::
:widths: auto
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_compute_cost<class_AStarGrid2D_private_method__compute_cost>`\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStarGrid2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStarGrid2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, end_id\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |const| |
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear<class_AStarGrid2D_method_clear>`\ (\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`fill_solid_region<class_AStarGrid2D_method_fill_solid_region>`\ (\ region\: :ref:`Rect2i<class_Rect2i>`, solid\: :ref:`bool<class_bool>` = true\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`fill_weight_scale_region<class_AStarGrid2D_method_fill_weight_scale_region>`\ (\ region\: :ref:`Rect2i<class_Rect2i>`, weight_scale\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_id_path<class_AStarGrid2D_method_get_id_path>`\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_point_data_in_region<class_AStarGrid2D_method_get_point_data_in_region>`\ (\ region\: :ref:`Rect2i<class_Rect2i>`\ ) |const| |
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_point_path<class_AStarGrid2D_method_get_point_path>`\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_point_position<class_AStarGrid2D_method_get_point_position>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_point_weight_scale<class_AStarGrid2D_method_get_point_weight_scale>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_dirty<class_AStarGrid2D_method_is_dirty>`\ (\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_in_bounds<class_AStarGrid2D_method_is_in_bounds>`\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_in_boundsv<class_AStarGrid2D_method_is_in_boundsv>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_point_solid<class_AStarGrid2D_method_is_point_solid>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_point_solid<class_AStarGrid2D_method_set_point_solid>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`, solid\: :ref:`bool<class_bool>` = true\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_point_weight_scale<class_AStarGrid2D_method_set_point_weight_scale>`\ (\ id\: :ref:`Vector2i<class_Vector2i>`, weight_scale\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`update<class_AStarGrid2D_method_update>`\ (\ ) |
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
@@ -483,7 +485,7 @@ enum **CellShape**: :ref:`🔗<enum_AStarGrid2D_CellShape>`
.. rst-class:: classref-method
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |const| :ref:`🔗<class_AStarGrid2D_private_method__estimate_cost>`
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, end_id\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |const| :ref:`🔗<class_AStarGrid2D_private_method__estimate_cost>`
估算某个点和路径终点之间的成本时调用。
@@ -539,9 +541,23 @@ enum **CellShape**: :ref:`🔗<enum_AStarGrid2D_CellShape>`
:ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_id_path**\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStarGrid2D_method_get_id_path>`
返回一个数组,其中包含 AStar2D 在给定点之间找到的路径中的点。数组从路径的起点到终点进行排序。
Returns an array with the IDs of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有通往目标的有效路径并且 ``allow_partial_path`` ``true``\ ,则会返回通往距离目标最近的可达点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is solid the search may take an unusually long time to finish.
.. rst-class:: classref-item-separator
----
.. _class_AStarGrid2D_method_get_point_data_in_region:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_point_data_in_region**\ (\ region\: :ref:`Rect2i<class_Rect2i>`\ ) |const| :ref:`🔗<class_AStarGrid2D_method_get_point_data_in_region>`
Returns an array of dictionaries with point data (``id``: :ref:`Vector2i<class_Vector2i>`, ``position``: :ref:`Vector2<class_Vector2>`, ``solid``: :ref:`bool<class_bool>`, ``weight_scale``: :ref:`float<class_float>`) within a ``region``.
.. rst-class:: classref-item-separator
@@ -553,11 +569,13 @@ enum **CellShape**: :ref:`🔗<enum_AStarGrid2D_CellShape>`
:ref:`PackedVector2Array<class_PackedVector2Array>` **get_point_path**\ (\ from_id\: :ref:`Vector2i<class_Vector2i>`, to_id\: :ref:`Vector2i<class_Vector2i>`, allow_partial_path\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AStarGrid2D_method_get_point_path>`
返回一个数组,其中包含 **AStarGrid2D** 在给定点之间找到的路径上的点。数组从路径的起点到终点排序。
Returns an array with the points that are in the path found by **AStarGrid2D** between the given points. The array is ordered from the starting point to the ending point of the path.
如果没有通往目标的有效路径并且 ``allow_partial_path`` ``true``\ ,则会返回通往距离目标最近的可达点的路径。
If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached.
\ **注意:**\ 该方法不是线程安全的。如果从 :ref:`Thread<class_Thread>` 中调用它,它将返回一个空的 :ref:`PackedVector3Array<class_PackedVector3Array>` 并打印一条错误消息。
\ **Note:** This method is not thread-safe. If called from a :ref:`Thread<class_Thread>`, it will return an empty array and will print an error message.
Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is solid the search may take an unusually long time to finish.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AtlasTexture.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AtlasTexture.xml.
.. _class_AtlasTexture:
@@ -19,11 +19,11 @@ AtlasTexture
描述
----
:ref:`Texture2D<class_Texture2D>` 资源,只绘制其 :ref:`atlas<class_AtlasTexture_property_atlas>` 纹理中的由 :ref:`region<class_AtlasTexture_property_region>` 所定义的那部分。还可以设置一个额外的 :ref:`margin<class_AtlasTexture_property_margin>`\ ,这对于小的调整很有用。
:ref:`Texture2D<class_Texture2D>` resource that draws only part of its :ref:`atlas<class_AtlasTexture_property_atlas>` texture, as defined by the :ref:`region<class_AtlasTexture_property_region>`. An additional :ref:`margin<class_AtlasTexture_property_margin>` can also be set, which is useful for small adjustments.
可以从同一个\ :ref:`atlas<class_AtlasTexture_property_atlas>`\ 中裁剪出多个 **AtlasTexture** 资源。将许多较小的纹理打包成一个单一的大纹理有助于优化视频内存成本和渲染调用。
Multiple **AtlasTexture** resources can be cropped from the same :ref:`atlas<class_AtlasTexture_property_atlas>`. Packing many smaller textures into a singular large texture helps to optimize video memory costs and render calls.
\ **注意:**\ **AtlasTexture** 不能在 :ref:`AnimatedTexture<class_AnimatedTexture>` 中使用,并且当在其他 **AtlasTexture** 资源内时,可能无法在 :ref:`TextureRect<class_TextureRect>` 等节点中正确平铺。
\ **Note:** **AtlasTexture** cannot be used in an :ref:`AnimatedTexture<class_AnimatedTexture>`, and will not tile properly in nodes such as :ref:`TextureRect<class_TextureRect>` or :ref:`Sprite2D<class_Sprite2D>`. To tile an **AtlasTexture**, modify its :ref:`region<class_AtlasTexture_property_region>` instead.
.. rst-class:: classref-reftable-group

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioBusLayout.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioBusLayout.xml.
.. _class_AudioBusLayout:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffect.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffect.xml.
.. _class_AudioEffect:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectAmplify.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectAmplify.xml.
.. _class_AudioEffectAmplify:
@@ -36,9 +36,11 @@ AudioEffectAmplify
.. table::
:widths: auto
+---------------------------+---------------------------------------------------------------+---------+
+---------------------------+-----------------------------------------------------------------------+---------+
| :ref:`float<class_float>` | :ref:`volume_db<class_AudioEffectAmplify_property_volume_db>` | ``0.0`` |
+---------------------------+---------------------------------------------------------------+---------+
+---------------------------+-----------------------------------------------------------------------+---------+
| :ref:`float<class_float>` | :ref:`volume_linear<class_AudioEffectAmplify_property_volume_linear>` | |
+---------------------------+-----------------------------------------------------------------------+---------+
.. rst-class:: classref-section-separator
@@ -62,6 +64,25 @@ AudioEffectAmplify
以分贝为单位的放大量。正值使声音更响亮,负值使声音更安静。数值范围从 -80 到 24。
.. rst-class:: classref-item-separator
----
.. _class_AudioEffectAmplify_property_volume_linear:
.. rst-class:: classref-property
:ref:`float<class_float>` **volume_linear** :ref:`🔗<class_AudioEffectAmplify_property_volume_linear>`
.. rst-class:: classref-property-setget
- |void| **set_volume_linear**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_linear**\ (\ )
Amount of amplification as a linear value.
\ **Note:** This member modifies :ref:`volume_db<class_AudioEffectAmplify_property_volume_db>` for convenience. The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` on :ref:`volume_db<class_AudioEffectAmplify_property_volume_db>`. Setting this member is equivalent to setting :ref:`volume_db<class_AudioEffectAmplify_property_volume_db>` to the result of :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>` on a value.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectBandLimitFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectBandLimitFilter.xml.
.. _class_AudioEffectBandLimitFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectBandPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectBandPassFilter.xml.
.. _class_AudioEffectBandPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectCapture.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectCapture.xml.
.. _class_AudioEffectCapture:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectChorus.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectChorus.xml.
.. _class_AudioEffectChorus:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectCompressor.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectCompressor.xml.
.. _class_AudioEffectCompressor:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectDelay.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectDelay.xml.
.. _class_AudioEffectDelay:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectDistortion.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectDistortion.xml.
.. _class_AudioEffectDistortion:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ.xml.
.. _class_AudioEffectEQ:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ10.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ10.xml.
.. _class_AudioEffectEQ10:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ21.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ21.xml.
.. _class_AudioEffectEQ21:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ6.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ6.xml.
.. _class_AudioEffectEQ6:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectFilter.xml.
.. _class_AudioEffectFilter:
@@ -69,11 +69,7 @@ enum **FilterDB**: :ref:`🔗<enum_AudioEffectFilter_FilterDB>`
:ref:`FilterDB<enum_AudioEffectFilter_FilterDB>` **FILTER_6DB** = ``0``
.. container:: contribute
该枚举目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Cutting off at 6dB per octave.
.. _class_AudioEffectFilter_constant_FILTER_12DB:
@@ -81,11 +77,7 @@ enum **FilterDB**: :ref:`🔗<enum_AudioEffectFilter_FilterDB>`
:ref:`FilterDB<enum_AudioEffectFilter_FilterDB>` **FILTER_12DB** = ``1``
.. container:: contribute
该枚举目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Cutting off at 12dB per octave.
.. _class_AudioEffectFilter_constant_FILTER_18DB:
@@ -93,11 +85,7 @@ enum **FilterDB**: :ref:`🔗<enum_AudioEffectFilter_FilterDB>`
:ref:`FilterDB<enum_AudioEffectFilter_FilterDB>` **FILTER_18DB** = ``2``
.. container:: contribute
该枚举目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Cutting off at 18dB per octave.
.. _class_AudioEffectFilter_constant_FILTER_24DB:
@@ -105,11 +93,7 @@ enum **FilterDB**: :ref:`🔗<enum_AudioEffectFilter_FilterDB>`
:ref:`FilterDB<enum_AudioEffectFilter_FilterDB>` **FILTER_24DB** = ``3``
.. container:: contribute
该枚举目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Cutting off at 24dB per octave.
.. rst-class:: classref-section-separator
@@ -148,9 +132,7 @@ enum **FilterDB**: :ref:`🔗<enum_AudioEffectFilter_FilterDB>`
- |void| **set_db**\ (\ value\: :ref:`FilterDB<enum_AudioEffectFilter_FilterDB>`\ )
- :ref:`FilterDB<enum_AudioEffectFilter_FilterDB>` **get_db**\ (\ )
.. container:: contribute
该属性目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Steepness of the cutoff curve in dB per octave, also known as the order of the filter. Higher orders have a more aggressive cutoff.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHardLimiter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHardLimiter.xml.
.. _class_AudioEffectHardLimiter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHighPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHighPassFilter.xml.
.. _class_AudioEffectHighPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHighShelfFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHighShelfFilter.xml.
.. _class_AudioEffectHighShelfFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectInstance.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectInstance.xml.
.. _class_AudioEffectInstance:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLimiter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLimiter.xml.
.. _class_AudioEffectLimiter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLowPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLowPassFilter.xml.
.. _class_AudioEffectLowPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLowShelfFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLowShelfFilter.xml.
.. _class_AudioEffectLowShelfFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectNotchFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectNotchFilter.xml.
.. _class_AudioEffectNotchFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPanner.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPanner.xml.
.. _class_AudioEffectPanner:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPhaser.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPhaser.xml.
.. _class_AudioEffectPhaser:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPitchShift.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPitchShift.xml.
.. _class_AudioEffectPitchShift:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectRecord.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectRecord.xml.
.. _class_AudioEffectRecord:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectReverb.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectReverb.xml.
.. _class_AudioEffectReverb:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectSpectrumAnalyzer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectSpectrumAnalyzer.xml.
.. _class_AudioEffectSpectrumAnalyzer:
@@ -19,11 +19,11 @@ AudioEffectSpectrumAnalyzer
描述
----
这种音频效果不影响声音输出,但可以用于实时音频可视化。
This audio effect does not affect sound output, but can be used for real-time audio visualizations.
该资源配置了一个 :ref:`AudioEffectSpectrumAnalyzerInstance<class_AudioEffectSpectrumAnalyzerInstance>`\ ,它在运行时执行实际分析。可以使用 :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>` 获取实例。
This resource configures an :ref:`AudioEffectSpectrumAnalyzerInstance<class_AudioEffectSpectrumAnalyzerInstance>`, which performs the actual analysis at runtime. An instance can be obtained with :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>`.
使用程序生成声音请参阅 :ref:`AudioStreamGenerator<class_AudioStreamGenerator>`\ 。
See also :ref:`AudioStreamGenerator<class_AudioStreamGenerator>` for procedurally generating sounds.
.. rst-class:: classref-introduction-group

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml.
.. _class_AudioEffectSpectrumAnalyzerInstance:
@@ -19,9 +19,9 @@ AudioEffectSpectrumAnalyzerInstance
描述
----
:ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>` 的运行时部分,可以用来查询宿主总线上某个频率范围内的幅度。
The runtime part of an :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>`, which can be used to query the magnitude of a frequency range on its host bus.
可以使用 :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>` 获取该类的实例。
An instance of this class can be obtained with :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>`.
.. rst-class:: classref-introduction-group

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectStereoEnhance.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectStereoEnhance.xml.
.. _class_AudioEffectStereoEnhance:
@@ -64,7 +64,7 @@ AudioEffectStereoEnhance
- |void| **set_pan_pullout**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_pan_pullout**\ (\ )
大于 1.0 的值会增加通过该效果的音频的任何声像强度,而小于 1.0 的值会降低声像强度。值为 0.0 会将音频缩混为单声道。
Amplifies the difference between stereo channels, increasing or decreasing existing panning. A value of 0.0 will downmix stereo to mono. Does not affect a mono signal.
.. rst-class:: classref-item-separator
@@ -81,9 +81,7 @@ AudioEffectStereoEnhance
- |void| **set_surround**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_surround**\ (\ )
.. container:: contribute
该属性目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Widens sound stage through phase shifting in conjunction with :ref:`time_pullout_ms<class_AudioEffectStereoEnhance_property_time_pullout_ms>`. Just pans sound to the left channel if :ref:`time_pullout_ms<class_AudioEffectStereoEnhance_property_time_pullout_ms>` is 0.
.. rst-class:: classref-item-separator
@@ -100,9 +98,7 @@ AudioEffectStereoEnhance
- |void| **set_time_pullout**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_time_pullout**\ (\ )
.. container:: contribute
该属性目前没有描述,请帮我们\ :ref:`贡献一个 <doc_updating_the_class_reference>`\ 吧!
Widens sound stage through phase shifting in conjunction with :ref:`surround<class_AudioEffectStereoEnhance_property_surround>`. Just delays the right channel if :ref:`surround<class_AudioEffectStereoEnhance_property_surround>` is 0.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioListener2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioListener2D.xml.
.. _class_AudioListener2D:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioListener3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioListener3D.xml.
.. _class_AudioListener3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioSample.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioSample.xml.
.. _class_AudioSample:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioSamplePlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioSamplePlayback.xml.
.. _class_AudioSamplePlayback:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioServer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioServer.xml.
.. _class_AudioServer:
@@ -87,8 +87,14 @@ AudioServer
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_bus_volume_db<class_AudioServer_method_get_bus_volume_db>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_bus_volume_linear<class_AudioServer_method_get_bus_volume_linear>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_driver_name<class_AudioServer_method_get_driver_name>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_input_device_list<class_AudioServer_method_get_input_device_list>`\ (\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_input_mix_rate<class_AudioServer_method_get_input_mix_rate>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_mix_rate<class_AudioServer_method_get_mix_rate>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_output_device_list<class_AudioServer_method_get_output_device_list>`\ (\ ) |
@@ -137,6 +143,8 @@ AudioServer
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_volume_db<class_AudioServer_method_set_bus_volume_db>`\ (\ bus_idx\: :ref:`int<class_int>`, volume_db\: :ref:`float<class_float>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_volume_linear<class_AudioServer_method_set_bus_volume_linear>`\ (\ bus_idx\: :ref:`int<class_int>`, volume_linear\: :ref:`float<class_float>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_enable_tagging_used_audio_streams<class_AudioServer_method_set_enable_tagging_used_audio_streams>`\ (\ enable\: :ref:`bool<class_bool>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`swap_bus_effects<class_AudioServer_method_swap_bus_effects>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, by_effect_idx\: :ref:`int<class_int>`\ ) |
@@ -514,6 +522,32 @@ enum **PlaybackType**: :ref:`🔗<enum_AudioServer_PlaybackType>`
----
.. _class_AudioServer_method_get_bus_volume_linear:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_bus_volume_linear**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_volume_linear>`
Returns the volume of the bus at index ``bus_idx`` as a linear value.
\ **Note:** The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` on the result of :ref:`get_bus_volume_db<class_AudioServer_method_get_bus_volume_db>`.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_driver_name:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_driver_name**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_driver_name>`
Returns the name of the current audio driver. The default usually depends on the operating system, but may be overridden via the ``--audio-driver`` :doc:`command line argument <../tutorials/editor/command_line_tutorial>`. ``--headless`` also automatically sets the audio driver to ``Dummy``. See also :ref:`ProjectSettings.audio/driver/driver<class_ProjectSettings_property_audio/driver/driver>`.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_input_device_list:
.. rst-class:: classref-method
@@ -528,6 +562,18 @@ enum **PlaybackType**: :ref:`🔗<enum_AudioServer_PlaybackType>`
----
.. _class_AudioServer_method_get_input_mix_rate:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_input_mix_rate**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_input_mix_rate>`
Returns the sample rate at the input of the **AudioServer**.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_mix_rate:
.. rst-class:: classref-method
@@ -822,7 +868,21 @@ enum **PlaybackType**: :ref:`🔗<enum_AudioServer_PlaybackType>`
|void| **set_bus_volume_db**\ (\ bus_idx\: :ref:`int<class_int>`, volume_db\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_volume_db>`
将索引为 ``bus_idx`` 的总线的音量设为 ``volume_db``\ 。
Sets the volume in decibels of the bus at index ``bus_idx`` to ``volume_db``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_volume_linear:
.. rst-class:: classref-method
|void| **set_bus_volume_linear**\ (\ bus_idx\: :ref:`int<class_int>`, volume_linear\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_volume_linear>`
Sets the volume as a linear value of the bus at index ``bus_idx`` to ``volume_linear``.
\ **Note:** Using this method is equivalent to calling :ref:`set_bus_volume_db<class_AudioServer_method_set_bus_volume_db>` with the result of :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>` on a value.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStream.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStream.xml.
.. _class_AudioStream:
@@ -44,6 +44,8 @@ AudioStream
.. table::
:widths: auto
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`_get_bar_beats<class_AudioStream_private_method__get_bar_beats>`\ (\ ) |virtual| |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`_get_beat_count<class_AudioStream_private_method__get_beat_count>`\ (\ ) |virtual| |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
@@ -55,6 +57,8 @@ AudioStream
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`_get_stream_name<class_AudioStream_private_method__get_stream_name>`\ (\ ) |virtual| |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`_has_loop<class_AudioStream_private_method__has_loop>`\ (\ ) |virtual| |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` | :ref:`_instantiate_playback<class_AudioStream_private_method__instantiate_playback>`\ (\ ) |virtual| |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`_is_monophonic<class_AudioStream_private_method__is_monophonic>`\ (\ ) |virtual| |const| |
@@ -98,6 +102,18 @@ AudioStream
方法说明
--------
.. _class_AudioStream_private_method__get_bar_beats:
.. rst-class:: classref-method
:ref:`int<class_int>` **_get_bar_beats**\ (\ ) |virtual| |const| :ref:`🔗<class_AudioStream_private_method__get_bar_beats>`
Override this method to return the bar beats of this stream.
.. rst-class:: classref-item-separator
----
.. _class_AudioStream_private_method__get_beat_count:
.. rst-class:: classref-method
@@ -162,13 +178,25 @@ AudioStream
----
.. _class_AudioStream_private_method__has_loop:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **_has_loop**\ (\ ) |virtual| |const| :ref:`🔗<class_AudioStream_private_method__has_loop>`
Override this method to return ``true`` if this stream has a loop.
.. rst-class:: classref-item-separator
----
.. _class_AudioStream_private_method__instantiate_playback:
.. rst-class:: classref-method
:ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **_instantiate_playback**\ (\ ) |virtual| |const| :ref:`🔗<class_AudioStream_private_method__instantiate_playback>`
覆盖该方法可以自定义 :ref:`instantiate_playback<class_AudioStream_method_instantiate_playback>` 的返回值。应该返回一个在播放流(例如通过 :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`\ )时创建的新的 :ref:`AudioStreamPlayback<class_AudioStreamPlayback>`\ 。
Override this method to customize the returned value of :ref:`instantiate_playback<class_AudioStream_method_instantiate_playback>`. Should return a new :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` created when the stream is played (such as by an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`).
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamGenerator.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamGenerator.xml.
.. _class_AudioStreamGenerator:
@@ -19,18 +19,19 @@ AudioStreamGenerator
描述
----
**AudioStreamGenerator** 是一种音频流,它自己并不播放声音,而是要用脚本来为它生成音频数据。另见 :ref:`AudioStreamGeneratorPlayback<class_AudioStreamGeneratorPlayback>`\ 。
**AudioStreamGenerator** is a type of audio stream that does not play back sounds on its own; instead, it expects a script to generate audio data for it. See also :ref:`AudioStreamGeneratorPlayback<class_AudioStreamGeneratorPlayback>`.
以下是用它来生成正弦波的例子:
Here's a sample on how to use it to generate a sine wave:
.. tabs::
.. code-tab:: gdscript
var playback # 存放 AudioStreamGeneratorPlayback
var playback # Will hold the AudioStreamGeneratorPlayback.
@onready var sample_hz = $AudioStreamPlayer.stream.mix_rate
var pulse_hz = 440.0 # 声音波形的频率。
var pulse_hz = 440.0 # The frequency of the sound wave.
var phase = 0.0
func _ready():
$AudioStreamPlayer.play()
@@ -38,7 +39,6 @@ AudioStreamGenerator
fill_buffer()
func fill_buffer():
var phase = 0.0
var increment = pulse_hz / sample_hz
var frames_available = playback.get_frames_available()
@@ -50,9 +50,10 @@ AudioStreamGenerator
[Export] public AudioStreamPlayer Player { get; set; }
private AudioStreamGeneratorPlayback _playback; // 存放 AudioStreamGeneratorPlayback
private AudioStreamGeneratorPlayback _playback; // Will hold the AudioStreamGeneratorPlayback.
private float _sampleHz;
private float _pulseHz = 440.0f; // 音频波形的频率。
private float _pulseHz = 440.0f; // The frequency of the sound wave.
private double phase = 0.0;
public override void _Ready()
{
@@ -67,7 +68,6 @@ AudioStreamGenerator
public void FillBuffer()
{
double phase = 0.0;
float increment = _pulseHz / _sampleHz;
int framesAvailable = _playback.GetFramesAvailable();
@@ -80,11 +80,11 @@ AudioStreamGenerator
上面的例子中“AudioStreamPlayer”节点必须使用 **AudioStreamGenerator** 作为其流。\ ``fill_buffer`` 函数负责提供模拟正弦波的音频数据。
In the example above, the "AudioStreamPlayer" node must use an **AudioStreamGenerator** as its stream. The ``fill_buffer`` function provides audio data for approximating a sine wave.
要执行实时音频频谱分析,见 :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>`\ 。
See also :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>` for performing real-time audio spectrum analysis.
\ **注意:**\ 由于性能的限制,这个类最好在 C# 或者在利用 GDExtension 的编译语言中使用。如果你仍然想要在 GDScript 中使用这个类,请考虑使用 11,025 Hz 或 22,050 Hz 等较低的 :ref:`mix_rate<class_AudioStreamGenerator_property_mix_rate>`\ 。
\ **Note:** Due to performance constraints, this class is best used from C# or from a compiled language via GDExtension. If you still want to use this class from GDScript, consider using a lower :ref:`mix_rate<class_AudioStreamGenerator_property_mix_rate>` such as 11,025 Hz or 22,050 Hz.
.. rst-class:: classref-introduction-group

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamGeneratorPlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamGeneratorPlayback.xml.
.. _class_AudioStreamGeneratorPlayback:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamInteractive.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamInteractive.xml.
.. _class_AudioStreamInteractive:
@@ -19,9 +19,9 @@ AudioStreamInteractive
描述
----
这是一种能够以可交互的形式播放音乐的音频流,包含若干剪辑和一张过渡表。必须先添加剪辑,再使用 :ref:`add_transition<class_AudioStreamInteractive_method_add_transition>` 添加过渡规则。这种音频流还导出了一个用于控制 :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`\ 、\ :ref:`AudioStreamPlayer2D<class_AudioStreamPlayer2D>`\ 、\ :ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>` 播放的属性参数。
This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and then the transition rules via the :ref:`add_transition<class_AudioStreamInteractive_method_add_transition>`. Additionally, this stream exports a property parameter to control the playback via :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`, :ref:`AudioStreamPlayer2D<class_AudioStreamPlayer2D>`, or :ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>`.
用法是先填充一些剪辑,然后配置过渡表。音频流会根据过渡表选择要播放的剪辑,并根据表中定义的对应过渡规则平滑地将当前音乐过渡到新的剪辑。
The way this is used is by filling a number of clips, then configuring the transition table. From there, clips are selected for playback and the music will smoothly go from the current to the new one while using the corresponding transition rule defined in the transition table.
.. rst-class:: classref-reftable-group
@@ -471,7 +471,7 @@ enum **AutoAdvanceMode**: :ref:`🔗<enum_AudioStreamInteractive_AutoAdvanceMode
:ref:`bool<class_bool>` **has_transition**\ (\ from_clip\: :ref:`int<class_int>`, to_clip\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamInteractive_method_has_transition>`
如果存在给定的过渡则返回 true通过 :ref:`add_transition<class_AudioStreamInteractive_method_add_transition>` 添加)。
Returns ``true`` if a given transition exists (was added via :ref:`add_transition<class_AudioStreamInteractive_method_add_transition>`).
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamMicrophone.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamMicrophone.xml.
.. _class_AudioStreamMicrophone:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/minimp3/doc_classes/AudioStreamMP3.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/minimp3/doc_classes/AudioStreamMP3.xml.
.. _class_AudioStreamMP3:
@@ -19,7 +19,9 @@ MP3 音频流驱动程序。
描述
----
MP3 音频流驱动程序。如果要在运行时加载 MP3 文件,请参阅 :ref:`data<class_AudioStreamMP3_property_data>`\ 。
MP3 audio stream driver. See :ref:`data<class_AudioStreamMP3_property_data>` if you want to load an MP3 file at run-time.
\ **Note:** This class can optionally support legacy MP1 and MP2 formats, provided that the engine is compiled with the ``minimp3_extra_formats=yes`` SCons option. These extra formats are not enabled by default.
.. rst-class:: classref-reftable-group
@@ -43,6 +45,20 @@ MP3 音频流驱动程序。如果要在运行时加载 MP3 文件,请参阅 :
| :ref:`float<class_float>` | :ref:`loop_offset<class_AudioStreamMP3_property_loop_offset>` | ``0.0`` |
+-----------------------------------------------+---------------------------------------------------------------+-----------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+---------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamMP3<class_AudioStreamMP3>` | :ref:`load_from_buffer<class_AudioStreamMP3_method_load_from_buffer>`\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| |
+---------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamMP3<class_AudioStreamMP3>` | :ref:`load_from_file<class_AudioStreamMP3_method_load_from_file>`\ (\ path\: :ref:`String<class_String>`\ ) |static| |
+---------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
@@ -183,6 +199,35 @@ MP3 音频流驱动程序。如果要在运行时加载 MP3 文件,请参阅 :
循环时,流开始的时间,单位为秒。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_AudioStreamMP3_method_load_from_buffer:
.. rst-class:: classref-method
:ref:`AudioStreamMP3<class_AudioStreamMP3>` **load_from_buffer**\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| :ref:`🔗<class_AudioStreamMP3_method_load_from_buffer>`
Creates a new **AudioStreamMP3** instance from the given buffer. The buffer must contain MP3 data.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamMP3_method_load_from_file:
.. rst-class:: classref-method
:ref:`AudioStreamMP3<class_AudioStreamMP3>` **load_from_file**\ (\ path\: :ref:`String<class_String>`\ ) |static| :ref:`🔗<class_AudioStreamMP3_method_load_from_file>`
Creates a new **AudioStreamMP3** instance from the given file path. The file must be in MP3 format.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml.
.. _class_AudioStreamOggVorbis:
@@ -58,11 +58,11 @@ AudioStreamOggVorbis 类是专用于处理 Ogg Vorbis 文件格式的 :ref:`Audi
.. table::
:widths: auto
+---------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` | :ref:`load_from_buffer<class_AudioStreamOggVorbis_method_load_from_buffer>`\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| |
+---------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` | :ref:`load_from_buffer<class_AudioStreamOggVorbis_method_load_from_buffer>`\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| |
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` | :ref:`load_from_file<class_AudioStreamOggVorbis_method_load_from_file>`\ (\ path\: :ref:`String<class_String>`\ ) |static| |
+---------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
@@ -190,9 +190,9 @@ AudioStreamOggVorbis 类是专用于处理 Ogg Vorbis 文件格式的 :ref:`Audi
.. rst-class:: classref-method
:ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` **load_from_buffer**\ (\ buffer\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| :ref:`🔗<class_AudioStreamOggVorbis_method_load_from_buffer>`
:ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` **load_from_buffer**\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| :ref:`🔗<class_AudioStreamOggVorbis_method_load_from_buffer>`
从给定缓冲区创建一个新的 AudioStreamOggVorbis 实例。缓冲区必须包含 Ogg Vorbis 数据。
Creates a new **AudioStreamOggVorbis** instance from the given buffer. The buffer must contain Ogg Vorbis data.
.. rst-class:: classref-item-separator
@@ -204,7 +204,7 @@ AudioStreamOggVorbis 类是专用于处理 Ogg Vorbis 文件格式的 :ref:`Audi
:ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` **load_from_file**\ (\ path\: :ref:`String<class_String>`\ ) |static| :ref:`🔗<class_AudioStreamOggVorbis_method_load_from_file>`
从给定文件路径创建新的 AudioStreamOggVorbis 实例。文件必须采用 Ogg Vorbis 格式。
Creates a new **AudioStreamOggVorbis** instance from the given file path. The file must be in Ogg Vorbis format.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayback.xml.
.. _class_AudioStreamPlayback:
@@ -59,10 +59,24 @@ AudioStreamPlayback
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`_tag_used_streams<class_AudioStreamPlayback_private_method__tag_used_streams>`\ (\ ) |virtual| |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_loop_count<class_AudioStreamPlayback_method_get_loop_count>`\ (\ ) |const| |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayback_method_get_playback_position>`\ (\ ) |const| |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioSamplePlayback<class_AudioSamplePlayback>` | :ref:`get_sample_playback<class_AudioStreamPlayback_method_get_sample_playback>`\ (\ ) |const| |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_playing<class_AudioStreamPlayback_method_is_playing>`\ (\ ) |const| |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`mix_audio<class_AudioStreamPlayback_method_mix_audio>`\ (\ rate_scale\: :ref:`float<class_float>`, frames\: :ref:`int<class_int>`\ ) |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`seek<class_AudioStreamPlayback_method_seek>`\ (\ time\: :ref:`float<class_float>` = 0.0\ ) |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_sample_playback<class_AudioStreamPlayback_method_set_sample_playback>`\ (\ playback_sample\: :ref:`AudioSamplePlayback<class_AudioSamplePlayback>`\ ) |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`start<class_AudioStreamPlayback_method_start>`\ (\ from_pos\: :ref:`float<class_float>` = 0.0\ ) |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`stop<class_AudioStreamPlayback_method_stop>`\ (\ ) |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
@@ -195,6 +209,30 @@ AudioStreamPlayback
----
.. _class_AudioStreamPlayback_method_get_loop_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_loop_count**\ (\ ) |const| :ref:`🔗<class_AudioStreamPlayback_method_get_loop_count>`
Returns the number of times the stream has looped.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_get_playback_position:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_playback_position**\ (\ ) |const| :ref:`🔗<class_AudioStreamPlayback_method_get_playback_position>`
Returns the current position in the stream, in seconds.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_get_sample_playback:
.. rst-class:: classref-method
@@ -209,6 +247,46 @@ AudioStreamPlayback
----
.. _class_AudioStreamPlayback_method_is_playing:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AudioStreamPlayback_method_is_playing>`
Returns ``true`` if the stream is playing.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_mix_audio:
.. rst-class:: classref-method
:ref:`PackedVector2Array<class_PackedVector2Array>` **mix_audio**\ (\ rate_scale\: :ref:`float<class_float>`, frames\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioStreamPlayback_method_mix_audio>`
Mixes up to ``frames`` of audio from the stream from the current position, at a rate of ``rate_scale``, advancing the stream.
Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` where each element holds the left and right channel volume levels of each frame.
\ **Note:** Can return fewer frames than requested, make sure to use the size of the return value.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_seek:
.. rst-class:: classref-method
|void| **seek**\ (\ time\: :ref:`float<class_float>` = 0.0\ ) :ref:`🔗<class_AudioStreamPlayback_method_seek>`
Seeks the stream at the given ``time``, in seconds.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_set_sample_playback:
.. rst-class:: classref-method
@@ -219,6 +297,30 @@ AudioStreamPlayback
:ref:`AudioSamplePlayback<class_AudioSamplePlayback>` 与该 **AudioStreamPlayback** 关联以播放该流的音频样本。
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_start:
.. rst-class:: classref-method
|void| **start**\ (\ from_pos\: :ref:`float<class_float>` = 0.0\ ) :ref:`🔗<class_AudioStreamPlayback_method_start>`
Starts the stream from the given ``from_pos``, in seconds.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayback_method_stop:
.. rst-class:: classref-method
|void| **stop**\ (\ ) :ref:`🔗<class_AudioStreamPlayback_method_stop>`
Stops the stream.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackInteractive.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackInteractive.xml.
.. _class_AudioStreamPlaybackInteractive:
@@ -29,11 +29,13 @@ AudioStreamPlaybackInteractive
.. table::
:widths: auto
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_current_clip_index<class_AudioStreamPlaybackInteractive_method_get_current_clip_index>`\ (\ ) |const| |
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`switch_to_clip<class_AudioStreamPlaybackInteractive_method_switch_to_clip>`\ (\ clip_index\: :ref:`int<class_int>`\ ) |
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`switch_to_clip_by_name<class_AudioStreamPlaybackInteractive_method_switch_to_clip_by_name>`\ (\ clip_name\: :ref:`StringName<class_StringName>`\ ) |
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
@@ -44,6 +46,29 @@ AudioStreamPlaybackInteractive
方法说明
--------
.. _class_AudioStreamPlaybackInteractive_method_get_current_clip_index:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_current_clip_index**\ (\ ) |const| :ref:`🔗<class_AudioStreamPlaybackInteractive_method_get_current_clip_index>`
Return the index of the currently playing clip. You can use this to get the name of the currently playing clip with :ref:`AudioStreamInteractive.get_clip_name<class_AudioStreamInteractive_method_get_clip_name>`.
\ **Example:** Get the currently playing clip name from inside an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` node.
.. tabs::
.. code-tab:: gdscript
var playing_clip_name = stream.get_clip_name(get_stream_playback().get_current_clip_index())
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlaybackInteractive_method_switch_to_clip:
.. rst-class:: classref-method

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml.
.. _class_AudioStreamPlaybackOggVorbis:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackPlaylist.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackPlaylist.xml.
.. _class_AudioStreamPlaybackPlaylist:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlaybackPolyphonic.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlaybackPolyphonic.xml.
.. _class_AudioStreamPlaybackPolyphonic:
@@ -73,7 +73,7 @@ AudioStreamPlaybackPolyphonic
:ref:`bool<class_bool>` **is_stream_playing**\ (\ stream\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamPlaybackPolyphonic_method_is_stream_playing>`
与整数 ID 关联的流仍在播放时返回 true。请检查 :ref:`play_stream<class_AudioStreamPlaybackPolyphonic_method_play_stream>` 以获取有关此 ID 何时失效的信息。
Returns ``true`` if the stream associated with the given integer ID is still playing. Check :ref:`play_stream<class_AudioStreamPlaybackPolyphonic_method_play_stream>` for information on when this ID becomes invalid.
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlaybackResampled.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlaybackResampled.xml.
.. _class_AudioStreamPlaybackResampled:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackSynchronized.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackSynchronized.xml.
.. _class_AudioStreamPlaybackSynchronized:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer.xml.
.. _class_AudioStreamPlayer:
@@ -74,6 +74,8 @@ AudioStreamPlayer
+----------------------------------------------------+----------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer_property_volume_db>` | ``0.0`` |
+----------------------------------------------------+----------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_linear<class_AudioStreamPlayer_property_volume_linear>` | |
+----------------------------------------------------+----------------------------------------------------------------------+---------------+
.. rst-class:: classref-reftable-group
@@ -276,6 +278,7 @@ enum **MixTarget**: :ref:`🔗<enum_AudioStreamPlayer_MixTarget>`
.. rst-class:: classref-property-setget
- |void| **set_playing**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_playing**\ (\ )
如果为 ``true``\ ,则该节点正在播放声音。设置该属性与 :ref:`play<class_AudioStreamPlayer_method_play>` 和 :ref:`stop<class_AudioStreamPlayer_method_stop>` 等效。
@@ -331,9 +334,28 @@ enum **MixTarget**: :ref:`🔗<enum_AudioStreamPlayer_MixTarget>`
- |void| **set_volume_db**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_db**\ (\ )
声音的音量,单位为分贝。这是对 :ref:`stream<class_AudioStreamPlayer_property_stream>` 音量的偏移。
Volume of sound, in decibels. This is an offset of the :ref:`stream<class_AudioStreamPlayer_property_stream>`'s volume.
\ **注意:**\ 如需在分贝和线性能量间进行转换(常见于音量滑块),请使用 :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>`\ 。
\ **Note:** To convert between decibel and linear energy (like most volume sliders do), use :ref:`volume_linear<class_AudioStreamPlayer_property_volume_linear>`, or :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` and :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>`.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayer_property_volume_linear:
.. rst-class:: classref-property
:ref:`float<class_float>` **volume_linear** :ref:`🔗<class_AudioStreamPlayer_property_volume_linear>`
.. rst-class:: classref-property-setget
- |void| **set_volume_linear**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_linear**\ (\ )
Volume of sound, as a linear value.
\ **Note:** This member modifies :ref:`volume_db<class_AudioStreamPlayer_property_volume_db>` for convenience. The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` on :ref:`volume_db<class_AudioStreamPlayer_property_volume_db>`. Setting this member is equivalent to setting :ref:`volume_db<class_AudioStreamPlayer_property_volume_db>` to the result of :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>` on a value.
.. rst-class:: classref-section-separator
@@ -350,9 +372,11 @@ enum **MixTarget**: :ref:`🔗<enum_AudioStreamPlayer_MixTarget>`
:ref:`float<class_float>` **get_playback_position**\ (\ ) :ref:`🔗<class_AudioStreamPlayer_method_get_playback_position>`
以秒为单位返回最后播放的声音在 :ref:`AudioStream<class_AudioStream>` 中的位置。如果没有正在播放的声音,将返回 ``0.0``\ 。
Returns the position in the :ref:`AudioStream<class_AudioStream>` of the latest sound, in seconds. Returns ``0.0`` if no sounds are playing.
\ **注意:**\ 返回的位置不一定精准,因为 :ref:`AudioServer<class_AudioServer>` 不会在每个处理的帧中混合音频。要想得到更多准确的结果,请将 :ref:`AudioServer.get_time_since_last_mix<class_AudioServer_method_get_time_since_last_mix>` 添加到返回的位置。
\ **Note:** The position is not always accurate, as the :ref:`AudioServer<class_AudioServer>` does not mix audio every processed frame. To get more accurate results, add :ref:`AudioServer.get_time_since_last_mix<class_AudioServer_method_get_time_since_last_mix>` to the returned position.
\ **Note:** This method always returns ``0.0`` if the :ref:`stream<class_AudioStreamPlayer_property_stream>` is an :ref:`AudioStreamInteractive<class_AudioStreamInteractive>`, since it can have multiple clips playing at once.
.. rst-class:: classref-item-separator

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer2D.xml.
.. _class_AudioStreamPlayer2D:
@@ -72,6 +72,8 @@ AudioStreamPlayer2D
+----------------------------------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>` | ``0.0`` |
+----------------------------------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_linear<class_AudioStreamPlayer2D_property_volume_linear>` | |
+----------------------------------------------------+------------------------------------------------------------------------------+---------------+
.. rst-class:: classref-reftable-group
@@ -286,6 +288,7 @@ AudioStreamPlayer2D
.. rst-class:: classref-property-setget
- |void| **set_playing**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_playing**\ (\ )
如果为 ``true``\ ,则音频正在播放,或者已加入播放队列(见 :ref:`play<class_AudioStreamPlayer2D_method_play>`\ )。
@@ -339,7 +342,26 @@ AudioStreamPlayer2D
- |void| **set_volume_db**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_db**\ (\ )
衰减前的基础音量。
Base volume before attenuation, in decibels.
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayer2D_property_volume_linear:
.. rst-class:: classref-property
:ref:`float<class_float>` **volume_linear** :ref:`🔗<class_AudioStreamPlayer2D_property_volume_linear>`
.. rst-class:: classref-property-setget
- |void| **set_volume_linear**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_linear**\ (\ )
Base volume before attenuation, as a linear value.
\ **Note:** This member modifies :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>` for convenience. The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` on :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>`. Setting this member is equivalent to setting :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>` to the result of :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>` on a value.
.. rst-class:: classref-section-separator

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer3D.xml.
.. _class_AudioStreamPlayer3D:
@@ -88,6 +88,8 @@ AudioStreamPlayer3D
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` | ``0.0`` |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`volume_linear<class_AudioStreamPlayer3D_property_volume_linear>` | |
+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
.. rst-class:: classref-reftable-group
@@ -502,6 +504,7 @@ enum **DopplerTracking**: :ref:`🔗<enum_AudioStreamPlayer3D_DopplerTracking>`
.. rst-class:: classref-property-setget
- |void| **set_playing**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_playing**\ (\ )
如果为 ``true``\ ,则音频正在播放,或者已加入播放队列(见 :ref:`play<class_AudioStreamPlayer3D_method_play>`\ )。
@@ -574,6 +577,25 @@ enum **DopplerTracking**: :ref:`🔗<enum_AudioStreamPlayer3D_DopplerTracking>`
不受衰减影响的基础声级,单位为分贝。
.. rst-class:: classref-item-separator
----
.. _class_AudioStreamPlayer3D_property_volume_linear:
.. rst-class:: classref-property
:ref:`float<class_float>` **volume_linear** :ref:`🔗<class_AudioStreamPlayer3D_property_volume_linear>`
.. rst-class:: classref-property-setget
- |void| **set_volume_linear**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_volume_linear**\ (\ )
The base sound level before attenuation, as a linear value.
\ **Note:** This member modifies :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` for convenience. The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear<class_@GlobalScope_method_db_to_linear>` on :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>`. Setting this member is equivalent to setting :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` to the result of :ref:`@GlobalScope.linear_to_db<class_@GlobalScope_method_linear_to_db>` on a value.
.. rst-class:: classref-section-separator
----

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaylist.xml.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaylist.xml.
.. _class_AudioStreamPlaylist:

Some files were not shown because too many files have changed in this diff Show More