Fix T73148: Incorrect Repeat Last for transforms with Individual Origins and Normal orientation

`pvec` was confusing and was adding steps that are apparently unnecessary.
So the code has been redone so as not to use this pvec.
This commit is contained in:
Germano Cavalcante 2020-05-19 18:54:46 -03:00
parent 3bced3b306
commit 5ca8875f69
Notes: blender-bot 2023-02-14 05:04:52 +01:00
Referenced by issue #73148, Repeat Last for transforms with Individual Origins and Normal orientation repeats incorrectly
4 changed files with 18 additions and 60 deletions

View File

@ -139,8 +139,7 @@ typedef struct TransCon {
struct TransDataContainer *tc,
struct TransData *td,
const float in[3],
float out[3],
float pvec[3]);
float out[3]);
/** Apply function pointer for size transformation. */
void (*applySize)(struct TransInfo *t,
struct TransDataContainer *tc,

View File

@ -121,10 +121,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
}
}
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
static void postConstraintChecks(TransInfo *t, float vec[3])
{
int i = 0;
mul_m3_v3(t->con.imtx, vec);
snapGridIncrement(t, vec);
@ -155,16 +153,6 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
/* inverse transformation at the end */
}
if (t->con.mode & CON_AXIS0) {
pvec[i++] = vec[0];
}
if (t->con.mode & CON_AXIS1) {
pvec[i++] = vec[1];
}
if (t->con.mode & CON_AXIS2) {
pvec[i++] = vec[2];
}
mul_m3_v3(t->con.mtx, vec);
}
@ -346,12 +334,8 @@ static void planeProjection(const TransInfo *t, const float in[3], float out[3])
* (in perspective mode, the view vector is relative to the position on screen)
*/
static void applyAxisConstraintVec(TransInfo *t,
TransDataContainer *UNUSED(tc),
TransData *td,
const float in[3],
float out[3],
float pvec[3])
static void applyAxisConstraintVec(
TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, const float in[3], float out[3])
{
copy_v3_v3(out, in);
if (!td && t->con.mode & CON_APPLY) {
@ -382,7 +366,7 @@ static void applyAxisConstraintVec(TransInfo *t,
axisProjection(t, c, in, out);
}
}
postConstraintChecks(t, out, pvec);
postConstraintChecks(t, out);
}
}
@ -397,12 +381,8 @@ static void applyAxisConstraintVec(TransInfo *t,
* Further down, that vector is mapped to each data's space.
*/
static void applyObjectConstraintVec(TransInfo *t,
TransDataContainer *tc,
TransData *td,
const float in[3],
float out[3],
float pvec[3])
static void applyObjectConstraintVec(
TransInfo *t, TransDataContainer *tc, TransData *td, const float in[3], float out[3])
{
copy_v3_v3(out, in);
if (t->con.mode & CON_APPLY) {
@ -431,23 +411,9 @@ static void applyObjectConstraintVec(TransInfo *t,
}
axisProjection(t, c, in, out);
}
postConstraintChecks(t, out, pvec);
copy_v3_v3(out, pvec);
postConstraintChecks(t, out);
}
else {
int i = 0;
out[0] = out[1] = out[2] = 0.0f;
if (t->con.mode & CON_AXIS0) {
out[0] = in[i++];
}
if (t->con.mode & CON_AXIS1) {
out[1] = in[i++];
}
if (t->con.mode & CON_AXIS2) {
out[2] = in[i++];
}
mul_m3_v3(td->axismtx, out);
if (t->flag & T_EDIT) {
mul_m3_v3(tc->mat3_unit, out);
@ -653,7 +619,7 @@ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[])
}
else {
BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
copy_m3_m3(t->con.mtx, tc->data->axismtx);
unit_m3(t->con.mtx);
t->con.mode = mode;
getConstraintMatrix(t);

View File

@ -101,9 +101,8 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
snapSequenceBounds(t, mval);
if (t->con.mode & CON_APPLY) {
float pvec[3] = {0.0f, 0.0f, 0.0f};
float tvec[3];
t->con.applyVec(t, NULL, NULL, t->values, tvec, pvec);
t->con.applyVec(t, NULL, NULL, t->values, tvec);
copy_v3_v3(t->values_final, tvec);
}
else {

View File

@ -277,8 +277,7 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
}
if (t->con.applyVec) {
float pvec[3];
t->con.applyVec(t, tc, td, vec, tvec, pvec);
t->con.applyVec(t, tc, td, vec, tvec);
}
else {
copy_v3_v3(tvec, vec);
@ -319,7 +318,6 @@ 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 values_final[3];
if (t->flag & T_INPUT_IS_VALUES_FINAL) {
copy_v3_v3(t->values_final, t->values);
@ -336,28 +334,24 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
applySnapping(t, t->values_final);
}
copy_v3_v3(values_final, t->values_final);
if (t->con.mode & CON_APPLY) {
float pvec[3] = {0.0f, 0.0f, 0.0f};
t->con.applyVec(t, NULL, NULL, t->values_final, values_final, pvec);
headerTranslation(t, pvec, str);
/* only so we have re-usable value with redo, see T46741. */
mul_v3_m3v3(t->values_final, t->con.imtx, values_final);
float values_final[3];
copy_v3_v3(values_final, t->values_final);
t->con.applyVec(t, NULL, NULL, values_final, t->values_final);
headerTranslation(t, t->values_final, str);
}
else {
headerTranslation(t, t->values_final, str);
copy_v3_v3(values_final, t->values_final);
}
/* don't use 't->values' now on */
applyTranslationValue(t, values_final);
applyTranslationValue(t, t->values_final);
/* evil hack - redo translation if clipping needed */
if (t->flag & T_CLIP_UV && clipUVTransform(t, values_final, 0)) {
applyTranslationValue(t, values_final);
if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 0)) {
applyTranslationValue(t, t->values_final);
/* In proportional edit it can happen that */
/* vertices in the radius of the brush end */