diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-07-27 09:59:02 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-07-27 10:03:46 +0200 |
commit | 4275e6aad53c0662c208c899ebcadd1d7b3cbbaa (patch) | |
tree | ef13644cd9af9fd22a1f6da59e5b3c452117925a /doc | |
parent | 1ab0644532521443d0594549da432d89b9d535a4 (diff) |
Improve the Object, Reference and Resource class documentations
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Object.xml | 4 | ||||
-rw-r--r-- | doc/classes/Reference.xml | 3 | ||||
-rw-r--r-- | doc/classes/Resource.xml | 5 | ||||
-rw-r--r-- | doc/classes/String.xml | 2 |
4 files changed, 9 insertions, 5 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 3d8c2c5eb0..ca6b624359 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -17,8 +17,10 @@ [/codeblock] The [code]in[/code] operator will evaluate to [code]true[/code] as long as the key exists, even if the value is [code]null[/code]. Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification]. + [b]Note:[/b] Unlike references to a [Reference], references to an Object stored in a variable can become invalid without warning. Therefore, it's recommended to use [Reference] for data classes instead of [Object]. </description> <tutorials> + <link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link> </tutorials> <methods> <method name="_get" qualifiers="virtual"> @@ -518,7 +520,7 @@ One-shot connections disconnect themselves after emission. </constant> <constant name="CONNECT_REFERENCE_COUNTED" value="8" enum="ConnectFlags"> - Connect a signal as reference counted. This means that a given signal can be connected several times to the same target, and will only be fully disconnected once no references are left. + Connect a signal as reference-counted. This means that a given signal can be connected several times to the same target, and will only be fully disconnected once no references are left. </constant> </constants> </class> diff --git a/doc/classes/Reference.xml b/doc/classes/Reference.xml index 860a47798c..9c3d1d5d9d 100644 --- a/doc/classes/Reference.xml +++ b/doc/classes/Reference.xml @@ -5,10 +5,11 @@ </brief_description> <description> Base class for any object that keeps a reference count. [Resource] and many other helper objects inherit this class. - References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with [method Object.free]. + Unlike [Object]s, References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with [method Object.free]. In the vast majority of use cases, instantiating and using [Reference]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused. </description> <tutorials> + <link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link> </tutorials> <methods> <method name="init_ref"> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index 0aa40dffb3..e79a2e0ea9 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -4,10 +4,11 @@ Base class for all resources. </brief_description> <description> - Resource is the base class for all Godot-specific resource types, serving primarily as data containers. They are reference counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. + Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Unlike [Object]s, they are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. </description> <tutorials> - <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/resources.html</link> + <link title="Resources">https://docs.godotengine.org/en/latest/getting_started/step_by_step/resources.html</link> + <link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link> </tutorials> <methods> <method name="_setup_local_to_scene" qualifiers="virtual"> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 71db03e84f..7e55f8bd9a 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -4,7 +4,7 @@ Built-in string class. </brief_description> <description> - This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources. + This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference-counted and use a copy-on-write approach, so passing them around is cheap in resources. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_format_string.html</link> |