diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-02-07 15:00:07 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-02-08 12:35:56 +0300 |
commit | 85bdc022edeb5dce39611d23cd305f9e45131548 (patch) | |
tree | 50d29ff0e140575788d9ba46916fffa129c0a4ca /bone_selection_sets.py | |
parent | d83880c35bf15d5218d70222585fad87a377b8f2 (diff) |
Bone Selection Sets: simplified some poll methods
Inverting the condition allows for simpler code and non-conditional core
functionality.
Diffstat (limited to 'bone_selection_sets.py')
-rw-r--r-- | bone_selection_sets.py | 17 |
1 files changed, 8 insertions, 9 deletions
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 |