BlenderKit: UI fixes
fix error when image not yet loaded. Profile info was hidden by accident. Login buttons layout was also not respecting login state.
This commit is contained in:
parent
8b6a5c9b83
commit
45e76b59c7
|
@ -370,6 +370,8 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None):
|
|||
|
||||
texth = line_height * nlines + nameline_height
|
||||
|
||||
if max(img.size[0], img.size[1]) == 0:
|
||||
return;
|
||||
isizex = int(512 * scale * img.size[0] / max(img.size[0], img.size[1]))
|
||||
isizey = int(512 * scale * img.size[1] / max(img.size[0], img.size[1]))
|
||||
|
||||
|
|
|
@ -412,7 +412,9 @@ class VIEW3D_PT_blenderkit_profile(Panel):
|
|||
|
||||
if user_preferences.enable_oauth:
|
||||
draw_login_buttons(layout)
|
||||
else:
|
||||
|
||||
|
||||
if user_preferences.api_key != '':
|
||||
me = bpy.context.window_manager.get('bkit profile')
|
||||
if me is not None:
|
||||
me = me['user']
|
||||
|
@ -424,6 +426,7 @@ class VIEW3D_PT_blenderkit_profile(Panel):
|
|||
layout.label(text='Private assets: %i MiB' % (me['sumPrivateAssetFilesSize']))
|
||||
if me.get('remainingPrivateQuota') is not None:
|
||||
layout.label(text='Remaining private storage: %i MiB' % (me['remainingPrivateQuota']))
|
||||
|
||||
layout.operator("wm.url_open", text="See my uploads",
|
||||
icon='URL').url = paths.BLENDERKIT_USER_ASSETS
|
||||
|
||||
|
@ -549,14 +552,20 @@ def draw_login_buttons(layout):
|
|||
layout.label(text='in progress.')
|
||||
layout.operator("wm.blenderkit_login_cancel", text="Cancel", icon='CANCEL')
|
||||
else:
|
||||
layout.operator("wm.blenderkit_login", text="Login",
|
||||
icon='URL').signup = False
|
||||
layout.operator("wm.blenderkit_login", text="Sign up",
|
||||
icon='URL').signup = True
|
||||
if user_preferences.api_key == '':
|
||||
layout.operator("wm.blenderkit_login", text="Login",
|
||||
icon='URL').signup = False
|
||||
layout.operator("wm.blenderkit_login", text="Sign up",
|
||||
icon='URL').signup = True
|
||||
|
||||
else:
|
||||
layout.operator("wm.blenderkit_login", text="Login as someone else",
|
||||
icon='URL').signup = False
|
||||
layout.operator("wm.blenderkit_logout", text="Logout",
|
||||
icon='URL')
|
||||
|
||||
|
||||
|
||||
if user_preferences.api_key != '':
|
||||
layout.operator("wm.blenderkit_logout", text="Logout",
|
||||
icon='URL')
|
||||
|
||||
class VIEW3D_PT_blenderkit_unified(Panel):
|
||||
bl_category = "BlenderKit"
|
||||
|
|
Loading…
Reference in New Issue