From d5d9c56cb54870edd08a2363178f573eebe08601 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Apr 2011 12:31:55 +0000 Subject: minor edits to keyingsets script. --- release/scripts/modules/keyingsets_utils.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 01e090cc230..dc61ce2a4af 100644 --- a/release/scripts/modules/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -43,7 +43,7 @@ import bpy # Append the specified property name on the the existing path def path_add_property(path, prop): - if len(path): + if path: return path + "." + prop else: return prop @@ -54,17 +54,19 @@ def path_add_property(path, prop): # selected objects (active object must be in object mode) def RKS_POLL_selected_objects(ksi, context): - if context.active_object: - return context.active_object.mode == 'OBJECT' + ob = context.active_object + if ob: + return ob.mode == 'OBJECT' else: - return len(context.selected_objects) != 0 + return bool(context.selected_objects) # selected bones def RKS_POLL_selected_bones(ksi, context): # we must be in Pose Mode, and there must be some bones selected - if (context.active_object) and (context.active_object.mode == 'POSE'): - if context.active_pose_bone or len(context.selected_pose_bones): + ob = context.active_object + if ob and ob.mode == 'POSE': + if context.active_pose_bone or context.selected_pose_bones: return True # nothing selected @@ -81,13 +83,15 @@ def RKS_POLL_selected_items(ksi, context): # all selected objects or pose bones, depending on which we've got def RKS_ITER_selected_item(ksi, context, ks): - if (context.active_object) and (context.active_object.mode == 'POSE'): + ob = context.active_object + if ob and ob.mode == 'POSE': for bone in context.selected_pose_bones: ksi.generate(context, ks, bone) else: for ob in context.selected_objects: ksi.generate(context, ks, ob) - + + # all select objects only def RKS_ITER_selected_objects(ksi, context, ks): for ob in context.selected_objects: -- cgit v1.2.3