BlenderKit: one more fix for check if an asset was linked or appended

The state was written before first check, that's why always append was assumed to happen
This commit is contained in:
Vilém Duha 2019-09-10 16:46:55 +02:00
parent 59c9616787
commit eb9bab0e71
1 changed files with 10 additions and 7 deletions

View File

@ -281,13 +281,7 @@ def append_asset(asset_data, **kwargs): # downloaders=[], location=None,
# link the group we are interested in( there are more groups in File!!!! , have to get the correct one!)
#
scene = bpy.context.scene
scene['assets used'] = scene.get('assets used', {})
scene['assets used'][asset_data['asset_base_id']] = asset_data.copy()
scene['assets rated'] = scene.get('assets rated', {})
id = asset_data['asset_base_id']
scene['assets rated'][id] = scene['assets rated'].get(id, False)
user_preferences = bpy.context.preferences.addons['blenderkit'].preferences
@ -433,6 +427,14 @@ def append_asset(asset_data, **kwargs): # downloaders=[], location=None,
parent = material
scene['assets used'] = scene.get('assets used', {})
scene['assets used'][asset_data['asset_base_id']] = asset_data.copy()
scene['assets rated'] = scene.get('assets rated', {})
id = asset_data['asset_base_id']
scene['assets rated'][id] = scene['assets rated'].get(id, False)
parent['asset_data'] = asset_data # TODO remove this??? should write to blenderkit Props?
# moving reporting to on save.
# report_use_success(asset_data['id'])
@ -701,7 +703,8 @@ def asset_in_scene(asset_data):
scene = bpy.context.scene
au = scene.get('assets used', {})
for id in au.keys():
id = asset_data['asset_base_id']
if id in au.keys():
ad = au[id]
if ad.get('file_name') != None: