From 7192e57d63a53a96461ba3ea761240f25a4294b7 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 19 Aug 2021 10:31:13 -0300 Subject: Fix the value in the graphical editor header when transforming The header did not display the actual value when transforming with snapping --- .../editors/transform/transform_mode_translate.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c index 75744f26c15..e44e346d3e4 100644 --- a/source/blender/editors/transform/transform_mode_translate.c +++ b/source/blender/editors/transform/transform_mode_translate.c @@ -221,22 +221,30 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_ } else { float dvec[3]; + copy_v3_v3(dvec, vec); + if (t->spacetype == SPACE_GRAPH) { + /* WORKAROUND: + * Special case where snapping is done in #recalData. + * Update the header based on the first element. */ + const short autosnap = getAnimEdit_SnapMode(t); + float ival = TRANS_DATA_CONTAINER_FIRST_OK(t)->data->ival; + float val = ival + dvec[0]; + snapFrameTransform(t, autosnap, ival, val, &dvec[0]); + } + if (t->con.mode & CON_APPLY) { int i = 0; zero_v3(dvec); if (t->con.mode & CON_AXIS0) { - dvec[i++] = vec[0]; + dvec[i++] = dvec[0]; } if (t->con.mode & CON_AXIS1) { - dvec[i++] = vec[1]; + dvec[i++] = dvec[1]; } if (t->con.mode & CON_AXIS2) { - dvec[i++] = vec[2]; + dvec[i++] = dvec[2]; } } - else { - copy_v3_v3(dvec, vec); - } if (t->flag & T_2D_EDIT) { applyAspectRatio(t, dvec); -- cgit v1.2.3