ScriptEditor

继承: PanelContainer < Container < Control < CanvasItem < Item < Object

i3D编辑器的脚本编辑器。

描述

i3D编辑器的脚本编辑器。

注意:这个类不应该直接实例化。相反,使用EditorInterface.get_script_editor()访问单例。

方法


信号

editor_script_changed(script: Script) 🔗

当用户更改活动脚本时发出。参数是新激活的Script


script_close(script: Script) 🔗

当编辑器即将关闭活动脚本时发出。参数是一个要关闭的Script


方法说明

PackedStringArray get_breakpoints() 🔗

返回断点数组。


ScriptEditorBase get_current_editor() const 🔗

返回用户当前正在编辑的ScriptEditorBase对象。


Script get_current_script() 🔗

返回当前在编辑器中处于活动状态的Script


Array[ScriptEditorBase] get_open_script_editors() const 🔗

返回一个数组,其中包含当前在编辑器中打开的所有ScriptEditorBase对象。


Array[Script] get_open_scripts() const 🔗

返回一个数组,其中包含当前在编辑器中打开的所有Script对象。


void goto_help(topic: String) 🔗

打开给定主题的帮助。topic 是一个编码字符串,用于控制应聚焦于哪个类、方法、常量、信号、注解、属性或主题项。

支持的 topic 格式包括 class_name:classclass_method:class:methodclass_constant:class:constantclass_signal:class:signalclass_annotation:class:@annotationclass_property:class:propertyclass_theme_item:class:item,其中 class 是类名,method 是方法名,constant 是常量名,signal 是信号名,annotation 是注解名,property 是属性名,item 是主题项。.

# 显示 Item 类的帮助信息.
class_name:Item
# 显示全局 min 函数的帮助信息.
# 全局对象可在 `@GlobalScope` 命名空间中访问,此处已展示.
class_method:@GlobalScope:min
# 显示 Item 类中 get_viewport 方法的帮助信息.
class_method:Item:get_viewport
# 显示 Input 类中 MOUSE_BUTTON_MIDDLE(鼠标中键)常量的帮助信息.
class_constant:Input:MOUSE_BUTTON_MIDDLE
# 显示 BaseButton 类中 pressed(按下)信号的帮助信息.
class_signal:BaseButton:pressed
# 显示 CanvasItem 类中 visible(可见性)属性的帮助信息.
class_property:CanvasItem:visible
# 显示 S3Script 中 export(导出)注解的帮助信息.
# 注解在描述符中应添加 `@` 符号作为前缀,此处已展示.
class_annotation:@S3Script:@export
# 显示 GraphNode 类中名为 panel_selected(选中面板)的主题项的帮助信息.
class_theme_item:GraphNode:panel_selected

void goto_line(line_number: int) 🔗

转到当前脚本中的指定行。


void open_script_create_dialog(base_name: String, base_path: String) 🔗

打开脚本创建对话框。脚本将扩展base_name。文件扩展名可以从base_path中省略。它将根据所选脚本语言添加。


void register_syntax_highlighter(syntax_highlighter: EditorSyntaxHighlighter) 🔗

EditorSyntaxHighlighter注册到编辑器,EditorSyntaxHighlighter将在所有打开的脚本上可用。

注意:不适用于已经打开的脚本。


void unregister_syntax_highlighter(syntax_highlighter: EditorSyntaxHighlighter) 🔗

从编辑器中注销EditorSyntaxHighlighter

注意:EditorSyntaxHighlighter仍将应用于已打开的脚本。


void update_docs_from_script(script: Script) 🔗

如果脚本的文档当前打开,则更新给定script的文档。

注意:每当更改脚本以使打开的文档状态保持最新时,都应该调用它。