Skip to content

Commit 39be6e5

Browse files
committed
stash changes for linux dev
1 parent 3cf97dd commit 39be6e5

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

mirror-godot-app/creator/asset_inventory/browser/recent/recents_browser_section.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ func _generate_new_slot(recent_asset: Dictionary) -> BaseAssetSlot:
152152
slot.slot_activated.connect(_asset_browser.asset_slot_activated)
153153
slot.slot_special_action.connect(_asset_browser.use_slot_asset)
154154
_id_to_slot_map[recent_asset["id"]] = slot
155-
_slots_flow_container.add_child(slot)
155+
if slot.get_parent() == null:
156+
_slots_flow_container.add_child(slot)
156157
return slot
157158

158159

mirror-godot-app/scripts/net/file_cache.gd

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ func try_load_cached_file(cache_key: String) -> Variant:
128128
return TMFileUtil.load_json_file(file_path)
129129
return null
130130

131-
131+
# in memory cache
132132
var _cached_pairs = {}
133-
133+
var mutex: Mutex = Mutex.new()
134134
func load_gltf_thread_task(cache_key: String) -> Promise:
135+
mutex.lock()
135136
if _cached_pairs.has(cache_key):
136137
print("Cache found... not loading twice")
137138
return _cached_pairs[cache_key].promise
@@ -145,30 +146,21 @@ func load_gltf_thread_task(cache_key: String) -> Promise:
145146
return
146147
var file_name: String = _storage_cache.get(pair.key, "")
147148
var file_path: String = get_file_path(file_name)
148-
149149
var task_id = WorkerThreadPool.add_task(func():
150-
# future: we'll pack all the assets to .tscn and dependencies
151-
# it should be faster than packing / repacking things. maybe even .scn files.
152-
# if ResourceLoader.exists(file_path + ".tscn"):
153-
# var node = ResourceLoader.load(file_path + ".tscn").instantiate()
154-
# call_thread_safe("_cached_file_is_loaded", pair, node)
155-
# return
156150
var node = TMFileUtil.load_gltf_file_as_node(file_path, Zone.is_host())
157-
# var scene: PackedScene = PackedScene.new()
158-
# scene.pack(node)
159-
# ResourceSaver.save(scene, file_path + ".tscn")
160-
# print("Path: ", file_path + ".tscn")
161151
call_thread_safe("_cached_file_is_loaded", pair, node)
162152
)
163153

164-
154+
mutex.unlock()
165155
return pair.promise
166156

167157
## THIS MUST BE ON THE MAIN THREAD
168158
func _cached_file_is_loaded(pair, node):
159+
mutex.lock()
169160
print("Node name: ", node.get_name())
170161
if node == null:
171162
push_error("Can't load GLTF")
172163
pair.promise.set_error("Failed to load mesh, ignoring and skipping")
173164
return
174165
pair.promise.set_result(node)
166+
mutex.unlock()

0 commit comments

Comments
 (0)