Fix T81096, T81127: Errors with the typed value for x-axis constrain

`applyNumInput` does not write all axis values and does not consider
the orientation.
This commit is contained in:
Germano Cavalcante 2020-09-24 10:35:49 -03:00
parent f3ac39b857
commit 58dc059ad3
Notes: blender-bot 2023-02-14 09:34:18 +01:00
Referenced by issue #81127, Transform constraints on a local axis with input numbers transforms in global space
Referenced by issue #81096, G X and type in numbers modifies the z axis as well
2 changed files with 7 additions and 4 deletions

View File

@ -93,13 +93,13 @@ static void applySeqSlideValue(TransInfo *t, const float val[2])
static void applySeqSlide(TransInfo *t, const int mval[2])
{
char str[UI_MAX_DRAW_STR];
float values_final[3];
float values_final[2] = {0.0f};
snapSequenceBounds(t, mval);
if (applyNumInput(&t->num, values_final)) {
if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
/* Do nothing. */
mul_v2_v2fl(values_final, t->spacemtx[0], values_final[0]);
}
else {
mul_v2_v2fl(values_final, t->spacemtx[1], values_final[0]);

View File

@ -355,7 +355,7 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
{
char str[UI_MAX_DRAW_STR];
float global_dir[3];
float global_dir[3] = {0.0f};
if (t->flag & T_INPUT_IS_VALUES_FINAL) {
mul_v3_m3v3(global_dir, t->spacemtx, t->values);
@ -363,7 +363,7 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
else if (applyNumInput(&t->num, global_dir)) {
if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
/* Do nothing. */
mul_v3_v3fl(global_dir, t->spacemtx[0], global_dir[0]);
}
else if (t->con.mode & CON_AXIS1) {
mul_v3_v3fl(global_dir, t->spacemtx[1], global_dir[0]);
@ -372,6 +372,9 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
mul_v3_v3fl(global_dir, t->spacemtx[2], global_dir[0]);
}
}
else {
mul_v3_m3v3(global_dir, t->spacemtx, global_dir);
}
}
else {
copy_v3_v3(global_dir, t->values);