[Bf-blender-cvs] [3852e4bb8f6] blender2.8: Cleanup: redundant len() checks

Campbell Barton noreply at git.blender.org
Mon Oct 15 23:54:02 CEST 2018


Commit: 3852e4bb8f61446575550d8b17ab4d6904a88018
Author: Campbell Barton
Date:   Tue Oct 16 08:50:35 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB3852e4bb8f61446575550d8b17ab4d6904a88018

Cleanup: redundant len() checks

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

M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/properties_data_armature.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 4fcadbf63e3..260afd39b65 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2521,11 +2521,11 @@ class WM_OT_studiolight_uninstall(Operator):
         userpref = context.user_preferences
         for studio_light in userpref.studio_lights:
             if studio_light.index == self.index:
-                if len(studio_light.path) > 0:
+                if studio_light.path:
                     self._remove_path(pathlib.Path(studio_light.path))
-                if len(studio_light.path_irr_cache) > 0:
+                if studio_light.path_irr_cache:
                     self._remove_path(pathlib.Path(studio_light.path_irr_cache))
-                if len(studio_light.path_sh_cache) > 0:
+                if studio_light.path_sh_cache:
                     self._remove_path(pathlib.Path(studio_light.path_sh_cache))
                 userpref.studio_lights.remove(studio_light)
                 return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 376f2d9811d..f41036db5a5 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -173,7 +173,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
 
         if poselib:
             # warning about poselib being in an invalid state
-            if len(poselib.fcurves) > 0 and len(poselib.pose_markers) == 0:
+            if poselib.fcurves and not poselib.pose_markers:
                 layout.label(icon='ERROR', text="Error: Potentially corrupt library, run 'Sanitize' operator to fix")
 
             # list of poses in pose library
@@ -344,7 +344,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel):  # , Panel): # inherit from
     @classmethod
     def poll(cls, context):
         # XXX: include pose-mode check?
-        return (context.object) and (context.armature)
+        return context.object and context.armature
 
     def draw(self, context):
         ob = context.object
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 8e06a811c5e..6cc0e6f46d4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -509,7 +509,7 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel):
                                      ob, "material_slots",
                                      ob, "active_material_index", rows=2)
             mat = ob.active_material
-            if mat and len(mat.texture_paint_images) > 0:
+            if mat and mat.texture_paint_images:
                 row = layout.row()
                 row.template_list("TEXTURE_UL_texpaintslots", "",
                                   mat, "texture_paint_images",



More information about the Bf-blender-cvs mailing list