Script.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Script" inherits="Resource" category="Core" version="3.1.2">
  3. <brief_description>
  4. A class stored as a resource.
  5. </brief_description>
  6. <description>
  7. A class stored as a resource. A script exends the functionality of all objects that instance it.
  8. The [code]new[/code] method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
  9. </description>
  10. <tutorials>
  11. <link>https://docs.godotengine.org/en/3.1/getting_started/step_by_step/scripting.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="can_instance" qualifiers="const">
  15. <return type="bool">
  16. </return>
  17. <description>
  18. Returns [code]true[/code] if the script can be instanced.
  19. </description>
  20. </method>
  21. <method name="get_base_script" qualifiers="const">
  22. <return type="Script">
  23. </return>
  24. <description>
  25. Returns the script directly inherited by this script.
  26. </description>
  27. </method>
  28. <method name="get_instance_base_type" qualifiers="const">
  29. <return type="String">
  30. </return>
  31. <description>
  32. Returns the script's base type.
  33. </description>
  34. </method>
  35. <method name="has_script_signal" qualifiers="const">
  36. <return type="bool">
  37. </return>
  38. <argument index="0" name="signal_name" type="String">
  39. </argument>
  40. <description>
  41. Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
  42. </description>
  43. </method>
  44. <method name="has_source_code" qualifiers="const">
  45. <return type="bool">
  46. </return>
  47. <description>
  48. Returns [code]true[/code] if the script contains non-empty source code.
  49. </description>
  50. </method>
  51. <method name="instance_has" qualifiers="const">
  52. <return type="bool">
  53. </return>
  54. <argument index="0" name="base_object" type="Object">
  55. </argument>
  56. <description>
  57. Returns [code]true[/code] if [code]base_object[/code] is an instance of this script.
  58. </description>
  59. </method>
  60. <method name="is_tool" qualifiers="const">
  61. <return type="bool">
  62. </return>
  63. <description>
  64. Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
  65. </description>
  66. </method>
  67. <method name="reload">
  68. <return type="int" enum="Error">
  69. </return>
  70. <argument index="0" name="keep_state" type="bool" default="false">
  71. </argument>
  72. <description>
  73. Reloads the script's class implementation. Returns an error code.
  74. </description>
  75. </method>
  76. </methods>
  77. <members>
  78. <member name="source_code" type="String" setter="set_source_code" getter="get_source_code">
  79. The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.
  80. </member>
  81. </members>
  82. <constants>
  83. </constants>
  84. </class>