:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorInterface.xml. .. _class_EditorInterface: EditorInterface =============== **Inherits:** :ref:`Node` **<** :ref:`Object` Godot editor's interface. .. rst-class:: classref-introduction-group Description ----------- EditorInterface gives you control over Godot editor's window. It allows customizing the window, saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects, and provides access to :ref:`EditorSettings`, :ref:`EditorFileSystem`, :ref:`EditorResourcePreview`, :ref:`ScriptEditor`, the editor viewport, and information about scenes. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorPlugin.get_editor_interface`. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------+------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`distraction_free_mode` | +-------------------------+------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_node` **(** :ref:`Node` node **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_resource` **(** :ref:`Resource` resource **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_script` **(** :ref:`Script` script, :ref:`int` line=-1, :ref:`int` column=0, :ref:`bool` grab_focus=true **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`get_base_control` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_current_path` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Node` | :ref:`get_edited_scene_root` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_editor_scale` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`EditorSettings` | :ref:`get_editor_settings` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`get_editor_viewport` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`FileSystemDock` | :ref:`get_file_system_dock` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`EditorInspector` | :ref:`get_inspector` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_open_scenes` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_playing_scene` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`EditorFileSystem` | :ref:`get_resource_filesystem` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`EditorResourcePreview` | :ref:`get_resource_previewer` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`ScriptEditor` | :ref:`get_script_editor` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_selected_path` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`EditorSelection` | :ref:`get_selection` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`inspect_object` **(** :ref:`Object` object, :ref:`String` for_property="", :ref:`bool` inspector_only=false **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_playing_scene` **(** **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_plugin_enabled` **(** :ref:`String` plugin **)** |const| | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`make_mesh_previews` **(** :ref:`Array` meshes, :ref:`int` preview_size **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`open_scene_from_path` **(** :ref:`String` scene_filepath **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play_current_scene` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play_custom_scene` **(** :ref:`String` scene_filepath **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play_main_scene` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`reload_scene_from_path` **(** :ref:`String` scene_filepath **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`save_scene` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`save_scene_as` **(** :ref:`String` path, :ref:`bool` with_preview=true **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`select_file` **(** :ref:`String` file **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_main_screen_editor` **(** :ref:`String` name **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_plugin_enabled` **(** :ref:`String` plugin, :ref:`bool` enabled **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop_playing_scene` **(** **)** | +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_EditorInterface_property_distraction_free_mode: .. rst-class:: classref-property :ref:`bool` **distraction_free_mode** .. rst-class:: classref-property-setget - void **set_distraction_free_mode** **(** :ref:`bool` value **)** - :ref:`bool` **is_distraction_free_mode_enabled** **(** **)** If ``true``, enables distraction-free mode which hides side docks to increase the space available for the main view. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_EditorInterface_method_edit_node: .. rst-class:: classref-method void **edit_node** **(** :ref:`Node` node **)** Edits the given :ref:`Node`. The node will be also selected if it's inside the scene tree. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_edit_resource: .. rst-class:: classref-method void **edit_resource** **(** :ref:`Resource` resource **)** Edits the given :ref:`Resource`. If the resource is a :ref:`Script` you can also edit it with :ref:`edit_script` to specify the line and column position. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_edit_script: .. rst-class:: classref-method void **edit_script** **(** :ref:`Script` script, :ref:`int` line=-1, :ref:`int` column=0, :ref:`bool` grab_focus=true **)** Edits the given :ref:`Script`. The line and column on which to open the script can also be specified. The script will be open with the user-configured editor for the script's language which may be an external editor. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_base_control: .. rst-class:: classref-method :ref:`Control` **get_base_control** **(** **)** Returns the main container of Godot editor's window. For example, you can use it to retrieve the size of the container and place your controls accordingly. \ **Warning:** Removing and freeing this node will render the editor useless and may cause a crash. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_current_path: .. rst-class:: classref-method :ref:`String` **get_current_path** **(** **)** |const| Returns the current path being viewed in the :ref:`FileSystemDock`. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_edited_scene_root: .. rst-class:: classref-method :ref:`Node` **get_edited_scene_root** **(** **)** Returns the edited (current) scene's root :ref:`Node`. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_editor_scale: .. rst-class:: classref-method :ref:`float` **get_editor_scale** **(** **)** |const| Returns the actual scale of the editor UI (``1.0`` being 100% scale). This can be used to adjust position and dimensions of the UI added by plugins. \ **Note:** This value is set via the ``interface/editor/display_scale`` and ``interface/editor/custom_display_scale`` editor settings. Editor must be restarted for changes to be properly applied. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_editor_settings: .. rst-class:: classref-method :ref:`EditorSettings` **get_editor_settings** **(** **)** Returns the editor's :ref:`EditorSettings` instance. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_editor_viewport: .. rst-class:: classref-method :ref:`Control` **get_editor_viewport** **(** **)** Returns the main editor control. Use this as a parent for main screens. \ **Note:** This returns the main editor control containing the whole editor, not the 2D or 3D viewports specifically. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_file_system_dock: .. rst-class:: classref-method :ref:`FileSystemDock` **get_file_system_dock** **(** **)** Returns the editor's :ref:`FileSystemDock` instance. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_inspector: .. rst-class:: classref-method :ref:`EditorInspector` **get_inspector** **(** **)** |const| Returns the editor's :ref:`EditorInspector` instance. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_open_scenes: .. rst-class:: classref-method :ref:`Array` **get_open_scenes** **(** **)** |const| Returns an :ref:`Array` with the file paths of the currently opened scenes. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_playing_scene: .. rst-class:: classref-method :ref:`String` **get_playing_scene** **(** **)** |const| Returns the name of the scene that is being played. If no scene is currently being played, returns an empty string. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_resource_filesystem: .. rst-class:: classref-method :ref:`EditorFileSystem` **get_resource_filesystem** **(** **)** Returns the editor's :ref:`EditorFileSystem` instance. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_resource_previewer: .. rst-class:: classref-method :ref:`EditorResourcePreview` **get_resource_previewer** **(** **)** Returns the editor's :ref:`EditorResourcePreview` instance. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_script_editor: .. rst-class:: classref-method :ref:`ScriptEditor` **get_script_editor** **(** **)** Returns the editor's :ref:`ScriptEditor` instance. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_selected_path: .. rst-class:: classref-method :ref:`String` **get_selected_path** **(** **)** |const| Returns the path of the directory currently selected in the :ref:`FileSystemDock`. If a file is selected, its base directory will be returned using :ref:`String.get_base_dir` instead. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_get_selection: .. rst-class:: classref-method :ref:`EditorSelection` **get_selection** **(** **)** Returns the editor's :ref:`EditorSelection` instance. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_inspect_object: .. rst-class:: classref-method void **inspect_object** **(** :ref:`Object` object, :ref:`String` for_property="", :ref:`bool` inspector_only=false **)** Shows the given property on the given ``object`` in the editor's Inspector dock. If ``inspector_only`` is ``true``, plugins will not attempt to edit ``object``. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_is_playing_scene: .. rst-class:: classref-method :ref:`bool` **is_playing_scene** **(** **)** |const| Returns ``true`` if a scene is currently being played, ``false`` otherwise. Paused scenes are considered as being played. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_is_plugin_enabled: .. rst-class:: classref-method :ref:`bool` **is_plugin_enabled** **(** :ref:`String` plugin **)** |const| Returns ``true`` if the specified ``plugin`` is enabled. The plugin name is the same as its directory name. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_make_mesh_previews: .. rst-class:: classref-method :ref:`Array` **make_mesh_previews** **(** :ref:`Array` meshes, :ref:`int` preview_size **)** Returns mesh previews rendered at the given size as an :ref:`Array` of :ref:`Texture`\ s. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_open_scene_from_path: .. rst-class:: classref-method void **open_scene_from_path** **(** :ref:`String` scene_filepath **)** Opens the scene at the given path. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_play_current_scene: .. rst-class:: classref-method void **play_current_scene** **(** **)** Plays the currently active scene. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_play_custom_scene: .. rst-class:: classref-method void **play_custom_scene** **(** :ref:`String` scene_filepath **)** Plays the scene specified by its filepath. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_play_main_scene: .. rst-class:: classref-method void **play_main_scene** **(** **)** Plays the main scene. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_reload_scene_from_path: .. rst-class:: classref-method void **reload_scene_from_path** **(** :ref:`String` scene_filepath **)** Reloads the scene at the given path. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_save_scene: .. rst-class:: classref-method :ref:`Error` **save_scene** **(** **)** Saves the scene. Returns either ``OK`` or ``ERR_CANT_CREATE`` (see :ref:`@GlobalScope` constants). .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_save_scene_as: .. rst-class:: classref-method void **save_scene_as** **(** :ref:`String` path, :ref:`bool` with_preview=true **)** Saves the scene as a file at ``path``. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_select_file: .. rst-class:: classref-method void **select_file** **(** :ref:`String` file **)** Selects the file, with the path provided by ``file``, in the FileSystem dock. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_set_main_screen_editor: .. rst-class:: classref-method void **set_main_screen_editor** **(** :ref:`String` name **)** Sets the editor's current main screen to the one specified in ``name``. ``name`` must match the text of the tab in question exactly (``2D``, ``3D``, ``Script``, ``AssetLib``). .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_set_plugin_enabled: .. rst-class:: classref-method void **set_plugin_enabled** **(** :ref:`String` plugin, :ref:`bool` enabled **)** Sets the enabled status of a plugin. The plugin name is the same as its directory name. .. rst-class:: classref-item-separator ---- .. _class_EditorInterface_method_stop_playing_scene: .. rst-class:: classref-method void **stop_playing_scene** **(** **)** Stops the scene that is currently playing. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`