class_editorinterface.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorInterface.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorInterface:
  6. EditorInterface
  7. ===============
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Godot editor's interface.
  10. Description
  11. -----------
  12. 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.
  13. Methods
  14. -------
  15. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`edit_resource<class_EditorInterface_method_edit_resource>` **(** :ref:`Resource<class_Resource>` resource **)** |
  17. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Control<class_Control>` | :ref:`get_base_control<class_EditorInterface_method_get_base_control>` **(** **)** |
  19. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_String>` | :ref:`get_current_path<class_EditorInterface_method_get_current_path>` **(** **)** const |
  21. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Node<class_Node>` | :ref:`get_edited_scene_root<class_EditorInterface_method_get_edited_scene_root>` **(** **)** |
  23. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`EditorSettings<class_EditorSettings>` | :ref:`get_editor_settings<class_EditorInterface_method_get_editor_settings>` **(** **)** |
  25. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Control<class_Control>` | :ref:`get_editor_viewport<class_EditorInterface_method_get_editor_viewport>` **(** **)** |
  27. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`EditorInspector<class_EditorInspector>` | :ref:`get_inspector<class_EditorInterface_method_get_inspector>` **(** **)** const |
  29. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Array<class_Array>` | :ref:`get_open_scenes<class_EditorInterface_method_get_open_scenes>` **(** **)** const |
  31. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`EditorFileSystem<class_EditorFileSystem>` | :ref:`get_resource_filesystem<class_EditorInterface_method_get_resource_filesystem>` **(** **)** |
  33. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`EditorResourcePreview<class_EditorResourcePreview>` | :ref:`get_resource_previewer<class_EditorInterface_method_get_resource_previewer>` **(** **)** |
  35. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`ScriptEditor<class_ScriptEditor>` | :ref:`get_script_editor<class_EditorInterface_method_get_script_editor>` **(** **)** |
  37. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_selected_path<class_EditorInterface_method_get_selected_path>` **(** **)** const |
  39. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`EditorSelection<class_EditorSelection>` | :ref:`get_selection<class_EditorInterface_method_get_selection>` **(** **)** |
  41. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`inspect_object<class_EditorInterface_method_inspect_object>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` for_property="" **)** |
  43. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`is_plugin_enabled<class_EditorInterface_method_is_plugin_enabled>` **(** :ref:`String<class_String>` plugin **)** const |
  45. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Array<class_Array>` | :ref:`make_mesh_previews<class_EditorInterface_method_make_mesh_previews>` **(** :ref:`Array<class_Array>` meshes, :ref:`int<class_int>` preview_size **)** |
  47. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`open_scene_from_path<class_EditorInterface_method_open_scene_from_path>` **(** :ref:`String<class_String>` scene_filepath **)** |
  49. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`reload_scene_from_path<class_EditorInterface_method_reload_scene_from_path>` **(** :ref:`String<class_String>` scene_filepath **)** |
  51. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`save_scene<class_EditorInterface_method_save_scene>` **(** **)** |
  53. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`save_scene_as<class_EditorInterface_method_save_scene_as>` **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` with_preview=true **)** |
  55. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`select_file<class_EditorInterface_method_select_file>` **(** :ref:`String<class_String>` file **)** |
  57. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_distraction_free_mode<class_EditorInterface_method_set_distraction_free_mode>` **(** :ref:`bool<class_bool>` enter **)** |
  59. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_main_screen_editor<class_EditorInterface_method_set_main_screen_editor>` **(** :ref:`String<class_String>` name **)** |
  61. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_plugin_enabled<class_EditorInterface_method_set_plugin_enabled>` **(** :ref:`String<class_String>` plugin, :ref:`bool<class_bool>` enabled **)** |
  63. +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. Method Descriptions
  65. -------------------
  66. .. _class_EditorInterface_method_edit_resource:
  67. - void **edit_resource** **(** :ref:`Resource<class_Resource>` resource **)**
  68. Edits the given :ref:`Resource<class_Resource>`.
  69. ----
  70. .. _class_EditorInterface_method_get_base_control:
  71. - :ref:`Control<class_Control>` **get_base_control** **(** **)**
  72. Returns the main container of Godot editor's window. You can use it, for example, to retrieve the size of the container and place your controls accordingly.
  73. ----
  74. .. _class_EditorInterface_method_get_current_path:
  75. - :ref:`String<class_String>` **get_current_path** **(** **)** const
  76. ----
  77. .. _class_EditorInterface_method_get_edited_scene_root:
  78. - :ref:`Node<class_Node>` **get_edited_scene_root** **(** **)**
  79. Returns the edited (current) scene's root :ref:`Node<class_Node>`.
  80. ----
  81. .. _class_EditorInterface_method_get_editor_settings:
  82. - :ref:`EditorSettings<class_EditorSettings>` **get_editor_settings** **(** **)**
  83. Returns the :ref:`EditorSettings<class_EditorSettings>`.
  84. ----
  85. .. _class_EditorInterface_method_get_editor_viewport:
  86. - :ref:`Control<class_Control>` **get_editor_viewport** **(** **)**
  87. Returns the editor :ref:`Viewport<class_Viewport>`.
  88. ----
  89. .. _class_EditorInterface_method_get_inspector:
  90. - :ref:`EditorInspector<class_EditorInspector>` **get_inspector** **(** **)** const
  91. ----
  92. .. _class_EditorInterface_method_get_open_scenes:
  93. - :ref:`Array<class_Array>` **get_open_scenes** **(** **)** const
  94. Returns an :ref:`Array<class_Array>` with the file paths of the currently opened scenes.
  95. ----
  96. .. _class_EditorInterface_method_get_resource_filesystem:
  97. - :ref:`EditorFileSystem<class_EditorFileSystem>` **get_resource_filesystem** **(** **)**
  98. Returns the :ref:`EditorFileSystem<class_EditorFileSystem>`.
  99. ----
  100. .. _class_EditorInterface_method_get_resource_previewer:
  101. - :ref:`EditorResourcePreview<class_EditorResourcePreview>` **get_resource_previewer** **(** **)**
  102. Returns the :ref:`EditorResourcePreview<class_EditorResourcePreview>`.
  103. ----
  104. .. _class_EditorInterface_method_get_script_editor:
  105. - :ref:`ScriptEditor<class_ScriptEditor>` **get_script_editor** **(** **)**
  106. Returns the :ref:`ScriptEditor<class_ScriptEditor>`.
  107. ----
  108. .. _class_EditorInterface_method_get_selected_path:
  109. - :ref:`String<class_String>` **get_selected_path** **(** **)** const
  110. ----
  111. .. _class_EditorInterface_method_get_selection:
  112. - :ref:`EditorSelection<class_EditorSelection>` **get_selection** **(** **)**
  113. Returns the :ref:`EditorSelection<class_EditorSelection>`.
  114. ----
  115. .. _class_EditorInterface_method_inspect_object:
  116. - void **inspect_object** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` for_property="" **)**
  117. Shows the given property on the given ``object`` in the Editor's Inspector dock.
  118. ----
  119. .. _class_EditorInterface_method_is_plugin_enabled:
  120. - :ref:`bool<class_bool>` **is_plugin_enabled** **(** :ref:`String<class_String>` plugin **)** const
  121. Returns the enabled status of a plugin. The plugin name is the same as its directory name.
  122. ----
  123. .. _class_EditorInterface_method_make_mesh_previews:
  124. - :ref:`Array<class_Array>` **make_mesh_previews** **(** :ref:`Array<class_Array>` meshes, :ref:`int<class_int>` preview_size **)**
  125. Returns mesh previews rendered at the given size as an :ref:`Array<class_Array>` of :ref:`Texture<class_Texture>`\ s.
  126. ----
  127. .. _class_EditorInterface_method_open_scene_from_path:
  128. - void **open_scene_from_path** **(** :ref:`String<class_String>` scene_filepath **)**
  129. Opens the scene at the given path.
  130. ----
  131. .. _class_EditorInterface_method_reload_scene_from_path:
  132. - void **reload_scene_from_path** **(** :ref:`String<class_String>` scene_filepath **)**
  133. Reloads the scene at the given path.
  134. ----
  135. .. _class_EditorInterface_method_save_scene:
  136. - :ref:`Error<enum_@GlobalScope_Error>` **save_scene** **(** **)**
  137. Saves the scene. Returns either ``OK`` or ``ERR_CANT_CREATE`` (see :ref:`@GlobalScope<class_@GlobalScope>` constants).
  138. ----
  139. .. _class_EditorInterface_method_save_scene_as:
  140. - void **save_scene_as** **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` with_preview=true **)**
  141. Saves the scene as a file at ``path``.
  142. ----
  143. .. _class_EditorInterface_method_select_file:
  144. - void **select_file** **(** :ref:`String<class_String>` file **)**
  145. Selects the file, with the path provided by ``file``, in the FileSystem dock.
  146. ----
  147. .. _class_EditorInterface_method_set_distraction_free_mode:
  148. - void **set_distraction_free_mode** **(** :ref:`bool<class_bool>` enter **)**
  149. ----
  150. .. _class_EditorInterface_method_set_main_screen_editor:
  151. - void **set_main_screen_editor** **(** :ref:`String<class_String>` name **)**
  152. ----
  153. .. _class_EditorInterface_method_set_plugin_enabled:
  154. - void **set_plugin_enabled** **(** :ref:`String<class_String>` plugin, :ref:`bool<class_bool>` enabled **)**
  155. Sets the enabled status of a plugin. The plugin name is the same as its directory name.