EditorScript.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorScript" inherits="RefCounted" version="4.0">
  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. [codeblocks]
  11. [gdscript]
  12. tool
  13. extends EditorScript
  14. func _run():
  15. print("Hello from the Godot Editor!")
  16. [/gdscript]
  17. [csharp]
  18. using Godot;
  19. using System;
  20. [Tool]
  21. public class HelloEditor : EditorScript
  22. {
  23. public override void _Run()
  24. {
  25. GD.Print("Hello from the Godot Editor!");
  26. }
  27. }
  28. [/csharp]
  29. [/codeblocks]
  30. [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.
  31. </description>
  32. <tutorials>
  33. </tutorials>
  34. <methods>
  35. <method name="_run" qualifiers="virtual">
  36. <return type="void" />
  37. <description>
  38. This method is executed by the Editor when [b]File &gt; Run[/b] is used.
  39. </description>
  40. </method>
  41. <method name="add_root_node">
  42. <return type="void" />
  43. <argument index="0" name="node" type="Node" />
  44. <description>
  45. Adds [code]node[/code] as a child of the root node in the editor context.
  46. [b]Warning:[/b] The implementation of this method is currently disabled.
  47. </description>
  48. </method>
  49. <method name="get_editor_interface">
  50. <return type="EditorInterface" />
  51. <description>
  52. Returns the [EditorInterface] singleton instance.
  53. </description>
  54. </method>
  55. <method name="get_scene">
  56. <return type="Node" />
  57. <description>
  58. Returns the Editor's currently active scene.
  59. </description>
  60. </method>
  61. </methods>
  62. </class>