[Bf-blender-cvs] [7192e57d63a] master: Fix the value in the graphical editor header when transforming

Germano Cavalcante noreply at git.blender.org
Thu Aug 19 15:34:28 CEST 2021


Commit: 7192e57d63a53a96461ba3ea761240f25a4294b7
Author: Germano Cavalcante
Date:   Thu Aug 19 10:31:13 2021 -0300
Branches: master
https://developer.blender.org/rB7192e57d63a53a96461ba3ea761240f25a4294b7

Fix the value in the graphical editor header when transforming

The header did not display the actual value when transforming with snapping

===================================================================

M	source/blender/editors/transform/transform_mode_translate.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list