[Bf-extensions-cvs] [3c23caa] master: Cleanup: use identity for None comparisons
Campbell Barton
noreply at git.blender.org
Wed Jul 20 19:47:57 CEST 2016
Commit: 3c23caa4c0b31b9908a43737369b715915a8fe62
Author: Campbell Barton
Date: Thu Jul 21 03:52:13 2016 +1000
Branches: master
https://developer.blender.org/rBA3c23caa4c0b31b9908a43737369b715915a8fe62
Cleanup: use identity for None comparisons
===================================================================
M rigify/generate.py
M rigify/rig_ui_template.py
M rigify/rigs/biped/arm/fk.py
M rigify/rigs/biped/arm/ik.py
M rigify/rigs/biped/leg/fk.py
M rigify/rigs/biped/leg/ik.py
M rigify/rigs/biped/limb_common.py
M rigify/rigs/finger.py
M rigify/rigs/palm.py
M rigify/rigs/pitchipoy/super_finger.py
M rigify/utils.py
===================================================================
diff --git a/rigify/generate.py b/rigify/generate.py
index 27ccf14..4fb83f5 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -279,7 +279,7 @@ def generate_rig(context, metarig):
obj.select = True
bpy.ops.object.mode_set(mode='EDIT')
scripts = rig.generate()
- if scripts != None:
+ if scripts is not None:
ui_scripts += [scripts[0]]
t.tick("Generate rigs: ")
except Exception as e:
diff --git a/rigify/rig_ui_template.py b/rigify/rig_ui_template.py
index c37b9db..717410d 100644
--- a/rigify/rig_ui_template.py
+++ b/rigify/rig_ui_template.py
@@ -386,7 +386,7 @@ class Rigify_Arm_FK2IK(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return (context.active_object != None and context.mode == 'POSE')
+ return (context.active_object is not None and context.mode == 'POSE')
def execute(self, context):
use_global_undo = context.user_preferences.edit.use_global_undo
@@ -416,7 +416,7 @@ class Rigify_Arm_IK2FK(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return (context.active_object != None and context.mode == 'POSE')
+ return (context.active_object is not None and context.mode == 'POSE')
def execute(self, context):
use_global_undo = context.user_preferences.edit.use_global_undo
@@ -447,7 +447,7 @@ class Rigify_Leg_FK2IK(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return (context.active_object != None and context.mode == 'POSE')
+ return (context.active_object is not None and context.mode == 'POSE')
def execute(self, context):
use_global_undo = context.user_preferences.edit.use_global_undo
@@ -479,7 +479,7 @@ class Rigify_Leg_IK2FK(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return (context.active_object != None and context.mode == 'POSE')
+ return (context.active_object is not None and context.mode == 'POSE')
def execute(self, context):
use_global_undo = context.user_preferences.edit.use_global_undo
diff --git a/rigify/rigs/biped/arm/fk.py b/rigify/rigs/biped/arm/fk.py
index 740b327..03ff6fc 100644
--- a/rigify/rigs/biped/arm/fk.py
+++ b/rigify/rigs/biped/arm/fk.py
@@ -73,7 +73,7 @@ class Rig:
# Create hand widget
ob = create_widget(self.obj, hand)
- if ob != None:
+ if ob is not None:
verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7)]
mesh = ob.data
diff --git a/rigify/rigs/biped/arm/ik.py b/rigify/rigs/biped/arm/ik.py
index a57256e..e4cd2b5 100644
--- a/rigify/rigs/biped/arm/ik.py
+++ b/rigify/rigs/biped/arm/ik.py
@@ -77,7 +77,7 @@ class Rig:
# vishand = bone_list[6]
ob = create_widget(self.obj, hand)
- if ob != None:
+ if ob is not None:
verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7)]
mesh = ob.data
diff --git a/rigify/rigs/biped/leg/fk.py b/rigify/rigs/biped/leg/fk.py
index 743e3a1..bf055fa 100644
--- a/rigify/rigs/biped/leg/fk.py
+++ b/rigify/rigs/biped/leg/fk.py
@@ -117,7 +117,7 @@ class Rig:
# Create foot widget
ob = create_widget(self.obj, foot)
- if ob != None:
+ if ob is not None:
verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7)]
mesh = ob.data
diff --git a/rigify/rigs/biped/leg/ik.py b/rigify/rigs/biped/leg/ik.py
index b0df999..82422e2 100644
--- a/rigify/rigs/biped/leg/ik.py
+++ b/rigify/rigs/biped/leg/ik.py
@@ -326,7 +326,7 @@ class Rig:
create_circle_widget(self.obj, toe, radius=0.7, head_tail=0.5)
ob = create_widget(self.obj, foot_roll)
- if ob != None:
+ if ob is not None:
verts = [(0.3999999761581421, 0.766044557094574, 0.6427875757217407), (0.17668449878692627, 3.823702598992895e-08, 3.2084670920085046e-08), (-0.17668461799621582, 9.874240447516058e-08, 8.285470443070153e-08), (-0.39999961853027344, 0.7660449147224426, 0.6427879333496094), (0.3562471270561218, 0.6159579753875732, 0.5168500542640686), (-0.35624682903289795, 0.6159582138061523, 0.5168502926826477), (0.20492683351039886, 0.09688037633895874, 0.0812922865152359), (-0.204926878213 [...]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (1, 6), (4, 6), (2, 7), (5, 7)]
mesh = ob.data
@@ -337,7 +337,7 @@ class Rig:
mod.levels = 2
ob = create_widget(self.obj, foot)
- if ob != None:
+ if ob is not None:
verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7)]
mesh = ob.data
diff --git a/rigify/rigs/biped/limb_common.py b/rigify/rigs/biped/limb_common.py
index 8cd5ad1..eadd637 100644
--- a/rigify/rigs/biped/limb_common.py
+++ b/rigify/rigs/biped/limb_common.py
@@ -48,7 +48,7 @@ class FKLimb:
bpy.ops.object.mode_set(mode='EDIT')
# Create non-scaling parent bone
- if self.org_parent != None:
+ if self.org_parent is not None:
loc = Vector(self.obj.data.edit_bones[self.org_bones[0]].head)
parent = make_nonscaling_child(self.obj, self.org_parent, loc, "_fk")
else:
@@ -69,7 +69,7 @@ class FKLimb:
eantistr = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[1], "_antistr.fk"))))
# Create the hinge bones
- if parent != None:
+ if parent is not None:
socket1 = copy_bone(self.obj, ulimb, make_mechanism_name(ulimb + ".socket1"))
socket2 = copy_bone(self.obj, ulimb, make_mechanism_name(ulimb + ".socket2"))
@@ -85,7 +85,7 @@ class FKLimb:
elimb_mch_e = eb[elimb_mch]
- if parent != None:
+ if parent is not None:
socket1_e = eb[socket1]
socket2_e = eb[socket2]
@@ -105,7 +105,7 @@ class FKLimb:
fantistr_e.use_connect = False
fantistr_e.parent = ulimb_e
- if parent != None:
+ if parent is not None:
socket1_e.use_connect = False
socket1_e.parent = eb[parent]
@@ -121,7 +121,7 @@ class FKLimb:
eantistr_e.length /= 8
put_bone(self.obj, eantistr, Vector(flimb_e.tail))
- if parent != None:
+ if parent is not None:
socket1_e.length /= 4
socket2_e.length /= 3
@@ -136,7 +136,7 @@ class FKLimb:
fantistr_p = pb[fantistr]
eantistr_p = pb[eantistr]
- if parent != None:
+ if parent is not None:
socket2_p = pb[socket2]
# Lock axes
@@ -154,7 +154,7 @@ class FKLimb:
flimb_p.lock_rotation = (True, True, False)
# Set up custom properties
- if parent != None:
+ if parent is not None:
prop = rna_idprop_ui_prop_get(ulimb_p, "isolate", create=True)
ulimb_p["isolate"] = 0.0
prop["soft_min"] = prop["min"] = 0.0
@@ -230,7 +230,7 @@ class FKLimb:
add_antistretch_drivers(eantistr_p)
# Hinge constraints / drivers
- if parent != None:
+ if parent is not None:
con = socket2_p.constraints.new('COPY_LOCATION')
con.name = "copy_location"
con.target = self.obj
@@ -282,7 +282,7 @@ class FKLimb:
create_limb_widget(self.obj, flimb)
ob = create_widget(self.obj, elimb)
- if ob != None:
+ if ob is not None:
verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7)]
mesh = ob.data
@@ -324,10 +324,10 @@ class IKLimb:
bpy.ops.object.mode_set(mode='EDIT')
# Create non-scaling parent bone
- if self.org_parent != None:
+ if self.org_parent is not None:
loc = Vector(self.obj.data.edit_bones[self.org_bones[0]].head)
parent = make_nonscaling_child(self.obj, self.org_parent, loc, "_ik")
- if self.pole_parent == None:
+ if self.pole_parent is None:
self.pole_parent = parent
else:
parent = None
@@ -348,7 +348,7 @@ class IKLimb:
pole = copy_bone(self.obj, self.org_bones[0], pole_target_name)
if self.pole_parent == self.org_bones[2]:
self.pole_parent = elimb_mch
- if self.pole_parent != None:
+ if self.pole_parent is not None:
pole_par = copy_bone(self.obj, self.pole_parent, make_mechanism_name(insert_before_lr(pole_target_name, "_parent")))
viselimb = copy_bone(self.obj, self.org_bones[2], "VIS-" + strip_org(insert_before_lr(self.org_bones[2], ".ik")))
@@ -357,7 +357,7 @@ class IKLimb:
# Get edit bones
eb = self.obj.data.edit_bones
- if parent != None:
+ if parent is not None:
parent_e = eb[parent]
ulimb_e = eb[ulimb]
flimb_e = eb[flimb]
@@ -368,7 +368,7 @@ class IKLimb:
ulimb_str_e = eb[ulimb_str]
flimb_str_e = eb[flimb_str]
pole_e = eb[pole]
- if self.pole_parent != None:
+ if self.pole_parent is not None:
pole_par_e = eb[pole_par]
viselimb_e = eb[viselimb]
vispole_e = eb[vispole]
@@ -376,7 +376,7 @@ class IKLimb:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list