diff options
Diffstat (limited to 'source/blender/editors/space_graph/graph_edit.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index c8e07dbda68..ebb9266149a 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -116,6 +116,8 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa /* get range */ if (calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) { + short mapping_flag = ANIM_get_normalization_flags(ac); + /* apply NLA scaling */ if (adt) { txmin = BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP); @@ -123,7 +125,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa } /* apply unit corrections */ - unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0); + unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag); tymin *= unitFac; tymax *= unitFac; @@ -330,12 +332,14 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end) FPoint *fpt; float unitFac; int cfra; - + SpaceIpo *sipo = (SpaceIpo *) ac->sl; + short mapping_flag = ANIM_get_normalization_flags(ac); + /* disable driver so that it don't muck up the sampling process */ fcu->driver = NULL; /* calculate unit-mapping factor */ - unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0); + unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag); /* create samples, but store them in a new curve * - we cannot use fcurve_store_samples() as that will only overwrite the original curve @@ -578,6 +582,8 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) * keyframes if these will be visible after doing so... */ if (fcurve_is_keyframable(fcu)) { + short mapping_flag = ANIM_get_normalization_flags(&ac); + /* get frame and value from props */ frame = RNA_float_get(op->ptr, "frame"); val = RNA_float_get(op->ptr, "value"); @@ -587,7 +593,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) frame = BKE_nla_tweakedit_remap(adt, frame, NLATIME_CONVERT_UNMAP); /* apply inverse unit-mapping to value to get correct value for F-Curves */ - val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, 1); + val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, mapping_flag | ANIM_UNITCONV_RESTORE); /* insert keyframe on the specified frame + value */ insert_vert_fcurve(fcu, frame, val, 0); @@ -1787,8 +1793,9 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + short mapping_flag = ANIM_get_normalization_flags(&ac); KeyframeEditData current_ked; - float unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); + float unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS); memset(¤t_ked, 0, sizeof(current_ked)); @@ -1891,7 +1898,8 @@ static void snap_graph_keys(bAnimContext *ac, short mode) /* snap keyframes */ for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); - float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, 0); + short mapping_flag = ANIM_get_normalization_flags(ac); + float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag); ked.f1 = cursor_value / unit_scale; @@ -2012,7 +2020,8 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) /* mirror keyframes */ for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); - float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); + short mapping_flag = ANIM_get_normalization_flags(ac); + float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS); /* apply unit corrections */ ked.f1 = cursor_value * unit_scale; |