[Bf-extensions-cvs] [8c378c5] master: Cleanup: identity for None comparison

Campbell Barton noreply at git.blender.org
Sun Mar 19 02:47:01 CET 2017


Commit: 8c378c52c83757b9e78d5a98581bf240ed31a1ec
Author: Campbell Barton
Date:   Sun Mar 19 12:47:06 2017 +1100
Branches: master
https://developer.blender.org/rBA8c378c52c83757b9e78d5a98581bf240ed31a1ec

Cleanup: identity for None comparison

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

M	add_curve_extra_objects/add_curve_simple.py
M	add_mesh_BoltFactory/Boltfactory.py
M	animation_add_corrective_shape_key.py
M	io_convert_image_to_mesh_img/import_img.py
M	io_export_dxf/export_dxf.py
M	io_export_dxf/primitive_exporters/base_exporter.py
M	io_export_unreal_psk_psa.py
M	io_import_dxf/dxfimport/do.py
M	io_import_scene_lwo.py
M	io_import_scene_unreal_psa_psk.py
M	io_mesh_ply/__init__.py
M	io_scene_x/export_x.py
M	io_scene_x3d/import_x3d.py
M	mesh_bsurfaces.py
M	netrender/master.py
M	netrender/slave.py
M	object_cloud_gen.py
M	render_copy_settings/operator.py
M	render_povray/nodes.py
M	rigify/rig_ui_pitchipoy_template.py
M	ui_translate/update_ui.py

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

diff --git a/add_curve_extra_objects/add_curve_simple.py b/add_curve_extra_objects/add_curve_simple.py
index 111d8c0..a17e544 100644
--- a/add_curve_extra_objects/add_curve_simple.py
+++ b/add_curve_extra_objects/add_curve_simple.py
@@ -1028,7 +1028,7 @@ class Simple(bpy.types.Operator):
     ##### POLL #####
     @classmethod
     def poll(cls, context):
-        return context.scene != None
+        return context.scene is not None
 
     ##### EXECUTE #####
     def execute(self, context):
@@ -1099,7 +1099,7 @@ class BezierPointsFillet(bpy.types.Operator):
     ##### POLL #####
     @classmethod
     def poll(cls, context):
-        return context.scene != None
+        return context.scene is not None
 
     ##### EXECUTE #####
     def execute(self, context):
@@ -1237,7 +1237,7 @@ class BezierDivide(bpy.types.Operator):
     ##### POLL #####
     @classmethod
     def poll(cls, context):
-        return context.scene != None
+        return context.scene is not None
 
     ##### EXECUTE #####
     def execute(self, context):
@@ -1347,7 +1347,7 @@ class SimpleEdit(bpy.types.Operator):
         nselected = []
         n = 0
         obj = context.active_object
-        if obj != None:
+        if obj is not None:
             if obj.type == 'CURVE':
                 for i in obj.data.splines:
                     for j in i.bezier_points:
@@ -1375,7 +1375,7 @@ class SimpleEdit(bpy.types.Operator):
         selected = []
         n = 0
         obj = context.active_object
-        if obj != None:
+        if obj is not None:
             if obj.type == 'CURVE':
                 for i in obj.data.splines:
                     for j in i.bezier_points:
diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index 66b0c32..be0ba61 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -266,7 +266,7 @@ class add_mesh_bolt(bpy.types.Operator):
     ##### POLL #####
     @classmethod
     def poll(cls, context):
-        return context.scene != None
+        return context.scene is not None
 
     ##### EXECUTE #####
     def execute(self, context):
