EditorScript.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorScript" inherits="Reference" category="Core" version="3.1">
  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 [code]_run()[/code] method can be executed from the Script Editor's [code]File -&gt; Run[/code] 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. Note that extending scripts need to have [code]tool mode[/code] enabled.
  8. Example script:
  9. [codeblock]
  10. tool
  11. extends EditorScript
  12. func _run():
  13. print("Hello from the Godot Editor!")
  14. [/codeblock]
  15. Note that 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 [i]Output[/i] dock.
  16. </description>
  17. <tutorials>
  18. </tutorials>
  19. <demos>
  20. </demos>
  21. <methods>
  22. <method name="_run" qualifiers="virtual">
  23. <return type="void">
  24. </return>
  25. <description>
  26. This method is executed by the Editor when [code]File -&gt; Run[/code] is used.
  27. </description>
  28. </method>
  29. <method name="add_root_node">
  30. <return type="void">
  31. </return>
  32. <argument index="0" name="node" type="Node">
  33. </argument>
  34. <description>
  35. Adds [code]node[/code] as a child of the root node in the editor context.
  36. WARNING: The implementation of this method is currently disabled.
  37. </description>
  38. </method>
  39. <method name="get_editor_interface">
  40. <return type="EditorInterface">
  41. </return>
  42. <description>
  43. Returns the [EditorInterface] singleton instance.
  44. </description>
  45. </method>
  46. <method name="get_scene">
  47. <return type="Node">
  48. </return>
  49. <description>
  50. Returns the Editor's currently active scene.
  51. </description>
  52. </method>
  53. </methods>
  54. <constants>
  55. </constants>
  56. </class>