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:
Diffstat (limited to 'blenderkit/ui_panels.py')
-rw-r--r--blenderkit/ui_panels.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index b17f7278..cb3b5a8b 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -1386,7 +1386,7 @@ def label_or_url(layout, text='', tooltip='', url='', icon_value=None, icon=None
else:
op = layout.operator('wm.blenderkit_tooltip', text=text)
op.tooltip = tooltip
- #these are here to move the text to left, since operators can only center text by default
+ # these are here to move the text to left, since operators can only center text by default
layout.label(text='')
layout.label(text='')
return
@@ -1397,6 +1397,7 @@ def label_or_url(layout, text='', tooltip='', url='', icon_value=None, icon=None
else:
layout.label(text=text)
+
class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
"""Generate Cycles thumbnail for model assets"""
bl_idname = "wm.blenderkit_asset_popup"
@@ -1412,7 +1413,6 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
col = layout.column()
draw_asset_context_menu(col, context, self.asset_data, from_panel=False)
-
def draw_property(self, layout, left, right, icon=None, icon_value=None, url='', tooltip=''):
right = str(right)
row = layout.row()
@@ -1515,14 +1515,12 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
if resolution is not None:
fs = self.asset_data['files']
-
ress = f"{int(round(resolution / 1024, 0))}K"
self.draw_property(box, 'Resolution', ress,
tooltip='Maximal resolution of textures in this asset.\n' \
'Most texture asset have also lower resolutions generated.\n' \
'Go to BlenderKit add-on import settings to set default resolution')
-
if fs and len(fs) > 2 and utils.profile_is_validator():
resolutions = ''
list.sort(fs, key=lambda f: f['fileType'])
@@ -1556,9 +1554,9 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
fsmb = fs // (1024 * 1024)
fskb = fs % 1024
if fsmb == 0:
- self.draw_property(box,'Original size:', f'{fskb}KB')
+ self.draw_property(box, 'Original size:', f'{fskb}KB')
else:
- self.draw_property(box,'Original size:', f'{fsmb}MB')
+ self.draw_property(box, 'Original size:', f'{fsmb}MB')
# Tags section
# row = box.row()
# letters_on_row = 0
@@ -1615,8 +1613,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
if utils.profile_is_validator():
date = self.asset_data['created'][:10]
date = f"{date[8:10]}. {date[5:7]}. {date[:4]}"
- self.draw_property(box,'Created:', date)
-
+ self.draw_property(box, 'Created:', date)
def draw_author_area(self, context, layout, width=330):
self.draw_author(context, layout, width=width)
@@ -1802,6 +1799,10 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
bl_label = asset_data['name']
self.tip = search.get_random_tip()
self.tip = self.tip.replace('\n', '')
+
+ # pre-fill ratings
+ self.prefill_ratings()
+
return wm.invoke_popup(self, width=self.width)