Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVilém Duha <vilda.novak@gmail.com>2020-11-02 08:01:10 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-11-02 08:01:10 +0300
commite7545e59529c7b322e46cfffe111972ec0fb574f (patch)
tree3a777d8027826588e0e5caa5a0bcbee63aff91f1
parenta927d3e1bca8a9d2c5e16932e32866954435cc7b (diff)
BlenderKit: fix older assets update, was throwing an error on scene load.
-rw-r--r--blenderkit/search.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 0af69dd8..f1230eb7 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -105,12 +105,15 @@ def refresh_token_timer():
def update_ad(ad):
if not ad.get('assetBaseId'):
- ad['assetBaseId'] = ad['asset_base_id'] # this should stay ONLY for compatibility with older scenes
- ad['assetType'] = ad['asset_type'] # this should stay ONLY for compatibility with older scenes
- ad['canDownload'] = ad['can_download'] # this should stay ONLY for compatibility with older scenes
- ad['verificationStatus'] = ad['verification_status'] # this should stay ONLY for compatibility with older scenes
- ad['author'] = {}
- ad['author']['id'] = ad['author_id'] # this should stay ONLY for compatibility with older scenes
+ try:
+ ad['assetBaseId'] = ad['asset_base_id'] # this should stay ONLY for compatibility with older scenes
+ ad['assetType'] = ad['asset_type'] # this should stay ONLY for compatibility with older scenes
+ ad['verificationStatus'] = ad['verification_status'] # this should stay ONLY for compatibility with older scenes
+ ad['author'] = {}
+ ad['author']['id'] = ad['author_id'] # this should stay ONLY for compatibility with older scenes
+ ad['canDownload'] = ad['can_download'] # this should stay ONLY for compatibility with older scenes
+ except Exception as e:
+ print('BLenderKit failed to update older asset data')
return ad
def update_assets_data(): # updates assets data on scene load.
@@ -131,16 +134,18 @@ def update_assets_data(): # updates assets data on scene load.
dicts = [
'assets used',
- 'assets rated',
+ # 'assets rated',# assets rated stores only true/false, not asset data.
]
for s in bpy.data.scenes:
- for k in dicts:
- d = s.get(k)
+ for bkdict in dicts:
+
+ d = s.get(bkdict)
+ print(d)
if not d:
continue;
- for k in d.keys():
- update_ad(d[k])
+ for asset_id in d.keys():
+ update_ad(d[asset_id])
# bpy.context.scene['assets used'][ad] = ad