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>2019-08-09 12:39:01 +0300
committerVilém Duha <vilda.novak@gmail.com>2019-08-12 16:58:36 +0300
commit87d8e1d28ae0deb271540cf1487970de865d51f7 (patch)
treef7143dbeaaf7ec20f49792f6fdb66c22864eb573
parent9e0dc9b9d3c4c83eee207324ea9df0bf6e619617 (diff)
BlenderKit: improve searching for first ratable asset.
Now parents will be searched to get first parent with relevant data, also in appended assets.
-rw-r--r--blenderkit/ui.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index b03875f0..e62b8aa6 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -973,12 +973,20 @@ def is_rating_possible():
rated = bpy.context.scene['assets rated'].get(ad['asset_base_id'])
return True, rated, b, ad
if ao is not None:
- # TODO ADD BRUSHES HERE
- ad = ao.get('asset_data')
- if ad is not None:
- rated = bpy.context.scene['assets rated'].get(ad['asset_base_id'])
- # originally hidden for already rated assets
- return True, rated, ao, ad
+ ad = None
+ #crawl parents to reach active asset. there could have been parenting so we need to find the first onw
+ ao_check = ao
+ while ad is None or (ad is None and ao_check.parent is not None):
+ ad = ao_check.get('asset_data')
+ if ad is not None:
+ rated = bpy.context.scene['assets rated'].get(ad['asset_base_id'])
+ # originally hidden for already rated assets
+ return True, rated, ao_check, ad
+ elif ao_check.parent is not None:
+ ao_check = ao_check.parent
+ else:
+ break;
+
# check also materials
m = ao.active_material