Skip to content
Snippets Groups Projects
Commit 90a0e8d0 authored by Vilem Duha's avatar Vilem Duha
Browse files

BlenderKit: temporarily hiding OAuth changes, webpages aren't ready yet.

parent 7d92fb16
Branches
Tags
No related merge requests found
...@@ -1222,6 +1222,8 @@ class BlenderKitAddonPreferences(AddonPreferences): ...@@ -1222,6 +1222,8 @@ class BlenderKitAddonPreferences(AddonPreferences):
default_global_dict = paths.default_global_dict() default_global_dict = paths.default_global_dict()
enable_oauth = False
api_key: StringProperty( api_key: StringProperty(
name="BlenderKit API Key", name="BlenderKit API Key",
description="Your blenderkit API Key. Get it from your page on the website", description="Your blenderkit API Key. Get it from your page on the website",
...@@ -1322,8 +1324,14 @@ class BlenderKitAddonPreferences(AddonPreferences): ...@@ -1322,8 +1324,14 @@ class BlenderKitAddonPreferences(AddonPreferences):
layout = self.layout layout = self.layout
if self.api_key.strip() == '': if self.api_key.strip() == '':
layout.operator("wm.blenderkit_login", text="Login/ Sign up", if self.enable_oauth:
layout.operator("wm.blenderkit_login", text="Login/ Sign up",
icon='URL') icon='URL')
else:
op = layout.operator("wm.url_open", text="Register online and get your API Key",
icon='QUESTION')
op.url = paths.BLENDERKIT_SIGNUP_URL
layout.prop(self, "api_key", text='Your API Key') layout.prop(self, "api_key", text='Your API Key')
# layout.label(text='After you paste API Key, categories are downloaded, so blender will freeze for a few seconds.') # layout.label(text='After you paste API Key, categories are downloaded, so blender will freeze for a few seconds.')
layout.prop(self, "global_dir") layout.prop(self, "global_dir")
......
...@@ -393,7 +393,10 @@ class VIEW3D_PT_blenderkit_profile(Panel): ...@@ -393,7 +393,10 @@ class VIEW3D_PT_blenderkit_profile(Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return True user_preferences = bpy.context.preferences.addons['blenderkit'].preferences
if user_preferences.enable_oauth:
return True
return False
def draw(self, context): def draw(self, context):
# draw asset properties here # draw asset properties here
...@@ -574,12 +577,17 @@ class VIEW3D_PT_blenderkit_unified(Panel): ...@@ -574,12 +577,17 @@ class VIEW3D_PT_blenderkit_unified(Panel):
return return
if len(user_preferences.api_key) < 20 and user_preferences.asset_counter > 20: if len(user_preferences.api_key) < 20 and user_preferences.asset_counter > 20:
layout.operator("wm.blenderkit_login", text="Login/ Sign up", if user_preferences.enable_oauth:
icon='URL') layout.operator("wm.blenderkit_login", text="Login/ Sign up",
# layout.label(text='Paste your API Key:') icon='URL')
# layout.prop(user_preferences, 'api_key', text='') else:
op = layout.operator("wm.url_open", text="Get your API Key",
icon='QUESTION')
op.url = paths.BLENDERKIT_SIGNUP_URL
layout.label(text='Paste your API Key:')
layout.prop(user_preferences, 'api_key', text='')
layout.separator() layout.separator()
elif bpy.data.filepath == '': if bpy.data.filepath == '':
label_multiline(layout, text="It's better to save the file first.", width=w) label_multiline(layout, text="It's better to save the file first.", width=w)
layout.separator() layout.separator()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment