From 570fbba3f33484111a472a835522d5ec30143a7c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 13 Mar 2016 03:49:26 +1300 Subject: Keyframing: Added ToolSetting for choosing default keyframe type To make it easier for animators working in a multipass pose-to-pose workflow when inserting breakdown keyframes and so forth, it is now possible to specify the "type" of keyframe being created (i.e. the colour of the keyframe, when drawn in the Dope Sheet). Usage: 1) Choose the type of keyframe ("Keyframe", "Breakdown", "Extreme", etc.) from the new dropdown located between the AutoKeying and KeyingSet widgets on the timeline header. 2) Insert keyframes 3) Rejoyce that your newly created keyframes have now been coloured for you already in the DopeSheet. Todo: * Look into a way of using the actual keyframe colours (from the theme) for the icons of these types. --- source/blender/editors/space_graph/graph_edit.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 9653a2cfebe..10baed8508d 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -522,6 +522,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) ReportList *reports = ac->reports; SpaceIpo *sipo = (SpaceIpo *)ac->sl; Scene *scene = ac->scene; + ToolSettings *ts = scene->toolsettings; short flag = 0; /* filter data */ @@ -574,7 +575,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) y = 0.0f; /* insert keyframe directly into the F-Curve */ - insert_vert_fcurve(fcu, x, y, 0); + insert_vert_fcurve(fcu, x, y, ts->keyframe_type, 0); ale->update |= ANIM_UPDATE_DEFAULT; } @@ -602,9 +603,9 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) * up adding the keyframes on a new F-Curve in the action data instead. */ if (ale->id && !ale->owner && !fcu->driver) - insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag); + insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag); else - insert_vert_fcurve(fcu, cfra, fcu->curval, 0); + insert_vert_fcurve(fcu, cfra, fcu->curval, ts->keyframe_type, 0); ale->update |= ANIM_UPDATE_DEFAULT; } @@ -683,9 +684,11 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) */ if (fcurve_is_keyframable(fcu)) { ListBase anim_data; - + ToolSettings *ts = ac.scene->toolsettings; + short mapping_flag = ANIM_get_normalization_flags(&ac); float scale, offset; + /* get frame and value from props */ frame = RNA_float_get(op->ptr, "frame"); val = RNA_float_get(op->ptr, "value"); @@ -696,11 +699,11 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) /* apply inverse unit-mapping to value to get correct value for F-Curves */ scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, mapping_flag | ANIM_UNITCONV_RESTORE, &offset); - + val = val * scale - offset; - + /* insert keyframe on the specified frame + value */ - insert_vert_fcurve(fcu, frame, val, 0); + insert_vert_fcurve(fcu, frame, val, ts->keyframe_type, 0); ale->update |= ANIM_UPDATE_DEPS; -- cgit v1.2.3