diff --git a/animation_add_corrective_shape_key.py b/animation_add_corrective_shape_key.py
index 66234f9..efb357f 100644
--- a/animation_add_corrective_shape_key.py
+++ b/animation_add_corrective_shape_key.py
@@ -181,7 +181,7 @@ class add_corrective_pose_shape(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        return context.active_object != None
+        return context.active_object is not None
 
     def execute(self, context):
         selection = context.selected_objects
@@ -378,7 +378,7 @@ class add_corrective_pose_shape_fast(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        return context.active_object != None
+        return context.active_object is not None
 
     def execute(self, context):
         selection = context.selected_objects
diff --git a/io_convert_image_to_mesh_img/import_img.py b/io_convert_image_to_mesh_img/import_img.py
index 303991d..7c9e76d 100644
--- a/io_convert_image_to_mesh_img/import_img.py
+++ b/io_convert_image_to_mesh_img/import_img.py
@@ -67,7 +67,7 @@ class hirise_dtm_importer(object):
       self.__cropXY = False
 
     def bin_mode(self, bin_mode=None):
-      if bin_mode != None:
+      if bin_mode is not None:
         self.__bin_mode = bin_mode
       return self.__bin_mode
 
@@ -503,7 +503,7 @@ class hirise_dtm_importer(object):
       x = 0
       point_offset += len( last_line ) - last_line.count(None)
       for z in last_line:
-        if z != None:
+        if z is not None:
           coords.append( (x*scale_x, 0.0, z) )
           coord += 1
         x += 1
@@ -535,7 +535,7 @@ class hirise_dtm_importer(object):
         # TODO: turn this into a map
         x = 0
         for z in dtm_line:
-          if z != None:
+          if z is not None:
             coords.append( (x*scale_x, y_val, z) )
             coord += 1
           x += 1
@@ -567,17 +567,17 @@ class hirise_dtm_importer(object):
             # TODO: implement a triangular face
             pass
 
-          if vals[1] != None:
+          if vals[1] is not None:
             previous_point_offset += 1
-          if vals[2] != None:
+          if vals[2] is not None:
             point_offset += 1
 
         # Squeeze the last point offset increment out of the previous line
-        if last_line[-1] != None:
+        if last_line[-1] is not None:
           previous_point_offset += 1
 
         # Squeeze the last point out of the current line
-        if dtm_line[-1] != None:
+        if dtm_line[-1] is not None:
           point_offset += 1
 
         # remember what we just saw (and forget anything before that)
diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py
index 89aa1d1..a17f50f 100644
--- a/io_export_dxf/export_dxf.py
+++ b/io_export_dxf/export_dxf.py
@@ -204,7 +204,7 @@ def get_view_projection_matrix(context, settings):
 	Currently only orthographic projection is used. (Subject to discussion).
 	"""
 	cam = settings['projectionThrough']
-	if cam == None:
+	if cam is None:
 		mw = mathutils.Matrix()
 		mw.identity()
 	elif cam in projectionMapping.keys():
@@ -238,8 +238,8 @@ def _exportItem(ctx, o, mw, drawing, settings):
 		print('elayer=%s, ecolor=%s, eltype=%s' % (elayer, ecolor, eltype))
 	#TODO: use o.boundBox for drawing extends ??
 
-	if elayer != None and not drawing.containsLayer(elayer):
-		if ecolor!=None: tempcolor = ecolor
+	if elayer is not None and not drawing.containsLayer(elayer):
+		if ecolor is not None: tempcolor = ecolor
 		else: tempcolor = settings['layercolor_def']
 		drawing.addLayer(elayer, tempcolor)
 
diff --git a/io_export_dxf/primitive_exporters/base_exporter.py b/io_export_dxf/primitive_exporters/base_exporter.py
index 2542a1c..d3c9663 100644
--- a/io_export_dxf/primitive_exporters/base_exporter.py
+++ b/io_export_dxf/primitive_exporters/base_exporter.py
@@ -181,7 +181,7 @@ class BasePrimitiveDXFExporter(object):
 #        #print 'deb: OCS_origin=', OCS_origin #---------
 #
 #        ZRotation = rotZ
-#        if Extrusion!=None:
+#        if Extrusion is not None:
 #            ZRotation = getZRotation(AXaxis,rot_matrix_invert)
 #        #Zrotmatrix = mathutils.RotationMatrix(-ZRotation, 3, "Z")
 #        rs, rc = sin(ZRotation), cos(ZRotation)
diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py
index c410f91..7ecef29 100644
--- a/io_export_unreal_psk_psa.py
+++ b/io_export_unreal_psk_psa.py
@@ -770,7 +770,7 @@ class SmoothingGroup:
     def get_valid_smoothgroup_id(self):
         temp_id = 1
         for group in self.neighboring_groups:
-            if group != None and group.id == temp_id:
+            if group is not None and group.id == temp_id:
                 if temp_id < 0x80000000:
                     temp_id = temp_id << 1
                 else:
@@ -828,7 +828,7 @@ def add_face_to_smoothgroup( mesh, face, edge_sharing_list, smoothgroup ):
 
         edge_id = find_edges(mesh, key)
 
-        if edge_id != None:
+        if edge_id is not None:
 
             # not sharp
             if not( mesh.edges[edge_id].use_edge_sharp):
@@ -946,7 +946,7 @@ def meshmerge(selectedobjects):
         count = 0 #reset count
         for count in range(len( selectedobjects)):
             #print("Index:",count)
-            if selectedobjects[count] != None:
+            if selectedobjects[count] is not None:
                 me_da = selectedobjects[count].data.copy() #copy data
                 me_ob = selectedobjects[count].copy() #copy object
                 #note two copy two types else it will use the current data or mesh
@@ -1016,8 +1016,8 @@ def parse_mesh( mesh, psk ):
 
         print("  Material {} '{}'".format(mat_slot_index, slot.name))
         MaterialName.append(slot.name)
-        #if slot.material.texture_slots[0] != None:
-            #if slot.material.texture_slots[0].texture.image.filepath != None:
+        #if slot.material.texture_slots[0] is not None:
+            #if slot.material.texture_slots[0].texture.image.filepath is not None:
                 #print("    Texture path {}".format(slot.material.texture_slots[0].texture.image.filepath))
         #create the current material
         v_material              = psk.GetMatByIndex(mat_slot_index)
@@ -1314,7 +1314,7 @@ def parse_armature( armature, psk, psa ):
     verbose("Armature object: {} Armature data: {}".format(armature.name, armature.data.name))
 
     # generate a list of root bone candidates
-    root_candidates = [b for b in armature.data.bones if b.parent == None and b.use_deform == True]
+    root_candidates = [b for b in armature.data.bones if b.parent is None and b.use_deform == True]
 
     # should be a single, unambiguous result
     if len(root_candidates) == 0:
@@ -1360,7 +1360,7 @@ def recurse_bone( bone, bones, psk, psa, parent_id, parent_matrix, indent="" ):
         status = "No effect"
 
     # calc parented bone transform
-    if bone.parent != None:
+    if bone.parent is not None:
         quat        = make_fquat(bone.matrix.to_quaternion())
         quat_parent = bone.parent.matrix.to_quaternion().inverted()
         parent_head = quat_parent * bone.parent.head
@@ -1431,7 +1431,7 @@ def parse_animation( armature, udk_bones, actions_to_export, psa ):
     print("Scene: {} FPS: {} Frames: {} to {}".format(context.scene.name, anim_rate, context.scene.frame_start, context.scene.frame_end))
     print("Processing {} action(s)".format(len(actions_to_export)))
     print()
-    if armature.animation_data == None: #if animation data was not create for the armature it will skip the exporting action set(s)
+    if armature.animation_data is None: #if animation data was not create for the armature it will skip the exporting action set(s)
         print("None Actions Set! skipping...")
         return
     restoreAction   = armature.animation_data.action    # Q: is animation_data always valid?
@@ -1505,14 +1505,14 @@ def parse_animation( armature, udk_bones, actions_to_export, psa ):
                 pose_bone           = bone_data[1]
                 pose_bone_matrix    = mathutils.Matrix(pose_bone.matri

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list