diff options
-rw-r--r-- | release/scripts/modules/keyingsets_utils.py | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 27 |
2 files changed, 30 insertions, 3 deletions
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 7ce5f3e029b..48071117bd4 100644 --- a/release/scripts/modules/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -153,8 +153,10 @@ def get_transform_generators_base_info(data): # no path in this case path = "" - # data on ID-blocks directly should get grouped by the KeyingSet - grouping = None + # transform data on ID-blocks directly should get grouped under a + # hardcoded label ("Object Transforms") so that they get grouped + # consistently when keyframed directly + grouping = "Object Transforms" else: # get the path to the ID-block path = data.path_from_id() diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 67f5aef2517..1e9d8af418a 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1826,12 +1826,37 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) path = RNA_path_from_ID_to_property(&ptr, prop); if (path) { + const char *identifier = RNA_property_identifier(prop); + char *group = NULL; + + /* Special exception for keyframing transforms: + * Set "group" for this manually, instead of having them appearing at the bottom (ungrouped) + * part of the channels list. Leaving these ungrouped is not a nice user behaviour in this case. + * + * TODO: Perhaps we can extend this behaviour in future for other properties... + */ + if ((ptr.type == &RNA_PoseBone) && + (strstr(identifier, "location") || strstr(identifier, "rotation") || strstr(identifier, "scale"))) + { + bPoseChannel *pchan = (bPoseChannel *)ptr.data; + group = pchan->name; + } + else if ((ptr.type == &RNA_Object) && + (strstr(identifier, "location") || strstr(identifier, "rotation") || strstr(identifier, "scale"))) + { + /* NOTE: Keep this label in sync with the "ID" case in + * keyingsets_utils.py :: get_transform_generators_base_info() + */ + group = "Object Transforms"; + } + + if (all) { /* -1 indicates operating on the entire array (or the property itself otherwise) */ index = -1; } - success = insert_keyframe(depsgraph, op->reports, ptr.id.data, NULL, NULL, path, index, cfra, ts->keyframe_type, flag); + success = insert_keyframe(depsgraph, op->reports, ptr.id.data, NULL, group, path, index, cfra, ts->keyframe_type, flag); MEM_freeN(path); } |