class_editorinterface.rst 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorInterface.xml.
  6. .. _class_EditorInterface:
  7. EditorInterface
  8. ===============
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Godot editor's interface.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **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<class_EditorSettings>`, :ref:`EditorFileSystem<class_EditorFileSystem>`, :ref:`EditorResourcePreview<class_EditorResourcePreview>`, :ref:`ScriptEditor<class_ScriptEditor>`, the editor viewport, and information about scenes.
  15. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton directly by its name.
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. var editor_settings = EditorInterface.get_editor_settings()
  19. .. code-tab:: csharp
  20. // In C# you can access it via the static Singleton property.
  21. EditorSettings settings = EditorInterface.Singleton.GetEditorSettings();
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +-------------------------+------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`distraction_free_mode<class_EditorInterface_property_distraction_free_mode>` |
  29. +-------------------------+------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`movie_maker_enabled<class_EditorInterface_property_movie_maker_enabled>` |
  31. +-------------------------+------------------------------------------------------------------------------------+
  32. .. rst-class:: classref-reftable-group
  33. Methods
  34. -------
  35. .. table::
  36. :widths: auto
  37. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`edit_node<class_EditorInterface_method_edit_node>` **(** :ref:`Node<class_Node>` node **)** |
  39. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`edit_resource<class_EditorInterface_method_edit_resource>` **(** :ref:`Resource<class_Resource>` resource **)** |
  41. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`edit_script<class_EditorInterface_method_edit_script>` **(** :ref:`Script<class_Script>` script, :ref:`int<class_int>` line=-1, :ref:`int<class_int>` column=0, :ref:`bool<class_bool>` grab_focus=true **)** |
  43. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Control<class_Control>` | :ref:`get_base_control<class_EditorInterface_method_get_base_control>` **(** **)** |const| |
  45. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`EditorCommandPalette<class_EditorCommandPalette>` | :ref:`get_command_palette<class_EditorInterface_method_get_command_palette>` **(** **)** |const| |
  47. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`String<class_String>` | :ref:`get_current_directory<class_EditorInterface_method_get_current_directory>` **(** **)** |const| |
  49. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`String<class_String>` | :ref:`get_current_feature_profile<class_EditorInterface_method_get_current_feature_profile>` **(** **)** |const| |
  51. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`String<class_String>` | :ref:`get_current_path<class_EditorInterface_method_get_current_path>` **(** **)** |const| |
  53. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Node<class_Node>` | :ref:`get_edited_scene_root<class_EditorInterface_method_get_edited_scene_root>` **(** **)** |const| |
  55. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`VBoxContainer<class_VBoxContainer>` | :ref:`get_editor_main_screen<class_EditorInterface_method_get_editor_main_screen>` **(** **)** |const| |
  57. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`EditorPaths<class_EditorPaths>` | :ref:`get_editor_paths<class_EditorInterface_method_get_editor_paths>` **(** **)** |const| |
  59. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`float<class_float>` | :ref:`get_editor_scale<class_EditorInterface_method_get_editor_scale>` **(** **)** |const| |
  61. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`EditorSettings<class_EditorSettings>` | :ref:`get_editor_settings<class_EditorInterface_method_get_editor_settings>` **(** **)** |const| |
  63. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Theme<class_Theme>` | :ref:`get_editor_theme<class_EditorInterface_method_get_editor_theme>` **(** **)** |const| |
  65. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`SubViewport<class_SubViewport>` | :ref:`get_editor_viewport_2d<class_EditorInterface_method_get_editor_viewport_2d>` **(** **)** |const| |
  67. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`SubViewport<class_SubViewport>` | :ref:`get_editor_viewport_3d<class_EditorInterface_method_get_editor_viewport_3d>` **(** :ref:`int<class_int>` idx=0 **)** |const| |
  69. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`FileSystemDock<class_FileSystemDock>` | :ref:`get_file_system_dock<class_EditorInterface_method_get_file_system_dock>` **(** **)** |const| |
  71. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`EditorInspector<class_EditorInspector>` | :ref:`get_inspector<class_EditorInterface_method_get_inspector>` **(** **)** |const| |
  73. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_open_scenes<class_EditorInterface_method_get_open_scenes>` **(** **)** |const| |
  75. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`String<class_String>` | :ref:`get_playing_scene<class_EditorInterface_method_get_playing_scene>` **(** **)** |const| |
  77. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`EditorFileSystem<class_EditorFileSystem>` | :ref:`get_resource_filesystem<class_EditorInterface_method_get_resource_filesystem>` **(** **)** |const| |
  79. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`EditorResourcePreview<class_EditorResourcePreview>` | :ref:`get_resource_previewer<class_EditorInterface_method_get_resource_previewer>` **(** **)** |const| |
  81. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`ScriptEditor<class_ScriptEditor>` | :ref:`get_script_editor<class_EditorInterface_method_get_script_editor>` **(** **)** |const| |
  83. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_selected_paths<class_EditorInterface_method_get_selected_paths>` **(** **)** |const| |
  85. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`EditorSelection<class_EditorSelection>` | :ref:`get_selection<class_EditorInterface_method_get_selection>` **(** **)** |const| |
  87. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`inspect_object<class_EditorInterface_method_inspect_object>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` for_property="", :ref:`bool<class_bool>` inspector_only=false **)** |
  89. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`bool<class_bool>` | :ref:`is_playing_scene<class_EditorInterface_method_is_playing_scene>` **(** **)** |const| |
  91. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_plugin_enabled<class_EditorInterface_method_is_plugin_enabled>` **(** :ref:`String<class_String>` plugin **)** |const| |
  93. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`Texture2D[]<class_Texture2D>` | :ref:`make_mesh_previews<class_EditorInterface_method_make_mesh_previews>` **(** :ref:`Mesh[]<class_Mesh>` meshes, :ref:`int<class_int>` preview_size **)** |
  95. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`mark_scene_as_unsaved<class_EditorInterface_method_mark_scene_as_unsaved>` **(** **)** |
  97. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`open_scene_from_path<class_EditorInterface_method_open_scene_from_path>` **(** :ref:`String<class_String>` scene_filepath **)** |
  99. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`play_current_scene<class_EditorInterface_method_play_current_scene>` **(** **)** |
  101. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`play_custom_scene<class_EditorInterface_method_play_custom_scene>` **(** :ref:`String<class_String>` scene_filepath **)** |
  103. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`play_main_scene<class_EditorInterface_method_play_main_scene>` **(** **)** |
  105. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`popup_dialog<class_EditorInterface_method_popup_dialog>` **(** :ref:`Window<class_Window>` dialog, :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)** |
  107. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`popup_dialog_centered<class_EditorInterface_method_popup_dialog_centered>` **(** :ref:`Window<class_Window>` dialog, :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)** |
  109. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`popup_dialog_centered_clamped<class_EditorInterface_method_popup_dialog_centered_clamped>` **(** :ref:`Window<class_Window>` dialog, :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0), :ref:`float<class_float>` fallback_ratio=0.75 **)** |
  111. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`popup_dialog_centered_ratio<class_EditorInterface_method_popup_dialog_centered_ratio>` **(** :ref:`Window<class_Window>` dialog, :ref:`float<class_float>` ratio=0.8 **)** |
  113. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`reload_scene_from_path<class_EditorInterface_method_reload_scene_from_path>` **(** :ref:`String<class_String>` scene_filepath **)** |
  115. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`restart_editor<class_EditorInterface_method_restart_editor>` **(** :ref:`bool<class_bool>` save=true **)** |
  117. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`save_all_scenes<class_EditorInterface_method_save_all_scenes>` **(** **)** |
  119. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_scene<class_EditorInterface_method_save_scene>` **(** **)** |
  121. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`save_scene_as<class_EditorInterface_method_save_scene_as>` **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` with_preview=true **)** |
  123. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`select_file<class_EditorInterface_method_select_file>` **(** :ref:`String<class_String>` file **)** |
  125. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`set_current_feature_profile<class_EditorInterface_method_set_current_feature_profile>` **(** :ref:`String<class_String>` profile_name **)** |
  127. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`set_main_screen_editor<class_EditorInterface_method_set_main_screen_editor>` **(** :ref:`String<class_String>` name **)** |
  129. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`set_plugin_enabled<class_EditorInterface_method_set_plugin_enabled>` **(** :ref:`String<class_String>` plugin, :ref:`bool<class_bool>` enabled **)** |
  131. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`stop_playing_scene<class_EditorInterface_method_stop_playing_scene>` **(** **)** |
  133. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. .. rst-class:: classref-section-separator
  135. ----
  136. .. rst-class:: classref-descriptions-group
  137. Property Descriptions
  138. ---------------------
  139. .. _class_EditorInterface_property_distraction_free_mode:
  140. .. rst-class:: classref-property
  141. :ref:`bool<class_bool>` **distraction_free_mode**
  142. .. rst-class:: classref-property-setget
  143. - void **set_distraction_free_mode** **(** :ref:`bool<class_bool>` value **)**
  144. - :ref:`bool<class_bool>` **is_distraction_free_mode_enabled** **(** **)**
  145. If ``true``, enables distraction-free mode which hides side docks to increase the space available for the main view.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_EditorInterface_property_movie_maker_enabled:
  149. .. rst-class:: classref-property
  150. :ref:`bool<class_bool>` **movie_maker_enabled**
  151. .. rst-class:: classref-property-setget
  152. - void **set_movie_maker_enabled** **(** :ref:`bool<class_bool>` value **)**
  153. - :ref:`bool<class_bool>` **is_movie_maker_enabled** **(** **)**
  154. If ``true``, the Movie Maker mode is enabled in the editor. See :ref:`MovieWriter<class_MovieWriter>` for more information.
  155. .. rst-class:: classref-section-separator
  156. ----
  157. .. rst-class:: classref-descriptions-group
  158. Method Descriptions
  159. -------------------
  160. .. _class_EditorInterface_method_edit_node:
  161. .. rst-class:: classref-method
  162. void **edit_node** **(** :ref:`Node<class_Node>` node **)**
  163. Edits the given :ref:`Node<class_Node>`. The node will be also selected if it's inside the scene tree.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_EditorInterface_method_edit_resource:
  167. .. rst-class:: classref-method
  168. void **edit_resource** **(** :ref:`Resource<class_Resource>` resource **)**
  169. Edits the given :ref:`Resource<class_Resource>`. If the resource is a :ref:`Script<class_Script>` you can also edit it with :ref:`edit_script<class_EditorInterface_method_edit_script>` to specify the line and column position.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_EditorInterface_method_edit_script:
  173. .. rst-class:: classref-method
  174. void **edit_script** **(** :ref:`Script<class_Script>` script, :ref:`int<class_int>` line=-1, :ref:`int<class_int>` column=0, :ref:`bool<class_bool>` grab_focus=true **)**
  175. Edits the given :ref:`Script<class_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.
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_EditorInterface_method_get_base_control:
  179. .. rst-class:: classref-method
  180. :ref:`Control<class_Control>` **get_base_control** **(** **)** |const|
  181. 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.
  182. \ **Warning:** Removing and freeing this node will render the editor useless and may cause a crash.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_EditorInterface_method_get_command_palette:
  186. .. rst-class:: classref-method
  187. :ref:`EditorCommandPalette<class_EditorCommandPalette>` **get_command_palette** **(** **)** |const|
  188. Returns the editor's :ref:`EditorCommandPalette<class_EditorCommandPalette>` instance.
  189. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_EditorInterface_method_get_current_directory:
  193. .. rst-class:: classref-method
  194. :ref:`String<class_String>` **get_current_directory** **(** **)** |const|
  195. Returns the current directory being viewed in the :ref:`FileSystemDock<class_FileSystemDock>`. If a file is selected, its base directory will be returned using :ref:`String.get_base_dir<class_String_method_get_base_dir>` instead.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_EditorInterface_method_get_current_feature_profile:
  199. .. rst-class:: classref-method
  200. :ref:`String<class_String>` **get_current_feature_profile** **(** **)** |const|
  201. Returns the name of the currently activated feature profile. If the default profile is currently active, an empty string is returned instead.
  202. In order to get a reference to the :ref:`EditorFeatureProfile<class_EditorFeatureProfile>`, you must load the feature profile using :ref:`EditorFeatureProfile.load_from_file<class_EditorFeatureProfile_method_load_from_file>`.
  203. \ **Note:** Feature profiles created via the user interface are loaded from the ``feature_profiles`` directory, as a file with the ``.profile`` extension. The editor configuration folder can be found by using :ref:`EditorPaths.get_config_dir<class_EditorPaths_method_get_config_dir>`.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_EditorInterface_method_get_current_path:
  207. .. rst-class:: classref-method
  208. :ref:`String<class_String>` **get_current_path** **(** **)** |const|
  209. Returns the current path being viewed in the :ref:`FileSystemDock<class_FileSystemDock>`.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_EditorInterface_method_get_edited_scene_root:
  213. .. rst-class:: classref-method
  214. :ref:`Node<class_Node>` **get_edited_scene_root** **(** **)** |const|
  215. Returns the edited (current) scene's root :ref:`Node<class_Node>`.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_EditorInterface_method_get_editor_main_screen:
  219. .. rst-class:: classref-method
  220. :ref:`VBoxContainer<class_VBoxContainer>` **get_editor_main_screen** **(** **)** |const|
  221. Returns the editor control responsible for main screen plugins and tools. Use it with plugins that implement :ref:`EditorPlugin._has_main_screen<class_EditorPlugin_private_method__has_main_screen>`.
  222. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_EditorInterface_method_get_editor_paths:
  226. .. rst-class:: classref-method
  227. :ref:`EditorPaths<class_EditorPaths>` **get_editor_paths** **(** **)** |const|
  228. Returns the :ref:`EditorPaths<class_EditorPaths>` singleton.
  229. .. rst-class:: classref-item-separator
  230. ----
  231. .. _class_EditorInterface_method_get_editor_scale:
  232. .. rst-class:: classref-method
  233. :ref:`float<class_float>` **get_editor_scale** **(** **)** |const|
  234. 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.
  235. \ **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.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_EditorInterface_method_get_editor_settings:
  239. .. rst-class:: classref-method
  240. :ref:`EditorSettings<class_EditorSettings>` **get_editor_settings** **(** **)** |const|
  241. Returns the editor's :ref:`EditorSettings<class_EditorSettings>` instance.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_EditorInterface_method_get_editor_theme:
  245. .. rst-class:: classref-method
  246. :ref:`Theme<class_Theme>` **get_editor_theme** **(** **)** |const|
  247. Returns the editor's :ref:`Theme<class_Theme>`.
  248. \ **Note:** When creating custom editor UI, prefer accessing theme items directly from your GUI nodes using the ``get_theme_*`` methods.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_EditorInterface_method_get_editor_viewport_2d:
  252. .. rst-class:: classref-method
  253. :ref:`SubViewport<class_SubViewport>` **get_editor_viewport_2d** **(** **)** |const|
  254. Returns the 2D editor :ref:`SubViewport<class_SubViewport>`. It does not have a camera. Instead, the view transforms are done directly and can be accessed with :ref:`Viewport.global_canvas_transform<class_Viewport_property_global_canvas_transform>`.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_EditorInterface_method_get_editor_viewport_3d:
  258. .. rst-class:: classref-method
  259. :ref:`SubViewport<class_SubViewport>` **get_editor_viewport_3d** **(** :ref:`int<class_int>` idx=0 **)** |const|
  260. Returns the specified 3D editor :ref:`SubViewport<class_SubViewport>`, from ``0`` to ``3``. The viewport can be used to access the active editor cameras with :ref:`Viewport.get_camera_3d<class_Viewport_method_get_camera_3d>`.
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_EditorInterface_method_get_file_system_dock:
  264. .. rst-class:: classref-method
  265. :ref:`FileSystemDock<class_FileSystemDock>` **get_file_system_dock** **(** **)** |const|
  266. Returns the editor's :ref:`FileSystemDock<class_FileSystemDock>` instance.
  267. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_EditorInterface_method_get_inspector:
  271. .. rst-class:: classref-method
  272. :ref:`EditorInspector<class_EditorInspector>` **get_inspector** **(** **)** |const|
  273. Returns the editor's :ref:`EditorInspector<class_EditorInspector>` instance.
  274. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  275. .. rst-class:: classref-item-separator
  276. ----
  277. .. _class_EditorInterface_method_get_open_scenes:
  278. .. rst-class:: classref-method
  279. :ref:`PackedStringArray<class_PackedStringArray>` **get_open_scenes** **(** **)** |const|
  280. Returns an :ref:`Array<class_Array>` with the file paths of the currently opened scenes.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_EditorInterface_method_get_playing_scene:
  284. .. rst-class:: classref-method
  285. :ref:`String<class_String>` **get_playing_scene** **(** **)** |const|
  286. Returns the name of the scene that is being played. If no scene is currently being played, returns an empty string.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_EditorInterface_method_get_resource_filesystem:
  290. .. rst-class:: classref-method
  291. :ref:`EditorFileSystem<class_EditorFileSystem>` **get_resource_filesystem** **(** **)** |const|
  292. Returns the editor's :ref:`EditorFileSystem<class_EditorFileSystem>` instance.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _class_EditorInterface_method_get_resource_previewer:
  296. .. rst-class:: classref-method
  297. :ref:`EditorResourcePreview<class_EditorResourcePreview>` **get_resource_previewer** **(** **)** |const|
  298. Returns the editor's :ref:`EditorResourcePreview<class_EditorResourcePreview>` instance.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_EditorInterface_method_get_script_editor:
  302. .. rst-class:: classref-method
  303. :ref:`ScriptEditor<class_ScriptEditor>` **get_script_editor** **(** **)** |const|
  304. Returns the editor's :ref:`ScriptEditor<class_ScriptEditor>` instance.
  305. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_EditorInterface_method_get_selected_paths:
  309. .. rst-class:: classref-method
  310. :ref:`PackedStringArray<class_PackedStringArray>` **get_selected_paths** **(** **)** |const|
  311. Returns an array containing the paths of the currently selected files (and directories) in the :ref:`FileSystemDock<class_FileSystemDock>`.
  312. .. rst-class:: classref-item-separator
  313. ----
  314. .. _class_EditorInterface_method_get_selection:
  315. .. rst-class:: classref-method
  316. :ref:`EditorSelection<class_EditorSelection>` **get_selection** **(** **)** |const|
  317. Returns the editor's :ref:`EditorSelection<class_EditorSelection>` instance.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_EditorInterface_method_inspect_object:
  321. .. rst-class:: classref-method
  322. void **inspect_object** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` for_property="", :ref:`bool<class_bool>` inspector_only=false **)**
  323. 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``.
  324. .. rst-class:: classref-item-separator
  325. ----
  326. .. _class_EditorInterface_method_is_playing_scene:
  327. .. rst-class:: classref-method
  328. :ref:`bool<class_bool>` **is_playing_scene** **(** **)** |const|
  329. Returns ``true`` if a scene is currently being played, ``false`` otherwise. Paused scenes are considered as being played.
  330. .. rst-class:: classref-item-separator
  331. ----
  332. .. _class_EditorInterface_method_is_plugin_enabled:
  333. .. rst-class:: classref-method
  334. :ref:`bool<class_bool>` **is_plugin_enabled** **(** :ref:`String<class_String>` plugin **)** |const|
  335. Returns ``true`` if the specified ``plugin`` is enabled. The plugin name is the same as its directory name.
  336. .. rst-class:: classref-item-separator
  337. ----
  338. .. _class_EditorInterface_method_make_mesh_previews:
  339. .. rst-class:: classref-method
  340. :ref:`Texture2D[]<class_Texture2D>` **make_mesh_previews** **(** :ref:`Mesh[]<class_Mesh>` meshes, :ref:`int<class_int>` preview_size **)**
  341. Returns mesh previews rendered at the given size as an :ref:`Array<class_Array>` of :ref:`Texture2D<class_Texture2D>`\ s.
  342. .. rst-class:: classref-item-separator
  343. ----
  344. .. _class_EditorInterface_method_mark_scene_as_unsaved:
  345. .. rst-class:: classref-method
  346. void **mark_scene_as_unsaved** **(** **)**
  347. Marks the current scene tab as unsaved.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_EditorInterface_method_open_scene_from_path:
  351. .. rst-class:: classref-method
  352. void **open_scene_from_path** **(** :ref:`String<class_String>` scene_filepath **)**
  353. Opens the scene at the given path.
  354. .. rst-class:: classref-item-separator
  355. ----
  356. .. _class_EditorInterface_method_play_current_scene:
  357. .. rst-class:: classref-method
  358. void **play_current_scene** **(** **)**
  359. Plays the currently active scene.
  360. .. rst-class:: classref-item-separator
  361. ----
  362. .. _class_EditorInterface_method_play_custom_scene:
  363. .. rst-class:: classref-method
  364. void **play_custom_scene** **(** :ref:`String<class_String>` scene_filepath **)**
  365. Plays the scene specified by its filepath.
  366. .. rst-class:: classref-item-separator
  367. ----
  368. .. _class_EditorInterface_method_play_main_scene:
  369. .. rst-class:: classref-method
  370. void **play_main_scene** **(** **)**
  371. Plays the main scene.
  372. .. rst-class:: classref-item-separator
  373. ----
  374. .. _class_EditorInterface_method_popup_dialog:
  375. .. rst-class:: classref-method
  376. void **popup_dialog** **(** :ref:`Window<class_Window>` dialog, :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)**
  377. Pops up the ``dialog`` in the editor UI with :ref:`Window.popup_exclusive<class_Window_method_popup_exclusive>`. The dialog must have no current parent, otherwise the method fails.
  378. See also :ref:`Window.set_unparent_when_invisible<class_Window_method_set_unparent_when_invisible>`.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_EditorInterface_method_popup_dialog_centered:
  382. .. rst-class:: classref-method
  383. void **popup_dialog_centered** **(** :ref:`Window<class_Window>` dialog, :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)**
  384. Pops up the ``dialog`` in the editor UI with :ref:`Window.popup_exclusive_centered<class_Window_method_popup_exclusive_centered>`. The dialog must have no current parent, otherwise the method fails.
  385. See also :ref:`Window.set_unparent_when_invisible<class_Window_method_set_unparent_when_invisible>`.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_EditorInterface_method_popup_dialog_centered_clamped:
  389. .. rst-class:: classref-method
  390. void **popup_dialog_centered_clamped** **(** :ref:`Window<class_Window>` dialog, :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0), :ref:`float<class_float>` fallback_ratio=0.75 **)**
  391. Pops up the ``dialog`` in the editor UI with :ref:`Window.popup_exclusive_centered_clamped<class_Window_method_popup_exclusive_centered_clamped>`. The dialog must have no current parent, otherwise the method fails.
  392. See also :ref:`Window.set_unparent_when_invisible<class_Window_method_set_unparent_when_invisible>`.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_EditorInterface_method_popup_dialog_centered_ratio:
  396. .. rst-class:: classref-method
  397. void **popup_dialog_centered_ratio** **(** :ref:`Window<class_Window>` dialog, :ref:`float<class_float>` ratio=0.8 **)**
  398. Pops up the ``dialog`` in the editor UI with :ref:`Window.popup_exclusive_centered_ratio<class_Window_method_popup_exclusive_centered_ratio>`. The dialog must have no current parent, otherwise the method fails.
  399. See also :ref:`Window.set_unparent_when_invisible<class_Window_method_set_unparent_when_invisible>`.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_EditorInterface_method_reload_scene_from_path:
  403. .. rst-class:: classref-method
  404. void **reload_scene_from_path** **(** :ref:`String<class_String>` scene_filepath **)**
  405. Reloads the scene at the given path.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_EditorInterface_method_restart_editor:
  409. .. rst-class:: classref-method
  410. void **restart_editor** **(** :ref:`bool<class_bool>` save=true **)**
  411. Restarts the editor. This closes the editor and then opens the same project. If ``save`` is ``true``, the project will be saved before restarting.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_EditorInterface_method_save_all_scenes:
  415. .. rst-class:: classref-method
  416. void **save_all_scenes** **(** **)**
  417. Saves all opened scenes in the editor.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_EditorInterface_method_save_scene:
  421. .. rst-class:: classref-method
  422. :ref:`Error<enum_@GlobalScope_Error>` **save_scene** **(** **)**
  423. Saves the currently active scene. Returns either :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` or :ref:`@GlobalScope.ERR_CANT_CREATE<class_@GlobalScope_constant_ERR_CANT_CREATE>`.
  424. .. rst-class:: classref-item-separator
  425. ----
  426. .. _class_EditorInterface_method_save_scene_as:
  427. .. rst-class:: classref-method
  428. void **save_scene_as** **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` with_preview=true **)**
  429. Saves the currently active scene as a file at ``path``.
  430. .. rst-class:: classref-item-separator
  431. ----
  432. .. _class_EditorInterface_method_select_file:
  433. .. rst-class:: classref-method
  434. void **select_file** **(** :ref:`String<class_String>` file **)**
  435. Selects the file, with the path provided by ``file``, in the FileSystem dock.
  436. .. rst-class:: classref-item-separator
  437. ----
  438. .. _class_EditorInterface_method_set_current_feature_profile:
  439. .. rst-class:: classref-method
  440. void **set_current_feature_profile** **(** :ref:`String<class_String>` profile_name **)**
  441. Selects and activates the specified feature profile with the given ``profile_name``. Set ``profile_name`` to an empty string to reset to the default feature profile.
  442. A feature profile can be created programmatically using the :ref:`EditorFeatureProfile<class_EditorFeatureProfile>` class.
  443. \ **Note:** The feature profile that gets activated must be located in the ``feature_profiles`` directory, as a file with the ``.profile`` extension. If a profile could not be found, an error occurs. The editor configuration folder can be found by using :ref:`EditorPaths.get_config_dir<class_EditorPaths_method_get_config_dir>`.
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_EditorInterface_method_set_main_screen_editor:
  447. .. rst-class:: classref-method
  448. void **set_main_screen_editor** **(** :ref:`String<class_String>` name **)**
  449. Sets the editor's current main screen to the one specified in ``name``. ``name`` must match the title of the tab in question exactly (e.g. ``2D``, ``3D``, ``Script``, or ``AssetLib`` for default tabs).
  450. .. rst-class:: classref-item-separator
  451. ----
  452. .. _class_EditorInterface_method_set_plugin_enabled:
  453. .. rst-class:: classref-method
  454. void **set_plugin_enabled** **(** :ref:`String<class_String>` plugin, :ref:`bool<class_bool>` enabled **)**
  455. Sets the enabled status of a plugin. The plugin name is the same as its directory name.
  456. .. rst-class:: classref-item-separator
  457. ----
  458. .. _class_EditorInterface_method_stop_playing_scene:
  459. .. rst-class:: classref-method
  460. void **stop_playing_scene** **(** **)**
  461. Stops the scene that is currently playing.
  462. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  463. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  464. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  465. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  466. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  467. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  468. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`