EditorScript.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorScript" inherits="Reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Base script that can be used to add extension functions to the editor.
  5. </brief_description>
  6. <description>
  7. Scripts extending this class and implementing its [method _run] method can be executed from the Script Editor's [b]File &gt; Run[/b] menu option (or by pressing [kbd]Ctrl + Shift + X[/kbd]) while the editor is running. This is useful for adding custom in-editor functionality to Godot. For more complex additions, consider using [EditorPlugin]s instead.
  8. [b]Note:[/b] Extending scripts need to have [code]tool[/code] mode enabled.
  9. [b]Example script:[/b]
  10. [codeblock]
  11. tool
  12. extends EditorScript
  13. func _run():
  14. print("Hello from the Godot Editor!")
  15. [/codeblock]
  16. [b]Note:[/b] The script is run in the Editor context, which means the output is visible in the console window started with the Editor (stdout) instead of the usual Godot [b]Output[/b] dock.
  17. [b]Note:[/b] EditorScript is reference counted, meaning it is destroyed when nothing references it. This can cause errors during asynchronous operations if there are no references to the script.
  18. </description>
  19. <tutorials>
  20. </tutorials>
  21. <methods>
  22. <method name="_run" qualifiers="virtual">
  23. <return type="void" />
  24. <description>
  25. This method is executed by the Editor when [b]File &gt; Run[/b] is used.
  26. </description>
  27. </method>
  28. <method name="add_root_node">
  29. <return type="void" />
  30. <argument index="0" name="node" type="Node" />
  31. <description>
  32. Adds [code]node[/code] as a child of the root node in the editor context.
  33. [b]Warning:[/b] The implementation of this method is currently disabled.
  34. </description>
  35. </method>
  36. <method name="get_editor_interface">
  37. <return type="EditorInterface" />
  38. <description>
  39. Returns the [EditorInterface] singleton instance.
  40. </description>
  41. </method>
  42. <method name="get_scene">
  43. <return type="Node" />
  44. <description>
  45. Returns the Editor's currently active scene.
  46. </description>
  47. </method>
  48. </methods>
  49. <constants>
  50. </constants>
  51. </class>