EditorPlugin
由编辑器使用,用于扩展其功能。
描述
编辑器使用插件来扩展功能。最常见的插件类型是编辑给定的节点或资源类型的插件、导入插件和导出插件。另见 EditorScript,能够向编辑器添加功能。
注意:这个类中的部分名称中包含“left”和“right”(例如 DOCK_SLOT_LEFT_UL)。这些 API 假设的是从左至右的布局,使用从右至左布局时是反的。保留这些名称是出于兼容的原因。
教程
方法
信号
main_screen_changed(screen_name: String) 🔗
当用户改变工作空间(2D、3D、脚本、游戏、资产库)时发出。也适用于由插件定义的自定义屏幕。
project_settings_changed() 🔗
已弃用: Use ProjectSettings.settings_changed instead.
当任意项目设置发生改变时触发。
resource_saved(resource: Resource) 🔗
给定的资源 resource 保存到磁盘时发出。另见 scene_saved。
scene_changed(scene_root: Node) 🔗
在编辑器中更改场景时发出。该参数将返回刚刚变为活动状态的场景的根节点。如果此场景是新场景且为空,则参数将为 null。
scene_closed(filepath: String) 🔗
当用户关闭场景时发出。参数是被关闭的场景的文件路径。
scene_saved(filepath: String) 🔗
当场景被保存在磁盘上时发出。参数是被保存的场景的文件路径。另见 resource_saved。
枚举
enum CustomControlContainer: 🔗
CustomControlContainer CONTAINER_TOOLBAR = 0
主编辑器的工具栏,旁边是运行按钮。
3D 编辑器处于活动状态时出现的工具栏。
CustomControlContainer CONTAINER_SPATIAL_EDITOR_SIDE_LEFT = 2
3D 编辑器的左侧边栏。
CustomControlContainer CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT = 3
3D 编辑器的右侧边栏。
CustomControlContainer CONTAINER_SPATIAL_EDITOR_BOTTOM = 4
3D 编辑器的底部面板。
2D 编辑器处于活动状态时出现的工具条。
CustomControlContainer CONTAINER_CANVAS_EDITOR_SIDE_LEFT = 6
2D 编辑器的左侧边栏。
CustomControlContainer CONTAINER_CANVAS_EDITOR_SIDE_RIGHT = 7
2D 编辑器的右侧边栏。
CustomControlContainer CONTAINER_CANVAS_EDITOR_BOTTOM = 8
2D 编辑器的底部面板。
CustomControlContainer CONTAINER_INSPECTOR_BOTTOM = 9
检查器的底部。
CustomControlContainer CONTAINER_PROJECT_SETTING_TAB_LEFT = 10
项目设置对话框中的选项卡,在其他选项卡的左侧。
CustomControlContainer CONTAINER_PROJECT_SETTING_TAB_RIGHT = 11
项目设置对话框中的选项卡,在其他选项卡的右侧。
enum DockSlot: 🔗
DockSlot DOCK_SLOT_NONE = -1
The dock is closed.
DockSlot DOCK_SLOT_LEFT_UL = 0
左侧停靠槽的左上(默认布局中为空)。
DockSlot DOCK_SLOT_LEFT_BL = 1
左侧停靠槽的左下(默认布局中为空)。
DockSlot DOCK_SLOT_LEFT_UR = 2
左侧停靠槽的右上(默认布局中为“场景”和“导入”面板)。
DockSlot DOCK_SLOT_LEFT_BR = 3
左侧停靠槽的右下(默认布局中为“文件系统”面板)。
DockSlot DOCK_SLOT_RIGHT_UL = 4
右侧停靠槽的左上(默认布局中为“检查器”“节点”以及“历史”面板)。
DockSlot DOCK_SLOT_RIGHT_BL = 5
右侧停靠槽的左下(默认布局中为空)。
DockSlot DOCK_SLOT_RIGHT_UR = 6
右侧停靠槽的右上(默认布局中为空)。
DockSlot DOCK_SLOT_RIGHT_BR = 7
右侧停靠槽的右下(默认布局中为空)。
DockSlot DOCK_SLOT_BOTTOM = 8
Bottom panel.
DockSlot DOCK_SLOT_MAX = 9
代表 DockSlot 枚举的大小。
enum AfterGUIInput: 🔗
AfterGUIInput AFTER_GUI_INPUT_PASS = 0
将该 InputEvent 转发给其他 EditorPlugin。
AfterGUIInput AFTER_GUI_INPUT_STOP = 1
阻止该 InputEvent 到达其他 Editor 类。
AfterGUIInput AFTER_GUI_INPUT_CUSTOM = 2
将该 InputEvent 传递给除主 Node3D 插件之外的其他编辑器插件。这可用于防止节点选择更改并且改为使用子小工具。
方法说明
void _apply_changes() virtual 🔗
当编辑器将要进行保存项目、切换选项卡等操作时,将调用该方法。它要求插件应用所有暂挂的状态更改以确保一致性。
例如,在着色器编辑器中使用它来使插件将用户编写的着色代码应用于对象。
该方法在编辑器即将运行项目时被调用。这样,插件可以在项目运行之前,执行所需的操作。
该方法必须返回一个布尔值。如果该方法返回 false,则项目将不会运行。运行会立即中止,因此这也会阻止运行所有其他插件的 _build() 方法。
void _clear() virtual 🔗
清除所有状态,并将正在编辑的对象重置为零。这可确保你的插件不会继续编辑当前存在的节点或来自错误场景的节点。
void _disable_plugin() virtual 🔗
当用户在项目设置窗口的插件选项卡中禁用 EditorPlugin 时,由引擎调用。
void _edit(object: Object) virtual 🔗
该函数用于编辑特定对象类型(节点或资源)的插件。它请求编辑器编辑给定的对象。
如果该插件刚刚正在编辑一个对象,且它不想再处理任何选定的对象,则 object 可以为 null。这可用于清理编辑状态。
void _enable_plugin() virtual 🔗
当用户在项目设置窗口的插件选项卡中启用该 EditorPlugin 时,由引擎调用。
void _forward_3d_draw_over_viewport(viewport_control: Control) virtual 🔗
当 3D 编辑器的视口更新时由引擎调用。viewport_control 覆盖在视口上方,可以用于绘制。可以通过调用 update_overlays() 手动更新该视口。
func _forward_3d_draw_over_viewport(overlay):
# 在光标位置画一个圆。
overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.WHITE)
func _forward_3d_gui_input(camera, event):
if event is InputEventMouseMotion:
# 当光标被移动时,重绘视口。
update_overlays()
return EditorPlugin.AFTER_GUI_INPUT_STOP
return EditorPlugin.AFTER_GUI_INPUT_PASS
public override void _Forward3DDrawOverViewport(Control viewportControl)
{
// 在光标位置画一个圆。
viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
// 当光标被移动时,重绘视口。
UpdateOverlays();
return EditorPlugin.AfterGuiInput.Stop;
}
return EditorPlugin.AfterGuiInput.Pass;
}
void _forward_3d_force_draw_over_viewport(viewport_control: Control) virtual 🔗
该方法与 _forward_3d_draw_over_viewport() 相同,只是它绘制在所有内容之上。当需要一个显示在其他任何内容之上的额外图层时很有用。
需要使用 set_force_draw_over_forwarding_enabled() 来启用该方法的调用。
int _forward_3d_gui_input(viewport_camera: Camera3D, event: InputEvent) virtual 🔗
在当前编辑的场景中有根节点时调用,实现 _handles() 并在 3D 视口中产生 InputEvent。返回值决定 InputEvent 是被消费还是被转发给其他 EditorPlugin。有关选项,请参阅 AfterGUIInput。
# 阻止 InputEvent 到达其他编辑类。
func _forward_3d_gui_input(camera, event):
return EditorPlugin.AFTER_GUI_INPUT_STOP
// 阻止 InputEvent 到达其他编辑类。
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
return EditorPlugin.AfterGuiInput.Stop;
}
该方法返回 AFTER_GUI_INPUT_PASS 才能将 InputEvent 转发给其他编辑器类。
# 消耗 InputEventMouseMotion 并转发其他 InputEvent 类型。
func _forward_3d_gui_input(camera, event):
return EditorPlugin.AFTER_GUI_INPUT_STOP if event is InputEventMouseMotion else EditorPlugin.AFTER_GUI_INPUT_PASS
// 消耗 InputEventMouseMotion 并转发其他 InputEvent 类型。
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
return @event is InputEventMouseMotion ? EditorPlugin.AfterGuiInput.Stop : EditorPlugin.AfterGuiInput.Pass;
}
void _forward_canvas_draw_over_viewport(viewport_control: Control) virtual 🔗
当 2D 编辑器的视口更新时由引擎调用。viewport_control 覆盖在视口上方,可以用于绘制。可以通过调用 update_overlays() 手动更新该视口。
func _forward_canvas_draw_over_viewport(overlay):
# 在光标位置画一个圆。
overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.WHITE)
func _forward_canvas_gui_input(event):
if event is InputEventMouseMotion:
# 当光标被移动时,重绘视口。
update_overlays()
return true
return false
public override void _ForwardCanvasDrawOverViewport(Control viewportControl)
{
// 在光标位置画一个圆。
viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
// 当光标被移动时,重绘视口。
UpdateOverlays();
return true;
}
return false;
}
void _forward_canvas_force_draw_over_viewport(viewport_control: Control) virtual 🔗
该方法与 _forward_canvas_draw_over_viewport() 相同,只是它绘制在所有内容之上。当需要一个显示在其他任何内容之上的额外图层时很有用。
需要使用 set_force_draw_over_forwarding_enabled() 来启用该方法的调用。
bool _forward_canvas_gui_input(event: InputEvent) virtual 🔗
在当前编辑的场景中有根节点时调用,实现 _handles() 并在 2D 视口中产生 InputEvent。如果该方法返回 true,则 EditorPlugin 会拦截 event,否则 event 会转发给其他编辑器类。
# 阻止 InputEvent 到达其他编辑类。
func _forward_canvas_gui_input(event):
return true
// 阻止 InputEvent 到达其他编辑类。
public override bool ForwardCanvasGuiInput(InputEvent @event)
{
return true;
}
该方法返回 false 才能将 InputEvent 转发到其他编辑器类。
# 消耗 InputEventMouseMotion 并转发其他 InputEvent 类型。
func _forward_canvas_gui_input(event):
if (event is InputEventMouseMotion):
return true
return false
// 消耗 InputEventMouseMotion 并转发其他 InputEvent 类型。
public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
return true;
}
return false;
}
PackedStringArray _get_breakpoints() virtual const 🔗
该函数用于编辑基于脚本的对象的编辑器。可以返回格式为(script:line)的断点的列表,例如:res://path_to_script.gd:25。
Texture2D _get_plugin_icon() virtual const 🔗
在插件中覆盖该方法,返回插件图标的 Texture2D。
对于主界面插件而言,图标出现在屏幕顶部,在“2D”“3D”“脚本”“游戏”“资产库”按钮的右侧。
理想情况下,插件图标应为透明背景的白色,大小为 16×16 像素。
func _get_plugin_icon():
# 你可以使用自定义的图标:
return preload("res://addons/my_plugin/my_plugin_icon.svg")
# 或者使用内置的图标:
return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
public override Texture2D _GetPluginIcon()
{
// 你可以使用自定义的图标:
return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg");
// 或者使用内置的图标:
return EditorInterface.Singleton.GetEditorTheme().GetIcon("Node", "EditorIcons");
}
String _get_plugin_name() virtual const 🔗
在插件中覆盖该方法,提供在 Godot 编辑器中显示时的名称。
对于主屏幕插件,它显示在屏幕顶部,在“2D”“3D”“脚本”“游戏”“资产库”按钮的右侧。
Dictionary _get_state() virtual const 🔗
覆盖该方法,以提供要保存的状态数据,如视图位置、网格设置、折叠等。这可用于保存场景(再次打开时,保持状态)和切换选项卡( 选项卡返回时,可以恢复状态)。每个场景的数据会自动被保存在编辑器元数据文件夹中的 editstate 文件中。如果想为插件存储全局的(独立于场景的)编辑器数据,可以改用 _get_window_layout()。
使用 _set_state() 恢复保存的状态。
注意:此方法不应该用于保存应随项目保留的重要设置。
注意:必须实现 _get_plugin_name(),才能正确存储和恢复状态。
func _get_state():
var state = { "zoom": zoom, "preferred_color": my_color }
return state
String _get_unsaved_status(for_scene: String) virtual const 🔗
覆盖该方法以提供列出未保存更改的自定义消息。编辑器将在退出或关闭场景时调用该方法,并在确认对话框中显示返回的字符串。如果该插件没有未保存的更改,则返回空字符串。
关闭场景时,for_scene 是正在关闭的场景的路径。你可以使用它来处理该场景中的内置资源。
如果用户确认保存,将在关闭编辑器之前将调用 _save_external_data()。
func _get_unsaved_status(for_scene):
if not unsaved:
return ""
if for_scene.is_empty():
return "Save changes in MyCustomPlugin before closing?"
else:
return "Scene %s has changes from MyCustomPlugin. Save before closing?" % for_scene.get_file()
func _save_external_data():
unsaved = false
如果该插件没有特定于场景的更改,则可以在关闭场景时忽略这些调用:
func _get_unsaved_status(for_scene):
if not for_scene.is_empty():
return ""
void _get_window_layout(configuration: ConfigFile) virtual 🔗
覆盖该方法,以提供该插件的 GUI 布局、或想要存储的任何其他数据。这用于在调用 queue_save_layout() 或更改编辑器布局(例如更改停靠面板的位置)时,保存项目的编辑器布局。数据被存储在编辑器元数据目录中的 editor_layout.cfg 文件中。
使用 _set_window_layout() 恢复保存的布局。
func _get_window_layout(configuration):
configuration.set_value("MyPlugin", "window_position", $Window.position)
configuration.set_value("MyPlugin", "icon_color", $Icon.modulate)
bool _handles(object: Object) virtual const 🔗
如果插件会编辑特定类型的对象(资源或节点),则请实现该函数。如果返回 true,则将在编辑器请求时,调用函数 _edit() 和 _make_visible()。如果已经声明了方法 _forward_canvas_gui_input() 和 _forward_3d_gui_input(),则它们也会被调用。
注意:每个插件一次只应处理一种类型的对象。如果一个插件处理多种类型的对象并且同时编辑这些对象,则会导致错误。
bool _has_main_screen() virtual const 🔗
如果这是主屏幕编辑器插件,则返回 true(它与 2D、3D、脚本、游戏、资产库一起进入工作区选择器)。
当该插件的工作区被选中时,其他主屏幕插件将被隐藏,但你的插件不会自动出现。它需要被添加为 EditorInterface.get_editor_main_screen() 的子节点,并在 _make_visible() 中使其可见。
使用 _get_plugin_name() 和 _get_plugin_icon() 自定义插件按钮的外观。
var plugin_control
func _enter_tree():
plugin_control = preload("my_plugin_control.tscn").instantiate()
EditorInterface.get_editor_main_screen().add_child(plugin_control)
plugin_control.hide()
func _has_main_screen():
return true
func _make_visible(visible):
plugin_control.visible = visible
func _get_plugin_name():
return "My Super Cool Plugin 3000"
func _get_plugin_icon():
return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
void _make_visible(visible: bool) virtual 🔗
当编辑器被要求变为可见时,该函数将被调用。它用于编辑特定对象类型的插件。
请记住,你必须手动管理所有编辑器控件的可见性。
PackedStringArray _run_scene(scene: String, args: PackedStringArray) virtual const 🔗
This function is called when an individual scene is about to be played in the editor. args is a list of command line arguments that will be passed to the new Godot instance, which will be replaced by the list returned by this function.
func _run_scene(scene, args):
args.append("--an-extra-argument")
return args
Note: Text that is printed in this method will not be visible in the editor's Output panel unless EditorSettings.run/output/always_clear_output_on_play is false.
void _save_external_data() virtual 🔗
这个方法在编辑器保存项目后或关闭项目时被调用,它要求插件保存编辑的外部场景/资源。
void _set_state(state: Dictionary) virtual 🔗
恢复用 _get_state() 保存的状态。这个方法会在编辑器的当前场景选项卡发生改变时调用。
注意:你的插件必须实现 _get_plugin_name(),否则无法被识别,这个方法也不会被调用。
func _set_state(data):
zoom = data.get("zoom", 1.0)
preferred_color = data.get("my_color", Color.WHITE)
void _set_window_layout(configuration: ConfigFile) virtual 🔗
恢复用 _get_window_layout() 保存的插件 GUI 布局和数据。编辑器启动时会调用每个插件的这个方法。请使用提供的 configuration 文件读取你保存的数据。
func _set_window_layout(configuration):
$Window.position = configuration.get_value("MyPlugin", "window_position", Vector2())
$Icon.modulate = configuration.get_value("MyPlugin", "icon_color", Color.WHITE)
void add_autoload_singleton(name: String, path: String) 🔗
将 path 处的脚本作为 name 添加到自动加载列表中。
将插件添加至上下文菜单。slot 为添加插件的上下文菜单。
注意:插件的实例只能属于单个上下文菜单槽。
Button add_control_to_bottom_panel(control: Control, title: String, shortcut: Shortcut = null) 🔗
已弃用: Use add_dock() instead, with EditorDock.default_slot set to DOCK_SLOT_BOTTOM.
将控件添加到底部面板(与输出、调试、动画等面板并列)。返回一个按钮的引用。这个按钮在场景树外,需要你视情况自行隐藏/显示。当插件停用时,请务必使用 remove_control_from_bottom_panel() 移除自定义控件,并使用 Node.queue_free() 将其释放。
shortcut 为快捷键,激活时将切换底部面板的可见性。此快捷键对象仅在该控件被添加到底部面板时才被设置。
注意:请将编辑器设置中默认的底部面板快捷键作为设计参考。按照惯例,它们均使用 Alt 修饰键。
void add_control_to_container(container: CustomControlContainer, control: Control) 🔗
将自定义控件添加到编辑器 UI 中的某个容器。
请记住,必须自己管理你的自定义控件的可见性(并且很可能在添加后隐藏它)。
当插件被停用时,请确保使用 remove_control_from_container() 移除自定义控件,并使用 Node.queue_free() 将其释放。
void add_control_to_dock(slot: DockSlot, control: Control, shortcut: Shortcut = null) 🔗
已弃用: Use add_dock() instead.
将控件添加到特定的停靠面板槽位。
如果重新放置了停靠面板,并且只要该插件处于活动状态,编辑器就会在以后的会话中保存停靠面板的位置。
停用插件后,请确保使用 remove_control_from_docks() 移除自定义控件,并使用 Node.queue_free() 将其释放。
你还可以指定快捷键参数。按下该快捷键就会打开并聚焦该面板。
void add_custom_type(type: String, base: String, script: Script, icon: Texture2D) 🔗
添加一个自定义类型,它将出现在节点或资源的列表中。
选择给定的节点或资源时,将实例化基本类型(例如“Node3D”、“Control”、“Resource”),然后脚本将被加载并将其设置为该对象。
注意:基本类型是该类型的类层次继承的基本引擎类,而不是任何自定义类型的父类。
可以使用虚方法 _handles() 通过检查脚本或使用 is 关键字来检查你的自定义对象是否正在被编辑。
在运行时,这将是一个带有脚本的简单对象,因此不需要调用该函数。
注意:以这种方式添加的自定义类型不是真正的类。它们只是使用特定脚本创建节点的助手。
void add_debugger_plugin(script: EditorDebuggerPlugin) 🔗
将一个 Script 作为调试器插件添加到调试器。该脚本必须扩展 EditorDebuggerPlugin。
void add_dock(dock: EditorDock) 🔗
添加一个新的停靠面板。
当插件停用时,请务必使用 remove_dock() 移除自定义停靠面板,并使用 Node.queue_free() 将其释放。
void add_export_platform(platform: EditorExportPlatform) 🔗
注册新的 EditorExportPlatform。导出平台提供导出到该平台的功能。
void add_export_plugin(plugin: EditorExportPlugin) 🔗
注册一个新的 EditorExportPlugin。导出插件是用来在项目被导出时执行任务的。
有关如何注册插件的示例,请参见 add_inspector_plugin()。
void add_import_plugin(importer: EditorImportPlugin, first_priority: bool = false) 🔗
注册一个新的 EditorImportPlugin。导入插件用于将自定义的和不受支持的资产,作为一种自定义 Resource 类型导入。
如果 first_priority 是 true,则该新的导入插件被首先插入列表中,并优先于预先存在的插件。
注意:如果要导入自定义 3D 资产格式,请改用 add_scene_format_importer_plugin()。
有关如何注册插件的示例,请参见 add_inspector_plugin()。
void add_inspector_plugin(plugin: EditorInspectorPlugin) 🔗
注册一个新的 EditorInspectorPlugin。检查器插件用于扩展 EditorInspector,并为对象的属性提供自定义配置工具。
注意:当 EditorPlugin 被禁用时,请始终使用 remove_inspector_plugin() 移除已注册的 EditorInspectorPlugin,以防止泄漏和意外行为。
const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
var inspector_plugin = MyInspectorPlugin.new()
func _enter_tree():
add_inspector_plugin(inspector_plugin)
func _exit_tree():
remove_inspector_plugin(inspector_plugin)
void add_node_3d_gizmo_plugin(plugin: EditorNode3DGizmoPlugin) 🔗
注册一个新的 EditorNode3DGizmoPlugin。小工具插件用于将自定义小工具添加到 Node3D 的 3D 预览视图。
有关如何注册插件的示例,请参阅 add_inspector_plugin()。
void add_resource_conversion_plugin(plugin: EditorResourceConversionPlugin) 🔗
注册一个新的 EditorResourceConversionPlugin。资源转换插件用于将自定义资源转换器添加到编辑器检查器。
有关如何创建资源转换插件的示例,请参阅 EditorResourceConversionPlugin。
void add_scene_format_importer_plugin(scene_format_importer: EditorSceneFormatImporter, first_priority: bool = false) 🔗
注册一个新的 EditorSceneFormatImporter。场景导入器用于将自定义格式的 3D 资产导入为场景。
如果 first_priority 为 true,则这个新的导入插件会被插入到列表的首位,优先于预先存在的插件。
void add_scene_post_import_plugin(scene_import_plugin: EditorScenePostImportPlugin, first_priority: bool = false) 🔗
添加 EditorScenePostImportPlugin。这些插件能够在导入对话框中添加新的选项,自定义 3D 资产的导入过程。
如果 first_priority 为 true,则这个新的导入插件会被插入到列表的首位,优先于预先存在的插件。
在项目 > 工具中添加名为 name 的自定义菜单项。点击时会调用所提供的 callable。
在项目 > 工具中添加名为 name 的自定义 PopupMenu 子菜单。请在清理插件时调用 remove_tool_menu_item() 移除该菜单。
void add_translation_parser_plugin(parser: EditorTranslationParserPlugin) 🔗
注册一个自定义翻译解析器插件,用于从自定义文件中提取可翻译的字符串。
void add_undo_redo_inspector_hook_callback(callable: Callable) 🔗
当在检查器中修改属性时,将一个回调函数挂钩到撤消/重做动作创建中。例如,这允许保存在修改给定属性时可能丢失的其他属性。
该回调函数应该有 4 个参数:Object undo_redo、Object modified_object、String property 和 Variant new_value。它们分别是检查器使用的 UndoRedo 对象、当前修改的对象、修改的属性的名称和该属性即将采用的新值。
EditorInterface get_editor_interface() 🔗
已弃用: EditorInterface is a global singleton and can be accessed directly by its name.
返回 EditorInterface 单例实例。
返回场景 > 另存为...下的 PopupMenu。
String get_plugin_version() const 🔗
提供在 plugin.cfg 配置文件中声明的插件版本。
ScriptCreateDialog get_script_create_dialog() 🔗
获取用于创建脚本的编辑器对话框。
注意:用户可以在使用前对其进行配置。
警告:移除和释放这个节点将使编辑器的一部分失去作用,并可能导致崩溃。
EditorUndoRedoManager get_undo_redo() 🔗
获取撤消/重做对象。编辑器中的大多数操作都是可以撤消的,因此请使用此对象来确保在需要时执行此操作。
void hide_bottom_panel() 🔗
最小化底部面板。
void make_bottom_panel_item_visible(item: Control) 🔗
使底部面板中的一个特定项目可见。
void queue_save_layout() 🔗
排队保存游戏项目的编辑器布局。
void remove_autoload_singleton(name: String) 🔗
从列表中移除自动加载 name。
移除指定的上下文菜单插件。
void remove_control_from_bottom_panel(control: Control) 🔗
已弃用: Use remove_dock() instead.
从底部面板上移除该控件。必须手动调用 Node.queue_free() 释放该控件。
void remove_control_from_container(container: CustomControlContainer, control: Control) 🔗
从指定的容器中移除该控件。必须手动调用 Node.queue_free() 释放该控件。
void remove_control_from_docks(control: Control) 🔗
已弃用: Use remove_dock() instead.
从停靠面板中移除该控件。必须手动调用 Node.queue_free() 释放该控件。
void remove_custom_type(type: String) 🔗
移除由 add_custom_type() 添加的自定义类型。
void remove_debugger_plugin(script: EditorDebuggerPlugin) 🔗
从调试器中移除带有给定脚本的调试器插件。
void remove_dock(dock: EditorDock) 🔗
Removes dock from the available docks. You should manually call Node.queue_free() to free it.
void remove_export_platform(platform: EditorExportPlatform) 🔗
移除由 add_export_platform() 注册的导出平台。
void remove_export_plugin(plugin: EditorExportPlugin) 🔗
移除由 add_export_plugin() 注册的导出插件。
void remove_import_plugin(importer: EditorImportPlugin) 🔗
移除由 add_import_plugin() 注册的导入插件。
void remove_inspector_plugin(plugin: EditorInspectorPlugin) 🔗
移除由 add_inspector_plugin() 注册的检查器插件。
void remove_node_3d_gizmo_plugin(plugin: EditorNode3DGizmoPlugin) 🔗
移除由 add_node_3d_gizmo_plugin() 注册的小工具插件。
void remove_resource_conversion_plugin(plugin: EditorResourceConversionPlugin) 🔗
移除由 add_resource_conversion_plugin() 注册的资源转换插件。
void remove_scene_format_importer_plugin(scene_format_importer: EditorSceneFormatImporter) 🔗
移除由 add_scene_format_importer_plugin() 注册的场景格式导入器插件。
void remove_scene_post_import_plugin(scene_import_plugin: EditorScenePostImportPlugin) 🔗
移除由 add_scene_post_import_plugin() 注册的 EditorScenePostImportPlugin。
从项目 > 工具中移除名为 name 的菜单。
void remove_translation_parser_plugin(parser: EditorTranslationParserPlugin) 🔗
移除由 add_translation_parser_plugin() 注册的自定义翻译解析器插件。
void remove_undo_redo_inspector_hook_callback(callable: Callable) 🔗
移除由 add_undo_redo_inspector_hook_callback() 添加的回调。
void set_dock_tab_icon(control: Control, icon: Texture2D) 🔗
已弃用: Use EditorDock.dock_icon instead.
设置停靠面板插槽中给定控件的选项卡图标。设置为 null 会移除该图标。
void set_force_draw_over_forwarding_enabled() 🔗
更新视口时,为 2D 编辑器启用 _forward_canvas_force_draw_over_viewport() 的调用,为 3D 编辑器启用 _forward_3d_force_draw_over_viewport() 的调用。只需调用该方法一次,它将永久适用于该插件。
void set_input_event_forwarding_always_enabled() 🔗
如果始终希望从 3D 视图屏幕在 _forward_3d_gui_input() 中接收输入,请使用该方法。如果插件想要在场景中使用射线投射,它可能特别有用。
更新 2D 和 3D 编辑器视口的叠加层。会导致方法 _forward_canvas_draw_over_viewport()、_forward_canvas_force_draw_over_viewport()、_forward_3d_draw_over_viewport() 和 _forward_3d_force_draw_over_viewport() 被调用。