BlenderKit: Don't do checks in the background mode or restricted context(blender startup)

This commit is contained in:
Vilem Duha 2019-04-21 21:19:34 +02:00
parent 8f1363a817
commit 3c410d63d3
2 changed files with 2 additions and 4 deletions

View File

@ -687,7 +687,6 @@ def get_download_url(asset_data, scene_id, api_key, tcom=None):
r = None
try:
r = requests.get(asset_data['download_url'], params=data, headers=headers)
fprint(r.text)
except Exception as e:
print(e)
if tcom is not None:

View File

@ -175,11 +175,10 @@ def load_prefs():
user_preferences.global_dir = prefs['global_dir']
def save_prefs(self, context):
if not bpy.app.background:
# print(type(context),type(bpy.context))
if not bpy.app.background and hasattr(bpy.context, 'view_layer'):
user_preferences = bpy.context.preferences.addons['blenderkit'].preferences
if user_preferences.api_key != '':
print(len(user_preferences.api_key))
print('length')
if len(user_preferences.api_key)>35:
prefs = {
'API_key': user_preferences.api_key,