mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Format files using updated file_format.sh
This commit is contained in:
@@ -12,9 +12,9 @@ func _thread_load(path):
|
||||
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())
|
||||
@@ -31,20 +31,20 @@ func _thread_load(path):
|
||||
# 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.instance()
|
||||
# Free current scene.
|
||||
@@ -54,7 +54,7 @@ func _thread_done(resource):
|
||||
get_tree().root.add_child(new_scene)
|
||||
# Set as current scene.
|
||||
get_tree().current_scene = new_scene
|
||||
|
||||
|
||||
progress.visible = false
|
||||
|
||||
func load_scene(path):
|
||||
|
||||
@@ -98,7 +98,7 @@ func get_resource(path):
|
||||
var pos = queue.find(res)
|
||||
queue.remove(pos)
|
||||
queue.insert(0, res)
|
||||
|
||||
|
||||
res = _wait_for_resource(res, path)
|
||||
pending.erase(path)
|
||||
_unlock("return")
|
||||
@@ -116,13 +116,13 @@ func get_resource(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 || ret != OK:
|
||||
var path = res.get_meta("path")
|
||||
if path in pending: # Else, it was already retrieved.
|
||||
|
||||
Reference in New Issue
Block a user