diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-18 02:13:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-18 02:13:51 +0400 |
commit | 96e9c67b472850ca711c710209ac684d40fe7132 (patch) | |
tree | d9649db26f8b0f93bc763f2dbb7f010709fd5c5e /release/scripts/startup | |
parent | a025ff407ec9c300cc2039bbb7f4b13cb466ac8b (diff) |
Code Cleanup: py script float comparisons
Diffstat (limited to 'release/scripts/startup')
4 files changed, 11 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index 7aa6ae13b56..73232232e23 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -41,7 +41,8 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): return rl and rl.freestyle_settings.linesets.active def execute(self, context): - rl = context.scene.render.layers.active + scene = context.scene + rl = scene.render.layers.active lineset = rl.freestyle_settings.linesets.active linestyle = lineset.linestyle # Find the modifier to work on @@ -53,7 +54,7 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): m = linestyle.thickness_modifiers[self.name] # Find the source object if m.type == 'DISTANCE_FROM_CAMERA': - source = context.scene.camera + source = scene.camera elif m.type == 'DISTANCE_FROM_OBJECT': if m.target is None: self.report({'ERROR'}, "Target object not specified") @@ -63,8 +64,8 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): self.report({'ERROR'}, "Unexpected modifier type: " + m.type) return {'CANCELLED'} # Find selected mesh objects - selection = [ob for ob in context.scene.objects if ob.select and ob.type == 'MESH' and ob.name != source.name] - if len(selection) > 0: + selection = [ob for ob in scene.objects if ob.select and ob.type == 'MESH' and ob.name != source.name] + if selection: # Compute the min/max distance between selected mesh objects and the source min_dist = sys.float_info.max max_dist = -min_dist diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 109484a6b9b..f9461c85341 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -151,7 +151,7 @@ class BakeToKeyframes(Operator): q1 = obj.rotation_quaternion q2 = mat.to_quaternion() # make quaternion compatible with the previous one - if (q1.dot(q2) < 0): + if q1.dot(q2) < 0.0: obj.rotation_quaternion = -q2 else: obj.rotation_quaternion = q2 diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index bca613be866..441d314463d 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -583,7 +583,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.prop(md, "wave_alignment", text="Alignment") sub = col.column() - sub.active = md.wave_alignment > 0 + sub.active = (md.wave_alignment > 0.0) sub.prop(md, "wave_direction", text="Direction") sub.prop(md, "damping") diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index d48c4957e6e..9e56c269b2b 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -412,7 +412,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, Panel): col.active = (not mat.use_shadeless) col.prop(rayt, "fresnel") sub = col.column() - sub.active = rayt.fresnel > 0 + sub.active = (rayt.fresnel > 0.0) sub.prop(rayt, "fresnel_factor", text="Blend") if base_mat.transparency_method == 'RAYTRACE': @@ -469,7 +469,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel): col = split.column() col.prop(raym, "fresnel") sub = col.column() - sub.active = raym.fresnel > 0 + sub.active = (raym.fresnel > 0.0) sub.prop(raym, "fresnel_factor", text="Blend") split = layout.split() @@ -480,7 +480,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel): col.prop(raym, "distance", text="Max Dist") col.separator() sub = col.split(percentage=0.4) - sub.active = raym.distance > 0.0 + sub.active = (raym.distance > 0.0) sub.label(text="Fade To:") sub.prop(raym, "fade_to", text="") @@ -488,7 +488,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel): col.label(text="Gloss:") col.prop(raym, "gloss_factor", text="Amount") sub = col.column() - sub.active = raym.gloss_factor < 1.0 + sub.active = (raym.gloss_factor < 1.0) sub.prop(raym, "gloss_threshold", text="Threshold") sub.prop(raym, "gloss_samples", text="Samples") sub.prop(raym, "gloss_anisotropic", text="Anisotropic") |