Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
ScriptEditor¶
继承: PanelContainer < Container < Control < CanvasItem < Node < Object
Godot 编辑器的脚本编辑器。
描述¶
Godot 编辑器的脚本编辑器。
注意:这个类不应该被直接实例化。请使用 EditorInterface.get_script_editor 来访问这个单例。
方法¶
get_current_editor ( ) const |
|
get_open_script_editors ( ) const |
|
get_open_scripts ( ) const |
|
void |
|
void |
open_script_create_dialog ( String base_name, String base_path ) |
void |
register_syntax_highlighter ( EditorSyntaxHighlighter syntax_highlighter ) |
void |
unregister_syntax_highlighter ( EditorSyntaxHighlighter syntax_highlighter ) |
信号¶
editor_script_changed ( Script script )
当用户更改活动脚本时发出。参数是新激活的 Script。
script_close ( Script script )
当编辑器即将关闭活动脚本时发出。参数是将要关闭的 Script。
方法说明¶
ScriptEditorBase get_current_editor ( ) const
返回用户当前正在编辑的 ScriptEditorBase 对象。
Script get_current_script ( )
返回当前在编辑器中处于活动状态的 Script。
ScriptEditorBase[] get_open_script_editors ( ) const
返回一个数组,其中包含当前在编辑器中打开的所有 ScriptEditorBase 对象。
Script[] get_open_scripts ( ) const
返回一个包含当前在编辑器中打开的所有 Script 对象的数组。
void goto_line ( int line_number )
转到当前脚本中的指定行。
void open_script_create_dialog ( String base_name, String base_path )
打开创建脚本对话框。脚本将扩展 base_name
。文件扩展名可以从 base_path
中省略,会根据所选择的脚本语言添加。
void register_syntax_highlighter ( EditorSyntaxHighlighter syntax_highlighter )
向编辑器注册该 EditorSyntaxHighlighter,打开的所有脚本都可以使用这个 EditorSyntaxHighlighter。
注意:不适用于已经打开的脚本。
void unregister_syntax_highlighter ( EditorSyntaxHighlighter syntax_highlighter )
从编辑器注销该 EditorSyntaxHighlighter。
注意:已经打开的脚本仍然适用该 EditorSyntaxHighlighter。