Script.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Script" inherits="Resource" version="3.4">
  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.4/getting_started/step_by_step/scripting.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="can_instance" qualifiers="const">
  15. <return type="bool" />
  16. <description>
  17. Returns [code]true[/code] if the script can be instanced.
  18. </description>
  19. </method>
  20. <method name="get_base_script" qualifiers="const">
  21. <return type="Script" />
  22. <description>
  23. Returns the script directly inherited by this script.
  24. </description>
  25. </method>
  26. <method name="get_instance_base_type" qualifiers="const">
  27. <return type="String" />
  28. <description>
  29. Returns the script's base type.
  30. </description>
  31. </method>
  32. <method name="get_property_default_value">
  33. <return type="Variant" />
  34. <argument index="0" name="property" type="String" />
  35. <description>
  36. Returns the default value of the specified property.
  37. </description>
  38. </method>
  39. <method name="get_script_constant_map">
  40. <return type="Dictionary" />
  41. <description>
  42. Returns a dictionary containing constant names and their values.
  43. </description>
  44. </method>
  45. <method name="get_script_method_list">
  46. <return type="Array" />
  47. <description>
  48. Returns the list of methods in this [Script].
  49. </description>
  50. </method>
  51. <method name="get_script_property_list">
  52. <return type="Array" />
  53. <description>
  54. Returns the list of properties in this [Script].
  55. </description>
  56. </method>
  57. <method name="get_script_signal_list">
  58. <return type="Array" />
  59. <description>
  60. Returns the list of user signals defined in this [Script].
  61. </description>
  62. </method>
  63. <method name="has_script_signal" qualifiers="const">
  64. <return type="bool" />
  65. <argument index="0" name="signal_name" type="String" />
  66. <description>
  67. Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
  68. </description>
  69. </method>
  70. <method name="has_source_code" qualifiers="const">
  71. <return type="bool" />
  72. <description>
  73. Returns [code]true[/code] if the script contains non-empty source code.
  74. </description>
  75. </method>
  76. <method name="instance_has" qualifiers="const">
  77. <return type="bool" />
  78. <argument index="0" name="base_object" type="Object" />
  79. <description>
  80. Returns [code]true[/code] if [code]base_object[/code] is an instance of this script.
  81. </description>
  82. </method>
  83. <method name="is_tool" qualifiers="const">
  84. <return type="bool" />
  85. <description>
  86. Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
  87. </description>
  88. </method>
  89. <method name="reload">
  90. <return type="int" enum="Error" />
  91. <argument index="0" name="keep_state" type="bool" default="false" />
  92. <description>
  93. Reloads the script's class implementation. Returns an error code.
  94. </description>
  95. </method>
  96. </methods>
  97. <members>
  98. <member name="source_code" type="String" setter="set_source_code" getter="get_source_code">
  99. The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.
  100. </member>
  101. </members>
  102. <constants>
  103. </constants>
  104. </class>