class_editorplugin.rst 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorPlugin.xml.
  6. .. _class_EditorPlugin:
  7. EditorPlugin
  8. ============
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Used by the editor to extend its functionality.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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. See also :ref:`EditorScript<class_EditorScript>` to add functions to the editor.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`../tutorials/plugins/editor/index`
  19. .. rst-class:: classref-reftable-group
  20. Methods
  21. -------
  22. .. table::
  23. :widths: auto
  24. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`add_autoload_singleton<class_EditorPlugin_method_add_autoload_singleton>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` path **)** |
  26. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :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 **)** |
  28. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`add_control_to_container<class_EditorPlugin_method_add_control_to_container>` **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)** |
  30. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`add_control_to_dock<class_EditorPlugin_method_add_control_to_dock>` **(** :ref:`DockSlot<enum_EditorPlugin_DockSlot>` slot, :ref:`Control<class_Control>` control **)** |
  32. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | 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 **)** |
  34. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`add_export_plugin<class_EditorPlugin_method_add_export_plugin>` **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)** |
  36. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`add_import_plugin<class_EditorPlugin_method_add_import_plugin>` **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)** |
  38. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`add_inspector_plugin<class_EditorPlugin_method_add_inspector_plugin>` **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)** |
  40. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`add_scene_import_plugin<class_EditorPlugin_method_add_scene_import_plugin>` **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)** |
  42. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`add_spatial_gizmo_plugin<class_EditorPlugin_method_add_spatial_gizmo_plugin>` **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)** |
  44. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | 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 **)** |
  46. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`add_tool_submenu_item<class_EditorPlugin_method_add_tool_submenu_item>` **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` submenu **)** |
  48. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`apply_changes<class_EditorPlugin_method_apply_changes>` **(** **)** |virtual| |
  50. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`build<class_EditorPlugin_method_build>` **(** **)** |virtual| |
  52. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`clear<class_EditorPlugin_method_clear>` **(** **)** |virtual| |
  54. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`disable_plugin<class_EditorPlugin_method_disable_plugin>` **(** **)** |virtual| |
  56. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`edit<class_EditorPlugin_method_edit>` **(** :ref:`Object<class_Object>` object **)** |virtual| |
  58. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`enable_plugin<class_EditorPlugin_method_enable_plugin>` **(** **)** |virtual| |
  60. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`forward_canvas_draw_over_viewport<class_EditorPlugin_method_forward_canvas_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** |virtual| |
  62. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`forward_canvas_force_draw_over_viewport<class_EditorPlugin_method_forward_canvas_force_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** |virtual| |
  64. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`forward_canvas_gui_input<class_EditorPlugin_method_forward_canvas_gui_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  66. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`forward_spatial_draw_over_viewport<class_EditorPlugin_method_forward_spatial_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** |virtual| |
  68. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`forward_spatial_force_draw_over_viewport<class_EditorPlugin_method_forward_spatial_force_draw_over_viewport>` **(** :ref:`Control<class_Control>` overlay **)** |virtual| |
  70. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :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| |
  72. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_breakpoints<class_EditorPlugin_method_get_breakpoints>` **(** **)** |virtual| |
  74. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`EditorInterface<class_EditorInterface>` | :ref:`get_editor_interface<class_EditorPlugin_method_get_editor_interface>` **(** **)** |
  76. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Texture<class_Texture>` | :ref:`get_plugin_icon<class_EditorPlugin_method_get_plugin_icon>` **(** **)** |virtual| |
  78. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`String<class_String>` | :ref:`get_plugin_name<class_EditorPlugin_method_get_plugin_name>` **(** **)** |virtual| |
  80. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`ScriptCreateDialog<class_ScriptCreateDialog>` | :ref:`get_script_create_dialog<class_EditorPlugin_method_get_script_create_dialog>` **(** **)** |
  82. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_state<class_EditorPlugin_method_get_state>` **(** **)** |virtual| |
  84. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`UndoRedo<class_UndoRedo>` | :ref:`get_undo_redo<class_EditorPlugin_method_get_undo_redo>` **(** **)** |
  86. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`get_window_layout<class_EditorPlugin_method_get_window_layout>` **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** |virtual| |
  88. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`bool<class_bool>` | :ref:`handles<class_EditorPlugin_method_handles>` **(** :ref:`Object<class_Object>` object **)** |virtual| |
  90. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`bool<class_bool>` | :ref:`has_main_screen<class_EditorPlugin_method_has_main_screen>` **(** **)** |virtual| |
  92. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`hide_bottom_panel<class_EditorPlugin_method_hide_bottom_panel>` **(** **)** |
  94. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`make_bottom_panel_item_visible<class_EditorPlugin_method_make_bottom_panel_item_visible>` **(** :ref:`Control<class_Control>` item **)** |
  96. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`make_visible<class_EditorPlugin_method_make_visible>` **(** :ref:`bool<class_bool>` visible **)** |virtual| |
  98. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`queue_save_layout<class_EditorPlugin_method_queue_save_layout>` **(** **)** |const| |
  100. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`remove_autoload_singleton<class_EditorPlugin_method_remove_autoload_singleton>` **(** :ref:`String<class_String>` name **)** |
  102. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`remove_control_from_bottom_panel<class_EditorPlugin_method_remove_control_from_bottom_panel>` **(** :ref:`Control<class_Control>` control **)** |
  104. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`remove_control_from_container<class_EditorPlugin_method_remove_control_from_container>` **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)** |
  106. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | void | :ref:`remove_control_from_docks<class_EditorPlugin_method_remove_control_from_docks>` **(** :ref:`Control<class_Control>` control **)** |
  108. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | void | :ref:`remove_custom_type<class_EditorPlugin_method_remove_custom_type>` **(** :ref:`String<class_String>` type **)** |
  110. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`remove_export_plugin<class_EditorPlugin_method_remove_export_plugin>` **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)** |
  112. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`remove_import_plugin<class_EditorPlugin_method_remove_import_plugin>` **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)** |
  114. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | void | :ref:`remove_inspector_plugin<class_EditorPlugin_method_remove_inspector_plugin>` **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)** |
  116. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`remove_scene_import_plugin<class_EditorPlugin_method_remove_scene_import_plugin>` **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)** |
  118. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | void | :ref:`remove_spatial_gizmo_plugin<class_EditorPlugin_method_remove_spatial_gizmo_plugin>` **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)** |
  120. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | void | :ref:`remove_tool_menu_item<class_EditorPlugin_method_remove_tool_menu_item>` **(** :ref:`String<class_String>` name **)** |
  122. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | void | :ref:`save_external_data<class_EditorPlugin_method_save_external_data>` **(** **)** |virtual| |
  124. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | void | :ref:`set_force_draw_over_forwarding_enabled<class_EditorPlugin_method_set_force_draw_over_forwarding_enabled>` **(** **)** |
  126. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | void | :ref:`set_input_event_forwarding_always_enabled<class_EditorPlugin_method_set_input_event_forwarding_always_enabled>` **(** **)** |
  128. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | void | :ref:`set_state<class_EditorPlugin_method_set_state>` **(** :ref:`Dictionary<class_Dictionary>` state **)** |virtual| |
  130. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | void | :ref:`set_window_layout<class_EditorPlugin_method_set_window_layout>` **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** |virtual| |
  132. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`int<class_int>` | :ref:`update_overlays<class_EditorPlugin_method_update_overlays>` **(** **)** |const| |
  134. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. .. rst-class:: classref-section-separator
  136. ----
  137. .. rst-class:: classref-descriptions-group
  138. Signals
  139. -------
  140. .. _class_EditorPlugin_signal_main_screen_changed:
  141. .. rst-class:: classref-signal
  142. **main_screen_changed** **(** :ref:`String<class_String>` screen_name **)**
  143. Emitted when user changes the workspace (**2D**, **3D**, **Script**, **AssetLib**). Also works with custom screens defined by plugins.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_EditorPlugin_signal_resource_saved:
  147. .. rst-class:: classref-signal
  148. **resource_saved** **(** :ref:`Resource<class_Resource>` resource **)**
  149. .. container:: contribute
  150. There is currently no description for this signal. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  151. .. rst-class:: classref-item-separator
  152. ----
  153. .. _class_EditorPlugin_signal_scene_changed:
  154. .. rst-class:: classref-signal
  155. **scene_changed** **(** :ref:`Node<class_Node>` scene_root **)**
  156. 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``.
  157. .. rst-class:: classref-item-separator
  158. ----
  159. .. _class_EditorPlugin_signal_scene_closed:
  160. .. rst-class:: classref-signal
  161. **scene_closed** **(** :ref:`String<class_String>` filepath **)**
  162. Emitted when user closes a scene. The argument is file path to a closed scene.
  163. .. rst-class:: classref-section-separator
  164. ----
  165. .. rst-class:: classref-descriptions-group
  166. Enumerations
  167. ------------
  168. .. _enum_EditorPlugin_CustomControlContainer:
  169. .. rst-class:: classref-enumeration
  170. enum **CustomControlContainer**:
  171. .. _class_EditorPlugin_constant_CONTAINER_TOOLBAR:
  172. .. rst-class:: classref-enumeration-constant
  173. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_TOOLBAR** = ``0``
  174. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_MENU:
  175. .. rst-class:: classref-enumeration-constant
  176. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_SPATIAL_EDITOR_MENU** = ``1``
  177. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_SIDE_LEFT:
  178. .. rst-class:: classref-enumeration-constant
  179. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_SPATIAL_EDITOR_SIDE_LEFT** = ``2``
  180. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT:
  181. .. rst-class:: classref-enumeration-constant
  182. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT** = ``3``
  183. .. _class_EditorPlugin_constant_CONTAINER_SPATIAL_EDITOR_BOTTOM:
  184. .. rst-class:: classref-enumeration-constant
  185. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_SPATIAL_EDITOR_BOTTOM** = ``4``
  186. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_MENU:
  187. .. rst-class:: classref-enumeration-constant
  188. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_CANVAS_EDITOR_MENU** = ``5``
  189. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_SIDE_LEFT:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_CANVAS_EDITOR_SIDE_LEFT** = ``6``
  192. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_SIDE_RIGHT:
  193. .. rst-class:: classref-enumeration-constant
  194. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_CANVAS_EDITOR_SIDE_RIGHT** = ``7``
  195. .. _class_EditorPlugin_constant_CONTAINER_CANVAS_EDITOR_BOTTOM:
  196. .. rst-class:: classref-enumeration-constant
  197. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_CANVAS_EDITOR_BOTTOM** = ``8``
  198. .. _class_EditorPlugin_constant_CONTAINER_PROPERTY_EDITOR_BOTTOM:
  199. .. rst-class:: classref-enumeration-constant
  200. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_PROPERTY_EDITOR_BOTTOM** = ``9``
  201. .. _class_EditorPlugin_constant_CONTAINER_PROJECT_SETTING_TAB_LEFT:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_PROJECT_SETTING_TAB_LEFT** = ``10``
  204. .. _class_EditorPlugin_constant_CONTAINER_PROJECT_SETTING_TAB_RIGHT:
  205. .. rst-class:: classref-enumeration-constant
  206. :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` **CONTAINER_PROJECT_SETTING_TAB_RIGHT** = ``11``
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _enum_EditorPlugin_DockSlot:
  210. .. rst-class:: classref-enumeration
  211. enum **DockSlot**:
  212. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_UL:
  213. .. rst-class:: classref-enumeration-constant
  214. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_LEFT_UL** = ``0``
  215. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_BL:
  216. .. rst-class:: classref-enumeration-constant
  217. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_LEFT_BL** = ``1``
  218. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_UR:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_LEFT_UR** = ``2``
  221. .. _class_EditorPlugin_constant_DOCK_SLOT_LEFT_BR:
  222. .. rst-class:: classref-enumeration-constant
  223. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_LEFT_BR** = ``3``
  224. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_UL:
  225. .. rst-class:: classref-enumeration-constant
  226. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_RIGHT_UL** = ``4``
  227. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_BL:
  228. .. rst-class:: classref-enumeration-constant
  229. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_RIGHT_BL** = ``5``
  230. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_UR:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_RIGHT_UR** = ``6``
  233. .. _class_EditorPlugin_constant_DOCK_SLOT_RIGHT_BR:
  234. .. rst-class:: classref-enumeration-constant
  235. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_RIGHT_BR** = ``7``
  236. .. _class_EditorPlugin_constant_DOCK_SLOT_MAX:
  237. .. rst-class:: classref-enumeration-constant
  238. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **DOCK_SLOT_MAX** = ``8``
  239. Represents the size of the :ref:`DockSlot<enum_EditorPlugin_DockSlot>` enum.
  240. .. rst-class:: classref-section-separator
  241. ----
  242. .. rst-class:: classref-descriptions-group
  243. Method Descriptions
  244. -------------------
  245. .. _class_EditorPlugin_method_add_autoload_singleton:
  246. .. rst-class:: classref-method
  247. void **add_autoload_singleton** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` path **)**
  248. Adds a script at ``path`` to the Autoload list as ``name``.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_EditorPlugin_method_add_control_to_bottom_panel:
  252. .. rst-class:: classref-method
  253. :ref:`ToolButton<class_ToolButton>` **add_control_to_bottom_panel** **(** :ref:`Control<class_Control>` control, :ref:`String<class_String>` title **)**
  254. Adds 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 :ref:`Node.queue_free<class_Node_method_queue_free>`.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_EditorPlugin_method_add_control_to_container:
  258. .. rst-class:: classref-method
  259. void **add_control_to_container** **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)**
  260. Adds a custom control to a container (see :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>`). There are many locations where custom controls can be added in the editor UI.
  261. Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
  262. 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 :ref:`Node.queue_free<class_Node_method_queue_free>`.
  263. .. rst-class:: classref-item-separator
  264. ----
  265. .. _class_EditorPlugin_method_add_control_to_dock:
  266. .. rst-class:: classref-method
  267. void **add_control_to_dock** **(** :ref:`DockSlot<enum_EditorPlugin_DockSlot>` slot, :ref:`Control<class_Control>` control **)**
  268. Adds the control to a specific dock slot (see :ref:`DockSlot<enum_EditorPlugin_DockSlot>` for options).
  269. If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
  270. 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 :ref:`Node.queue_free<class_Node_method_queue_free>`.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_EditorPlugin_method_add_custom_type:
  274. .. rst-class:: classref-method
  275. void **add_custom_type** **(** :ref:`String<class_String>` type, :ref:`String<class_String>` base, :ref:`Script<class_Script>` script, :ref:`Texture<class_Texture>` icon **)**
  276. Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
  277. 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.
  278. 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 the ``is`` keyword.
  279. During run-time, this will be a simple object with a script so this function does not need to be called then.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_EditorPlugin_method_add_export_plugin:
  283. .. rst-class:: classref-method
  284. void **add_export_plugin** **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)**
  285. Registers a new :ref:`EditorExportPlugin<class_EditorExportPlugin>`. Export plugins are used to perform tasks when the project is being exported.
  286. See :ref:`add_inspector_plugin<class_EditorPlugin_method_add_inspector_plugin>` for an example of how to register a plugin.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_EditorPlugin_method_add_import_plugin:
  290. .. rst-class:: classref-method
  291. void **add_import_plugin** **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)**
  292. Registers a new :ref:`EditorImportPlugin<class_EditorImportPlugin>`. Import plugins are used to import custom and unsupported assets as a custom :ref:`Resource<class_Resource>` type.
  293. \ **Note:** If you want to import custom 3D asset formats use :ref:`add_scene_import_plugin<class_EditorPlugin_method_add_scene_import_plugin>` instead.
  294. See :ref:`add_inspector_plugin<class_EditorPlugin_method_add_inspector_plugin>` for an example of how to register a plugin.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_EditorPlugin_method_add_inspector_plugin:
  298. .. rst-class:: classref-method
  299. void **add_inspector_plugin** **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)**
  300. Registers a new :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>`. Inspector plugins are used to extend :ref:`EditorInspector<class_EditorInspector>` and provide custom configuration tools for your object's properties.
  301. \ **Note:** Always use :ref:`remove_inspector_plugin<class_EditorPlugin_method_remove_inspector_plugin>` to remove the registered :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` when your **EditorPlugin** is disabled to prevent leaks and an unexpected behavior.
  302. ::
  303. const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
  304. var inspector_plugin = MyInspectorPlugin.new()
  305. func _enter_tree():
  306. add_inspector_plugin(inspector_plugin)
  307. func _exit_tree():
  308. remove_inspector_plugin(inspector_plugin)
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_EditorPlugin_method_add_scene_import_plugin:
  312. .. rst-class:: classref-method
  313. void **add_scene_import_plugin** **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)**
  314. Registers a new :ref:`EditorSceneImporter<class_EditorSceneImporter>`. Scene importers are used to import custom 3D asset formats as scenes.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_EditorPlugin_method_add_spatial_gizmo_plugin:
  318. .. rst-class:: classref-method
  319. void **add_spatial_gizmo_plugin** **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)**
  320. Registers a new :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>`. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a :ref:`Spatial<class_Spatial>`.
  321. See :ref:`add_inspector_plugin<class_EditorPlugin_method_add_inspector_plugin>` for an example of how to register a plugin.
  322. .. rst-class:: classref-item-separator
  323. ----
  324. .. _class_EditorPlugin_method_add_tool_menu_item:
  325. .. rst-class:: classref-method
  326. 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 **)**
  327. 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.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_EditorPlugin_method_add_tool_submenu_item:
  331. .. rst-class:: classref-method
  332. void **add_tool_submenu_item** **(** :ref:`String<class_String>` name, :ref:`Object<class_Object>` submenu **)**
  333. 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)``.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_EditorPlugin_method_apply_changes:
  337. .. rst-class:: classref-method
  338. void **apply_changes** **(** **)** |virtual|
  339. 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.
  340. 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.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_EditorPlugin_method_build:
  344. .. rst-class:: classref-method
  345. :ref:`bool<class_bool>` **build** **(** **)** |virtual|
  346. This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
  347. This method must return a boolean. If this method returns ``false``, the project will not run. The run is aborted immediately, so this also prevents all other plugins' :ref:`build<class_EditorPlugin_method_build>` methods from running.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_EditorPlugin_method_clear:
  351. .. rst-class:: classref-method
  352. void **clear** **(** **)** |virtual|
  353. 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.
  354. .. rst-class:: classref-item-separator
  355. ----
  356. .. _class_EditorPlugin_method_disable_plugin:
  357. .. rst-class:: classref-method
  358. void **disable_plugin** **(** **)** |virtual|
  359. Called by the engine when the user disables the **EditorPlugin** in the Plugin tab of the project settings window.
  360. .. rst-class:: classref-item-separator
  361. ----
  362. .. _class_EditorPlugin_method_edit:
  363. .. rst-class:: classref-method
  364. void **edit** **(** :ref:`Object<class_Object>` object **)** |virtual|
  365. This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
  366. .. rst-class:: classref-item-separator
  367. ----
  368. .. _class_EditorPlugin_method_enable_plugin:
  369. .. rst-class:: classref-method
  370. void **enable_plugin** **(** **)** |virtual|
  371. Called by the engine when the user enables the **EditorPlugin** in the Plugin tab of the project settings window.
  372. .. rst-class:: classref-item-separator
  373. ----
  374. .. _class_EditorPlugin_method_forward_canvas_draw_over_viewport:
  375. .. rst-class:: classref-method
  376. void **forward_canvas_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** |virtual|
  377. Called by the engine when the 2D editor's viewport is updated. Use the ``overlay`` :ref:`Control<class_Control>` for drawing. You can update the viewport manually by calling :ref:`update_overlays<class_EditorPlugin_method_update_overlays>`.
  378. ::
  379. func forward_canvas_draw_over_viewport(overlay):
  380. # Draw a circle at cursor position.
  381. overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white)
  382. func forward_canvas_gui_input(event):
  383. if event is InputEventMouseMotion:
  384. # Redraw viewport when cursor is moved.
  385. update_overlays()
  386. return true
  387. return false
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_EditorPlugin_method_forward_canvas_force_draw_over_viewport:
  391. .. rst-class:: classref-method
  392. void **forward_canvas_force_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** |virtual|
  393. This method is the same as :ref:`forward_canvas_draw_over_viewport<class_EditorPlugin_method_forward_canvas_draw_over_viewport>`, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
  394. You need to enable calling of this method by using :ref:`set_force_draw_over_forwarding_enabled<class_EditorPlugin_method_set_force_draw_over_forwarding_enabled>`.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_EditorPlugin_method_forward_canvas_gui_input:
  398. .. rst-class:: classref-method
  399. :ref:`bool<class_bool>` **forward_canvas_gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  400. Called when there is a root node in the current edited scene, :ref:`handles<class_EditorPlugin_method_handles>` is implemented and an :ref:`InputEvent<class_InputEvent>` happens in the 2D viewport. Intercepts the :ref:`InputEvent<class_InputEvent>`, if ``return true`` **EditorPlugin** consumes the ``event``, otherwise forwards ``event`` to other Editor classes. Example:
  401. ::
  402. # Prevents the InputEvent to reach other Editor classes
  403. func forward_canvas_gui_input(event):
  404. var forward = true
  405. return forward
  406. Must ``return false`` in order to forward the :ref:`InputEvent<class_InputEvent>` to other Editor classes. Example:
  407. ::
  408. # Consumes InputEventMouseMotion and forwards other InputEvent types
  409. func forward_canvas_gui_input(event):
  410. var forward = false
  411. if event is InputEventMouseMotion:
  412. forward = true
  413. return forward
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_EditorPlugin_method_forward_spatial_draw_over_viewport:
  417. .. rst-class:: classref-method
  418. void **forward_spatial_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** |virtual|
  419. Called by the engine when the 3D editor's viewport is updated. Use the ``overlay`` :ref:`Control<class_Control>` for drawing. You can update the viewport manually by calling :ref:`update_overlays<class_EditorPlugin_method_update_overlays>`.
  420. ::
  421. func forward_spatial_draw_over_viewport(overlay):
  422. # Draw a circle at cursor position.
  423. overlay.draw_circle(overlay.get_local_mouse_position(), 64)
  424. func forward_spatial_gui_input(camera, event):
  425. if event is InputEventMouseMotion:
  426. # Redraw viewport when cursor is moved.
  427. update_overlays()
  428. return true
  429. return false
  430. .. rst-class:: classref-item-separator
  431. ----
  432. .. _class_EditorPlugin_method_forward_spatial_force_draw_over_viewport:
  433. .. rst-class:: classref-method
  434. void **forward_spatial_force_draw_over_viewport** **(** :ref:`Control<class_Control>` overlay **)** |virtual|
  435. This method is the same as :ref:`forward_spatial_draw_over_viewport<class_EditorPlugin_method_forward_spatial_draw_over_viewport>`, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
  436. You need to enable calling of this method by using :ref:`set_force_draw_over_forwarding_enabled<class_EditorPlugin_method_set_force_draw_over_forwarding_enabled>`.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_EditorPlugin_method_forward_spatial_gui_input:
  440. .. rst-class:: classref-method
  441. :ref:`bool<class_bool>` **forward_spatial_gui_input** **(** :ref:`Camera<class_Camera>` camera, :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  442. Called when there is a root node in the current edited scene, :ref:`handles<class_EditorPlugin_method_handles>` is implemented and an :ref:`InputEvent<class_InputEvent>` happens in the 3D viewport. Intercepts the :ref:`InputEvent<class_InputEvent>`, if ``return true`` **EditorPlugin** consumes the ``event``, otherwise forwards ``event`` to other Editor classes. Example:
  443. ::
  444. # Prevents the InputEvent to reach other Editor classes
  445. func forward_spatial_gui_input(camera, event):
  446. var forward = true
  447. return forward
  448. Must ``return false`` in order to forward the :ref:`InputEvent<class_InputEvent>` to other Editor classes. Example:
  449. ::
  450. # Consumes InputEventMouseMotion and forwards other InputEvent types
  451. func forward_spatial_gui_input(camera, event):
  452. var forward = false
  453. if event is InputEventMouseMotion:
  454. forward = true
  455. return forward
  456. .. rst-class:: classref-item-separator
  457. ----
  458. .. _class_EditorPlugin_method_get_breakpoints:
  459. .. rst-class:: classref-method
  460. :ref:`PoolStringArray<class_PoolStringArray>` **get_breakpoints** **(** **)** |virtual|
  461. 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``.
  462. .. rst-class:: classref-item-separator
  463. ----
  464. .. _class_EditorPlugin_method_get_editor_interface:
  465. .. rst-class:: classref-method
  466. :ref:`EditorInterface<class_EditorInterface>` **get_editor_interface** **(** **)**
  467. Returns the :ref:`EditorInterface<class_EditorInterface>` object that gives you control over Godot editor's window and its functionalities.
  468. .. rst-class:: classref-item-separator
  469. ----
  470. .. _class_EditorPlugin_method_get_plugin_icon:
  471. .. rst-class:: classref-method
  472. :ref:`Texture<class_Texture>` **get_plugin_icon** **(** **)** |virtual|
  473. Override this method in your plugin to return a :ref:`Texture<class_Texture>` in order to give it an icon.
  474. For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
  475. Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size.
  476. ::
  477. func get_plugin_icon():
  478. # You can use a custom icon:
  479. return preload("res://addons/my_plugin/my_plugin_icon.svg")
  480. # Or use a built-in icon:
  481. return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
  482. .. rst-class:: classref-item-separator
  483. ----
  484. .. _class_EditorPlugin_method_get_plugin_name:
  485. .. rst-class:: classref-method
  486. :ref:`String<class_String>` **get_plugin_name** **(** **)** |virtual|
  487. Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor.
  488. For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
  489. .. rst-class:: classref-item-separator
  490. ----
  491. .. _class_EditorPlugin_method_get_script_create_dialog:
  492. .. rst-class:: classref-method
  493. :ref:`ScriptCreateDialog<class_ScriptCreateDialog>` **get_script_create_dialog** **(** **)**
  494. Gets the Editor's dialog used for making scripts.
  495. \ **Note:** Users can configure it before use.
  496. \ **Warning:** Removing and freeing this node will render a part of the editor useless and may cause a crash.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_EditorPlugin_method_get_state:
  500. .. rst-class:: classref-method
  501. :ref:`Dictionary<class_Dictionary>` **get_state** **(** **)** |virtual|
  502. Override this method to provide a state data you want to be saved, like view position, grid settings, folding, etc. 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). This data is automatically saved for each scene in an ``editstate`` file in the editor metadata folder. If you want to store global (scene-independent) editor data for your plugin, you can use :ref:`get_window_layout<class_EditorPlugin_method_get_window_layout>` instead.
  503. Use :ref:`set_state<class_EditorPlugin_method_set_state>` to restore your saved state.
  504. \ **Note:** This method should not be used to save important settings that should persist with the project.
  505. \ **Note:** You must implement :ref:`get_plugin_name<class_EditorPlugin_method_get_plugin_name>` for the state to be stored and restored correctly.
  506. ::
  507. func get_state():
  508. var state = {"zoom": zoom, "preferred_color": my_color}
  509. return state
  510. .. rst-class:: classref-item-separator
  511. ----
  512. .. _class_EditorPlugin_method_get_undo_redo:
  513. .. rst-class:: classref-method
  514. :ref:`UndoRedo<class_UndoRedo>` **get_undo_redo** **(** **)**
  515. Gets 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.
  516. .. rst-class:: classref-item-separator
  517. ----
  518. .. _class_EditorPlugin_method_get_window_layout:
  519. .. rst-class:: classref-method
  520. void **get_window_layout** **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** |virtual|
  521. Override this method to provide the GUI layout of the plugin or any other data you want to be stored. 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). The data is stored in the ``editor_layout.cfg`` file in the editor metadata directory.
  522. Use :ref:`set_window_layout<class_EditorPlugin_method_set_window_layout>` to restore your saved layout.
  523. ::
  524. func get_window_layout(configuration):
  525. configuration.set_value("MyPlugin", "window_position", $Window.position)
  526. configuration.set_value("MyPlugin", "icon_color", $Icon.modulate)
  527. .. rst-class:: classref-item-separator
  528. ----
  529. .. _class_EditorPlugin_method_handles:
  530. .. rst-class:: classref-method
  531. :ref:`bool<class_bool>` **handles** **(** :ref:`Object<class_Object>` object **)** |virtual|
  532. 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.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_EditorPlugin_method_has_main_screen:
  536. .. rst-class:: classref-method
  537. :ref:`bool<class_bool>` **has_main_screen** **(** **)** |virtual|
  538. Returns ``true`` if this is a main screen editor plugin (it goes in the workspace selector together with **2D**, **3D**, **Script** and **AssetLib**).
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _class_EditorPlugin_method_hide_bottom_panel:
  542. .. rst-class:: classref-method
  543. void **hide_bottom_panel** **(** **)**
  544. Minimizes the bottom panel.
  545. .. rst-class:: classref-item-separator
  546. ----
  547. .. _class_EditorPlugin_method_make_bottom_panel_item_visible:
  548. .. rst-class:: classref-method
  549. void **make_bottom_panel_item_visible** **(** :ref:`Control<class_Control>` item **)**
  550. Makes a specific item in the bottom panel visible.
  551. .. rst-class:: classref-item-separator
  552. ----
  553. .. _class_EditorPlugin_method_make_visible:
  554. .. rst-class:: classref-method
  555. void **make_visible** **(** :ref:`bool<class_bool>` visible **)** |virtual|
  556. This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
  557. Remember that you have to manage the visibility of all your editor controls manually.
  558. .. rst-class:: classref-item-separator
  559. ----
  560. .. _class_EditorPlugin_method_queue_save_layout:
  561. .. rst-class:: classref-method
  562. void **queue_save_layout** **(** **)** |const|
  563. Queue save the project's editor layout.
  564. .. rst-class:: classref-item-separator
  565. ----
  566. .. _class_EditorPlugin_method_remove_autoload_singleton:
  567. .. rst-class:: classref-method
  568. void **remove_autoload_singleton** **(** :ref:`String<class_String>` name **)**
  569. Removes an Autoload ``name`` from the list.
  570. .. rst-class:: classref-item-separator
  571. ----
  572. .. _class_EditorPlugin_method_remove_control_from_bottom_panel:
  573. .. rst-class:: classref-method
  574. void **remove_control_from_bottom_panel** **(** :ref:`Control<class_Control>` control **)**
  575. Removes the control from the bottom panel. You have to manually :ref:`Node.queue_free<class_Node_method_queue_free>` the control.
  576. .. rst-class:: classref-item-separator
  577. ----
  578. .. _class_EditorPlugin_method_remove_control_from_container:
  579. .. rst-class:: classref-method
  580. void **remove_control_from_container** **(** :ref:`CustomControlContainer<enum_EditorPlugin_CustomControlContainer>` container, :ref:`Control<class_Control>` control **)**
  581. Removes the control from the specified container. You have to manually :ref:`Node.queue_free<class_Node_method_queue_free>` the control.
  582. .. rst-class:: classref-item-separator
  583. ----
  584. .. _class_EditorPlugin_method_remove_control_from_docks:
  585. .. rst-class:: classref-method
  586. void **remove_control_from_docks** **(** :ref:`Control<class_Control>` control **)**
  587. Removes the control from the dock. You have to manually :ref:`Node.queue_free<class_Node_method_queue_free>` the control.
  588. .. rst-class:: classref-item-separator
  589. ----
  590. .. _class_EditorPlugin_method_remove_custom_type:
  591. .. rst-class:: classref-method
  592. void **remove_custom_type** **(** :ref:`String<class_String>` type **)**
  593. Removes a custom type added by :ref:`add_custom_type<class_EditorPlugin_method_add_custom_type>`.
  594. .. rst-class:: classref-item-separator
  595. ----
  596. .. _class_EditorPlugin_method_remove_export_plugin:
  597. .. rst-class:: classref-method
  598. void **remove_export_plugin** **(** :ref:`EditorExportPlugin<class_EditorExportPlugin>` plugin **)**
  599. Removes an export plugin registered by :ref:`add_export_plugin<class_EditorPlugin_method_add_export_plugin>`.
  600. .. rst-class:: classref-item-separator
  601. ----
  602. .. _class_EditorPlugin_method_remove_import_plugin:
  603. .. rst-class:: classref-method
  604. void **remove_import_plugin** **(** :ref:`EditorImportPlugin<class_EditorImportPlugin>` importer **)**
  605. Removes an import plugin registered by :ref:`add_import_plugin<class_EditorPlugin_method_add_import_plugin>`.
  606. .. rst-class:: classref-item-separator
  607. ----
  608. .. _class_EditorPlugin_method_remove_inspector_plugin:
  609. .. rst-class:: classref-method
  610. void **remove_inspector_plugin** **(** :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` plugin **)**
  611. Removes an inspector plugin registered by :ref:`add_import_plugin<class_EditorPlugin_method_add_import_plugin>`
  612. .. rst-class:: classref-item-separator
  613. ----
  614. .. _class_EditorPlugin_method_remove_scene_import_plugin:
  615. .. rst-class:: classref-method
  616. void **remove_scene_import_plugin** **(** :ref:`EditorSceneImporter<class_EditorSceneImporter>` scene_importer **)**
  617. Removes a scene importer registered by :ref:`add_scene_import_plugin<class_EditorPlugin_method_add_scene_import_plugin>`.
  618. .. rst-class:: classref-item-separator
  619. ----
  620. .. _class_EditorPlugin_method_remove_spatial_gizmo_plugin:
  621. .. rst-class:: classref-method
  622. void **remove_spatial_gizmo_plugin** **(** :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` plugin **)**
  623. Removes a gizmo plugin registered by :ref:`add_spatial_gizmo_plugin<class_EditorPlugin_method_add_spatial_gizmo_plugin>`.
  624. .. rst-class:: classref-item-separator
  625. ----
  626. .. _class_EditorPlugin_method_remove_tool_menu_item:
  627. .. rst-class:: classref-method
  628. void **remove_tool_menu_item** **(** :ref:`String<class_String>` name **)**
  629. Removes a menu ``name`` from **Project > Tools**.
  630. .. rst-class:: classref-item-separator
  631. ----
  632. .. _class_EditorPlugin_method_save_external_data:
  633. .. rst-class:: classref-method
  634. void **save_external_data** **(** **)** |virtual|
  635. 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.
  636. .. rst-class:: classref-item-separator
  637. ----
  638. .. _class_EditorPlugin_method_set_force_draw_over_forwarding_enabled:
  639. .. rst-class:: classref-method
  640. void **set_force_draw_over_forwarding_enabled** **(** **)**
  641. Enables calling of :ref:`forward_canvas_force_draw_over_viewport<class_EditorPlugin_method_forward_canvas_force_draw_over_viewport>` for the 2D editor and :ref:`forward_spatial_force_draw_over_viewport<class_EditorPlugin_method_forward_spatial_force_draw_over_viewport>` for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
  642. .. rst-class:: classref-item-separator
  643. ----
  644. .. _class_EditorPlugin_method_set_input_event_forwarding_always_enabled:
  645. .. rst-class:: classref-method
  646. void **set_input_event_forwarding_always_enabled** **(** **)**
  647. 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.
  648. .. rst-class:: classref-item-separator
  649. ----
  650. .. _class_EditorPlugin_method_set_state:
  651. .. rst-class:: classref-method
  652. void **set_state** **(** :ref:`Dictionary<class_Dictionary>` state **)** |virtual|
  653. Restore the state saved by :ref:`get_state<class_EditorPlugin_method_get_state>`. This method is called when the current scene tab is changed in the editor.
  654. \ **Note:** Your plugin must implement :ref:`get_plugin_name<class_EditorPlugin_method_get_plugin_name>`, otherwise it will not be recognized and this method will not be called.
  655. ::
  656. func set_state(data):
  657. zoom = data.get("zoom", 1.0)
  658. preferred_color = data.get("my_color", Color.white)
  659. .. rst-class:: classref-item-separator
  660. ----
  661. .. _class_EditorPlugin_method_set_window_layout:
  662. .. rst-class:: classref-method
  663. void **set_window_layout** **(** :ref:`ConfigFile<class_ConfigFile>` layout **)** |virtual|
  664. Restore the plugin GUI layout and data saved by :ref:`get_window_layout<class_EditorPlugin_method_get_window_layout>`. This method is called for every plugin on editor startup. Use the provided ``configuration`` file to read your saved data.
  665. ::
  666. func set_window_layout(configuration):
  667. $Window.position = configuration.get_value("MyPlugin", "window_position", Vector2())
  668. $Icon.modulate = configuration.get_value("MyPlugin", "icon_color", Color.white)
  669. .. rst-class:: classref-item-separator
  670. ----
  671. .. _class_EditorPlugin_method_update_overlays:
  672. .. rst-class:: classref-method
  673. :ref:`int<class_int>` **update_overlays** **(** **)** |const|
  674. Updates the overlays of the 2D and 3D editor viewport. Causes methods :ref:`forward_canvas_draw_over_viewport<class_EditorPlugin_method_forward_canvas_draw_over_viewport>`, :ref:`forward_canvas_force_draw_over_viewport<class_EditorPlugin_method_forward_canvas_force_draw_over_viewport>`, :ref:`forward_spatial_draw_over_viewport<class_EditorPlugin_method_forward_spatial_draw_over_viewport>` and :ref:`forward_spatial_force_draw_over_viewport<class_EditorPlugin_method_forward_spatial_force_draw_over_viewport>` to be called.
  675. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  676. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  677. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  678. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`