diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-09-28 14:54:57 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-09-28 14:54:57 +0300 |
commit | 601ce6a89c4f7ecc974f40c85add491a7c295c6f (patch) | |
tree | dd2a0e4c6b655308d44fd210487a7928b6d335f4 /release | |
parent | dbb8222baa408eb1c1ebb47fc7b7c52bf2fbdd35 (diff) |
POSELIB_OT_pose_add: only create keyframes for selected bones.
Previously the pose library used the WholeCharacter key set, which ignores
selection and add keys for almost all bones in the rig. This is a very
slow operation on complex rigs. With this patch, only selected bones are
keyed, defaulting to keying all bones when none are selected.
Note that this fixes the FIXME previously mentioned in the source.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/keyingsets_builtins.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index 0b4fbd52b5d..e04b55ec4d2 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -43,6 +43,7 @@ ANIM_KS_SCALING_ID = "Scaling" ANIM_KS_LOC_ROT_SCALE_ID = "LocRotScale" ANIM_KS_AVAILABLE_ID = "Available" ANIM_KS_WHOLE_CHARACTER_ID = "WholeCharacter" +ANIM_KS_WHOLE_CHARACTER_SELECTED_ID = "WholeCharacterSelected" # Location @@ -522,9 +523,24 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): elif prop_rna.is_animatable: ksi.addProp(ks, bone, prop) +# All properties that are likely to get animated in a character rig, only selected bones. +class BUILTIN_KSI_WholeCharacterSelected(BUILTIN_KSI_WholeCharacter): + """Insert a keyframe for all properties that are likely to get animated in a character rig """ + """(only selected bones)""" + bl_idname = ANIM_KS_WHOLE_CHARACTER_SELECTED_ID + bl_label = "Whole Character (Selected bones)" -############################### + # iterator - all bones regardless of selection + def iterator(ksi, context, ks): + # Use either the selected bones, or all of them if none are selected. + bones = context.selected_pose_bones or context.active_object.pose.bones + for bone in bones: + if bone.name.startswith(BUILTIN_KSI_WholeCharacterSelected.badBonePrefixes): + continue + ksi.generate(context, ks, bone) + +############################### # Delta Location class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): |