@@ -21,6 +21,7 @@ onready var progress = find_node("ProgressBar")
21
21
onready var size_label = find_node ("Size" )
22
22
23
23
var uid
24
+ var imported_path
24
25
25
26
func set_uid (uid ):
26
27
self .uid = uid
@@ -79,6 +80,12 @@ func _on_about_to_show():
79
80
$ All .visible = true
80
81
81
82
func _on_Download_pressed ():
83
+ if imported_path :
84
+ var ei = get_tree ().get_meta ("__editor_interface" )
85
+ ei .open_scene_from_path (imported_path )
86
+ hide ()
87
+ return
88
+
82
89
# Request download link
83
90
84
91
download .disabled = true
@@ -166,8 +173,23 @@ func _on_Download_pressed():
166
173
167
174
size_label .text = " Model unpacked into project!"
168
175
169
- # Trigger import
170
- get_tree ().get_meta ("__editor_interface" ).get_resource_filesystem ().scan ()
176
+ # Import and open
177
+
178
+ var base_name = filename .substr (0 , filename .find (".zip" ))
179
+ imported_path = "res://sketchfab/%s /scene.gltf" % base_name
180
+ var ei = get_tree ().get_meta ("__editor_interface" )
181
+ ei .get_resource_filesystem ().scan ()
182
+ while ei .get_resource_filesystem ().is_scanning ():
183
+ yield (get_tree (), "idle_frame" )
184
+ if ! get_tree ():
185
+ return
186
+ ei .select_file (imported_path )
187
+
188
+ progress .visible = false
189
+ size_label .visible = false
190
+ download .visible = true
191
+ download .text = "OPEN IMPORTED MODEL"
192
+ download .uppercase = true
171
193
172
194
func _on_download_progressed (bytes , total_bytes ):
173
195
if ! get_tree ():
0 commit comments