diff --git a/ops_snapping.py b/ops_snapping.py index ebfba42..2eb406e 100644 --- a/ops_snapping.py +++ b/ops_snapping.py @@ -43,8 +43,10 @@ class Operator_Torso_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -96,8 +98,10 @@ class Operator_Torso_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -153,8 +157,10 @@ class Operator_Torso_Snap_INV_UP(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -216,8 +222,10 @@ class Operator_Torso_Snap_UP_INV(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -274,8 +282,10 @@ class Operator_Head_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -326,8 +336,10 @@ class Operator_Head_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -382,8 +394,10 @@ class Operator_Arm_L_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -469,8 +483,10 @@ class Operator_Arm_L_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -578,8 +594,10 @@ class Operator_Arm_R_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -665,8 +683,10 @@ class Operator_Arm_R_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -774,8 +794,10 @@ class Operator_Leg_L_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -859,8 +881,10 @@ class Operator_Leg_L_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -979,8 +1003,10 @@ class Operator_Leg_R_Snap_IK_FK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object @@ -1064,8 +1090,10 @@ class Operator_Leg_R_Snap_FK_IK(bpy.types.Operator): @classmethod def poll(cls, context): - if context.active_object is not None: - return (bpy.context.object.type=='ARMATURE' and context.mode=='POSE') + if not bpy.context.active_object: + return False + else: + return (bpy.context.active_object.type=='ARMATURE' and context.mode=='POSE') def execute(self, context): arm = bpy.context.active_object