diff options
Diffstat (limited to 'release/scripts/modules/keyingsets_utils.py')
-rw-r--r-- | release/scripts/modules/keyingsets_utils.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 00ad45cf9bb..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 @@ -52,16 +52,21 @@ def path_add_property(path, prop): # Poll Callbacks -# selected objects +# selected objects (active object must be in object mode) def RKS_POLL_selected_objects(ksi, context): - return context.active_object or len(context.selected_objects) + ob = context.active_object + if ob: + return ob.mode == 'OBJECT' + else: + 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 @@ -78,13 +83,20 @@ 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: + ksi.generate(context, ks, ob) + ########################### # Generate Callbacks |