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