Script.xml 3.8 KB

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