mirror of
https://github.com/godotengine/godot.git
synced 2024-11-13 15:42:40 +00:00
Improve the Object, Reference and Resource class documentations
(cherry picked from commit 4275e6aad5
)
This commit is contained in:
parent
518f109927
commit
b717a61903
@ -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">
|
||||
@ -521,7 +523,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>
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user