forked from bartvdbraak/blender
Insert Keyframe: Change default behaviour for how F-Curves get grouped
For many years, animators have been complaining about how keyframing a (transform) property directly would leave them ungrouped, while keyframing them using a Keying Set would put them into a group based on the name of the keyingset. This commit attempts to improve (unify + make consistent) the default behaviour: * All object transforms now get added to an "Object Transforms" group, regardless of whether they were added individually via buttons or keyingset * All bone transforms now get added to a group corresponding to the name of the bone instead of only the ones added via keyingset
This commit is contained in:
parent
23b455a891
commit
cdfa517760
@ -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()
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user