BlenderKit: UI cleanup - minor tweaks to UI
This commit is contained in:
parent
7164debdd6
commit
a1fbcb6108
|
@ -335,7 +335,7 @@ class BlenderKitUIProps(PropertyGroup):
|
|||
asset_type: EnumProperty(
|
||||
name="BlenderKit Active Asset Type",
|
||||
items=asset_type_callback,
|
||||
description="Activate asset in UI",
|
||||
description="",
|
||||
default=None,
|
||||
update=switch_search_results
|
||||
)
|
||||
|
@ -533,7 +533,7 @@ class BlenderKitCommonSearchProps(object):
|
|||
('UPLOADING', 'Uploading', 'Uploading'),
|
||||
('UPLOADED', 'Uploaded', 'Uploaded'),
|
||||
('READY', 'Ready for V.', 'Ready for validation (deprecated since 2.8)'),
|
||||
('VALIDATED', 'Validated', 'Calidated'),
|
||||
('VALIDATED', 'Validated', 'Validated'),
|
||||
('ON_HOLD', 'On Hold', 'On Hold'),
|
||||
('REJECTED', 'Rejected', 'Rejected'),
|
||||
('DELETED', 'Deleted', 'Deleted'),
|
||||
|
|
|
@ -553,7 +553,7 @@ def writeblockm(tooltip, mdata, key='', pretext=None, width=40): # for longer t
|
|||
|
||||
|
||||
def fmt_length(prop):
|
||||
prop = str(round(prop, 2)) + 'm'
|
||||
prop = str(round(prop, 2))
|
||||
return prop
|
||||
|
||||
|
||||
|
@ -590,9 +590,9 @@ def generate_tooltip(mdata):
|
|||
for b in bools_data:
|
||||
if mdata.get(b) and mdata[b]:
|
||||
mdata['tags'].append(b)
|
||||
t = writeblockm(t, mparams, key='designer', pretext='designer', width=col_w)
|
||||
t = writeblockm(t, mparams, key='manufacturer', pretext='manufacturer', width=col_w)
|
||||
t = writeblockm(t, mparams, key='designCollection', pretext='design collection', width=col_w)
|
||||
t = writeblockm(t, mparams, key='designer', pretext='Designer', width=col_w)
|
||||
t = writeblockm(t, mparams, key='manufacturer', pretext='Manufacturer', width=col_w)
|
||||
t = writeblockm(t, mparams, key='designCollection', pretext='Design collection', width=col_w)
|
||||
|
||||
# t = writeblockm(t, mparams, key='engines', pretext='engine', width = col_w)
|
||||
# t = writeblockm(t, mparams, key='model_style', pretext='style', width = col_w)
|
||||
|
@ -601,21 +601,22 @@ def generate_tooltip(mdata):
|
|||
# t = writeblockm(t, mparams, key='condition', pretext='condition', width = col_w)
|
||||
# t = writeblockm(t, mparams, key='productionLevel', pretext='production level', width = col_w)
|
||||
if has(mdata, 'purePbr'):
|
||||
t = writeblockm(t, mparams, key='pbrType', pretext='pbr', width=col_w)
|
||||
t = writeblockm(t, mparams, key='pbrType', pretext='Pbr', width=col_w)
|
||||
|
||||
t = writeblockm(t, mparams, key='designYear', pretext='design year', width=col_w)
|
||||
t = writeblockm(t, mparams, key='designYear', pretext='Design year', width=col_w)
|
||||
|
||||
if has(mparams, 'dimensionX'):
|
||||
t += 'size: %s, %s, %s\n' % (fmt_length(mparams['dimensionX']),
|
||||
t += 'Size: %s x %s x %sm\n' % (fmt_length(mparams['dimensionX']),
|
||||
fmt_length(mparams['dimensionY']),
|
||||
fmt_length(mparams['dimensionZ']))
|
||||
if has(mparams, 'faceCount'):
|
||||
t += 'face count: %s, render: %s\n' % (mparams['faceCount'], mparams['faceCountRender'])
|
||||
t += 'Face count: %s\n' % (mparams['faceCount'])
|
||||
# t += 'face count: %s, render: %s\n' % (mparams['faceCount'], mparams['faceCountRender'])
|
||||
|
||||
# write files size - this doesn't reflect true file size, since files size is computed from all asset files, including resolutions.
|
||||
if mdata.get('filesSize'):
|
||||
fs = utils.files_size_to_text(mdata['filesSize'])
|
||||
t += f'files size: {fs}\n'
|
||||
# if mdata.get('filesSize'):
|
||||
# fs = utils.files_size_to_text(mdata['filesSize'])
|
||||
# t += f'files size: {fs}\n'
|
||||
|
||||
# t = writeblockm(t, mparams, key='meshPolyType', pretext='mesh type', width = col_w)
|
||||
# t = writeblockm(t, mparams, key='objectCount', pretext='nubmber of objects', width = col_w)
|
||||
|
@ -624,36 +625,44 @@ def generate_tooltip(mdata):
|
|||
# t = writeblockm(t, mparams, key='modifiers', width = col_w)
|
||||
# t = writeblockm(t, mparams, key='shaders', width = col_w)
|
||||
|
||||
if has(mparams, 'textureSizeMeters'):
|
||||
t += 'texture size: %s\n' % fmt_length(mparams['textureSizeMeters'])
|
||||
# if has(mparams, 'textureSizeMeters'):
|
||||
# t += 'Texture size: %s m\n' % fmt_length(mparams['textureSizeMeters'])
|
||||
|
||||
if has(mparams, 'textureResolutionMax') and mparams['textureResolutionMax'] > 0:
|
||||
if not mparams.get('textureResolutionMin'): # for HDR's
|
||||
t = writeblockm(t, mparams, key='textureResolutionMax', pretext='Resolution', width=col_w)
|
||||
elif mparams.get('textureResolutionMin') == mparams['textureResolutionMax']:
|
||||
t = writeblockm(t, mparams, key='textureResolutionMin', pretext='texture resolution', width=col_w)
|
||||
t = writeblockm(t, mparams, key='textureResolutionMin', pretext='Texture resolution', width=col_w)
|
||||
else:
|
||||
t += 'tex resolution: %i - %i\n' % (mparams.get('textureResolutionMin'), mparams['textureResolutionMax'])
|
||||
t += 'Tex resolution: %i - %i\n' % (mparams.get('textureResolutionMin'), mparams['textureResolutionMax'])
|
||||
|
||||
if has(mparams, 'thumbnailScale'):
|
||||
t = writeblockm(t, mparams, key='thumbnailScale', pretext='preview scale', width=col_w)
|
||||
t = writeblockm(t, mparams, key='thumbnailScale', pretext='Preview scale', width=col_w)
|
||||
|
||||
# t += 'uv: %s\n' % mdata['uv']
|
||||
# t += '\n'
|
||||
t = writeblockm(t, mdata, key='license', width=col_w)
|
||||
if mdata.get('license') == 'cc_zero':
|
||||
t+= 'license: CC Zero'
|
||||
else:
|
||||
t+= 'license: Royalty free'
|
||||
# t = writeblockm(t, mdata, key='license', width=col_w)
|
||||
|
||||
fs = mdata.get('files')
|
||||
|
||||
if utils.profile_is_validator():
|
||||
if fs:
|
||||
resolutions = 'resolutions:'
|
||||
if fs and len(fs) > 2:
|
||||
resolutions = 'Resolutions:'
|
||||
list.sort(fs, key=lambda f: f['fileType'])
|
||||
for f in fs:
|
||||
if f['fileType'].find('resolution') > -1:
|
||||
resolutions += f['fileType'][11:] + ' '
|
||||
resolutions += '\n'
|
||||
t += resolutions
|
||||
t += resolutions.replace('_', '.')
|
||||
|
||||
t = writeblockm(t, mdata, key='isFree', width=col_w)
|
||||
if mdata['isFree']:
|
||||
t += 'FREE plan\n'
|
||||
else:
|
||||
t += 'FULL plan\n'
|
||||
else:
|
||||
if fs:
|
||||
for f in fs:
|
||||
|
@ -670,7 +679,7 @@ def generate_tooltip(mdata):
|
|||
# if adata != None:
|
||||
# t += generate_author_textblock(adata)
|
||||
|
||||
# t += '\n'
|
||||
t += '\n'
|
||||
rc = mdata.get('ratingsCount')
|
||||
if rc:
|
||||
t+='\n'
|
||||
|
|
|
@ -379,6 +379,7 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None):
|
|||
tsize = font_height
|
||||
else:
|
||||
fsize = font_height
|
||||
|
||||
if l[:4] == 'Tip:' or l[:11] == 'Please rate':
|
||||
tcol = textcol_strong
|
||||
fsize = font_height + 1
|
||||
|
@ -389,6 +390,7 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None):
|
|||
xtext += int(isizex / ncolumns)
|
||||
|
||||
column_lines = 1
|
||||
i=0
|
||||
for l in alines:
|
||||
if gravatar is not None:
|
||||
if column_lines == 1:
|
||||
|
@ -397,15 +399,21 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None):
|
|||
xtext -= gsize + textmargin
|
||||
|
||||
ytext = y - column_lines * line_height - nameline_height - ttipmargin - textmargin - isizey + texth
|
||||
if i == 0:
|
||||
if False:#i == 0:
|
||||
ytext = y - name_height + 5 - isizey + texth - textmargin
|
||||
elif i == len(lines) - 1:
|
||||
ytext = y - (nlines - 1) * line_height - nameline_height - ttipmargin * 2 - isizey + texth
|
||||
tcol = textcol
|
||||
tsize = font_height
|
||||
if (i> 0 and alines[i-1][:7] == 'Author:'):
|
||||
tcol = textcol_strong
|
||||
fsize = font_height + 2
|
||||
else:
|
||||
fsize = font_height
|
||||
if l[:4] == 'Tip:' or l[:11] == 'Please rate':
|
||||
tcol = textcol
|
||||
|
||||
print (i)
|
||||
if l[:4] == 'Tip:' or l[:11] == 'Please rate' :
|
||||
tcol = textcol_strong
|
||||
fsize = font_height + 1
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ class FastMetadata(bpy.types.Operator):
|
|||
args=(self.asset_id, mdict, user_preferences.api_key))
|
||||
thread.start()
|
||||
tasks_queue.add_task((ui.add_report, (f'Uploading metadata for {self.name}. '
|
||||
f'Refreash search results to see that changes applied correctly.', 8,)))
|
||||
f'Refresh search results to see that changes applied correctly.', 8,)))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
|
|
@ -366,12 +366,12 @@ def get_thumbnail(name):
|
|||
|
||||
|
||||
def files_size_to_text(size):
|
||||
fsmb = size // (1024 * 1024)
|
||||
fsmb = size / (1024 * 1024)
|
||||
fskb = size % 1024
|
||||
if fsmb == 0:
|
||||
return f'{fskb}KB'
|
||||
return f'{round(fskb)}KB'
|
||||
else:
|
||||
return f'{fsmb}MB {fskb}KB'
|
||||
return f'{round(fsmb, 1)}MB'
|
||||
|
||||
|
||||
def get_brush_props(context):
|
||||
|
|
Loading…
Reference in New Issue