Update loading demos for 4.0 (#776)
@@ -4,4 +4,4 @@ These demos demonstrate various ways to load scenes and other data.
|
|||||||
|
|
||||||
Languages: All are GDScript
|
Languages: All are GDScript
|
||||||
|
|
||||||
Renderers: All are GLES 2
|
Renderers: All are Mobile
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This demo shows how to use autoloads to change between scenes.
|
|||||||
|
|
||||||
Language: GDScript
|
Language: GDScript
|
||||||
|
|
||||||
Renderer: Vulkan Mobile
|
Renderer: Mobile
|
||||||
|
|
||||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/529
|
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/529
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
# Changing scenes is most easily done using the functions change_scene_to_file
|
||||||
# Changing scenes is most easily done using the functions `change_scene`
|
# and change_scene_to_packed of the SceneTree. This script demonstrates how to
|
||||||
# and `change_scene_to` of the SceneTree. This script demonstrates how to
|
|
||||||
# change scenes without those helpers.
|
# change scenes without those helpers.
|
||||||
|
|
||||||
func goto_scene(path):
|
|
||||||
|
func goto_scene(path: String):
|
||||||
# This function will usually be called from a signal callback,
|
# This function will usually be called from a signal callback,
|
||||||
# or some other function from the running scene.
|
# or some other function from the running scene.
|
||||||
# Deleting the current scene at this point might be
|
# Deleting the current scene at this point might be
|
||||||
@@ -13,21 +13,20 @@ func goto_scene(path):
|
|||||||
|
|
||||||
# The way around this is deferring the load to a later time, when
|
# The way around this is deferring the load to a later time, when
|
||||||
# it is ensured that no code from the current scene is running:
|
# it is ensured that no code from the current scene is running:
|
||||||
call_deferred("_deferred_goto_scene", path)
|
_deferred_goto_scene.call_deferred(path)
|
||||||
|
|
||||||
|
|
||||||
func _deferred_goto_scene(path):
|
func _deferred_goto_scene(path: String):
|
||||||
# Immediately free the current scene, there is no risk here.
|
# Immediately free the current scene. There is no risk here because the
|
||||||
get_tree().get_current_scene().free()
|
# call to this method is already deferred.
|
||||||
|
get_tree().current_scene.free()
|
||||||
|
|
||||||
# Load new scene
|
var packed_scene := ResourceLoader.load(path) as PackedScene
|
||||||
var packed_scene = ResourceLoader.load(path)
|
|
||||||
|
|
||||||
# Instance the new scene
|
var instanced_scene := packed_scene.instantiate()
|
||||||
var instanced_scene = packed_scene.instantiate()
|
|
||||||
|
|
||||||
# Add it to the scene tree, as direct child of root
|
# Add it to the scene tree, as direct child of root
|
||||||
get_tree().get_root().add_child(instanced_scene)
|
get_tree().root.add_child(instanced_scene)
|
||||||
|
|
||||||
# Set it as the current scene, only after it has been added to the tree
|
# Set it as the current scene, only after it has been added to the tree
|
||||||
get_tree().set_current_scene(instanced_scene)
|
get_tree().current_scene = instanced_scene
|
||||||
|
|||||||
@@ -14,20 +14,16 @@ config/name="Autoload (Singletons)"
|
|||||||
config/description="This demo shows how to use autoloads to change between scenes."
|
config/description="This demo shows how to use autoloads to change between scenes."
|
||||||
run/main_scene="res://scene_a.tscn"
|
run/main_scene="res://scene_a.tscn"
|
||||||
config/features=PackedStringArray("4.0")
|
config/features=PackedStringArray("4.0")
|
||||||
|
run/low_processor_mode=true
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
global="res://global.gd"
|
global="*res://global.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/stretch/mode="canvas_items"
|
window/vsync/vsync_mode=0
|
||||||
window/stretch/aspect="expand"
|
|
||||||
|
|
||||||
[gdnative]
|
|
||||||
|
|
||||||
singletons=[]
|
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
vulkan/rendering/back_end=1
|
renderer/rendering_method="mobile"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
|
|
||||||
func _on_goto_scene_pressed():
|
func _on_goto_scene_pressed():
|
||||||
get_node(^"/root/global").goto_scene("res://scene_b.tscn")
|
global.goto_scene("res://scene_b.tscn")
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://bh2ylkcsgejgy"]
|
[gd_scene load_steps=2 format=3 uid="uid://6xgdg1bmya7c"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scene_a.gd" id="1"]
|
[ext_resource type="Script" path="res://scene_a.gd" id="1"]
|
||||||
|
|
||||||
[node name="SceneA" type="Panel"]
|
[node name="SceneA" type="Panel"]
|
||||||
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
script = ExtResource( "1" )
|
script = ExtResource("1")
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 64.0
|
offset_left = 64.0
|
||||||
offset_top = 48.0
|
offset_top = 48.0
|
||||||
offset_right = 104.0
|
offset_right = 104.0
|
||||||
@@ -18,6 +22,7 @@ size_flags_vertical = 0
|
|||||||
text = "This is scene A."
|
text = "This is scene A."
|
||||||
|
|
||||||
[node name="GoToSceneB" type="Button" parent="."]
|
[node name="GoToSceneB" type="Button" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 64.0
|
offset_left = 64.0
|
||||||
offset_top = 128.0
|
offset_top = 128.0
|
||||||
offset_right = 192.0
|
offset_right = 192.0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
|
|
||||||
func _on_goto_scene_pressed():
|
func _on_goto_scene_pressed():
|
||||||
get_node(^"/root/global").goto_scene("res://scene_a.tscn")
|
global.goto_scene("res://scene_a.tscn")
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://pt77vxjf3uwe"]
|
[gd_scene load_steps=2 format=3 uid="uid://cmu1caqo7k7wy"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scene_b.gd" id="1"]
|
[ext_resource type="Script" path="res://scene_b.gd" id="1"]
|
||||||
|
|
||||||
[node name="SceneB" type="Panel"]
|
[node name="SceneB" type="Panel"]
|
||||||
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 2
|
size_flags_vertical = 2
|
||||||
script = ExtResource( "1" )
|
script = ExtResource("1")
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 64.0
|
offset_left = 64.0
|
||||||
offset_top = 48.0
|
offset_top = 48.0
|
||||||
offset_right = 164.0
|
offset_right = 164.0
|
||||||
@@ -21,6 +22,7 @@ size_flags_vertical = 0
|
|||||||
text = "This is scene B."
|
text = "This is scene B."
|
||||||
|
|
||||||
[node name="GoToSceneA" type="Button" parent="."]
|
[node name="GoToSceneA" type="Button" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 64.0
|
offset_left = 64.0
|
||||||
offset_top = 128.0
|
offset_top = 128.0
|
||||||
offset_right = 192.0
|
offset_right = 192.0
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -1,15 +0,0 @@
|
|||||||
# Background Load
|
|
||||||
|
|
||||||
This is a demo showing how to use the `load_interactive()` method of
|
|
||||||
[`ResourceLoader`](https://docs.godotengine.org/en/latest/classes/class_resourceloader.html)
|
|
||||||
to load large scenes in the background with a progress bar.
|
|
||||||
|
|
||||||
Language: GDScript
|
|
||||||
|
|
||||||
Renderer: GLES 2
|
|
||||||
|
|
||||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/530
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
extends Control
|
|
||||||
|
|
||||||
const SIMULATED_DELAY_SEC = 0.1
|
|
||||||
|
|
||||||
var thread = null
|
|
||||||
|
|
||||||
@onready var progress = $Progress
|
|
||||||
|
|
||||||
func _thread_load(path):
|
|
||||||
var ril = ResourceLoader.load_interactive(path)
|
|
||||||
assert(ril)
|
|
||||||
var total = ril.get_stage_count()
|
|
||||||
# Call deferred to configure max load steps.
|
|
||||||
progress.call_deferred("set_max", total)
|
|
||||||
|
|
||||||
var res = null
|
|
||||||
|
|
||||||
while true: #iterate until we have a resource
|
|
||||||
# Update progress bar, use call deferred, which routes to main thread.
|
|
||||||
progress.call_deferred("set_value", ril.get_stage())
|
|
||||||
# Simulate a delay.
|
|
||||||
OS.delay_msec(int(SIMULATED_DELAY_SEC * 1000.0))
|
|
||||||
# Poll (does a load step).
|
|
||||||
var err = ril.poll()
|
|
||||||
# If OK, then load another one. If EOF, it' s done. Otherwise there was an error.
|
|
||||||
if err == ERR_FILE_EOF:
|
|
||||||
# Loading done, fetch resource.
|
|
||||||
res = ril.get_resource()
|
|
||||||
break
|
|
||||||
elif err != OK:
|
|
||||||
# Not OK, there was an error.
|
|
||||||
print("There was an error loading")
|
|
||||||
break
|
|
||||||
|
|
||||||
# Send whathever we did (or did not) get.
|
|
||||||
call_deferred("_thread_done", res)
|
|
||||||
|
|
||||||
|
|
||||||
func _thread_done(resource):
|
|
||||||
assert(resource)
|
|
||||||
|
|
||||||
# Always wait for threads to finish, this is required on Windows.
|
|
||||||
thread.wait_to_finish()
|
|
||||||
|
|
||||||
# Hide the progress bar.
|
|
||||||
progress.hide()
|
|
||||||
|
|
||||||
# Instantiate new scene.
|
|
||||||
var new_scene = resource.instantiate()
|
|
||||||
# Free current scene.
|
|
||||||
get_tree().current_scene.free()
|
|
||||||
get_tree().current_scene = null
|
|
||||||
# Add new one to root.
|
|
||||||
get_tree().root.add_child(new_scene)
|
|
||||||
# Set as current scene.
|
|
||||||
get_tree().current_scene = new_scene
|
|
||||||
|
|
||||||
progress.visible = false
|
|
||||||
|
|
||||||
func load_scene(path):
|
|
||||||
thread = Thread.new()
|
|
||||||
thread.start( self, "_thread_load", path)
|
|
||||||
raise() # Show on top.
|
|
||||||
progress.visible = true
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://background_load.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="BackgroundLoad" type="Control"]
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Progress" type="ProgressBar" parent="."]
|
|
||||||
visible = false
|
|
||||||
offset_left = 7.0
|
|
||||||
offset_top = 8.0
|
|
||||||
offset_right = 207.0
|
|
||||||
offset_bottom = 22.0
|
|
||||||
step = 1.0
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
extends Node2D
|
|
||||||
|
|
||||||
func _on_switch_pressed():
|
|
||||||
$CanvasLayer/Switch.hide()
|
|
||||||
background_load.load_scene("res://sculptures.tscn")
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
[gd_scene load_steps=9 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://paintings.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://paintings/painting_babel.jpg" type="Texture2D" id=2]
|
|
||||||
[ext_resource path="res://paintings/painting_las_meninas.png" type="Texture2D" id=3]
|
|
||||||
[ext_resource path="res://paintings/painting_mona_lisa.jpg" type="Texture2D" id=4]
|
|
||||||
[ext_resource path="res://paintings/painting_old_guitarist.jpg" type="Texture2D" id=5]
|
|
||||||
[ext_resource path="res://paintings/painting_parasol.jpg" type="Texture2D" id=6]
|
|
||||||
[ext_resource path="res://paintings/painting_the_swing.jpg" type="Texture2D" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=1]
|
|
||||||
resource_name = "move_around"
|
|
||||||
length = 4.0
|
|
||||||
loop = true
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath("MonaLisa:position")
|
|
||||||
tracks/0/interp = 2
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(117.659, 173.793), Vector2(164.387, 206.955)]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/path = NodePath("MonaLisa:rotation_degrees")
|
|
||||||
tracks/1/interp = 2
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 0.0]
|
|
||||||
}
|
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/path = NodePath("Parasol:position")
|
|
||||||
tracks/2/interp = 2
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(451.448, 256.916), Vector2(483.102, 317.21)]
|
|
||||||
}
|
|
||||||
tracks/3/type = "value"
|
|
||||||
tracks/3/path = NodePath("Parasol:rotation_degrees")
|
|
||||||
tracks/3/interp = 2
|
|
||||||
tracks/3/loop_wrap = true
|
|
||||||
tracks/3/imported = false
|
|
||||||
tracks/3/enabled = true
|
|
||||||
tracks/3/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 0.0]
|
|
||||||
}
|
|
||||||
tracks/4/type = "value"
|
|
||||||
tracks/4/path = NodePath("TheSwing:position")
|
|
||||||
tracks/4/interp = 2
|
|
||||||
tracks/4/loop_wrap = true
|
|
||||||
tracks/4/imported = false
|
|
||||||
tracks/4/enabled = true
|
|
||||||
tracks/4/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(715.927, 181.745), Vector2(661.663, 205.863)]
|
|
||||||
}
|
|
||||||
tracks/5/type = "value"
|
|
||||||
tracks/5/path = NodePath("TheSwing:rotation_degrees")
|
|
||||||
tracks/5/interp = 2
|
|
||||||
tracks/5/loop_wrap = true
|
|
||||||
tracks/5/imported = false
|
|
||||||
tracks/5/enabled = true
|
|
||||||
tracks/5/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 0.0]
|
|
||||||
}
|
|
||||||
tracks/6/type = "value"
|
|
||||||
tracks/6/path = NodePath("OldGuitarist:position")
|
|
||||||
tracks/6/interp = 2
|
|
||||||
tracks/6/loop_wrap = true
|
|
||||||
tracks/6/imported = false
|
|
||||||
tracks/6/enabled = true
|
|
||||||
tracks/6/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(886.982, 185.641), Vector2(901.179, 210.693)]
|
|
||||||
}
|
|
||||||
tracks/7/type = "value"
|
|
||||||
tracks/7/path = NodePath("OldGuitarist:rotation_degrees")
|
|
||||||
tracks/7/interp = 2
|
|
||||||
tracks/7/loop_wrap = true
|
|
||||||
tracks/7/imported = false
|
|
||||||
tracks/7/enabled = true
|
|
||||||
tracks/7/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 15.0]
|
|
||||||
}
|
|
||||||
tracks/8/type = "value"
|
|
||||||
tracks/8/path = NodePath("Babel:position")
|
|
||||||
tracks/8/interp = 2
|
|
||||||
tracks/8/loop_wrap = true
|
|
||||||
tracks/8/imported = false
|
|
||||||
tracks/8/enabled = true
|
|
||||||
tracks/8/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(155.796, 468.287), Vector2(194.21, 444.904)]
|
|
||||||
}
|
|
||||||
tracks/9/type = "value"
|
|
||||||
tracks/9/path = NodePath("Babel:rotation_degrees")
|
|
||||||
tracks/9/interp = 2
|
|
||||||
tracks/9/loop_wrap = true
|
|
||||||
tracks/9/imported = false
|
|
||||||
tracks/9/enabled = true
|
|
||||||
tracks/9/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 0.0]
|
|
||||||
}
|
|
||||||
tracks/10/type = "value"
|
|
||||||
tracks/10/path = NodePath("LasMeninas:position")
|
|
||||||
tracks/10/interp = 2
|
|
||||||
tracks/10/loop_wrap = true
|
|
||||||
tracks/10/imported = false
|
|
||||||
tracks/10/enabled = true
|
|
||||||
tracks/10/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(861.734, 494.059), Vector2(840.022, 470.677)]
|
|
||||||
}
|
|
||||||
tracks/11/type = "value"
|
|
||||||
tracks/11/path = NodePath("LasMeninas:rotation_degrees")
|
|
||||||
tracks/11/interp = 2
|
|
||||||
tracks/11/loop_wrap = true
|
|
||||||
tracks/11/imported = false
|
|
||||||
tracks/11/enabled = true
|
|
||||||
tracks/11/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [0.0, 0.0]
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Paintings" type="Node2D"]
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="Babel" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(155.796, 468.287)
|
|
||||||
scale = Vector2(0.29005, 0.29005)
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="LasMeninas" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(861.734, 494.059)
|
|
||||||
scale = Vector2(0.348146, 0.348146)
|
|
||||||
texture = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="MonaLisa" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(117.659, 173.793)
|
|
||||||
scale = Vector2(0.696799, 0.696799)
|
|
||||||
texture = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="OldGuitarist" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(886.982, 185.641)
|
|
||||||
scale = Vector2(0.344706, 0.328421)
|
|
||||||
texture = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Parasol" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(451.448, 256.916)
|
|
||||||
scale = Vector2(0.557998, 0.557998)
|
|
||||||
texture = ExtResource( 6 )
|
|
||||||
|
|
||||||
[node name="TheSwing" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(715.927, 181.745)
|
|
||||||
scale = Vector2(0.286677, 0.286677)
|
|
||||||
texture = ExtResource( 7 )
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
|
||||||
autoplay = "move_around"
|
|
||||||
anims/move_around = SubResource( 1 )
|
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
|
||||||
offset = Vector2(512, 300)
|
|
||||||
current = true
|
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
|
||||||
|
|
||||||
[node name="Switch" type="Button" parent="CanvasLayer"]
|
|
||||||
offset_left = 10.0
|
|
||||||
offset_top = 10.0
|
|
||||||
offset_right = 156.0
|
|
||||||
offset_bottom = 30.0
|
|
||||||
text = "Switch to Sculptures"
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[connection signal="pressed" from="CanvasLayer/Switch" to="." method="_on_switch_pressed"]
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
; Engine configuration file.
|
|
||||||
; It's best edited using the editor UI and not directly,
|
|
||||||
; since the parameters that go here are not all obvious.
|
|
||||||
;
|
|
||||||
; Format:
|
|
||||||
; [section] ; section goes between []
|
|
||||||
; param=value ; assign values to parameters
|
|
||||||
|
|
||||||
config_version=4
|
|
||||||
|
|
||||||
[application]
|
|
||||||
|
|
||||||
config/name="Background Thread Loading Demo"
|
|
||||||
config/description="This is a demo showing how to use the load_interactive() method of
|
|
||||||
ResourceLoader to load large scenes in the background with a progress bar."
|
|
||||||
run/main_scene="res://paintings.tscn"
|
|
||||||
|
|
||||||
[autoload]
|
|
||||||
|
|
||||||
background_load="*res://background_load.tscn"
|
|
||||||
|
|
||||||
[display]
|
|
||||||
|
|
||||||
window/dpi/allow_hidpi=true
|
|
||||||
window/stretch/mode="2d"
|
|
||||||
window/stretch/aspect="expand"
|
|
||||||
|
|
||||||
[input]
|
|
||||||
|
|
||||||
ui_accept={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777221,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777222,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_select={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_cancel={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777217,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_focus_next={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777218,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_focus_prev={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_left={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777231,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_right={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777233,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_up={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777232,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_down={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777234,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_page_up={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777235,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_page_down={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777236,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_home={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777229,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_end={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777230,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[rendering]
|
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
|
||||||
vram_compression/import_etc=true
|
|
||||||
vram_compression/import_etc2=false
|
|
||||||
|
Before Width: | Height: | Size: 962 KiB |
@@ -1,5 +0,0 @@
|
|||||||
extends Node2D
|
|
||||||
|
|
||||||
func _on_switch_pressed():
|
|
||||||
$CanvasLayer/Switch.hide()
|
|
||||||
background_load.load_scene("res://paintings.tscn")
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
[gd_scene load_steps=9 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://sculptures.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_david.jpg" type="Texture2D" id=2]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_fountain.jpg" type="Texture2D" id=3]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_four_parts_of_earth.jpg" type="Texture2D" id=4]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_lincoln.jpg" type="Texture2D" id=5]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_thinker.jpg" type="Texture2D" id=6]
|
|
||||||
[ext_resource path="res://sculptures/sculpture_venus.png" type="Texture2D" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=1]
|
|
||||||
resource_name = "colorcycle"
|
|
||||||
length = 8.0
|
|
||||||
loop = true
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath("FourPartsOfEarth:modulate")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(0.827451, 0.25098, 0.25098, 1)]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/path = NodePath("Fountain:modulate")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
|
||||||
}
|
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/path = NodePath("Lincoln:modulate")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4.1),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(0.32549, 0.407843, 0.862745, 1)]
|
|
||||||
}
|
|
||||||
tracks/3/type = "value"
|
|
||||||
tracks/3/path = NodePath("David:modulate")
|
|
||||||
tracks/3/interp = 1
|
|
||||||
tracks/3/loop_wrap = true
|
|
||||||
tracks/3/imported = false
|
|
||||||
tracks/3/enabled = true
|
|
||||||
tracks/3/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4.1),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(0.180392, 0.866667, 0.137255, 1)]
|
|
||||||
}
|
|
||||||
tracks/4/type = "value"
|
|
||||||
tracks/4/path = NodePath("Thinker:modulate")
|
|
||||||
tracks/4/interp = 1
|
|
||||||
tracks/4/loop_wrap = true
|
|
||||||
tracks/4/imported = false
|
|
||||||
tracks/4/enabled = true
|
|
||||||
tracks/4/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4.1),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(0.898039, 0, 1, 1)]
|
|
||||||
}
|
|
||||||
tracks/5/type = "value"
|
|
||||||
tracks/5/path = NodePath("Venus:modulate")
|
|
||||||
tracks/5/interp = 1
|
|
||||||
tracks/5/loop_wrap = true
|
|
||||||
tracks/5/imported = false
|
|
||||||
tracks/5/enabled = true
|
|
||||||
tracks/5/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 4.1),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1), Color(0, 0, 0, 1)]
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Sculptures" type="Node2D"]
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="David" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(567.784, 196.577)
|
|
||||||
scale = Vector2(0.447348, 0.447348)
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="Fountain" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(152.971, 513.499)
|
|
||||||
scale = Vector2(0.191615, 0.191615)
|
|
||||||
texture = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="FourPartsOfEarth" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(480.743, 588.027)
|
|
||||||
scale = Vector2(0.198693, 0.198693)
|
|
||||||
texture = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="Lincoln" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(211.852, 203.688)
|
|
||||||
scale = Vector2(0.386179, 0.378971)
|
|
||||||
texture = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Thinker" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(854.336, 202.363)
|
|
||||||
scale = Vector2(0.182302, 0.182302)
|
|
||||||
texture = ExtResource( 6 )
|
|
||||||
|
|
||||||
[node name="Venus" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(848.731, 495.153)
|
|
||||||
scale = Vector2(0.402249, 0.402249)
|
|
||||||
texture = ExtResource( 7 )
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
|
||||||
autoplay = "colorcycle"
|
|
||||||
anims/colorcycle = SubResource( 1 )
|
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
|
||||||
offset = Vector2(512, 300)
|
|
||||||
current = true
|
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
|
||||||
|
|
||||||
[node name="Switch" type="Button" parent="CanvasLayer"]
|
|
||||||
offset_left = 10.0
|
|
||||||
offset_top = 10.0
|
|
||||||
offset_right = 142.0
|
|
||||||
offset_bottom = 30.0
|
|
||||||
text = "Switch to Paintings"
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[connection signal="pressed" from="CanvasLayer/Switch" to="." method="_on_switch_pressed"]
|
|
||||||
|
Before Width: | Height: | Size: 167 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_david.jpg-a970dbaef2d14bf5b95bd6bc742cc5b7.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_david.jpg"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_david.jpg-a970dbaef2d14bf5b95bd6bc742cc5b7.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
Before Width: | Height: | Size: 93 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_fountain.jpg-c97f66cd28cbdedd878a6bccaee9f8ab.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_fountain.jpg"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_fountain.jpg-c97f66cd28cbdedd878a6bccaee9f8ab.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
Before Width: | Height: | Size: 753 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_four_parts_of_earth.jpg-3a91357b6e4b11dc5c9d6cf4e883ae09.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_four_parts_of_earth.jpg"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_four_parts_of_earth.jpg-3a91357b6e4b11dc5c9d6cf4e883ae09.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
Before Width: | Height: | Size: 132 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_lincoln.jpg-6788997c8779fe1e17e7199d4f455ddd.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_lincoln.jpg"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_lincoln.jpg-6788997c8779fe1e17e7199d4f455ddd.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
Before Width: | Height: | Size: 894 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_thinker.jpg-09c1107239db80502d91eb2eed125d58.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_thinker.jpg"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_thinker.jpg-09c1107239db80502d91eb2eed125d58.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
|
Before Width: | Height: | Size: 167 KiB |
@@ -1,35 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="StreamTexture2D"
|
|
||||||
path="res://.godot/imported/sculpture_venus.png-f25859b819e865591053766b700269eb.stex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://sculptures/sculpture_venus.png"
|
|
||||||
dest_files=["res://.godot/imported/sculpture_venus.png-f25859b819e865591053766b700269eb.stex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/hdr_mode=0
|
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
|
||||||
flags/repeat=0
|
|
||||||
flags/filter=true
|
|
||||||
flags/mipmaps=true
|
|
||||||
flags/anisotropic=false
|
|
||||||
flags/srgb=2
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
stream=false
|
|
||||||
size_limit=0
|
|
||||||
detect_3d=true
|
|
||||||
svg/scale=1.0
|
|
||||||
13
loading/load_threaded/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Threaded Loading
|
||||||
|
|
||||||
|
This demo demonstrates how to use ResourceLoader for background loading.
|
||||||
|
|
||||||
|
Language: GDScript
|
||||||
|
|
||||||
|
Renderer: Mobile
|
||||||
|
|
||||||
|
Check out this demo on the asset library: *Coming soon*
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|

|
||||||
BIN
loading/load_threaded/icon.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
uid="uid://y4rcaycsgn4r"
|
||||||
|
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://icon.png"
|
source_file="res://icon.png"
|
||||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
|
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=false
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
42
loading/load_threaded/load_threaded.gd
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
extends VBoxContainer
|
||||||
|
|
||||||
|
|
||||||
|
func _on_start_loading_pressed():
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_babel.jpg")
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_las_meninas.png")
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_mona_lisa.jpg")
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_old_guitarist.jpg")
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_parasol.jpg")
|
||||||
|
ResourceLoader.load_threaded_request("res://paintings/painting_the_swing.jpg")
|
||||||
|
for current_button in $GetLoaded.get_children():
|
||||||
|
current_button.disabled = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_babel_pressed():
|
||||||
|
$Paintings/Babel.texture = ResourceLoader.load_threaded_get("res://paintings/painting_babel.jpg")
|
||||||
|
$GetLoaded/Babel.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_las_meninas_pressed():
|
||||||
|
$Paintings/LasMeninas.texture = ResourceLoader.load_threaded_get("res://paintings/painting_las_meninas.png")
|
||||||
|
$GetLoaded/LasMeninas.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mona_lisa_pressed():
|
||||||
|
$Paintings/MonaLisa.texture = ResourceLoader.load_threaded_get("res://paintings/painting_mona_lisa.jpg")
|
||||||
|
$GetLoaded/MonaLisa.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_old_guitarist_pressed():
|
||||||
|
$Paintings/OldGuitarist.texture = ResourceLoader.load_threaded_get("res://paintings/painting_old_guitarist.jpg")
|
||||||
|
$GetLoaded/OldGuitarist.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_parasol_pressed():
|
||||||
|
$Paintings/Parasol.texture = ResourceLoader.load_threaded_get("res://paintings/painting_parasol.jpg")
|
||||||
|
$GetLoaded/Parasol.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_swing_pressed():
|
||||||
|
$Paintings/Swing.texture = ResourceLoader.load_threaded_get("res://paintings/painting_the_swing.jpg")
|
||||||
|
$GetLoaded/Swing.disabled = true
|
||||||
102
loading/load_threaded/load_threaded.tscn
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://gc6pbdkdi7xt"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://load_threaded.gd" id="1_5o27a"]
|
||||||
|
|
||||||
|
[node name="LoadThreaded" type="VBoxContainer"]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_5o27a")
|
||||||
|
|
||||||
|
[node name="Paintings" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Babel" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="LasMeninas" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="MonaLisa" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="OldGuitarist" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="Parasol" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="Swing" type="TextureRect" parent="Paintings"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
ignore_texture_size = true
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="StartLoading" type="Button" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Start Loading"
|
||||||
|
|
||||||
|
[node name="GetLoaded" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Babel" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "The Tower of Babel"
|
||||||
|
|
||||||
|
[node name="LasMeninas" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "Las Meninas"
|
||||||
|
|
||||||
|
[node name="MonaLisa" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "Mona Lisa"
|
||||||
|
|
||||||
|
[node name="OldGuitarist" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "The Old Guitarist"
|
||||||
|
|
||||||
|
[node name="Parasol" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "Woman with a Parasol – Madame Monet and Her Son"
|
||||||
|
|
||||||
|
[node name="Swing" type="Button" parent="GetLoaded"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
disabled = true
|
||||||
|
text = "The Swing"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="StartLoading" to="." method="_on_start_loading_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/Babel" to="." method="_on_babel_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/LasMeninas" to="." method="_on_las_meninas_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/MonaLisa" to="." method="_on_mona_lisa_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/OldGuitarist" to="." method="_on_old_guitarist_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/Parasol" to="." method="_on_parasol_pressed"]
|
||||||
|
[connection signal="pressed" from="GetLoaded/Swing" to="." method="_on_swing_pressed"]
|
||||||
|
Before Width: | Height: | Size: 420 KiB After Width: | Height: | Size: 420 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_babel.jpg-7d4afda4b0268025e231a7f9e793a18d.stex"
|
uid="uid://y5tmlxhhiv2u"
|
||||||
|
path="res://.godot/imported/painting_babel.jpg-7d4afda4b0268025e231a7f9e793a18d.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_babel.jpg"
|
source_file="res://paintings/painting_babel.jpg"
|
||||||
dest_files=["res://.godot/imported/painting_babel.jpg-7d4afda4b0268025e231a7f9e793a18d.stex"]
|
dest_files=["res://.godot/imported/painting_babel.jpg-7d4afda4b0268025e231a7f9e793a18d.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 654 KiB After Width: | Height: | Size: 654 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_las_meninas.png-980a9e4669b648b01417bfb871e282ee.stex"
|
uid="uid://d1pbl328jrf0k"
|
||||||
|
path="res://.godot/imported/painting_las_meninas.png-980a9e4669b648b01417bfb871e282ee.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_las_meninas.png"
|
source_file="res://paintings/painting_las_meninas.png"
|
||||||
dest_files=["res://.godot/imported/painting_las_meninas.png-980a9e4669b648b01417bfb871e282ee.stex"]
|
dest_files=["res://.godot/imported/painting_las_meninas.png-980a9e4669b648b01417bfb871e282ee.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_mona_lisa.jpg-0d1e89a489f14142e264e1f238465e1c.stex"
|
uid="uid://bad1drr2you5e"
|
||||||
|
path="res://.godot/imported/painting_mona_lisa.jpg-0d1e89a489f14142e264e1f238465e1c.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_mona_lisa.jpg"
|
source_file="res://paintings/painting_mona_lisa.jpg"
|
||||||
dest_files=["res://.godot/imported/painting_mona_lisa.jpg-0d1e89a489f14142e264e1f238465e1c.stex"]
|
dest_files=["res://.godot/imported/painting_mona_lisa.jpg-0d1e89a489f14142e264e1f238465e1c.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_old_guitarist.jpg-9b4236f27fd614bf0a429568255ea118.stex"
|
uid="uid://bn3aufteoq2sa"
|
||||||
|
path="res://.godot/imported/painting_old_guitarist.jpg-9b4236f27fd614bf0a429568255ea118.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_old_guitarist.jpg"
|
source_file="res://paintings/painting_old_guitarist.jpg"
|
||||||
dest_files=["res://.godot/imported/painting_old_guitarist.jpg-9b4236f27fd614bf0a429568255ea118.stex"]
|
dest_files=["res://.godot/imported/painting_old_guitarist.jpg-9b4236f27fd614bf0a429568255ea118.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 266 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_parasol.jpg-58515a51999e7c2414ba8e02c335b3cf.stex"
|
uid="uid://qut3pkm72hge"
|
||||||
|
path="res://.godot/imported/painting_parasol.jpg-58515a51999e7c2414ba8e02c335b3cf.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_parasol.jpg"
|
source_file="res://paintings/painting_parasol.jpg"
|
||||||
dest_files=["res://.godot/imported/painting_parasol.jpg-58515a51999e7c2414ba8e02c335b3cf.stex"]
|
dest_files=["res://.godot/imported/painting_parasol.jpg-58515a51999e7c2414ba8e02c335b3cf.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 241 KiB |
@@ -1,8 +1,9 @@
|
|||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture2D"
|
type="CompressedTexture2D"
|
||||||
path="res://.godot/imported/painting_the_swing.jpg-c81abef8954f7fb30f742b957576d4d2.stex"
|
uid="uid://bqtsy0u0x7drj"
|
||||||
|
path="res://.godot/imported/painting_the_swing.jpg-c81abef8954f7fb30f742b957576d4d2.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
@@ -10,26 +11,24 @@ metadata={
|
|||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://paintings/painting_the_swing.jpg"
|
source_file="res://paintings/painting_the_swing.jpg"
|
||||||
dest_files=["res://.godot/imported/painting_the_swing.jpg-c81abef8954f7fb30f742b957576d4d2.stex"]
|
dest_files=["res://.godot/imported/painting_the_swing.jpg-c81abef8954f7fb30f742b957576d4d2.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_mode=0
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
compress/bptc_ldr=0
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
flags/repeat=0
|
compress/channel_pack=0
|
||||||
flags/filter=true
|
mipmaps/generate=false
|
||||||
flags/mipmaps=true
|
mipmaps/limit=-1
|
||||||
flags/anisotropic=false
|
roughness/mode=0
|
||||||
flags/srgb=2
|
roughness/src_normal=""
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/HDR_as_SRGB=false
|
|
||||||
process/invert_color=false
|
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
stream=false
|
process/hdr_as_srgb=false
|
||||||
size_limit=0
|
process/hdr_clamp_exposure=false
|
||||||
detect_3d=true
|
process/size_limit=0
|
||||||
svg/scale=1.0
|
detect_3d/compress_to=1
|
||||||
26
loading/load_threaded/project.godot
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Threaded Loading"
|
||||||
|
config/description="This demo demonstrates how to use ResourceLoader for background loading."
|
||||||
|
run/main_scene="res://load_threaded.tscn"
|
||||||
|
config/features=PackedStringArray("4.0")
|
||||||
|
run/low_processor_mode=true
|
||||||
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="mobile"
|
||||||
BIN
loading/load_threaded/screenshots/paintings.png
Normal file
|
After Width: | Height: | Size: 382 KiB |
@@ -1,18 +0,0 @@
|
|||||||
# Multiple-threads loading demo
|
|
||||||
|
|
||||||
This demo shows how you can organize
|
|
||||||
background loading using multiple threads.
|
|
||||||
|
|
||||||
Language: GDScript
|
|
||||||
|
|
||||||
Renderer: GLES 2
|
|
||||||
|
|
||||||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/582
|
|
||||||
|
|
||||||
## How does it work?
|
|
||||||
|
|
||||||
[Official documentation - Using multiple threads](http://docs.godotengine.org/en/3.2/tutorials/io/background_loading.html#using-multiple-threads)
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
|
Before Width: | Height: | Size: 4.3 KiB |
@@ -1,3 +0,0 @@
|
|||||||
# For this folder only, let's ignore all *.import files.
|
|
||||||
# Otherwise, there would be over a thousand lines committed for no benefit.
|
|
||||||
*.import
|
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -1,5 +0,0 @@
|
|||||||
extends LinkButton
|
|
||||||
|
|
||||||
func _on_LinkButton_button_up():
|
|
||||||
# warning-ignore:return_value_discarded
|
|
||||||
OS.shell_open("http://docs.godotengine.org/en/3.2/tutorials/io/background_loading.html#using-multiple-threads")
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
[gd_scene load_steps=41 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://images/icon_1.png" type="Texture2D" id=1]
|
|
||||||
[ext_resource path="res://images/icon_2.png" type="Texture2D" id=2]
|
|
||||||
[ext_resource path="res://images/icon_3.png" type="Texture2D" id=3]
|
|
||||||
[ext_resource path="res://images/icon_4.png" type="Texture2D" id=4]
|
|
||||||
[ext_resource path="res://images/icon_5.png" type="Texture2D" id=5]
|
|
||||||
[ext_resource path="res://images/icon_6.png" type="Texture2D" id=6]
|
|
||||||
[ext_resource path="res://images/icon_7.png" type="Texture2D" id=7]
|
|
||||||
[ext_resource path="res://images/icon_8.png" type="Texture2D" id=8]
|
|
||||||
[ext_resource path="res://images/icon_9.png" type="Texture2D" id=9]
|
|
||||||
[ext_resource path="res://images/icon_10.png" type="Texture2D" id=10]
|
|
||||||
[ext_resource path="res://images/icon_11.png" type="Texture2D" id=11]
|
|
||||||
[ext_resource path="res://images/icon_12.png" type="Texture2D" id=12]
|
|
||||||
[ext_resource path="res://images/icon_13.png" type="Texture2D" id=13]
|
|
||||||
[ext_resource path="res://images/icon_14.png" type="Texture2D" id=14]
|
|
||||||
[ext_resource path="res://images/icon_15.png" type="Texture2D" id=15]
|
|
||||||
[ext_resource path="res://images/icon_16.png" type="Texture2D" id=16]
|
|
||||||
[ext_resource path="res://images/icon_17.png" type="Texture2D" id=17]
|
|
||||||
[ext_resource path="res://images/icon_18.png" type="Texture2D" id=18]
|
|
||||||
[ext_resource path="res://images/icon_19.png" type="Texture2D" id=19]
|
|
||||||
[ext_resource path="res://images/icon_20.png" type="Texture2D" id=20]
|
|
||||||
[ext_resource path="res://images/icon_21.png" type="Texture2D" id=21]
|
|
||||||
[ext_resource path="res://images/icon_22.png" type="Texture2D" id=22]
|
|
||||||
[ext_resource path="res://images/icon_23.png" type="Texture2D" id=23]
|
|
||||||
[ext_resource path="res://images/icon_24.png" type="Texture2D" id=24]
|
|
||||||
[ext_resource path="res://images/icon_25.png" type="Texture2D" id=25]
|
|
||||||
[ext_resource path="res://images/icon_26.png" type="Texture2D" id=26]
|
|
||||||
[ext_resource path="res://images/icon_27.png" type="Texture2D" id=27]
|
|
||||||
[ext_resource path="res://images/icon_28.png" type="Texture2D" id=28]
|
|
||||||
[ext_resource path="res://images/icon_29.png" type="Texture2D" id=29]
|
|
||||||
[ext_resource path="res://images/icon_30.png" type="Texture2D" id=30]
|
|
||||||
[ext_resource path="res://images/icon_31.png" type="Texture2D" id=31]
|
|
||||||
[ext_resource path="res://images/icon_32.png" type="Texture2D" id=32]
|
|
||||||
[ext_resource path="res://images/icon_33.png" type="Texture2D" id=33]
|
|
||||||
[ext_resource path="res://images/icon_34.png" type="Texture2D" id=34]
|
|
||||||
[ext_resource path="res://images/icon_35.png" type="Texture2D" id=35]
|
|
||||||
[ext_resource path="res://images/icon_36.png" type="Texture2D" id=36]
|
|
||||||
[ext_resource path="res://images/icon_37.png" type="Texture2D" id=37]
|
|
||||||
[ext_resource path="res://images/icon_38.png" type="Texture2D" id=38]
|
|
||||||
[ext_resource path="res://images/icon_39.png" type="Texture2D" id=39]
|
|
||||||
[ext_resource path="res://images/icon_40.png" type="Texture2D" id=40]
|
|
||||||
|
|
||||||
[node name="Node" type="Node"]
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
color = Color(0, 0, 0, 1)
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
|
||||||
offset_left = 452.0
|
|
||||||
offset_top = 272.0
|
|
||||||
offset_right = 572.0
|
|
||||||
offset_bottom = 286.0
|
|
||||||
text = "Main scene loaded"
|
|
||||||
|
|
||||||
[node name="Sprite1" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="Sprite2" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="Sprite3" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="Sprite4" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="Sprite5" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Sprite6" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 6 )
|
|
||||||
|
|
||||||
[node name="Sprite7" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 7 )
|
|
||||||
|
|
||||||
[node name="Sprite8" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 8 )
|
|
||||||
|
|
||||||
[node name="Sprite9" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 9 )
|
|
||||||
|
|
||||||
[node name="Sprite10" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 10 )
|
|
||||||
|
|
||||||
[node name="Sprite11" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 11 )
|
|
||||||
|
|
||||||
[node name="Sprite12" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 12 )
|
|
||||||
|
|
||||||
[node name="Sprite13" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 13 )
|
|
||||||
|
|
||||||
[node name="Sprite14" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 14 )
|
|
||||||
|
|
||||||
[node name="Sprite15" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 15 )
|
|
||||||
|
|
||||||
[node name="Sprite16" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 16 )
|
|
||||||
|
|
||||||
[node name="Sprite17" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 17 )
|
|
||||||
|
|
||||||
[node name="Sprite18" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 18 )
|
|
||||||
|
|
||||||
[node name="Sprite19" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 19 )
|
|
||||||
|
|
||||||
[node name="Sprite20" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 20 )
|
|
||||||
|
|
||||||
[node name="Sprite21" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 21 )
|
|
||||||
|
|
||||||
[node name="Sprite22" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 22 )
|
|
||||||
|
|
||||||
[node name="Sprite23" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 23 )
|
|
||||||
|
|
||||||
[node name="Sprite24" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 24 )
|
|
||||||
|
|
||||||
[node name="Sprite25" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 25 )
|
|
||||||
|
|
||||||
[node name="Sprite26" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 26 )
|
|
||||||
|
|
||||||
[node name="Sprite27" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 27 )
|
|
||||||
|
|
||||||
[node name="Sprite28" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 28 )
|
|
||||||
|
|
||||||
[node name="Sprite29" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 29 )
|
|
||||||
|
|
||||||
[node name="Sprite30" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 30 )
|
|
||||||
|
|
||||||
[node name="Sprite31" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 31 )
|
|
||||||
|
|
||||||
[node name="Sprite32" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 32 )
|
|
||||||
|
|
||||||
[node name="Sprite33" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 33 )
|
|
||||||
|
|
||||||
[node name="Sprite34" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 34 )
|
|
||||||
|
|
||||||
[node name="Sprite35" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 35 )
|
|
||||||
|
|
||||||
[node name="Sprite36" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 36 )
|
|
||||||
|
|
||||||
[node name="Sprite37" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 37 )
|
|
||||||
|
|
||||||
[node name="Sprite38" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 38 )
|
|
||||||
|
|
||||||
[node name="Sprite39" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 39 )
|
|
||||||
|
|
||||||
[node name="Sprite40" type="Sprite2D" parent="."]
|
|
||||||
visible = false
|
|
||||||
texture = ExtResource( 40 )
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
extends Node
|
|
||||||
|
|
||||||
|
|
||||||
var queue
|
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
# Initialize.
|
|
||||||
queue = preload("res://resource_queue.gd").new()
|
|
||||||
# Call after you instance the class to start the thread.
|
|
||||||
queue.start()
|
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
# Returns true if a resource is done loading and ready to be retrieved.
|
|
||||||
if queue.is_ready("res://main.tscn"):
|
|
||||||
set_process(false)
|
|
||||||
# Returns the fully loaded resource.
|
|
||||||
var next_scene = queue.get_resource("res://main.tscn").instantiate()
|
|
||||||
get_node(^"/root").add_child(next_scene)
|
|
||||||
get_node(^"/root").remove_child(self)
|
|
||||||
queue_free()
|
|
||||||
else:
|
|
||||||
# Get the progress of a resource.
|
|
||||||
var progress = round(queue.get_progress("res://main.tscn") * 100)
|
|
||||||
get_node(^"ProgressBar").set_value(progress)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Button_button_up():
|
|
||||||
get_node(^"Button").hide()
|
|
||||||
set_process(true)
|
|
||||||
# Queue a resource.
|
|
||||||
queue.queue_resource("res://main.tscn", true)
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://preload.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://link_button.gd" type="Script" id=2]
|
|
||||||
|
|
||||||
[node name="Node" type="Node"]
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
color = Color(0.00390625, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="ProgressBar" type="ProgressBar" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -225.0
|
|
||||||
offset_top = -66.0
|
|
||||||
offset_right = 225.0
|
|
||||||
offset_bottom = 66.0
|
|
||||||
step = 1.0
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_left = -223.0
|
|
||||||
offset_top = -193.0
|
|
||||||
offset_right = 224.0
|
|
||||||
offset_bottom = -84.0
|
|
||||||
text = "Load next scene"
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
offset_left = -267.0
|
|
||||||
offset_top = 12.0
|
|
||||||
offset_right = 267.0
|
|
||||||
offset_bottom = 82.0
|
|
||||||
text = "Multiple-treads loading demo
|
|
||||||
The next scene contains 40 resource files. Loading is done using multiple threads.
|
|
||||||
The download speed depends on the performance of your device.
|
|
||||||
For more information, see:"
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="LinkButton" type="LinkButton" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
offset_left = -233.0
|
|
||||||
offset_top = 80.0
|
|
||||||
offset_right = 233.0
|
|
||||||
offset_bottom = 94.0
|
|
||||||
text = "http://docs.godotengine.org/en/3.2/tutorials/io/background_loading.html"
|
|
||||||
script = ExtResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[connection signal="button_up" from="Button" to="." method="_on_Button_button_up"]
|
|
||||||
[connection signal="button_up" from="LinkButton" to="LinkButton" method="_on_LinkButton_button_up"]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
; Engine configuration file.
|
|
||||||
; It's best edited using the editor UI and not directly,
|
|
||||||
; since the parameters that go here are not all obvious.
|
|
||||||
;
|
|
||||||
; Format:
|
|
||||||
; [section] ; section goes between []
|
|
||||||
; param=value ; assign values to parameters
|
|
||||||
|
|
||||||
config_version=4
|
|
||||||
|
|
||||||
[application]
|
|
||||||
|
|
||||||
config/name="Multiple threads loading"
|
|
||||||
config/description="This demo shows how you can organize
|
|
||||||
background loading using multiple threads."
|
|
||||||
run/main_scene="res://preload.tscn"
|
|
||||||
config/icon="res://icon.png"
|
|
||||||
|
|
||||||
[rendering]
|
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
|
||||||
vram_compression/import_etc=true
|
|
||||||
vram_compression/import_etc2=false
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
var thread
|
|
||||||
var mutex
|
|
||||||
var sem
|
|
||||||
|
|
||||||
var time_max = 100 # Milliseconds.
|
|
||||||
|
|
||||||
var queue = []
|
|
||||||
var pending = {}
|
|
||||||
|
|
||||||
func _lock(_caller):
|
|
||||||
mutex.lock()
|
|
||||||
|
|
||||||
|
|
||||||
func _unlock(_caller):
|
|
||||||
mutex.unlock()
|
|
||||||
|
|
||||||
|
|
||||||
func _post(_caller):
|
|
||||||
sem.post()
|
|
||||||
|
|
||||||
|
|
||||||
func _wait(_caller):
|
|
||||||
sem.wait()
|
|
||||||
|
|
||||||
|
|
||||||
func queue_resource(path, p_in_front = false):
|
|
||||||
_lock("queue_resource")
|
|
||||||
if path in pending:
|
|
||||||
_unlock("queue_resource")
|
|
||||||
return
|
|
||||||
elif ResourceLoader.has_cached(path):
|
|
||||||
var res = ResourceLoader.load(path)
|
|
||||||
pending[path] = res
|
|
||||||
_unlock("queue_resource")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
var res = ResourceLoader.load_interactive(path)
|
|
||||||
res.set_meta("path", path)
|
|
||||||
if p_in_front:
|
|
||||||
queue.insert(0, res)
|
|
||||||
else:
|
|
||||||
queue.push_back(res)
|
|
||||||
pending[path] = res
|
|
||||||
_post("queue_resource")
|
|
||||||
_unlock("queue_resource")
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
func cancel_resource(path):
|
|
||||||
_lock("cancel_resource")
|
|
||||||
if path in pending:
|
|
||||||
if pending[path] is ResourceInteractiveLoader:
|
|
||||||
queue.erase(pending[path])
|
|
||||||
pending.erase(path)
|
|
||||||
_unlock("cancel_resource")
|
|
||||||
|
|
||||||
|
|
||||||
func get_progress(path):
|
|
||||||
_lock("get_progress")
|
|
||||||
var ret = -1
|
|
||||||
if path in pending:
|
|
||||||
if pending[path] is ResourceInteractiveLoader:
|
|
||||||
ret = float(pending[path].get_stage()) / float(pending[path].get_stage_count())
|
|
||||||
else:
|
|
||||||
ret = 1.0
|
|
||||||
_unlock("get_progress")
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
func is_ready(path):
|
|
||||||
var ret
|
|
||||||
_lock("is_ready")
|
|
||||||
if path in pending:
|
|
||||||
ret = !(pending[path] is ResourceInteractiveLoader)
|
|
||||||
else:
|
|
||||||
ret = false
|
|
||||||
_unlock("is_ready")
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
func _wait_for_resource(res, path):
|
|
||||||
_unlock("wait_for_resource")
|
|
||||||
while true:
|
|
||||||
RenderingServer.sync()
|
|
||||||
OS.delay_usec(16000) # Wait approximately 1 frame.
|
|
||||||
_lock("wait_for_resource")
|
|
||||||
if queue.size() == 0 or queue[0] != res:
|
|
||||||
return pending[path]
|
|
||||||
_unlock("wait_for_resource")
|
|
||||||
|
|
||||||
|
|
||||||
func get_resource(path):
|
|
||||||
_lock("get_resource")
|
|
||||||
if path in pending:
|
|
||||||
if pending[path] is ResourceInteractiveLoader:
|
|
||||||
var res = pending[path]
|
|
||||||
if res != queue[0]:
|
|
||||||
var pos = queue.find(res)
|
|
||||||
queue.remove(pos)
|
|
||||||
queue.insert(0, res)
|
|
||||||
|
|
||||||
res = _wait_for_resource(res, path)
|
|
||||||
pending.erase(path)
|
|
||||||
_unlock("return")
|
|
||||||
return res
|
|
||||||
else:
|
|
||||||
var res = pending[path]
|
|
||||||
pending.erase(path)
|
|
||||||
_unlock("return")
|
|
||||||
return res
|
|
||||||
else:
|
|
||||||
_unlock("return")
|
|
||||||
return ResourceLoader.load(path)
|
|
||||||
|
|
||||||
|
|
||||||
func thread_process():
|
|
||||||
_wait("thread_process")
|
|
||||||
_lock("process")
|
|
||||||
|
|
||||||
while queue.size() > 0:
|
|
||||||
var res = queue[0]
|
|
||||||
_unlock("process_poll")
|
|
||||||
var ret = res.poll()
|
|
||||||
_lock("process_check_queue")
|
|
||||||
|
|
||||||
if ret == ERR_FILE_EOF or ret != OK:
|
|
||||||
var path = res.get_meta("path")
|
|
||||||
if path in pending: # Else, it was already retrieved.
|
|
||||||
pending[res.get_meta("path")] = res.get_resource()
|
|
||||||
# Something might have been put at the front of the queue while
|
|
||||||
# we polled, so use erase instead of remove.
|
|
||||||
queue.erase(res)
|
|
||||||
_unlock("process")
|
|
||||||
|
|
||||||
|
|
||||||
func thread_func(_u):
|
|
||||||
while true:
|
|
||||||
thread_process()
|
|
||||||
|
|
||||||
|
|
||||||
func start():
|
|
||||||
mutex = Mutex.new()
|
|
||||||
sem = Semaphore.new()
|
|
||||||
thread = Thread.new()
|
|
||||||
thread.start(self, "thread_func", 0)
|
|
||||||