BlenderKit: more fixes for ratings
This commit is contained in:
parent
2efbd0801e
commit
4a7958c848
|
@ -405,11 +405,11 @@ class FastRateMenu(Operator):
|
|||
if utils.profile_is_validator():
|
||||
col.prop(self, 'rating_work_hours')
|
||||
row.prop(self, 'rating_work_hours_ui', expand=True, icon_only=False, emboss=True)
|
||||
if int(self.rating_work_hours_ui) > 100:
|
||||
if float(self.rating_work_hours_ui) > 100:
|
||||
utils.label_multiline(layout,
|
||||
text=f"\nThat's huge! please be sure to give such rating only to godly {self.asset_type}s.\n",
|
||||
width=500)
|
||||
elif int(self.rating_work_hours_ui) > 18:
|
||||
elif float(self.rating_work_hours_ui) > 18:
|
||||
layout.separator()
|
||||
|
||||
utils.label_multiline(layout,
|
||||
|
@ -437,7 +437,7 @@ class FastRateMenu(Operator):
|
|||
if self.rating_quality_ui == '':
|
||||
self.rating_quality = 0
|
||||
else:
|
||||
self.rating_quality = int(self.rating_quality_ui)
|
||||
self.rating_quality = float(self.rating_quality_ui)
|
||||
|
||||
if self.rating_quality > 0.1:
|
||||
rtgs = (('quality', self.rating_quality),)
|
||||
|
|
|
@ -660,6 +660,7 @@ def generate_tooltip(mdata):
|
|||
if f['fileType'].find('resolution') > -1:
|
||||
t += 'Asset has lower resolutions available\n'
|
||||
break;
|
||||
|
||||
# generator is for both upload preview and search, this is only after search
|
||||
# if mdata.get('versionNumber'):
|
||||
# # t = writeblockm(t, mdata, key='versionNumber', pretext='version', width = col_w)
|
||||
|
@ -671,22 +672,27 @@ def generate_tooltip(mdata):
|
|||
|
||||
# t += '\n'
|
||||
rc = mdata.get('ratingsCount')
|
||||
if utils.profile_is_validator() and rc:
|
||||
|
||||
if rc:
|
||||
t+='\n'
|
||||
if rc:
|
||||
rcount = min(rc['quality'], rc['workingHours'])
|
||||
else:
|
||||
rcount = 0
|
||||
if rcount < 10:
|
||||
t += f"Please rate this asset, \nit doesn't have enough ratings.\n"
|
||||
else:
|
||||
t += f"Quality rating: {int(mdata['ratingsAverage']['quality']) * '*'}\n"
|
||||
t += f"Hours saved rating: {int(mdata['ratingsAverage']['workingHours'])}\n"
|
||||
|
||||
show_rating_threshold = 5
|
||||
|
||||
if rcount < show_rating_threshold:
|
||||
t += f"Only assets with enough ratings \nshow the rating value. Please rate.\n"
|
||||
if rc['quality'] >= show_rating_threshold:
|
||||
# t += f"{int(mdata['ratingsAverage']['quality']) * '*'}\n"
|
||||
t += f"* {round(mdata['ratingsAverage']['quality'],1)}\n"
|
||||
if rc['workingHours'] >= show_rating_threshold:
|
||||
t += f"Hours saved: {int(mdata['ratingsAverage']['workingHours'])}\n"
|
||||
if utils.profile_is_validator():
|
||||
t += f"Score: {int(mdata['score'])}\n"
|
||||
|
||||
t += f"Ratings count {rc['quality']}*/{rc['workingHours']}wh value " \
|
||||
f"{mdata['ratingsAverage']['quality']}*/{mdata['ratingsAverage']['workingHours']}wh\n"
|
||||
f"{(mdata['ratingsAverage']['quality'],1)}*/{(mdata['ratingsAverage']['workingHours'],1)}wh\n"
|
||||
if len(t.split('\n')) < 11:
|
||||
t += '\n'
|
||||
t += get_random_tip(mdata)
|
||||
|
|
|
@ -338,7 +338,7 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None):
|
|||
textcol = (textcol[0], textcol[1], textcol[2], 1)
|
||||
textcol_mild = (textcol[0] * .8, textcol[1] * .8, textcol[2] * .8, 1)
|
||||
textcol_strong = (textcol[0] * 1.3, textcol[1] * 2.3, textcol[2] * 1.3, 1)
|
||||
textcol_strong = (0.4, 1, 0.3, 1)
|
||||
# textcol_strong = (0.4, 1, 0.3, 1)
|
||||
white = (1, 1, 1, .1)
|
||||
|
||||
# background
|
||||
|
|
|
@ -975,7 +975,7 @@ class VIEW3D_PT_blenderkit_unified(Panel):
|
|||
row.scale_y = 1.6
|
||||
# split = row.split(factor=.
|
||||
col = layout.column()
|
||||
col.prop(ui_props, 'asset_type', expand=True, icon_only=True)
|
||||
col.prop(ui_props, 'asset_type', expand=True, icon_only=False)
|
||||
# row = layout.column(align = False)
|
||||
# layout.prop(ui_props, 'asset_type', expand=False, text='')
|
||||
|
||||
|
|
Loading…
Reference in New Issue