Skip to content

Commit 6c42662

Browse files
committed
Merge pull request #67082 from Mickeon/resource-screw-you-setup-local-to-scene
Deprecate Resource.`setup_local_to_scene`
2 parents 4330a94 + 0af2467 commit 6c42662

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

doc/classes/Resource.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,11 @@
5555
Returns the [RID] of this resource (or an empty RID). Many resources (such as [Texture2D], [Mesh], and so on) are high-level abstractions of resources stored in a specialized server ([DisplayServer], [RenderingServer], etc.), so this function will return the original [RID].
5656
</description>
5757
</method>
58-
<method name="setup_local_to_scene">
58+
<method name="setup_local_to_scene" is_deprecated="true">
5959
<return type="void" />
6060
<description>
6161
Emits the [signal setup_local_to_scene_requested] signal. If [member resource_local_to_scene] is set to [code]true[/code], this method is called from [method PackedScene.instantiate] by the newly duplicated resource within the scene instance.
6262
For most resources, this method performs no logic of its own. Custom behavior can be defined by connecting [signal setup_local_to_scene_requested] from a script, [b]not[/b] by overriding this method.
63-
[b]Example:[/b] Assign a random value to [code]health[/code] for every duplicated Resource from an instantiated scene, excluding the original.
64-
[codeblock]
65-
extends Resource
66-
67-
var health = 0
68-
69-
func _init():
70-
setup_local_to_scene_requested.connect(randomize_health)
71-
72-
func randomize_health():
73-
health = randi_range(10, 40)
74-
[/codeblock]
7563
</description>
7664
</method>
7765
<method name="take_over_path">
@@ -104,7 +92,7 @@
10492
</signal>
10593
<signal name="setup_local_to_scene_requested">
10694
<description>
107-
Emitted when [method setup_local_to_scene] is called, usually by a newly duplicated resource with [member resource_local_to_scene] set to [code]true[/code]. Custom behavior can be defined by connecting this signal.
95+
Emitted by the newly duplicated resource with [member resource_local_to_scene] set to [code]true[/code], when the scene is instantiated. Custom behavior can be defined by connecting this signal.
10896
</description>
10997
</signal>
11098
</signals>

doc/classes/ViewportTexture.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<description>
77
Provides the content of a [Viewport] as a dynamic [Texture2D]. This can be used to mix controls, 2D game objects, and 3D game objects in the same scene.
88
To create a [ViewportTexture] in code, use the [method Viewport.get_texture] method on the target viewport.
9-
[b]Note:[/b] When local to scene, this texture uses [method Resource.setup_local_to_scene] to set the proxy texture and flags in the local viewport. Local to scene [ViewportTexture]s will return incorrect data until the scene root is ready (see [signal Node.ready]).
9+
[b]Note:[/b] A [ViewportTexture] is always local to its scene (see [member Resource.resource_local_to_scene]). If the scene root is not ready, it may return incorrect data (see [signal Node.ready]).
1010
</description>
1111
<tutorials>
1212
<link title="GUI in 3D Demo">https://godotengine.org/asset-library/asset/127</link>

0 commit comments

Comments
 (0)