class_editorplugin.rst 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 EditorPlugin.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorPlugin:
  6. EditorPlugin
  7. ============
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Used by the editor to extend its functionality.
  13. Methods
  14. -------
  15. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_autoload_singleton<class_EditorPlugin_method_add_autoload_singleton>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` path **)** |
  17. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`ToolButton<class_ToolButton>` | :ref:`add_control_to_bottom_panel<class_EditorPlugin_method_add_control_to_bottom_panel>` **(** :ref:`Control<class_Control>` control, :ref:`String<class_String>` title **)** |
  19. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`add_control_to_container<class_EditorPlugin_method_add_control_to_container>` **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)** |
  21. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`add_control_to_dock<class_EditorPlugin_method_add_control_to_dock>` **(** :ref:`DockSlot<enum_EditorPlugin_DockSlot>` slot, :ref:`Control<class_Control>` control **)** |
  23. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`add_custom_type<class_EditorPlugin_method_add_custom_type>` **(** :ref:`String<class_String>` type, :ref:`String<class_String>` base, :ref:`Script<class_Script>` script, :ref:`Texture<class_Texture>` icon **)** |
  25. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`add_export_plugin<class_EditorPlugin_method_add_export_plugin>` **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)** |
  27. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`add_import_plugin<class_EditorPlugin_method_add_import_plugin>` **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)** |
  29. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`add_inspector_plugin<class_EditorPlugin_method_add_inspector_plugin>` **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)** |
  31. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`add_scene_import_plugin<class_EditorPlugin_method_add_scene_import_plugin>` **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)** |
  33. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`add_spatial_gizmo_plugin<class_EditorPlugin_method_add_spatial_gizmo_plugin>` **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)** |
  35. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`add_tool_menu_item<class_EditorPlugin_method_add_tool_menu_item>` **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` handler, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` ud=null **)** |
  37. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`add_tool_submenu_item<class_EditorPlugin_method_add_tool_submenu_item>` **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` submenu **)** |
  39. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`apply_changes<class_EditorPlugin_method_apply_changes>` **(** **)** virtual |
  41. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`build<class_EditorPlugin_method_build>` **(** **)** virtual |
  43. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`clear<class_EditorPlugin_method_clear>` **(** **)** virtual |
  45. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`disable_plugin<class_EditorPlugin_method_disable_plugin>` **(** **)** virtual |
  47. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`edit<class_EditorPlugin_method_edit>` **(** :ref:`Object<class_Object>` object **)** virtual |
  49. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`enable_plugin<class_EditorPlugin_method_enable_plugin>` **(** **)** virtual |
  51. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`forward_canvas_draw_over_viewport<class_EditorPlugin_method_forward_canvas_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** virtual |
  53. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`forward_canvas_force_draw_over_viewport<class_EditorPlugin_method_forward_canvas_force_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** virtual |
  55. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`forward_canvas_gui_input<class_EditorPlugin_method_forward_canvas_gui_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** virtual |
  57. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`forward_spatial_gui_input<class_EditorPlugin_method_forward_spatial_gui_input>` **(** :ref:`Camera<class_Camera>` camera, :ref:`InputEvent<class_InputEvent>` event **)** virtual |
  59. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_breakpoints<class_EditorPlugin_method_get_breakpoints>` **(** **)** virtual |
  61. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`EditorInterface<class_EditorInterface>` | :ref:`get_editor_interface<class_EditorPlugin_method_get_editor_interface>` **(** **)** |
  63. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Object<class_Object>` | :ref:`get_plugin_icon<class_EditorPlugin_method_get_plugin_icon>` **(** **)** virtual |
  65. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`String<class_String>` | :ref:`get_plugin_name<class_EditorPlugin_method_get_plugin_name>` **(** **)** virtual |
  67. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`ScriptCreateDialog<class_ScriptCreateDialog>` | :ref:`get_script_create_dialog<class_EditorPlugin_method_get_script_create_dialog>` **(** **)** |
  69. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_state<class_EditorPlugin_method_get_state>` **(** **)** virtual |
  71. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`UndoRedo<class_UndoRedo>` | :ref:`get_undo_redo<class_EditorPlugin_method_get_undo_redo>` **(** **)** |
  73. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`get_window_layout<class_EditorPlugin_method_get_window_layout>` **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** virtual |
  75. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`bool<class_bool>` | :ref:`handles<class_EditorPlugin_method_handles>` **(** :ref:`Object<class_Object>` object **)** virtual |
  77. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`bool<class_bool>` | :ref:`has_main_screen<class_EditorPlugin_method_has_main_screen>` **(** **)** virtual |
  79. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`hide_bottom_panel<class_EditorPlugin_method_hide_bottom_panel>` **(** **)** |
  81. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`make_bottom_panel_item_visible<class_EditorPlugin_method_make_bottom_panel_item_visible>` **(** :ref:`Control<class_Control>` item **)** |
  83. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`make_visible<class_EditorPlugin_method_make_visible>` **(** :ref:`bool<class_bool>` visible **)** virtual |
  85. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`queue_save_layout<class_EditorPlugin_method_queue_save_layout>` **(** **)** const |
  87. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`remove_autoload_singleton<class_EditorPlugin_method_remove_autoload_singleton>` **(** :ref:`String<class_String>` name **)** |
  89. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`remove_control_from_bottom_panel<class_EditorPlugin_method_remove_control_from_bottom_panel>` **(** :ref:`Control<class_Control>` control **)** |
  91. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`remove_control_from_container<class_EditorPlugin_method_remove_control_from_container>` **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)** |
  93. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`remove_control_from_docks<class_EditorPlugin_method_remove_control_from_docks>` **(** :ref:`Control<class_Control>` control **)** |
  95. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`remove_custom_type<class_EditorPlugin_method_remove_custom_type>` **(** :ref:`String<class_String>` type **)** |
  97. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`remove_export_plugin<class_EditorPlugin_method_remove_export_plugin>` **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)** |
  99. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`remove_import_plugin<class_EditorPlugin_method_remove_import_plugin>` **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)** |
  101. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`remove_inspector_plugin<class_EditorPlugin_method_remove_inspector_plugin>` **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)** |
  103. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`remove_scene_import_plugin<class_EditorPlugin_method_remove_scene_import_plugin>` **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)** |
  105. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`remove_spatial_gizmo_plugin<class_EditorPlugin_method_remove_spatial_gizmo_plugin>` **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)** |
  107. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`remove_tool_menu_item<class_EditorPlugin_method_remove_tool_menu_item>` **(** :ref:`String<class_String>` name **)** |
  109. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`save_external_data<class_EditorPlugin_method_save_external_data>` **(** **)** virtual |
  111. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`set_force_draw_over_forwarding_enabled<class_EditorPlugin_method_set_force_draw_over_forwarding_enabled>` **(** **)** |
  113. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`set_input_event_forwarding_always_enabled<class_EditorPlugin_method_set_input_event_forwarding_always_enabled>` **(** **)** |
  115. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_state<class_EditorPlugin_method_set_state>` **(** :ref:`Dictionary<class_Dictionary>` state **)** virtual |
  117. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_window_layout<class_EditorPlugin_method_set_window_layout>` **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** virtual |
  119. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`int<class_int>` | :ref:`update_overlays<class_EditorPlugin_method_update_overlays>` **(** **)** const |
  121. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. Signals
  123. -------
  124. .. _class_EditorPlugin_signal_main_screen_changed:
  125. - **main_screen_changed** **(** :ref:`String<class_String>` screen_name **)**
  126. Emitted when user changes the workspace (2D, 3D, Script, AssetLib). Also works with custom screens defined by plugins.
  127. ----
  128. .. _class_EditorPlugin_signal_resource_saved:
  129. - **resource_saved** **(** :ref:`Resource<class_Resource>` resource **)**
  130. ----
  131. .. _class_EditorPlugin_signal_scene_changed:
  132. - **scene_changed** **(** :ref:`Node<class_Node>` scene_root **)**
  133. Emitted when the scene is changed in the editor. The argument will return the root node of the scene that has just become active. If this scene is new and empty, the argument will be null.
  134. ----
  135. .. _class_EditorPlugin_signal_scene_closed:
  136. - **scene_closed** **(** :ref:`String<class_String>` filepath **)**
  137. Emitted when user closes a scene. The argument is file path to a closed scene.
  138. Enumerations
  139. ------------
  140. .. _enum_EditorPlugin_CustomControlContainer:
  141. .. _class_EditorPlugin_constant_CONTAINER_TOOLBAR:
  142. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_MENU:
  143. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_SIDE_LEFT:
  144. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT:
  145. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_BOTTOM:
  146. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_MENU:
  147. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_SIDE_LEFT:
  148. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_SIDE_RIGHT:
  149. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_BOTTOM:
  150. .. _class_EditorPlugin_constant_CONTAINER_PROPERTY_EDITOR_BOTTOM:
  151. enum **CustomControlContainer**:
  152. - **CONTAINER_TOOLBAR** = **0**
  153. - **CONTAINER_SPATIAL_EDITOR_MENU** = **1**
  154. - **CONTAINER_SPATIAL_EDITOR_SIDE_LEFT** = **2**
  155. - **CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT** = **3**
  156. - **CONTAINER_SPATIAL_EDITOR_BOTTOM** = **4**
  157. - **CONTAINER_CANVAS_EDITOR_MENU** = **5**
  158. - **CONTAINER_CANVAS_EDITOR_SIDE_LEFT** = **6**
  159. - **CONTAINER_CANVAS_EDITOR_SIDE_RIGHT** = **7**
  160. - **CONTAINER_CANVAS_EDITOR_BOTTOM** = **8**
  161. - **CONTAINER_PROPERTY_EDITOR_BOTTOM** = **9**
  162. ----
  163. .. _enum_EditorPlugin_DockSlot:
  164. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_UL:
  165. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_BL:
  166. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_UR:
  167. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_BR:
  168. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_UL:
  169. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_BL:
  170. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_UR:
  171. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_BR:
  172. .. _class_EditorPlugin_constant_DOCK_SLOT_MAX:
  173. enum **DockSlot**:
  174. - **DOCK_SLOT_LEFT_UL** = **0**
  175. - **DOCK_SLOT_LEFT_BL** = **1**
  176. - **DOCK_SLOT_LEFT_UR** = **2**
  177. - **DOCK_SLOT_LEFT_BR** = **3**
  178. - **DOCK_SLOT_RIGHT_UL** = **4**
  179. - **DOCK_SLOT_RIGHT_BL** = **5**
  180. - **DOCK_SLOT_RIGHT_UR** = **6**
  181. - **DOCK_SLOT_RIGHT_BR** = **7**
  182. - **DOCK_SLOT_MAX** = **8** --- Represents the size of the :ref:`DockSlot<enum_EditorPlugin_DockSlot>` enum.
  183. Description
  184. -----------
  185. Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. Also see :ref:`EditorScript<class_EditorScript>` to add functions to the editor.
  186. Tutorials
  187. ---------
  188. - :doc:`../tutorials/plugins/editor/index`
  189. Method Descriptions
  190. -------------------
  191. .. _class_EditorPlugin_method_add_autoload_singleton:
  192. - void **add_autoload_singleton** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` path **)**
  193. Add a script at ``path`` to the Autoload list as ``name``.
  194. ----
  195. .. _class_EditorPlugin_method_add_control_to_bottom_panel:
  196. - :ref:`ToolButton<class_ToolButton>` **add_control_to_bottom_panel** **(** :ref:`Control<class_Control>` control, :ref:`String<class_String>` title **)**
  197. Add a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_bottom_panel<class_EditorPlugin_method_remove_control_from_bottom_panel>` and free it with ``queue_free()``.
  198. ----
  199. .. _class_EditorPlugin_method_add_control_to_container:
  200. - void **add_control_to_container** **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)**
  201. Add a custom control to a container (see CONTAINER\_\* enum). There are many locations where custom controls can be added in the editor UI.
  202. Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
  203. When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_container<class_EditorPlugin_method_remove_control_from_container>` and free it with ``queue_free()``.
  204. ----
  205. .. _class_EditorPlugin_method_add_control_to_dock:
  206. - void **add_control_to_dock** **(** :ref:`DockSlot<enum_EditorPlugin_DockSlot>` slot, :ref:`Control<class_Control>` control **)**
  207. Add the control to a specific dock slot (see DOCK\_\* enum for options).
  208. If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
  209. When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_docks<class_EditorPlugin_method_remove_control_from_docks>` and free it with ``queue_free()``.
  210. ----
  211. .. _class_EditorPlugin_method_add_custom_type:
  212. - void **add_custom_type** **(** :ref:`String<class_String>` type, :ref:`String<class_String>` base, :ref:`Script<class_Script>` script, :ref:`Texture<class_Texture>` icon **)**
  213. Add a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
  214. When given node or resource is selected, the base type will be instanced (ie, "Spatial", "Control", "Resource"), then the script will be loaded and set to this object.
  215. You can use the virtual method :ref:`handles<class_EditorPlugin_method_handles>` to check if your custom object is being edited by checking the script or using 'is' keyword.
  216. During run-time, this will be a simple object with a script so this function does not need to be called then.
  217. ----
  218. .. _class_EditorPlugin_method_add_export_plugin:
  219. - void **add_export_plugin** **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)**
  220. ----
  221. .. _class_EditorPlugin_method_add_import_plugin:
  222. - void **add_import_plugin** **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)**
  223. ----
  224. .. _class_EditorPlugin_method_add_inspector_plugin:
  225. - void **add_inspector_plugin** **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)**
  226. ----
  227. .. _class_EditorPlugin_method_add_scene_import_plugin:
  228. - void **add_scene_import_plugin** **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)**
  229. ----
  230. .. _class_EditorPlugin_method_add_spatial_gizmo_plugin:
  231. - void **add_spatial_gizmo_plugin** **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)**
  232. ----
  233. .. _class_EditorPlugin_method_add_tool_menu_item:
  234. - void **add_tool_menu_item** **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` handler, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` ud=null **)**
  235. Adds a custom menu item to **Project > Tools** as ``name`` that calls ``callback`` on an instance of ``handler`` with a parameter ``ud`` when user activates it.
  236. ----
  237. .. _class_EditorPlugin_method_add_tool_submenu_item:
  238. - void **add_tool_submenu_item** **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` submenu **)**
  239. Adds a custom submenu under **Project > Tools >** ``name``. ``submenu`` should be an object of class :ref:`PopupMenu<class_PopupMenu>`. This submenu should be cleaned up using ``remove_tool_menu_item(name)``.
  240. ----
  241. .. _class_EditorPlugin_method_apply_changes:
  242. - void **apply_changes** **(** **)** virtual
  243. This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency.
  244. This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
  245. ----
  246. .. _class_EditorPlugin_method_build:
  247. - :ref:`bool<class_bool>` **build** **(** **)** virtual
  248. ----
  249. .. _class_EditorPlugin_method_clear:
  250. - void **clear** **(** **)** virtual
  251. Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
  252. ----
  253. .. _class_EditorPlugin_method_disable_plugin:
  254. - void **disable_plugin** **(** **)** virtual
  255. ----
  256. .. _class_EditorPlugin_method_edit:
  257. - void **edit** **(** :ref:`Object<class_Object>` object **)** virtual
  258. This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
  259. ----
  260. .. _class_EditorPlugin_method_enable_plugin:
  261. - void **enable_plugin** **(** **)** virtual
  262. ----
  263. .. _class_EditorPlugin_method_forward_canvas_draw_over_viewport:
  264. - void **forward_canvas_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** virtual
  265. This method is called when there is an input event in the 2D viewport, e.g. the user clicks with the mouse in the 2D space (canvas GUI). Keep in mind that for this method to be called you have to first declare the virtual method :ref:`handles<class_EditorPlugin_method_handles>` so the editor knows that you want to work with the workspace:
  266. ::
  267. func handles(object):
  268. return true
  269. Also note that the edited scene must have a root node.
  270. ----
  271. .. _class_EditorPlugin_method_forward_canvas_force_draw_over_viewport:
  272. - void **forward_canvas_force_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** virtual
  273. ----
  274. .. _class_EditorPlugin_method_forward_canvas_gui_input:
  275. - :ref:`bool<class_bool>` **forward_canvas_gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** virtual
  276. ----
  277. .. _class_EditorPlugin_method_forward_spatial_gui_input:
  278. - :ref:`bool<class_bool>` **forward_spatial_gui_input** **(** :ref:`Camera<class_Camera>` camera, :ref:`InputEvent<class_InputEvent>` event **)** virtual
  279. This method is called when there is an input event in the 3D viewport, e.g. the user clicks with the mouse in the 3D space (spatial GUI). Keep in mind that for this method to be called you have to first declare the virtual method :ref:`handles<class_EditorPlugin_method_handles>` so the editor knows that you want to work with the workspace:
  280. ::
  281. func handles(object):
  282. return true
  283. Also note that the edited scene must have a root node.
  284. ----
  285. .. _class_EditorPlugin_method_get_breakpoints:
  286. - :ref:`PoolStringArray<class_PoolStringArray>` **get_breakpoints** **(** **)** virtual
  287. This is for editors that edit script based objects. You can return a list of breakpoints in the format (script:line), for example: res://path_to_script.gd:25
  288. ----
  289. .. _class_EditorPlugin_method_get_editor_interface:
  290. - :ref:`EditorInterface<class_EditorInterface>` **get_editor_interface** **(** **)**
  291. Returns the :ref:`EditorInterface<class_EditorInterface>` object that gives you control over Godot editor's window and its functionalities.
  292. ----
  293. .. _class_EditorPlugin_method_get_plugin_icon:
  294. - :ref:`Object<class_Object>` **get_plugin_icon** **(** **)** virtual
  295. ----
  296. .. _class_EditorPlugin_method_get_plugin_name:
  297. - :ref:`String<class_String>` **get_plugin_name** **(** **)** virtual
  298. ----
  299. .. _class_EditorPlugin_method_get_script_create_dialog:
  300. - :ref:`ScriptCreateDialog<class_ScriptCreateDialog>` **get_script_create_dialog** **(** **)**
  301. Gets the Editor's dialogue used for making scripts. Note that users can configure it before use.
  302. ----
  303. .. _class_EditorPlugin_method_get_state:
  304. - :ref:`Dictionary<class_Dictionary>` **get_state** **(** **)** virtual
  305. Get the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).
  306. ----
  307. .. _class_EditorPlugin_method_get_undo_redo:
  308. - :ref:`UndoRedo<class_UndoRedo>` **get_undo_redo** **(** **)**
  309. Get the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
  310. ----
  311. .. _class_EditorPlugin_method_get_window_layout:
  312. - void **get_window_layout** **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** virtual
  313. Get the GUI layout of the plugin. This is used to save the project's editor layout when :ref:`queue_save_layout<class_EditorPlugin_method_queue_save_layout>` is called or the editor layout was changed(For example changing the position of a dock).
  314. ----
  315. .. _class_EditorPlugin_method_handles:
  316. - :ref:`bool<class_bool>` **handles** **(** :ref:`Object<class_Object>` object **)** virtual
  317. Implement this function if your plugin edits a specific type of object (Resource or Node). If you return ``true``, then you will get the functions :ref:`edit<class_EditorPlugin_method_edit>` and :ref:`make_visible<class_EditorPlugin_method_make_visible>` called when the editor requests them. If you have declared the methods :ref:`forward_canvas_gui_input<class_EditorPlugin_method_forward_canvas_gui_input>` and :ref:`forward_spatial_gui_input<class_EditorPlugin_method_forward_spatial_gui_input>` these will be called too.
  318. ----
  319. .. _class_EditorPlugin_method_has_main_screen:
  320. - :ref:`bool<class_bool>` **has_main_screen** **(** **)** virtual
  321. Returns ``true`` if this is a main screen editor plugin (it goes in the workspaces selector together with '2D', '3D', and 'Script').
  322. ----
  323. .. _class_EditorPlugin_method_hide_bottom_panel:
  324. - void **hide_bottom_panel** **(** **)**
  325. ----
  326. .. _class_EditorPlugin_method_make_bottom_panel_item_visible:
  327. - void **make_bottom_panel_item_visible** **(** :ref:`Control<class_Control>` item **)**
  328. ----
  329. .. _class_EditorPlugin_method_make_visible:
  330. - void **make_visible** **(** :ref:`bool<class_bool>` visible **)** virtual
  331. This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
  332. Remember that you have to manage the visibility of all your editor controls manually.
  333. ----
  334. .. _class_EditorPlugin_method_queue_save_layout:
  335. - void **queue_save_layout** **(** **)** const
  336. Queue save the project's editor layout.
  337. ----
  338. .. _class_EditorPlugin_method_remove_autoload_singleton:
  339. - void **remove_autoload_singleton** **(** :ref:`String<class_String>` name **)**
  340. Remove an Autoload ``name`` from the list.
  341. ----
  342. .. _class_EditorPlugin_method_remove_control_from_bottom_panel:
  343. - void **remove_control_from_bottom_panel** **(** :ref:`Control<class_Control>` control **)**
  344. Remove the control from the bottom panel. You have to manually ``queue_free()`` the control.
  345. ----
  346. .. _class_EditorPlugin_method_remove_control_from_container:
  347. - void **remove_control_from_container** **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)**
  348. Remove the control from the specified container. You have to manually ``queue_free()`` the control.
  349. ----
  350. .. _class_EditorPlugin_method_remove_control_from_docks:
  351. - void **remove_control_from_docks** **(** :ref:`Control<class_Control>` control **)**
  352. Remove the control from the dock. You have to manually ``queue_free()`` the control.
  353. ----
  354. .. _class_EditorPlugin_method_remove_custom_type:
  355. - void **remove_custom_type** **(** :ref:`String<class_String>` type **)**
  356. Remove a custom type added by :ref:`add_custom_type<class_EditorPlugin_method_add_custom_type>`
  357. ----
  358. .. _class_EditorPlugin_method_remove_export_plugin:
  359. - void **remove_export_plugin** **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)**
  360. ----
  361. .. _class_EditorPlugin_method_remove_import_plugin:
  362. - void **remove_import_plugin** **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)**
  363. ----
  364. .. _class_EditorPlugin_method_remove_inspector_plugin:
  365. - void **remove_inspector_plugin** **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)**
  366. ----
  367. .. _class_EditorPlugin_method_remove_scene_import_plugin:
  368. - void **remove_scene_import_plugin** **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)**
  369. ----
  370. .. _class_EditorPlugin_method_remove_spatial_gizmo_plugin:
  371. - void **remove_spatial_gizmo_plugin** **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)**
  372. ----
  373. .. _class_EditorPlugin_method_remove_tool_menu_item:
  374. - void **remove_tool_menu_item** **(** :ref:`String<class_String>` name **)**
  375. Removes a menu ``name`` from 'Project > Tools'.
  376. ----
  377. .. _class_EditorPlugin_method_save_external_data:
  378. - void **save_external_data** **(** **)** virtual
  379. This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
  380. ----
  381. .. _class_EditorPlugin_method_set_force_draw_over_forwarding_enabled:
  382. - void **set_force_draw_over_forwarding_enabled** **(** **)**
  383. ----
  384. .. _class_EditorPlugin_method_set_input_event_forwarding_always_enabled:
  385. - void **set_input_event_forwarding_always_enabled** **(** **)**
  386. Use this method if you always want to receive inputs from 3D view screen inside :ref:`forward_spatial_gui_input<class_EditorPlugin_method_forward_spatial_gui_input>`. It might be especially usable if your plugin will want to use raycast in the scene.
  387. ----
  388. .. _class_EditorPlugin_method_set_state:
  389. - void **set_state** **(** :ref:`Dictionary<class_Dictionary>` state **)** virtual
  390. Restore the state saved by :ref:`get_state<class_EditorPlugin_method_get_state>`.
  391. ----
  392. .. _class_EditorPlugin_method_set_window_layout:
  393. - void **set_window_layout** **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** virtual
  394. Restore the plugin GUI layout saved by :ref:`get_window_layout<class_EditorPlugin_method_get_window_layout>`.
  395. ----
  396. .. _class_EditorPlugin_method_update_overlays:
  397. - :ref:`int<class_int>` **update_overlays** **(** **)** const
  398. Updates the overlays of the editor (2D/3D) viewport.