Object.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Object" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. Base class for all non built-in types.
  5. </brief_description>
  6. <description>
  7. Base class for all non built-in types. Everything not a built-in type starts the inheritance chain from this class.
  8. Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++).
  9. Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
  10. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
  11. Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
  12. </description>
  13. <tutorials>
  14. </tutorials>
  15. <demos>
  16. </demos>
  17. <methods>
  18. <method name="_get" qualifiers="virtual">
  19. <return type="void">
  20. </return>
  21. <argument index="0" name="property" type="String">
  22. </argument>
  23. <description>
  24. Returns the given property. Returns [code]null[/code] if the [code]property[/code] does not exist.
  25. </description>
  26. </method>
  27. <method name="_get_property_list" qualifiers="virtual">
  28. <return type="Array">
  29. </return>
  30. <description>
  31. Returns the object's property list as an [Array] of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in [@Global Scope]) and optionally: hint:int (see PROPERTY_HINT_* in [@Global Scope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@Global Scope]).
  32. </description>
  33. </method>
  34. <method name="_init" qualifiers="virtual">
  35. <return type="void">
  36. </return>
  37. <description>
  38. The virtual method called upon initialization.
  39. </description>
  40. </method>
  41. <method name="_notification" qualifiers="virtual">
  42. <return type="void">
  43. </return>
  44. <argument index="0" name="what" type="int">
  45. </argument>
  46. <description>
  47. Notify the object internally using an ID.
  48. </description>
  49. </method>
  50. <method name="_set" qualifiers="virtual">
  51. <return type="bool">
  52. </return>
  53. <argument index="0" name="property" type="String">
  54. </argument>
  55. <argument index="1" name="value" type="Variant">
  56. </argument>
  57. <description>
  58. Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
  59. </description>
  60. </method>
  61. <method name="add_user_signal">
  62. <return type="void">
  63. </return>
  64. <argument index="0" name="signal" type="String">
  65. </argument>
  66. <argument index="1" name="arguments" type="Array" default="[ ]">
  67. </argument>
  68. <description>
  69. Adds a user-defined [code]signal[/code]. Arguments are optional, but can be added as an [Array] of dictionaries, each containing "name" and "type" (from [@Global Scope] TYPE_*).
  70. </description>
  71. </method>
  72. <method name="call" qualifiers="vararg">
  73. <return type="Variant">
  74. </return>
  75. <argument index="0" name="method" type="String">
  76. </argument>
  77. <description>
  78. Calls the [code]method[/code] on the object and returns a result. Pass parameters as a comma separated list.
  79. </description>
  80. </method>
  81. <method name="call_deferred" qualifiers="vararg">
  82. <return type="Variant">
  83. </return>
  84. <argument index="0" name="method" type="String">
  85. </argument>
  86. <description>
  87. Calls the [code]method[/code] on the object during idle time and returns a result. Pass parameters as a comma separated list.
  88. </description>
  89. </method>
  90. <method name="callv">
  91. <return type="Variant">
  92. </return>
  93. <argument index="0" name="method" type="String">
  94. </argument>
  95. <argument index="1" name="arg_array" type="Array">
  96. </argument>
  97. <description>
  98. Calls the [code]method[/code] on the object and returns a result. Pass parameters as an [Array].
  99. </description>
  100. </method>
  101. <method name="can_translate_messages" qualifiers="const">
  102. <return type="bool">
  103. </return>
  104. <description>
  105. Returns [code]true[/code] if the object can translate strings.
  106. </description>
  107. </method>
  108. <method name="connect">
  109. <return type="int" enum="Error">
  110. </return>
  111. <argument index="0" name="signal" type="String">
  112. </argument>
  113. <argument index="1" name="target" type="Object">
  114. </argument>
  115. <argument index="2" name="method" type="String">
  116. </argument>
  117. <argument index="3" name="binds" type="Array" default="[ ]">
  118. </argument>
  119. <argument index="4" name="flags" type="int" default="0">
  120. </argument>
  121. <description>
  122. Connects a [code]signal[/code] to a [code]method[/code] on a [code]target[/code] object. Pass optional [code]binds[/code] to the call. Use [code]flags[/code] to set deferred or one shot connections. See [code]CONNECT_*[/code] constants. A [code]signal[/code] can only be connected once to a [code]method[/code]. It will throw an error if already connected. To avoid this, first use [method is_connected] to check for existing connections.
  123. </description>
  124. </method>
  125. <method name="disconnect">
  126. <return type="void">
  127. </return>
  128. <argument index="0" name="signal" type="String">
  129. </argument>
  130. <argument index="1" name="target" type="Object">
  131. </argument>
  132. <argument index="2" name="method" type="String">
  133. </argument>
  134. <description>
  135. Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code].
  136. </description>
  137. </method>
  138. <method name="emit_signal" qualifiers="vararg">
  139. <return type="Variant">
  140. </return>
  141. <argument index="0" name="signal" type="String">
  142. </argument>
  143. <description>
  144. Emits the given [code]signal[/code].
  145. </description>
  146. </method>
  147. <method name="free">
  148. <return type="void">
  149. </return>
  150. <description>
  151. Deletes the object from memory.
  152. </description>
  153. </method>
  154. <method name="get" qualifiers="const">
  155. <return type="Variant">
  156. </return>
  157. <argument index="0" name="property" type="String">
  158. </argument>
  159. <description>
  160. Returns a [Variant] for a [code]property[/code].
  161. </description>
  162. </method>
  163. <method name="get_class" qualifiers="const">
  164. <return type="String">
  165. </return>
  166. <description>
  167. Returns the object's class as a [String].
  168. </description>
  169. </method>
  170. <method name="get_incoming_connections" qualifiers="const">
  171. <return type="Array">
  172. </return>
  173. <description>
  174. Returns an [Array] of dictionaries with information about signals that are connected to the object.
  175. Inside each [Dictionary] there are 3 fields:
  176. - "source" is a reference to signal emitter.
  177. - "signal_name" is name of connected signal.
  178. - "method_name" is a name of method to which signal is connected.
  179. </description>
  180. </method>
  181. <method name="get_instance_id" qualifiers="const">
  182. <return type="int">
  183. </return>
  184. <description>
  185. Returns the object's unique instance ID.
  186. </description>
  187. </method>
  188. <method name="get_meta" qualifiers="const">
  189. <return type="Variant">
  190. </return>
  191. <argument index="0" name="name" type="String">
  192. </argument>
  193. <description>
  194. Returns the object's metadata for the given [code]name[/code].
  195. </description>
  196. </method>
  197. <method name="get_meta_list" qualifiers="const">
  198. <return type="PoolStringArray">
  199. </return>
  200. <description>
  201. Returns the object's metadata as a [PoolStringArray].
  202. </description>
  203. </method>
  204. <method name="get_method_list" qualifiers="const">
  205. <return type="Array">
  206. </return>
  207. <description>
  208. Returns the object's methods and their signatures as an [Array].
  209. </description>
  210. </method>
  211. <method name="get_property_list" qualifiers="const">
  212. <return type="Array">
  213. </return>
  214. <description>
  215. Returns the list of properties as an [Array] of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in [@Global Scope]) and optionally: hint:int (see PROPERTY_HINT_* in [@Global Scope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@Global Scope]).
  216. </description>
  217. </method>
  218. <method name="get_script" qualifiers="const">
  219. <return type="Reference">
  220. </return>
  221. <description>
  222. Returns the object's [Script] or [code]null[/code] if one doesn't exist.
  223. </description>
  224. </method>
  225. <method name="get_signal_connection_list" qualifiers="const">
  226. <return type="Array">
  227. </return>
  228. <argument index="0" name="signal" type="String">
  229. </argument>
  230. <description>
  231. Returns an [Array] of connections for the given [code]signal[/code].
  232. </description>
  233. </method>
  234. <method name="get_signal_list" qualifiers="const">
  235. <return type="Array">
  236. </return>
  237. <description>
  238. Returns the list of signals as an [Array] of dictionaries.
  239. </description>
  240. </method>
  241. <method name="has_meta" qualifiers="const">
  242. <return type="bool">
  243. </return>
  244. <argument index="0" name="name" type="String">
  245. </argument>
  246. <description>
  247. Returns [code]true[/code] if a metadata is found with the given [code]name[/code].
  248. </description>
  249. </method>
  250. <method name="has_method" qualifiers="const">
  251. <return type="bool">
  252. </return>
  253. <argument index="0" name="method" type="String">
  254. </argument>
  255. <description>
  256. Returns [code]true[/code] if the object contains the given [code]method[/code].
  257. </description>
  258. </method>
  259. <method name="has_user_signal" qualifiers="const">
  260. <return type="bool">
  261. </return>
  262. <argument index="0" name="signal" type="String">
  263. </argument>
  264. <description>
  265. Returns [code]true[/code] if the given user-defined [code]signal[/code] exists.
  266. </description>
  267. </method>
  268. <method name="is_blocking_signals" qualifiers="const">
  269. <return type="bool">
  270. </return>
  271. <description>
  272. Returns [code]true[/code] if signal emission blocking is enabled.
  273. </description>
  274. </method>
  275. <method name="is_class" qualifiers="const">
  276. <return type="bool">
  277. </return>
  278. <argument index="0" name="type" type="String">
  279. </argument>
  280. <description>
  281. Returns [code]true[/code] if the object inherits from the given [code]type[/code].
  282. </description>
  283. </method>
  284. <method name="is_connected" qualifiers="const">
  285. <return type="bool">
  286. </return>
  287. <argument index="0" name="signal" type="String">
  288. </argument>
  289. <argument index="1" name="target" type="Object">
  290. </argument>
  291. <argument index="2" name="method" type="String">
  292. </argument>
  293. <description>
  294. Returns [code]true[/code] if a connection exists for a given [code]signal[/code], [code]target[/code], and [code]method[/code].
  295. </description>
  296. </method>
  297. <method name="is_queued_for_deletion" qualifiers="const">
  298. <return type="bool">
  299. </return>
  300. <description>
  301. Returns [code]true[/code] if the [code]queue_free[/code] method was called for the object.
  302. </description>
  303. </method>
  304. <method name="notification">
  305. <return type="void">
  306. </return>
  307. <argument index="0" name="what" type="int">
  308. </argument>
  309. <argument index="1" name="reversed" type="bool" default="false">
  310. </argument>
  311. <description>
  312. Notify the object of something.
  313. </description>
  314. </method>
  315. <method name="property_list_changed_notify">
  316. <return type="void">
  317. </return>
  318. <description>
  319. </description>
  320. </method>
  321. <method name="set">
  322. <return type="void">
  323. </return>
  324. <argument index="0" name="property" type="String">
  325. </argument>
  326. <argument index="1" name="value" type="Variant">
  327. </argument>
  328. <description>
  329. Set property into the object.
  330. </description>
  331. </method>
  332. <method name="set_block_signals">
  333. <return type="void">
  334. </return>
  335. <argument index="0" name="enable" type="bool">
  336. </argument>
  337. <description>
  338. If set to true, signal emission is blocked.
  339. </description>
  340. </method>
  341. <method name="set_message_translation">
  342. <return type="void">
  343. </return>
  344. <argument index="0" name="enable" type="bool">
  345. </argument>
  346. <description>
  347. Define whether the object can translate strings (with calls to [method tr]). Default is true.
  348. </description>
  349. </method>
  350. <method name="set_meta">
  351. <return type="void">
  352. </return>
  353. <argument index="0" name="name" type="String">
  354. </argument>
  355. <argument index="1" name="value" type="Variant">
  356. </argument>
  357. <description>
  358. Set a metadata into the object. Metadata is serialized. Metadata can be [i]anything[/i].
  359. </description>
  360. </method>
  361. <method name="set_script">
  362. <return type="void">
  363. </return>
  364. <argument index="0" name="script" type="Reference">
  365. </argument>
  366. <description>
  367. Set a script into the object, scripts extend the object functionality.
  368. </description>
  369. </method>
  370. <method name="tr" qualifiers="const">
  371. <return type="String">
  372. </return>
  373. <argument index="0" name="message" type="String">
  374. </argument>
  375. <description>
  376. Translate a message. Only works if message translation is enabled (which it is by default). See [method set_message_translation].
  377. </description>
  378. </method>
  379. </methods>
  380. <signals>
  381. <signal name="script_changed">
  382. <description>
  383. </description>
  384. </signal>
  385. </signals>
  386. <constants>
  387. <constant name="NOTIFICATION_POSTINITIALIZE" value="0" enum="">
  388. Called right when the object is initialized. Not available in script.
  389. </constant>
  390. <constant name="NOTIFICATION_PREDELETE" value="1" enum="">
  391. Called before the object is about to be deleted.
  392. </constant>
  393. <constant name="CONNECT_DEFERRED" value="1">
  394. Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time.
  395. </constant>
  396. <constant name="CONNECT_PERSIST" value="2">
  397. Persisting connections are saved when the object is serialized to file.
  398. </constant>
  399. <constant name="CONNECT_ONESHOT" value="4">
  400. One shot connections disconnect themselves after emission.
  401. </constant>
  402. </constants>
  403. </class>