BlenderKit: minor UI fixes and improvements

This commit is contained in:
Vilém Duha 2020-01-09 17:28:57 +01:00
parent d1701786f2
commit 65da3f00f7
4 changed files with 19 additions and 9 deletions

View File

@ -277,7 +277,7 @@ class BlenderKitUIProps(PropertyGroup):
default="SEARCH",
)
asset_type: EnumProperty(
name="Active Asset Type",
name="BlenderKit Active Asset Type",
items=asset_type_callback,
description="Activate asset in UI",
default=None,

View File

@ -260,7 +260,7 @@ def timer_update(): # TODO might get moved to handle all blenderkit stuff.
ui_props.scrolloffset = 0
props.is_searching = False
props.search_error = False
props.report = 'Open assetbar to see %i results. ' % len(s['search results'])
props.report = 'Found %i results. ' % (s['search results orig']['count'])
if len(s['search results']) == 0:
tasks_queue.add_task((ui.add_report, ('No matching results found.',)))

View File

@ -1290,7 +1290,7 @@ class AssetBarOperator(bpy.types.Operator):
ao = bpy.context.active_object
if ui_props.asset_type == 'MODEL' and ao != None \
or ui_props.asset_type == 'MATERIAL' and ao != None and ao.active_material != None \
or ui_props.asset_type == 'BRUSH':
or ui_props.asset_type == 'BRUSH' and utils.get_active_brush() is not None:
export_data, upload_data, eval_path_computing, eval_path_state, eval_path, props = upload.get_upload_data(
self,
context,

View File

@ -150,7 +150,9 @@ def prop_needed(layout, props, name, value, is_not_filled=''):
if value == is_not_filled:
# row.label(text='', icon = 'ERROR')
icon = 'ERROR'
row.prop(props, name, icon=icon)
row.alert = True
row.prop(props, name)#, icon=icon)
row.alert = False
else:
# row.label(text='', icon = 'FILE_TICK')
icon = None
@ -614,15 +616,21 @@ class VIEW3D_PT_blenderkit_unified(Panel):
layout = self.layout
# layout.prop_tabs_enum(ui_props, "asset_type", icon_only = True)
row = layout.row()
row.scale_x = 1.6
row.scale_y = 1.6
#row.scale_x = 1.6
#row.scale_y = 1.6
#
row.prop(ui_props, 'down_up', expand=True, icon_only=False)
# row.label(text='')
#row = row.split().row()
layout.prop(ui_props, 'asset_type', expand=False, text = '', icon_only=False)
#layout.alert = True
#layout.alignment = 'CENTER'
#row = layout.row(align = True)
#split = row.split(factor=.5)
#row.prop(ui_props, 'asset_type', expand=True, icon_only=True)
#row = layout.column(align = False)
layout.prop(ui_props, 'asset_type', expand=False, text = '')
w = context.region.width
if user_preferences.login_attempt:
@ -640,7 +648,9 @@ class VIEW3D_PT_blenderkit_unified(Panel):
layout.prop(user_preferences, 'api_key', text='')
layout.separator()
if bpy.data.filepath == '':
label_multiline(layout, text="It's better to save the file first.", width=w)
layout.alert = True
label_multiline(layout, text="It's better to save your file first.", width=w)
layout.alert = False
layout.separator()
if ui_props.down_up == 'SEARCH':