[Bf-extensions-cvs] [8b659917] blender-v2.82-release: BlenderKit: several fixes - oauth errors

Vilém Duha noreply at git.blender.org
Thu Feb 6 11:26:12 CET 2020


Commit: 8b659917baecbea5471a05369aa754ae544a814b
Author: Vilém Duha
Date:   Mon Feb 3 22:33:34 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBA8b659917baecbea5471a05369aa754ae544a814b

BlenderKit: several fixes - oauth errors

authentication errors
drag drop on cameras/lights threw an error
undo push message
Ready status for validation status search

===================================================================

M	blenderkit/__init__.py
M	blenderkit/bkit_oauth.py
M	blenderkit/download.py
M	blenderkit/rerequests.py
M	blenderkit/search.py
M	blenderkit/ui.py

===================================================================

diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py
index 9db72bb0..bf0ec328 100644
--- a/blenderkit/__init__.py
+++ b/blenderkit/__init__.py
@@ -474,13 +474,13 @@ class BlenderKitCommonSearchProps(object):
             ('ALL', 'All', 'All'),
             ('UPLOADING', 'Uploading', 'Uploading'),
             ('UPLOADED', 'Uploaded', 'Uploaded'),
+            ('READY', 'Ready for V.', 'Ready for validation (deprecated since 2.8)'),
             ('VALIDATED', 'Validated', 'Calidated'),
             ('ON_HOLD', 'On Hold', 'On Hold'),
             ('REJECTED', 'Rejected', 'Rejected'),
             ('DELETED', 'Deleted', 'Deleted'),
         ),
         default='ALL',
-        update=search.search_update,
     )
 
 
diff --git a/blenderkit/bkit_oauth.py b/blenderkit/bkit_oauth.py
index dc272104..d56629e5 100644
--- a/blenderkit/bkit_oauth.py
+++ b/blenderkit/bkit_oauth.py
@@ -78,7 +78,7 @@ def refresh_token(api_key_refresh, url):
     auth_token, refresh_token, oauth_response = authenticator.get_refreshed_token(api_key_refresh)
     if auth_token is not None and refresh_token is not None:
         tasks_queue.add_task((write_tokens, (auth_token, refresh_token, oauth_response)))
-    return auth_token, refresh_token
+    return auth_token, refresh_token, oauth_response
 
 
 def write_tokens(auth_token, refresh_token, oauth_response):
diff --git a/blenderkit/download.py b/blenderkit/download.py
index 3a99f66f..82c57235 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -441,7 +441,7 @@ def append_asset(asset_data, **kwargs):  # downloaders=[], location=None,
     scene['assets rated'][id] = scene['assets rated'].get(id, False)
 
     parent['asset_data'] = asset_data  # TODO remove this??? should write to blenderkit Props?
-    bpy.ops.wm.undo_push_context()
+    bpy.ops.wm.undo_push_context(message = 'add %s to scene'% asset_data['name'])
     # moving reporting to on save.
     # report_use_success(asset_data['id'])
 
diff --git a/blenderkit/rerequests.py b/blenderkit/rerequests.py
index eab78fba..28c7e2ca 100644
--- a/blenderkit/rerequests.py
+++ b/blenderkit/rerequests.py
@@ -54,7 +54,7 @@ def rerequest(method, url, **kwargs):
         if rdata.get('detail') == 'Invalid token.':
             user_preferences = bpy.context.preferences.addons['blenderkit'].preferences
             if user_preferences.api_key != '':
-                if user_preferences.enable_oauth:
+                if user_preferences.enable_oauth and user_preferences.api_key_refresh != '':
                     tasks_queue.add_task((ui.add_report, (
                     'refreshing token. If this fails, please login in BlenderKit Login panel.', 10)))
                     refresh_url = paths.get_bkit_url()
diff --git a/blenderkit/search.py b/blenderkit/search.py
index f5cadaad..6eeafcd1 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -247,7 +247,6 @@ def timer_update():  # TODO might get moved to handle all blenderkit stuff.
                                               'author_id': str(r['author']['id']),
                                               # 'author': r['author']['firstName'] + ' ' + r['author']['lastName']
                                               # 'description': r['description'],
-                                              'author': r['author'],
                                               }
                                 asset_data['downloaded'] = 0
 
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index 3f4d0381..2101e54b 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -1575,7 +1575,8 @@ class AssetBarOperator(bpy.types.Operator):
 
                         else:
                             # first, test if object can have material applied.
-                            if object is not None and not object.is_library_indirect:
+                            #TODO add other types here if droppable.
+                            if object is None or object.is_library_indirect and object.type =='MESH' :
                                 target_object = object.name
                                 # create final mesh to extract correct material slot
                                 depsgraph = bpy.context.evaluated_depsgraph_get()
@@ -1778,6 +1779,8 @@ class UndoWithContext(bpy.types.Operator):
     # def modal(self, context, event):
     #     return {'RUNNING_MODAL'}
 
+    message = StringProperty('Undo Message', default = 'BlenderKit operation')
+
     def execute(self, context):
         C_dict = bpy.context.copy()
         C_dict.update(region='WINDOW')
@@ -1785,7 +1788,7 @@ class UndoWithContext(bpy.types.Operator):
             w, a, r = get_largest_3dview()
             override = {'window': w, 'screen': w.screen, 'area': a, 'region': r}
             C_dict.update(override)
-        bpy.ops.ed.undo_push(C_dict, 'INVOKE_REGION_WIN')
+        bpy.ops.ed.undo_push(C_dict, 'INVOKE_REGION_WIN', message = self.message)
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list