[Bf-extensions-cvs] [85bdc022] master: Bone Selection Sets: simplified some poll methods
Sybren A. Stüvel
noreply at git.blender.org
Thu Feb 8 11:02:47 CET 2018
Commit: 85bdc022edeb5dce39611d23cd305f9e45131548
Author: Sybren A. Stüvel
Date: Wed Feb 7 13:00:07 2018 +0100
Branches: master
https://developer.blender.org/rBA85bdc022edeb5dce39611d23cd305f9e45131548
Bone Selection Sets: simplified some poll methods
Inverting the condition allows for simpler code and non-conditional core
functionality.
===================================================================
M bone_selection_sets.py
===================================================================
diff --git a/bone_selection_sets.py b/bone_selection_sets.py
index 22cadd50..cd1249c8 100644
--- a/bone_selection_sets.py
+++ b/bone_selection_sets.py
@@ -151,11 +151,10 @@ class PluginOperator(Operator):
class NeedSelSetPluginOperator(PluginOperator):
@classmethod
def poll(cls, context):
- if super().poll(context):
- arm = context.object
- return (arm.active_selection_set < len(arm.selection_sets) and
- arm.active_selection_set >= 0)
- return False
+ if not super().poll(context):
+ return False
+ arm = context.object
+ return 0 <= arm.active_selection_set < len(arm.selection_sets)
class POSE_OT_selection_set_delete_all(PluginOperator):
@@ -207,10 +206,10 @@ class POSE_OT_selection_set_move(NeedSelSetPluginOperator):
@classmethod
def poll(cls, context):
- if super().poll(context):
- arm = context.object
- return len(arm.selection_sets) > 1
- return False
+ if not super().poll(context):
+ return False
+ arm = context.object
+ return len(arm.selection_sets) > 1
def execute(self, context):
arm = context.object
More information about the Bf-extensions-cvs
mailing list