[Bf-extensions-cvs] [69751991] blender-v2.91-release: Fix T82405: Check if active object's data is None

Robert Guetzkow noreply at git.blender.org
Fri Nov 6 11:56:23 CET 2020


Commit: 69751991311a165e97a48ea67ed60e2c6022ee63
Author: Robert Guetzkow
Date:   Fri Nov 6 11:47:35 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rBA69751991311a165e97a48ea67ed60e2c6022ee63

Fix T82405: Check if active object's data is None

Check if the active object's data is `None` before attempting
to call functions on it. It is `None` if the object is an
empty.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9456

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

M	add_mesh_BoltFactory/Boltfactory.py
M	add_mesh_extra_objects/Wallfactory.py
M	add_mesh_extra_objects/add_mesh_beam_builder.py
M	add_mesh_extra_objects/add_mesh_gears.py
M	add_mesh_extra_objects/add_mesh_gemstones.py
M	add_mesh_extra_objects/add_mesh_honeycomb.py
M	add_mesh_extra_objects/add_mesh_pipe_joint.py
M	add_mesh_extra_objects/add_mesh_pyramid.py
M	add_mesh_extra_objects/add_mesh_round_brilliant.py
M	add_mesh_extra_objects/add_mesh_round_cube.py
M	add_mesh_extra_objects/add_mesh_star.py
M	add_mesh_extra_objects/add_mesh_supertoroid.py
M	add_mesh_extra_objects/add_mesh_torusknot.py
M	add_mesh_extra_objects/add_mesh_twisted_torus.py
M	add_mesh_geodesic_domes/third_domes_panel_271.py

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

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.AddObjectHe

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list