[Bf-blender-cvs] [fd730fce0c2] master: GPencil: Add inverse diff matrix to iterator macro

Antonioya noreply at git.blender.org
Mon Jul 29 12:11:29 CEST 2019


Commit: fd730fce0c202342cbc39f4c196c93a2f24ecc01
Author: Antonioya
Date:   Thu Jul 25 12:10:47 2019 +0200
Branches: master
https://developer.blender.org/rBfd730fce0c202342cbc39f4c196c93a2f24ecc01

GPencil: Add inverse diff matrix to iterator macro

GPencil: Cleanup inverse mat code

This calculation is done in the macro, so don't need do it again in loop.

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

M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_intern.h

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 2e51fc355a4..779ce27ddf1 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3401,12 +3401,6 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
     if (gps->flag & GP_STROKE_SELECT) {
       bGPDspoint *pt;
       int i;
-      float inverse_diff_mat[4][4];
-
-      /* Compute inverse matrix for unapplying parenting once instead of doing per-point */
-      /* TODO: add this bit to the iteration macro? */
-      invert_m4_m4(inverse_diff_mat, gpstroke_iter.diff_mat);
-
       /* Adjust each point */
       for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
         float xy[2];
@@ -3493,7 +3487,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
 
         /* Unapply parent corrections */
         if (!ELEM(mode, GP_REPROJECT_FRONT, GP_REPROJECT_SIDE, GP_REPROJECT_TOP)) {
-          mul_m4_v3(inverse_diff_mat, &pt->x);
+          mul_m4_v3(gpstroke_iter.inverse_diff_mat, &pt->x);
         }
       }
     }
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index df9cb2e9a01..6a3439a4898 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -583,6 +583,7 @@ typedef enum ACTCONT_TYPES {
 
 struct GP_EditableStrokes_Iter {
   float diff_mat[4][4];
+  float inverse_diff_mat[4][4];
 };
 
 /**
@@ -607,6 +608,7 @@ struct GP_EditableStrokes_Iter {
       for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
         if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
           ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, gpstroke_iter.diff_mat); \
+          invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
           /* loop over strokes */ \
           for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gps->next) { \
             /* skip strokes that are invalid for current view */ \



More information about the Bf-blender-cvs mailing list