EditorScript.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorScript" inherits="Reference" version="3.4">
  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 [code]Ctrl+Shift+X[/code]) 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. </description>
  18. <tutorials>
  19. </tutorials>
  20. <methods>
  21. <method name="_run" qualifiers="virtual">
  22. <return type="void" />
  23. <description>
  24. This method is executed by the Editor when [b]File &gt; Run[/b] is used.
  25. </description>
  26. </method>
  27. <method name="add_root_node">
  28. <return type="void" />
  29. <argument index="0" name="node" type="Node" />
  30. <description>
  31. Adds [code]node[/code] as a child of the root node in the editor context.
  32. [b]Warning:[/b] The implementation of this method is currently disabled.
  33. </description>
  34. </method>
  35. <method name="get_editor_interface">
  36. <return type="EditorInterface" />
  37. <description>
  38. Returns the [EditorInterface] singleton instance.
  39. </description>
  40. </method>
  41. <method name="get_scene">
  42. <return type="Node" />
  43. <description>
  44. Returns the Editor's currently active scene.
  45. </description>
  46. </method>
  47. </methods>
  48. <constants>
  49. </constants>
  50. </class>