Fix the value in the graphical editor header when transforming

The header did not display the actual value when transforming with snapping
This commit is contained in:
Germano Cavalcante 2021-08-19 10:31:13 -03:00
parent b0d9e6797f
commit 7192e57d63
Notes: blender-bot 2023-02-14 09:17:57 +01:00
Referenced by commit 0d36439f95, Fix T90911: Move along axis does not display real distance units
Referenced by issue #90911, Edit Mode - Move along axis while mouse dragging does not correctly display distance units
1 changed files with 14 additions and 6 deletions

View File

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