EditorScript.xml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorScript" inherits="Reference" version="3.2">
  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. </return>
  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. </return>
  31. <argument index="0" name="node" type="Node">
  32. </argument>
  33. <description>
  34. Adds [code]node[/code] as a child of the root node in the editor context.
  35. [b]Warning:[/b] The implementation of this method is currently disabled.
  36. </description>
  37. </method>
  38. <method name="get_editor_interface">
  39. <return type="EditorInterface">
  40. </return>
  41. <description>
  42. Returns the [EditorInterface] singleton instance.
  43. </description>
  44. </method>
  45. <method name="get_scene">
  46. <return type="Node">
  47. </return>
  48. <description>
  49. Returns the Editor's currently active scene.
  50. </description>
  51. </method>
  52. </methods>
  53. <constants>
  54. </constants>
  55. </class>