mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
377 lines
22 KiB
ReStructuredText
377 lines
22 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_EngineDebugger:
|
|
|
|
EngineDebugger
|
|
==============
|
|
|
|
**继承:** :ref:`Object<class_Object>`
|
|
|
|
暴露内部调试器。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
描述
|
|
----
|
|
|
|
**EngineDebugger** 处理编辑器与正在运行的游戏之间的通信。它会在运行游戏时激活,可以通过它收发消息,还负责管理性能分析器。
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
方法
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_breakpoints<class_EngineDebugger_method_clear_breakpoints>`\ (\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`debug<class_EngineDebugger_method_debug>`\ (\ can_continue\: :ref:`bool<class_bool>` = true, is_error_breakpoint\: :ref:`bool<class_bool>` = false\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_depth<class_EngineDebugger_method_get_depth>`\ (\ ) |const| |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_lines_left<class_EngineDebugger_method_get_lines_left>`\ (\ ) |const| |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_capture<class_EngineDebugger_method_has_capture>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_profiler<class_EngineDebugger_method_has_profiler>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`insert_breakpoint<class_EngineDebugger_method_insert_breakpoint>`\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_active<class_EngineDebugger_method_is_active>`\ (\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_breakpoint<class_EngineDebugger_method_is_breakpoint>`\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_profiling<class_EngineDebugger_method_is_profiling>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_skipping_breakpoints<class_EngineDebugger_method_is_skipping_breakpoints>`\ (\ ) |const| |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`line_poll<class_EngineDebugger_method_line_poll>`\ (\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`profiler_add_frame_data<class_EngineDebugger_method_profiler_add_frame_data>`\ (\ name\: :ref:`StringName<class_StringName>`, data\: :ref:`Array<class_Array>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`profiler_enable<class_EngineDebugger_method_profiler_enable>`\ (\ name\: :ref:`StringName<class_StringName>`, enable\: :ref:`bool<class_bool>`, arguments\: :ref:`Array<class_Array>` = []\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`register_message_capture<class_EngineDebugger_method_register_message_capture>`\ (\ name\: :ref:`StringName<class_StringName>`, callable\: :ref:`Callable<class_Callable>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`register_profiler<class_EngineDebugger_method_register_profiler>`\ (\ name\: :ref:`StringName<class_StringName>`, profiler\: :ref:`EngineProfiler<class_EngineProfiler>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`remove_breakpoint<class_EngineDebugger_method_remove_breakpoint>`\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`script_debug<class_EngineDebugger_method_script_debug>`\ (\ language\: :ref:`ScriptLanguage<class_ScriptLanguage>`, can_continue\: :ref:`bool<class_bool>` = true, is_error_breakpoint\: :ref:`bool<class_bool>` = false\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`send_message<class_EngineDebugger_method_send_message>`\ (\ message\: :ref:`String<class_String>`, data\: :ref:`Array<class_Array>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_depth<class_EngineDebugger_method_set_depth>`\ (\ depth\: :ref:`int<class_int>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_lines_left<class_EngineDebugger_method_set_lines_left>`\ (\ lines\: :ref:`int<class_int>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`unregister_message_capture<class_EngineDebugger_method_unregister_message_capture>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`unregister_profiler<class_EngineDebugger_method_unregister_profiler>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
方法说明
|
|
--------
|
|
|
|
.. _class_EngineDebugger_method_clear_breakpoints:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_breakpoints**\ (\ ) :ref:`🔗<class_EngineDebugger_method_clear_breakpoints>`
|
|
|
|
清除所有断点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_debug:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **debug**\ (\ can_continue\: :ref:`bool<class_bool>` = true, is_error_breakpoint\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_EngineDebugger_method_debug>`
|
|
|
|
在运行脚本时触发调试中断,可以使用 ``can_continue`` 指定程序是否能够继续运行,还可以指定该中断是否是由断点导致的。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_get_depth:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_depth**\ (\ ) |const| :ref:`🔗<class_EngineDebugger_method_get_depth>`
|
|
|
|
**实验性:** 未来版本中可能会修改或移除该方法。
|
|
|
|
返回当前调试深度。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_get_lines_left:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_lines_left**\ (\ ) |const| :ref:`🔗<class_EngineDebugger_method_get_lines_left>`
|
|
|
|
**实验性:** 未来版本中可能会修改或移除该方法。
|
|
|
|
返回剩余的行数。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_has_capture:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_capture**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_has_capture>`
|
|
|
|
如果存在具有给定名称的捕获,则返回 ``true``\ ,否则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_has_profiler:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_profiler**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_has_profiler>`
|
|
|
|
如果存在具有给定名称的分析器,则返回 ``true``\ ,否则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_insert_breakpoint:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **insert_breakpoint**\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_insert_breakpoint>`
|
|
|
|
使用给定的 ``source`` 和 ``line`` 插入一个新断点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_is_active:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_active**\ (\ ) :ref:`🔗<class_EngineDebugger_method_is_active>`
|
|
|
|
如果调试器处于活动状态,则返回 ``true``\ ,否则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_is_breakpoint:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_breakpoint**\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_EngineDebugger_method_is_breakpoint>`
|
|
|
|
如果给定的 ``source`` 和 ``line`` 代表一个已存在的断点,则返回 ``true``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_is_profiling:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_profiling**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_is_profiling>`
|
|
|
|
如果存在具有给定名称的分析器,并且该分析器处于活动状态,则返回 ``true``\ ,否则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_is_skipping_breakpoints:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_skipping_breakpoints**\ (\ ) |const| :ref:`🔗<class_EngineDebugger_method_is_skipping_breakpoints>`
|
|
|
|
如果调试器跳过断点,则返回 ``true``\ ,否则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_line_poll:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **line_poll**\ (\ ) :ref:`🔗<class_EngineDebugger_method_line_poll>`
|
|
|
|
强制调试器事件的一个处理循环。该方法的目的是当脚本可能过于繁忙时不时地处理事件,以便可以捕获无限循环之类的错误。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_profiler_add_frame_data:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **profiler_add_frame_data**\ (\ name\: :ref:`StringName<class_StringName>`, data\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_EngineDebugger_method_profiler_add_frame_data>`
|
|
|
|
使用给定的 ``name`` 和 ``data`` 调用分析器中的 ``add`` 可调用体。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_profiler_enable:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **profiler_enable**\ (\ name\: :ref:`StringName<class_StringName>`, enable\: :ref:`bool<class_bool>`, arguments\: :ref:`Array<class_Array>` = []\ ) :ref:`🔗<class_EngineDebugger_method_profiler_enable>`
|
|
|
|
使用给定的 ``name`` 和 ``arguments`` 调用分析器中的 ``toggle`` 可调用体。会根据 ``enable`` 参数启用/禁用同一分析器。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_register_message_capture:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **register_message_capture**\ (\ name\: :ref:`StringName<class_StringName>`, callable\: :ref:`Callable<class_Callable>`\ ) :ref:`🔗<class_EngineDebugger_method_register_message_capture>`
|
|
|
|
使用名称 ``name`` 注册消息捕获。如果 ``name`` 为“my_message”则会为“my_message:”开头的消息调用给定的可调用体。
|
|
|
|
可调用体必须接受消息字符串和数据数组参数。如果能够识别该消息,则可调用体应返回 ``true``\ 。
|
|
|
|
\ **注意:**\ 可调用体收到的消息已剥离前缀,这一点与 :ref:`EditorDebuggerPlugin._capture()<class_EditorDebuggerPlugin_private_method__capture>` 不同。示例见 :ref:`EditorDebuggerPlugin<class_EditorDebuggerPlugin>` 的描述。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_register_profiler:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **register_profiler**\ (\ name\: :ref:`StringName<class_StringName>`, profiler\: :ref:`EngineProfiler<class_EngineProfiler>`\ ) :ref:`🔗<class_EngineDebugger_method_register_profiler>`
|
|
|
|
使用给定的名称 ``name`` 注册分析器。详见 :ref:`EngineProfiler<class_EngineProfiler>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_remove_breakpoint:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **remove_breakpoint**\ (\ line\: :ref:`int<class_int>`, source\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_remove_breakpoint>`
|
|
|
|
使用给定的 ``source`` 和 ``line`` 移除一个断点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_script_debug:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **script_debug**\ (\ language\: :ref:`ScriptLanguage<class_ScriptLanguage>`, can_continue\: :ref:`bool<class_bool>` = true, is_error_breakpoint\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_EngineDebugger_method_script_debug>`
|
|
|
|
在运行脚本时触发调试中断,可以使用 ``can_continue`` 指定程序是否能够继续运行,还可以指定该中断是否是由断点导致的。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_send_message:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **send_message**\ (\ message\: :ref:`String<class_String>`, data\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_EngineDebugger_method_send_message>`
|
|
|
|
发送消息,内容为给定的 ``message`` 和 ``data`` 数组。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_set_depth:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_depth**\ (\ depth\: :ref:`int<class_int>`\ ) :ref:`🔗<class_EngineDebugger_method_set_depth>`
|
|
|
|
**实验性:** 未来版本中可能会修改或移除该方法。
|
|
|
|
设置当前调试深度。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_set_lines_left:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_lines_left**\ (\ lines\: :ref:`int<class_int>`\ ) :ref:`🔗<class_EngineDebugger_method_set_lines_left>`
|
|
|
|
**实验性:** 未来版本中可能会修改或移除该方法。
|
|
|
|
设置当前剩余的调试行。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_unregister_message_capture:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **unregister_message_capture**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_unregister_message_capture>`
|
|
|
|
将具有给定名称 ``name`` 的消息捕获解除注册。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EngineDebugger_method_unregister_profiler:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **unregister_profiler**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EngineDebugger_method_unregister_profiler>`
|
|
|
|
将具有给定名称 ``name`` 的分析器解除注册。
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |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 (无返回值。)`
|