diff options
Diffstat (limited to 'blenderkit')
-rw-r--r-- | blenderkit/ratings.py | 39 | ||||
-rw-r--r-- | blenderkit/search.py | 2 | ||||
-rw-r--r-- | blenderkit/ui.py | 5 | ||||
-rw-r--r-- | blenderkit/ui_panels.py | 31 |
4 files changed, 51 insertions, 26 deletions
diff --git a/blenderkit/ratings.py b/blenderkit/ratings.py index 1d7b843d..24e56a45 100644 --- a/blenderkit/ratings.py +++ b/blenderkit/ratings.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -from blenderkit import paths, utils, rerequests, tasks_queue, ratings_utils +from blenderkit import paths, utils, rerequests, tasks_queue, ratings_utils, icons import bpy import requests, threading @@ -176,44 +176,58 @@ class UploadRatingOperator(bpy.types.Operator): def draw_ratings_menu(self, context, layout): + pcoll = icons.icon_collections["main"] + layout.scale_y=1 + col = layout.column() # layout.template_icon_view(bkit_ratings, property, show_labels=False, scale=6.0, scale_popup=5.0) row = col.row() + row.label(text='Quality:', icon = 'SOLO_ON') + row = col.row() + row.label(text='Please help us by rating this asset quality:') + + row = col.row() row.prop(self, 'rating_quality_ui', expand=True, icon_only=True, emboss=False) # row.label(text=str(self.rating_quality)) col.separator() + col.separator() - row = layout.row() + row = col.row() + row.label(text='Complexity:', icon_value=pcoll['dumbbell'].icon_id) + row = col.row() row.label(text=f"How many hours did this {self.asset_type} save you?") + if utils.profile_is_validator(): + row = col.row() + row.prop(self, 'rating_work_hours') + if self.asset_type in ('model', 'scene'): - row = layout.row() - if utils.profile_is_validator(): - col.prop(self, 'rating_work_hours') + row = col.row() + row.prop(self, 'rating_work_hours_ui', expand=True, icon_only=False, emboss=True) if float(self.rating_work_hours_ui) > 100: - utils.label_multiline(layout, + utils.label_multiline(col, text=f"\nThat's huge! please be sure to give such rating only to godly {self.asset_type}s.\n", width=500) elif float(self.rating_work_hours_ui) > 18: - layout.separator() + col.separator() - utils.label_multiline(layout, + utils.label_multiline(col, text=f"\nThat's a lot! please be sure to give such rating only to amazing {self.asset_type}s.\n", width=500) elif self.asset_type == 'hdr': - row = layout.row() + row = col.row() row.prop(self, 'rating_work_hours_ui_1_10', expand=True, icon_only=False, emboss=True) else: - row = layout.row() + row = col.row() row.prop(self, 'rating_work_hours_ui_1_5', expand=True, icon_only=False, emboss=True) class FastRateMenu(Operator, ratings_utils.RatingsProperties): """Rating of the assets , also directly from the asset bar - without need to download assets""" bl_idname = "wm.blenderkit_menu_rating_upload" - bl_label = "Rate asset" + bl_label = "" bl_options = {'REGISTER', 'UNDO', 'INTERNAL'} @@ -226,6 +240,7 @@ class FastRateMenu(Operator, ratings_utils.RatingsProperties): def draw(self, context): layout = self.layout layout.label(text=self.message) + layout.separator() draw_ratings_menu(self, context, layout) @@ -265,7 +280,7 @@ class FastRateMenu(Operator, ratings_utils.RatingsProperties): if self.asset_id == '': return {'CANCELLED'} - self.message = f"Rate asset {self.asset_name}" + self.message = f"{self.asset_name}" wm = context.window_manager if self.asset_type in ('model', 'scene'): diff --git a/blenderkit/search.py b/blenderkit/search.py index 858f676b..49337888 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -628,7 +628,7 @@ class ThumbDownloader(threading.Thread): return self._stop_event.is_set() def run(self): - print('thumb downloader', self.url) + # print('thumb downloader', self.url) try: r = requests.get(self.url, stream=False) except Exception as e: diff --git a/blenderkit/ui.py b/blenderkit/ui.py index 182ab99a..14eccb24 100644 --- a/blenderkit/ui.py +++ b/blenderkit/ui.py @@ -382,6 +382,7 @@ def draw_tooltip_with_author(asset_data, x, y): gimg = utils.get_hidden_image(a['gravatarImg'], a['gravatarHash']) aname = asset_data['displayName'] + aname = aname[0].capitalize() + aname[0:] if len(aname)>36: aname = f"{aname[:33]}..." @@ -1419,10 +1420,10 @@ class AssetBarOperator(bpy.types.Operator): my = event.mouse_y - r.y if event.value == 'PRESS' and mouse_in_asset_bar(mx, my): - context.window.cursor_warp(event.mouse_x - 400, event.mouse_y - 20); + # context.window.cursor_warp(event.mouse_x - 300, event.mouse_y - 10); bpy.ops.wm.blenderkit_asset_popup('INVOKE_DEFAULT') - context.window.cursor_warp(event.mouse_x, event.mouse_y); + # context.window.cursor_warp(event.mouse_x, event.mouse_y); # bpy.ops.wm.call_menu(name='OBJECT_MT_blenderkit_asset_menu') return {'RUNNING_MODAL'} diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py index bc1d4984..3b9cd0c0 100644 --- a/blenderkit/ui_panels.py +++ b/blenderkit/ui_panels.py @@ -421,8 +421,6 @@ class VIEW3D_PT_blenderkit_model_properties(Panel): layout.label(text=str(ad['name'])) if o.instance_type == 'COLLECTION' and o.instance_collection is not None: layout.operator('object.blenderkit_bring_to_scene', text='Bring to scene') - # layout.label(text='Ratings:') - # draw_panel_model_rating(self, context) layout.label(text='Asset tools:') draw_asset_context_menu(self.layout, context, ad, from_panel=True) @@ -465,8 +463,6 @@ class NODE_PT_blenderkit_material_properties(Panel): if m.get('asset_data') is not None: ad = m['asset_data'] layout.label(text=str(ad['name'])) - layout.label(text='Ratings:') - draw_panel_material_ratings(self, context) layout.label(text='Asset tools:') draw_asset_context_menu(self.layout, context, ad, from_panel=True) @@ -1390,6 +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 layout.label(text='') layout.label(text='') return @@ -1400,7 +1397,6 @@ 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" @@ -1416,6 +1412,7 @@ 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() @@ -1439,6 +1436,10 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): parameter = utils.get_param(self.asset_data, key) if parameter == None: return + if type(parameter) == int: + parameter = f"{parameter:,d}" + elif type(parameter) == float: + parameter = f"{parameter:,.1f}" self.draw_property(layout, pretext, parameter) def draw_properties(self, layout, width=250): @@ -1458,6 +1459,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): pcoll = icons.icon_collections["main"] box = layout.box() + box.scale_y = 0.8 box.label(text='Properties') if self.asset_data.get('license') == 'cc_zero': @@ -1531,6 +1533,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): self.draw_asset_parameter(box, key='designCollection', pretext='Collection') self.draw_asset_parameter(box, key='designVariant', pretext='Variant') self.draw_asset_parameter(box, key='designYear', pretext='Design year') + self.draw_asset_parameter(box, key='faceCount', pretext='Face count') # self.draw_asset_parameter(box, key='thumbnailScale', pretext='Preview scale') # self.draw_asset_parameter(box, key='purePbr', pretext='Pure PBR') @@ -1605,6 +1608,11 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): icon_value=icon.icon_id, tooltip=plans_tooltip, url=plans_link) + 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) + def draw_author_area(self, context, layout, width=330): self.draw_author(context, layout, width=width) @@ -1673,9 +1681,9 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): box_thumbnail.template_icon(icon_value=self.img.preview.icon_id, scale=34.0) - # row = box_thumbnail.row() - # row.scale_y = 3 - # op = row.operator('view3d.asset_drag_drop', text='Drag & Drop from here', depress=True) + row = box_thumbnail.row() + row.scale_y = 3 + op = row.operator('view3d.asset_drag_drop', text='Drag & Drop from here', depress=True) row = box_thumbnail.row() row.alignment = 'EXPAND' @@ -1749,7 +1757,9 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): # top draggabe bar with name of the asset top_row = layout.row() top_drag_bar = top_row.box() - top_drag_bar.label(text=asset_data['displayName']) + aname = asset_data['displayName'] + aname = aname[0].capitalize() + aname[0:] + top_drag_bar.label(text=aname) # left side row = layout.row(align=True) @@ -1763,8 +1773,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): self.draw_menu_desc_author(context, split_right, width=int(self.width * split_ratio)) ratings_box = layout.box() - ratings_box.scale_y = 0.7 - ratings_box.label(text='Rate asset quality:') + ratings.draw_ratings_menu(self, context, ratings_box) tip_box = layout.box() tip_box.label(text=self.tip) |