[Bf-extensions-cvs] [05ed8f54] master: BlenderKit: thumbnailer had accidentally set resolution to 50% Try to avoid a rare bug where categories file isn't present (not sure yet as why that happens, but this enables the use of the addon until categories are loaded) Internal Transfer BlendrKit data operator Switch some operators to internal and remove undo from those where it doesn't make sense.

Vilém Duha noreply at git.blender.org
Tue Aug 20 10:51:19 CEST 2019


Commit: 05ed8f54271de2c6e4a91fdda14c9ac3f95431ab
Author: Vilém Duha
Date:   Tue Aug 20 10:22:16 2019 +0200
Branches: master
https://developer.blender.org/rBA05ed8f54271de2c6e4a91fdda14c9ac3f95431ab

BlenderKit:
thumbnailer had accidentally set resolution to 50%
Try to avoid a rare bug where categories file isn't present (not sure yet as why that happens, but this enables the use of the addon until categories are loaded)
Internal Transfer BlendrKit data operator
Switch some operators to internal and remove undo from those where it doesn't make sense.

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

M	blenderkit/asset_inspector.py
M	blenderkit/bg_blender.py
M	blenderkit/bkit_oauth.py
M	blenderkit/blendfiles/thumbnailer.blend
M	blenderkit/categories.py
M	blenderkit/download.py
M	blenderkit/ratings.py
M	blenderkit/search.py
M	blenderkit/ui.py
M	blenderkit/ui_panels.py
M	blenderkit/upload.py

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

diff --git a/blenderkit/asset_inspector.py b/blenderkit/asset_inspector.py
index b437a226..73e6c09a 100644
--- a/blenderkit/asset_inspector.py
+++ b/blenderkit/asset_inspector.py
@@ -350,6 +350,7 @@ class AutoFillTags(bpy.types.Operator):
     """Fill tags for asset. Now run before upload, no need to interact from user side."""
     bl_idname = "object.blenderkit_auto_tags"
     bl_label = "Generate Auto Tags for BlenderKit"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     @classmethod
     def poll(cls, context):
diff --git a/blenderkit/bg_blender.py b/blenderkit/bg_blender.py
index 4a7afd92..9ed68128 100644
--- a/blenderkit/bg_blender.py
+++ b/blenderkit/bg_blender.py
@@ -157,7 +157,7 @@ class KillBgProcess(bpy.types.Operator):
     '''Remove  processes in background.'''
     bl_idname = "object.kill_bg_process"
     bl_label = "Kill Background Process"
