Improve the documentation of the Object class

I edited the main description to remove parentheses and split long sentences.

Closes #29382
Closes #29384

(cherry picked from commit 21a0dad58a)
This commit is contained in:
Nathan Lovato 2019-06-03 19:10:59 +09:00 committed by Rémi Verschelde
parent d83e80e039
commit 8d69f1651c
1 changed files with 9 additions and 6 deletions

View File

@ -4,12 +4,12 @@
Base class for all non built-in types. Base class for all non built-in types.
</brief_description> </brief_description>
<description> <description>
Base class for all non built-in types. Everything which is not a built-in type starts the inheritance chain from this class. Every class which is not a built-in type inherits from this class.
Objects can be constructed from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript. You can construct Objects from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript.
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++). Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the [method free] method from your script or delete the instance from C++.
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. Some classes that extend Object add memory management. This is the case of [Reference], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory.
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 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. Objects also receive notifications. Notifications are a simple way to notify the object about simple events, so they can all be handled together. See [method _notification].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -118,7 +118,9 @@
<argument index="4" name="flags" type="int" default="0"> <argument index="4" name="flags" type="int" default="0">
</argument> </argument>
<description> <description>
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. 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.
If the [code]target[/code] is destroyed in the game's lifecycle, the connection will be lost.
</description> </description>
</method> </method>
<method name="disconnect"> <method name="disconnect">
@ -132,6 +134,7 @@
</argument> </argument>
<description> <description>
Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code]. Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code].
If you try to disconnect a connection that does not exist, the method will throw an error. Use [method is_connected] to ensure that the connection exists.
</description> </description>
</method> </method>
<method name="emit_signal" qualifiers="vararg"> <method name="emit_signal" qualifiers="vararg">