Script.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Script" inherits="Resource" version="3.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 extends 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/latest/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="get_property_default_value">
  36. <return type="Variant">
  37. </return>
  38. <argument index="0" name="property" type="String">
  39. </argument>
  40. <description>
  41. </description>
  42. </method>
  43. <method name="get_script_constant_map">
  44. <return type="Dictionary">
  45. </return>
  46. <description>
  47. </description>
  48. </method>
  49. <method name="get_script_method_list">
  50. <return type="Array">
  51. </return>
  52. <description>
  53. </description>
  54. </method>
  55. <method name="get_script_property_list">
  56. <return type="Array">
  57. </return>
  58. <description>
  59. </description>
  60. </method>
  61. <method name="get_script_signal_list">
  62. <return type="Array">
  63. </return>
  64. <description>
  65. </description>
  66. </method>
  67. <method name="has_script_signal" qualifiers="const">
  68. <return type="bool">
  69. </return>
  70. <argument index="0" name="signal_name" type="String">
  71. </argument>
  72. <description>
  73. Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
  74. </description>
  75. </method>
  76. <method name="has_source_code" qualifiers="const">
  77. <return type="bool">
  78. </return>
  79. <description>
  80. Returns [code]true[/code] if the script contains non-empty source code.
  81. </description>
  82. </method>
  83. <method name="instance_has" qualifiers="const">
  84. <return type="bool">
  85. </return>
  86. <argument index="0" name="base_object" type="Object">
  87. </argument>
  88. <description>
  89. Returns [code]true[/code] if [code]base_object[/code] is an instance of this script.
  90. </description>
  91. </method>
  92. <method name="is_tool" qualifiers="const">
  93. <return type="bool">
  94. </return>
  95. <description>
  96. Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
  97. </description>
  98. </method>
  99. <method name="reload">
  100. <return type="int" enum="Error">
  101. </return>
  102. <argument index="0" name="keep_state" type="bool" default="false">
  103. </argument>
  104. <description>
  105. Reloads the script's class implementation. Returns an error code.
  106. </description>
  107. </method>
  108. </methods>
  109. <members>
  110. <member name="source_code" type="String" setter="set_source_code" getter="get_source_code">
  111. The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.
  112. </member>
  113. </members>
  114. <constants>
  115. </constants>
  116. </class>