EditorInterface

Inherits: Node < Object

Godot 编辑器的界面。

描述

EditorInterface 让您可以控制 Godot 编辑器的窗口,它允许自定义窗口,保存和(重新)加载场景,渲染网格预览,检查和编辑资源和对象。它允许自定义窗口,保存和(重新)加载场景,渲染网格预览,检查和编辑资源和对象,并提供对 EditorSettingsEditorFileSystemEditorResourcePreviewScriptEditor、编辑器视窗和场景信息的访问。

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

属性

bool

distraction_free_mode

方法

void

edit_node ( Node node )

void

edit_resource ( Resource resource )

void

edit_script ( Script script, int line=-1, int column=0, bool grab_focus=true )

Control

get_base_control ( )

String

get_current_path ( ) const

Node

get_edited_scene_root ( )

float

get_editor_scale ( ) const

EditorSettings

get_editor_settings ( )

Control

get_editor_viewport ( )

FileSystemDock

get_file_system_dock ( )

EditorInspector

get_inspector ( ) const

Array

get_open_scenes ( ) const

String

get_playing_scene ( ) const

EditorFileSystem

get_resource_filesystem ( )

EditorResourcePreview

get_resource_previewer ( )

ScriptEditor

get_script_editor ( )

String

get_selected_path ( ) const

EditorSelection

get_selection ( )

void

inspect_object ( Object object, String for_property=””, bool inspector_only=false )

bool

is_playing_scene ( ) const

bool

is_plugin_enabled ( String plugin ) const

Array

make_mesh_previews ( Array meshes, int preview_size )

void

open_scene_from_path ( String scene_filepath )

void

play_current_scene ( )

void

play_custom_scene ( String scene_filepath )

void

play_main_scene ( )

void

reload_scene_from_path ( String scene_filepath )

Error

save_scene ( )

void

save_scene_as ( String path, bool with_preview=true )

void

select_file ( String file )

void

set_main_screen_editor ( String name )

void

set_plugin_enabled ( String plugin, bool enabled )

void

stop_playing_scene ( )

属性说明

  • bool distraction_free_mode

Setter

set_distraction_free_mode(value)

Getter

is_distraction_free_mode_enabled()

如果true,启用无分心模式,该模式隐藏了侧边底座,以增加主视图的可用空间。

方法说明

  • void edit_node ( Node node )

编辑给定的 Node。如果该节点在场景树内,将被选中。


  • void edit_resource ( Resource resource )

编辑给定的 Resource。如果该资源是 Script,你还可以使用 edit_script 编辑,指定行列位置。


  • void edit_script ( Script script, int line=-1, int column=0, bool grab_focus=true )

编辑给定的 Script。还可以指定所打开脚本的行和列。打开脚本所使用的编辑器是由用户为该脚本的语言所配置,可能是外部编辑器。


返回Godot编辑器窗口的主容器。例如,你可以用它来检索容器的大小并相应地放置你的控件。

警告: 删除和释放这个节点将使编辑器失效,并可能导致崩溃。


  • String get_current_path ( ) const

返回在FileSystemDock中查看的当前路径。


  • Node get_edited_scene_root ( )

返回已编辑的(当前)场景的根节点Node


  • float get_editor_scale ( ) const

返回编辑器用户UI的实际比例,1.0比例为100%。这可以用来调整由插件添加的用户UI的位置和尺寸。

注意:这个值是通过interface/editor/display_scaleinterface/editor/custom_display_scale编辑器设置项来设置。编辑器必须重新启动才能正确应用这些变化。


返回编辑器的EditorSettings实例。


返回主编辑器控件。将其作为主屏幕的父控件。

注意: 这将返回包含整个编辑器的主编辑器控件,而不是具体的 2D或 3D视窗。

警告: 删除和释放这个节点将使编辑器的一部分失去作用,并可能导致崩溃。


返回编辑器的文件系统面板 FileSystemDock 实例。

警告: 移除和释放此节点将使编辑器的一部分失去作用,并可能导致崩溃。


返回编辑器的属性检查器 EditorInspector实例。

警告: 删除和释放这个节点将使编辑器的一部分失去作用,并可能导致崩溃。


  • Array get_open_scenes ( ) const

返回包含当前打开的场景的文件路径的数组Array


  • String get_playing_scene ( ) const

返回正在播放的场景名称。如果当前没有场景正在播放,返回一个空字符串。


返回编辑器的EditorFileSystem实例。


返回编辑器的EditorResourcePreview实例。


返回编辑器的脚本编辑器 ScriptEditor 实例。

警告: 删除和释放这个节点将使编辑器的一部分失去作用,并可能导致崩溃。


  • String get_selected_path ( ) const

返回当前在FileSystemDock中选择的目录的路径,如果选择了一个文件,将使用String.get_base_dir返回其基本目录。如果选择了一个文件,将使用String.get_base_dir返回它的基本目录。


返回编辑器的EditorSelection实例。


  • void inspect_object ( Object object, String for_property=””, bool inspector_only=false )

在编辑器的属性检查器中显示给定对象 object 的给定属性。如果 inspector_only = true,插件将不会尝试编辑对象 object


  • bool is_playing_scene ( ) const

如果场景正在播放,返回true,否则返回false。暂停的场景将被视为正在播放。


如果指定的插件 plugin 已启用时返回 true。插件名称与其目录名称一致。


返回 Array 数组包含给定尺寸渲染的网格预览图Texture


  • void open_scene_from_path ( String scene_filepath )

打开给定路径中的场景。


  • void play_current_scene ( )

播放当前活动的场景。


  • void play_custom_scene ( String scene_filepath )

播放文件路径所指定的场景。


  • void play_main_scene ( )

播放主场景。


  • void reload_scene_from_path ( String scene_filepath )

重新加载给定路径的场景。


保存场景。返回 OKERR_CANT_CREATE (参阅 @GlobalScope 常量)。


  • void save_scene_as ( String path, bool with_preview=true )

将场景保存为path处的文件。


  • void select_file ( String file )

选择文件,路径由file提供,在文件系统面板处。


  • void set_main_screen_editor ( String name )

将编辑器的当前主界面设置为 name 中指定的界面。name必须与相关选项卡的文本完全匹配(2D, 3D, Script, AssetLib)。


  • void set_plugin_enabled ( String plugin, bool enabled )

设置插件的启用状态。插件名称与其目录名称相同。


  • void stop_playing_scene ( )

停止当前正在播放的场景。