diff options
author | Robert Guetzkow <gitcommit@outlook.de> | 2020-11-06 14:01:44 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2020-11-06 14:01:44 +0300 |
commit | 99896ff381300b701c19f73ed00776cf8e80ab1a (patch) | |
tree | 6f4a5c03b6037d37da83d5cf02f33056783c154d | |
parent | d32998246bdb0dba15946ee387ca672b4e17911a (diff) | |
parent | 69751991311a165e97a48ea67ed60e2c6022ee63 (diff) |
Merge branch 'blender-v2.91-release'
-rw-r--r-- | add_mesh_BoltFactory/Boltfactory.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/Wallfactory.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_beam_builder.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_gears.py | 6 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_gemstones.py | 6 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_honeycomb.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_pipe_joint.py | 15 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_pyramid.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_round_brilliant.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_round_cube.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_star.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_supertoroid.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_torusknot.py | 3 | ||||
-rw-r--r-- | add_mesh_extra_objects/add_mesh_twisted_torus.py | 3 | ||||
-rw-r--r-- | add_mesh_geodesic_domes/third_domes_panel_271.py | 3 | ||||
-rw-r--r-- | blenderkit/search.py | 26 | ||||
-rw-r--r-- | blenderkit/ui.py | 4 | ||||
-rw-r--r-- | blenderkit/utils.py | 11 |
18 files changed, 66 insertions, 38 deletions
diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index 244d9720..330df8ae 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -428,7 +428,8 @@ class add_mesh_bolt(Operator, AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Bolt' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/Wallfactory.py b/add_mesh_extra_objects/Wallfactory.py index 4b15b62a..9ed8cb84 100644 --- a/add_mesh_extra_objects/Wallfactory.py +++ b/add_mesh_extra_objects/Wallfactory.py @@ -885,7 +885,8 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Wall' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Wall' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_beam_builder.py b/add_mesh_extra_objects/add_mesh_beam_builder.py index 5bb1bceb..0cc43e0f 100644 --- a/add_mesh_extra_objects/add_mesh_beam_builder.py +++ b/add_mesh_extra_objects/add_mesh_beam_builder.py @@ -761,7 +761,8 @@ class addBeam(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Beam' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Beam' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py index 9655dea9..1d3bc70e 100644 --- a/add_mesh_extra_objects/add_mesh_gears.py +++ b/add_mesh_extra_objects/add_mesh_gears.py @@ -689,7 +689,8 @@ class AddGear(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Gear' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Gear' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -910,7 +911,8 @@ class AddWormGear(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('WormGear' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('WormGear' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_gemstones.py b/add_mesh_extra_objects/add_mesh_gemstones.py index fe31675d..dc505b0f 100644 --- a/add_mesh_extra_objects/add_mesh_gemstones.py +++ b/add_mesh_extra_objects/add_mesh_gemstones.py @@ -284,7 +284,8 @@ class AddDiamond(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Diamond' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Diamond' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -433,7 +434,8 @@ class AddGem(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Gem' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Gem' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_honeycomb.py b/add_mesh_extra_objects/add_mesh_honeycomb.py index 48a71940..bb6734a4 100644 --- a/add_mesh_extra_objects/add_mesh_honeycomb.py +++ b/add_mesh_extra_objects/add_mesh_honeycomb.py @@ -278,7 +278,8 @@ class add_mesh_honeycomb(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('HoneyComb' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('HoneyComb' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_pipe_joint.py b/add_mesh_extra_objects/add_mesh_pipe_joint.py index 98421331..91c64e2f 100644 --- a/add_mesh_extra_objects/add_mesh_pipe_joint.py +++ b/add_mesh_extra_objects/add_mesh_pipe_joint.py @@ -230,7 +230,8 @@ class AddElbowJoint(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if (context.selected_objects != []) and context.active_object and \ - ('ElbowJoint' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('ElbowJoint' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -496,7 +497,8 @@ class AddTeeJoint(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if (context.selected_objects != []) and context.active_object and \ - ('TeeJoint' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('TeeJoint' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -779,7 +781,8 @@ class AddWyeJoint(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if (context.selected_objects != []) and context.active_object and \ - ('WyeJoint' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('WyeJoint' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -1126,7 +1129,8 @@ class AddCrossJoint(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if (context.selected_objects != []) and context.active_object and \ - ('CrossJoint' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('CrossJoint' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name @@ -1370,7 +1374,8 @@ class AddNJoint(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if (context.selected_objects != []) and context.active_object and \ - ('NJoint' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('NJoint' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_pyramid.py b/add_mesh_extra_objects/add_mesh_pyramid.py index 405e6eaf..58fafb04 100644 --- a/add_mesh_extra_objects/add_mesh_pyramid.py +++ b/add_mesh_extra_objects/add_mesh_pyramid.py @@ -168,7 +168,8 @@ class AddPyramid(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Pyramid' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Pyramid' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_round_brilliant.py b/add_mesh_extra_objects/add_mesh_round_brilliant.py index e50a1dbe..874a26db 100644 --- a/add_mesh_extra_objects/add_mesh_round_brilliant.py +++ b/add_mesh_extra_objects/add_mesh_round_brilliant.py @@ -428,7 +428,8 @@ class MESH_OT_primitive_brilliant_add(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Brilliant' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Brilliant' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_round_cube.py b/add_mesh_extra_objects/add_mesh_round_cube.py index 1190be93..b48e9a69 100644 --- a/add_mesh_extra_objects/add_mesh_round_cube.py +++ b/add_mesh_extra_objects/add_mesh_round_cube.py @@ -405,7 +405,8 @@ class AddRoundCube(Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Roundcube' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Roundcube' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_star.py b/add_mesh_extra_objects/add_mesh_star.py index b5d515c6..2bede081 100644 --- a/add_mesh_extra_objects/add_mesh_star.py +++ b/add_mesh_extra_objects/add_mesh_star.py @@ -208,7 +208,8 @@ class AddStar(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('Star' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('Star' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_supertoroid.py b/add_mesh_extra_objects/add_mesh_supertoroid.py index fabc8147..8a87a289 100644 --- a/add_mesh_extra_objects/add_mesh_supertoroid.py +++ b/add_mesh_extra_objects/add_mesh_supertoroid.py @@ -223,7 +223,8 @@ class add_supertoroid(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('SuperToroid' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('SuperToroid' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_torusknot.py b/add_mesh_extra_objects/add_mesh_torusknot.py index 30957f7a..39e985c3 100644 --- a/add_mesh_extra_objects/add_mesh_torusknot.py +++ b/add_mesh_extra_objects/add_mesh_torusknot.py @@ -144,7 +144,8 @@ class AddTorusKnot(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('TorusKnot' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('TorusKnot' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_extra_objects/add_mesh_twisted_torus.py b/add_mesh_extra_objects/add_mesh_twisted_torus.py index 0502a189..bb3bd483 100644 --- a/add_mesh_extra_objects/add_mesh_twisted_torus.py +++ b/add_mesh_extra_objects/add_mesh_twisted_torus.py @@ -236,7 +236,8 @@ class AddTwistedTorus(bpy.types.Operator, object_utils.AddObjectHelper): if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('TwistedTorus' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and ('TwistedTorus' in context.active_object.data.keys()) and \ + (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/add_mesh_geodesic_domes/third_domes_panel_271.py b/add_mesh_geodesic_domes/third_domes_panel_271.py index 98add45f..d95de427 100644 --- a/add_mesh_geodesic_domes/third_domes_panel_271.py +++ b/add_mesh_geodesic_domes/third_domes_panel_271.py @@ -1293,7 +1293,8 @@ class GenerateGeodesicDome(Operator, object_utils.AddObjectHelper): if mesh != None: if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ - ('GeodesicDome' in context.active_object.data.keys()) and (self.change == True): + (context.active_object.data is not None) and \ + ('GeodesicDome' in context.active_object.data.keys()) and (self.change == True): obj = context.active_object oldmesh = obj.data oldmeshname = obj.data.name diff --git a/blenderkit/search.py b/blenderkit/search.py index 0af69dd8..b681134c 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -105,12 +105,15 @@ def refresh_token_timer(): def update_ad(ad): if not ad.get('assetBaseId'): - ad['assetBaseId'] = ad['asset_base_id'] # this should stay ONLY for compatibility with older scenes - ad['assetType'] = ad['asset_type'] # this should stay ONLY for compatibility with older scenes - ad['canDownload'] = ad['can_download'] # this should stay ONLY for compatibility with older scenes - ad['verificationStatus'] = ad['verification_status'] # this should stay ONLY for compatibility with older scenes - ad['author'] = {} - ad['author']['id'] = ad['author_id'] # this should stay ONLY for compatibility with older scenes + try: + ad['assetBaseId'] = ad['asset_base_id'] # this should stay ONLY for compatibility with older scenes + ad['assetType'] = ad['asset_type'] # this should stay ONLY for compatibility with older scenes + ad['verificationStatus'] = ad['verification_status'] # this should stay ONLY for compatibility with older scenes + ad['author'] = {} + ad['author']['id'] = ad['author_id'] # this should stay ONLY for compatibility with older scenes + ad['canDownload'] = ad['can_download'] # this should stay ONLY for compatibility with older scenes + except Exception as e: + print('BLenderKit failed to update older asset data') return ad def update_assets_data(): # updates assets data on scene load. @@ -131,16 +134,17 @@ def update_assets_data(): # updates assets data on scene load. dicts = [ 'assets used', - 'assets rated', + # 'assets rated',# assets rated stores only true/false, not asset data. ] for s in bpy.data.scenes: - for k in dicts: - d = s.get(k) + for bkdict in dicts: + + d = s.get(bkdict) if not d: continue; - for k in d.keys(): - update_ad(d[k]) + for asset_id in d.keys(): + update_ad(d[asset_id]) # bpy.context.scene['assets used'][ad] = ad diff --git a/blenderkit/ui.py b/blenderkit/ui.py index af5d60fb..f2d95364 100644 --- a/blenderkit/ui.py +++ b/blenderkit/ui.py @@ -1822,7 +1822,6 @@ class UndoWithContext(bpy.types.Operator): return {'FINISHED'} - class RunAssetBarWithContext(bpy.types.Operator): """Regenerate cobweb""" bl_idname = "object.run_assetbar_fix_context" @@ -1835,7 +1834,8 @@ class RunAssetBarWithContext(bpy.types.Operator): def execute(self, context): C_dict = utils.get_fake_context(context) - bpy.ops.view3d.blenderkit_asset_bar(C_dict, 'INVOKE_REGION_WIN', keep_running=True, do_search=False) + if C_dict.get('window'): # no 3d view, no asset bar. + bpy.ops.view3d.blenderkit_asset_bar(C_dict, 'INVOKE_REGION_WIN', keep_running=True, do_search=False) return {'FINISHED'} diff --git a/blenderkit/utils.py b/blenderkit/utils.py index 8ddd7e7d..d03140b7 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -656,14 +656,17 @@ def get_fake_context(context, area_type='VIEW_3D'): try: context = context.copy() - except: + except Exception as e: + print(e) + print('BlenderKit: context.copy() failed. probably a colliding addon.') context = {} if context.get('area') is None or context.get('area').type != area_type: w, a, r = get_largest_area(area_type=area_type) - - override = {'window': w, 'screen': w.screen, 'area': a, 'region': r} - C_dict.update(override) + if w: + #sometimes there is no area of the requested type. Let's face it, some people use Blender without 3d view. + override = {'window': w, 'screen': w.screen, 'area': a, 'region': r} + C_dict.update(override) # print(w,a,r) return C_dict |