From 692a15f3c50c57cc3b66115aa5f316aa290ddc0a Mon Sep 17 00:00:00 2001 From: Vilem Duha Date: Tue, 20 Jul 2021 14:26:26 +0200 Subject: BlenderKit: fixes and optimizations Search results aren't passed around back to search and are parsed only once. Same for previews. Search function could run many times per second when more pages were loaded. Search now causes almost no lag in Blender thanks to the fixes Default page size in search request is now fit to the asset bar size settings. several optimizations in the draw code - is now about 3x faster rerequests now can return a fake response in case of a timeout --- blenderkit/upload.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'blenderkit/upload.py') diff --git a/blenderkit/upload.py b/blenderkit/upload.py index 367f2cbd..d4570bf3 100644 --- a/blenderkit/upload.py +++ b/blenderkit/upload.py @@ -1274,16 +1274,11 @@ class AssetDebugPrint(Operator): return {'CANCELLED'}; # update status in search results for validator's clarity sr = bpy.context.window_manager['search results'] - sro = bpy.context.window_manager['search results orig']['results'] result = None for r in sr: if r['id'] == self.asset_id: result = r.to_dict() - if not result: - for r in sro: - if r['id'] == self.asset_id: - result = r.to_dict() if not result: ad = bpy.context.active_object.get('asset_data') if ad: @@ -1329,14 +1324,10 @@ class AssetVerificationStatusChange(Operator): return {'CANCELLED'}; # update status in search results for validator's clarity sr = bpy.context.window_manager['search results'] - sro = bpy.context.window_manager['search results orig']['results'] for r in sr: if r['id'] == self.asset_id: r['verificationStatus'] = self.state - for r in sro: - if r['id'] == self.asset_id: - r['verificationStatus'] = self.state thread = threading.Thread(target=verification_status_change_thread, args=(self.asset_id, self.state, preferences.api_key)) @@ -1353,7 +1344,6 @@ class AssetVerificationStatusChange(Operator): def register_upload(): bpy.utils.register_class(UploadOperator) - # bpy.utils.register_class(FastMetadataMenu) bpy.utils.register_class(FastMetadata) bpy.utils.register_class(AssetDebugPrint) bpy.utils.register_class(AssetVerificationStatusChange) @@ -1361,7 +1351,6 @@ def register_upload(): def unregister_upload(): bpy.utils.unregister_class(UploadOperator) - # bpy.utils.unregister_class(FastMetadataMenu) bpy.utils.unregister_class(FastMetadata) bpy.utils.unregister_class(AssetDebugPrint) bpy.utils.unregister_class(AssetVerificationStatusChange) -- cgit v1.2.3