-    bl_options = {'REGISTER', 'UNDO'}
+    bl_options = {'REGISTER'}
 
     process_type: EnumProperty(
         name="Type",
diff --git a/blenderkit/bkit_oauth.py b/blenderkit/bkit_oauth.py
index cb0e7586..f435d95d 100644
--- a/blenderkit/bkit_oauth.py
+++ b/blenderkit/bkit_oauth.py
@@ -97,6 +97,7 @@ class RegisterLoginOnline(bpy.types.Operator):
     bl_label = "BlenderKit login or signup"
     bl_options = {'REGISTER', 'UNDO'}
 
+
     signup: BoolProperty(
         name="create a new account",
         description="True for register, otherwise login",
diff --git a/blenderkit/blendfiles/thumbnailer.blend b/blenderkit/blendfiles/thumbnailer.blend
index 84f243d3..970499c3 100644
Binary files a/blenderkit/blendfiles/thumbnailer.blend and b/blenderkit/blendfiles/thumbnailer.blend differ
diff --git a/blenderkit/categories.py b/blenderkit/categories.py
index ee20557c..6407b050 100644
--- a/blenderkit/categories.py
+++ b/blenderkit/categories.py
@@ -92,16 +92,18 @@ def load_categories():
     categories_filepath = os.path.join(tempdir, 'categories.json')
 
     wm = bpy.context.window_manager
-    with open(categories_filepath, 'r') as catfile:
-        wm['bkit_categories'] = json.load(catfile)
-
-    wm['active_category'] = {
-        'MODEL': ['model'],
-        'SCENE': ['scene'],
-        'MATERIAL': ['material'],
-        'BRUSH': ['brush'],
-    }
-
+    try:
+        with open(categories_filepath, 'r') as catfile:
+            wm['bkit_categories'] = json.load(catfile)
+
+        wm['active_category'] = {
+            'MODEL': ['model'],
+            'SCENE': ['scene'],
+            'MATERIAL': ['material'],
+            'BRUSH': ['brush'],
+        }
+    except:
+        print('categories failed to read')
 
 def fetch_categories(API_key):
     url = paths.get_api_url() + 'categories/'
diff --git a/blenderkit/download.py b/blenderkit/download.py
index 37b2c8e6..366081ca 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -815,7 +815,7 @@ class BlenderkitKillDownloadOperator(bpy.types.Operator):
     """Kill a download."""
     bl_idname = "scene.blenderkit_download_kill"
     bl_label = "BlenderKit Kill Asset Download"
-    bl_options = {'REGISTER', 'UNDO'}
+    bl_options = {'REGISTER', 'INTERNAL'}
 
     thread_index: IntProperty(name="Thread index", description='index of the thread to kill', default=-1)
 
@@ -831,7 +831,8 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
     """Download and link asset to scene. Only link if asset already available locally."""
     bl_idname = "scene.blenderkit_download"
     bl_label = "BlenderKit Asset Download"
-    bl_options = {'REGISTER', 'UNDO'}
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
+
 
     asset_type: EnumProperty(
         name="Type",
diff --git a/blenderkit/ratings.py b/blenderkit/ratings.py
index c3621df3..ddf01e6c 100644
--- a/blenderkit/ratings.py
+++ b/blenderkit/ratings.py
@@ -123,6 +123,7 @@ class StarRatingOperator(bpy.types.Operator):
     """Tooltip"""
     bl_idname = "object.blenderkit_rating"
     bl_label = "Rate the Asset"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     property_name: StringProperty(
         name="Rating Property",
@@ -153,6 +154,7 @@ class UploadRatingOperator(bpy.types.Operator):
     """Upload rating to the web db"""
     bl_idname = "object.blenderkit_rating_upload"
     bl_label = "Upload the Rating"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     # type of upload - model, material, textures, e.t.c.
     asset_type: EnumProperty(
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 56c8b526..f19a019e 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -1096,7 +1096,7 @@ class SearchOperator(Operator):
     """Tooltip"""
     bl_idname = "view3d.blenderkit_search"
     bl_label = "BlenderKit asset search"
-
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
     own: BoolProperty(name="own assets only",
                       description="Find all own assets",
                       default=False)
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index bd30d152..dd4e765b 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -1154,7 +1154,7 @@ class AssetBarOperator(bpy.types.Operator):
     '''runs search and displays the asset bar at the same time'''
     bl_idname = "view3d.blenderkit_asset_bar"
     bl_label = "BlenderKit Asset Bar UI"
-    bl_options = {'REGISTER', 'UNDO'}
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     do_search: BoolProperty(name="Run Search", description='', default=True, options={'SKIP_SAVE'})
     keep_running: BoolProperty(name="Keep Running", description='', default=True, options={'SKIP_SAVE'})
@@ -1683,9 +1683,27 @@ class AssetBarOperator(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
+class TransferBlenderkitData(bpy.types.Operator):
+    """Regenerate cobweb"""
+    bl_idname = "object.blenderkit_data_trasnfer"
+    bl_label = "Transfer BlenderKit data"
+    bl_description = "Transfer blenderKit metadata from one object to another when fixing uploads with wrong parenting."
+    bl_options = {'REGISTER', 'UNDO'}
+
+    def execute(self, context):
+        source_ob = bpy.context.active_object
+        for target_ob in bpy.context.selected_objects:
+            if target_ob != source_ob:
+                target_ob.property_unset('blenderkit')
+                for k in source_ob.keys():
+                    target_ob[k] = source_ob[k]
+        source_ob.property_unset('blenderkit')
+        return {'FINISHED'}
+
+
 classess = (
     AssetBarOperator,
-
+    TransferBlenderkitData
 )
 
 # store keymap items here to access after registration
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index b516f37e..5a758291 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -769,6 +769,7 @@ class SetCategoryOperator(bpy.types.Operator):
     """Visit subcategory"""
     bl_idname = "view3d.blenderkit_set_category"
     bl_label = "BlenderKit Set Active Category"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     category: bpy.props.StringProperty(
         name="Category",
@@ -803,9 +804,12 @@ def draw_panel_categories(self, context):
     # row = layout.row()
     # row.prop(ui_props, 'asset_type', expand=True, icon_only=True)
     layout.separator()
+
+
     layout.label(text='Categories')
     wm = bpy.context.window_manager
-
+    if wm.get('bkit_categories') == None:
+        return
     col = layout.column(align=True)
     if wm.get('active_category') is not None:
         acat = wm['active_category'][ui_props.asset_type]
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index 3616beb0..c9e767a4 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -699,6 +699,7 @@ class UploadOperator(Operator):
     bl_description = "Upload or re-upload asset + thumbnail + metadata"
 
     bl_label = "BlenderKit asset upload"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     # type of upload - model, material, textures, e.t.c.
     asset_type: EnumProperty(
@@ -797,6 +798,7 @@ class AssetVerificationStatusChange(Operator):
     bl_idname = "object.blenderkit_change_status"
     bl_description = "Change asset ststus"
     bl_label = "Change verification status"
+    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
 
     # type of upload - model, material, textures, e.t.c.
     asset_id: StringProperty(



More information about the Bf-extensions-cvs mailing list