Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform_convert_gpencil.c')
-rw-r--r--source/blender/editors/transform/transform_convert_gpencil.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c
index f7b78b10868..e52dcb17806 100644
--- a/source/blender/editors/transform/transform_convert_gpencil.c
+++ b/source/blender/editors/transform/transform_convert_gpencil.c
@@ -496,8 +496,8 @@ static void createTransGPencil_strokes(bContext *C,
if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) {
const int cfra = (gpl->flag & GP_LAYER_FRAMELOCK) ? gpl->actframe->framenum : cfra_scene;
bGPDframe *gpf = gpl->actframe;
- float diff_mat[4][4];
- float inverse_diff_mat[4][4];
+ float diff_mat[3][3];
+ float inverse_diff_mat[3][3];
bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
/* Init multiframe falloff options. */
@@ -509,9 +509,14 @@ static void createTransGPencil_strokes(bContext *C,
}
/* Calculate difference matrix. */
- BKE_gpencil_layer_transform_matrix_get(depsgraph, obact, gpl, diff_mat);
- /* Undo matrix. */
- invert_m4_m4(inverse_diff_mat, diff_mat);
+ {
+ float diff_mat_tmp[4][4];
+ BKE_gpencil_layer_transform_matrix_get(depsgraph, obact, gpl, diff_mat_tmp);
+ copy_m3_m4(diff_mat, diff_mat_tmp);
+ }
+
+ /* Use safe invert for cases where the input matrix has zero axes. */
+ invert_m3_m3_safe_ortho(inverse_diff_mat, diff_mat);
/* Make a new frame to work on if the layer's frame
* and the current scene frame don't match up.
@@ -651,9 +656,9 @@ static void createTransGPencil_strokes(bContext *C,
}
}
/* apply parent transformations */
- copy_m3_m4(td->smtx, inverse_diff_mat); /* final position */
- copy_m3_m4(td->mtx, diff_mat); /* display position */
- copy_m3_m4(td->axismtx, diff_mat); /* axis orientation */
+ copy_m3_m3(td->smtx, inverse_diff_mat); /* final position */
+ copy_m3_m3(td->mtx, diff_mat); /* display position */
+ copy_m3_m3(td->axismtx, diff_mat); /* axis orientation */
/* Triangulation must be calculated again,
* so save the stroke for recalc function */
@@ -748,7 +753,6 @@ void createTransGPencil(bContext *C, TransInfo *t)
}
}
-/* force recalculation of triangles during transformation */
void recalcData_gpencil_strokes(TransInfo *t)
{
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);