[Bf-blender-cvs] [12777fb0f44] greasepencil-refactor: GPencil: Fix compiler warnings

Antonio Vazquez noreply at git.blender.org
Sat Feb 8 10:27:29 CET 2020


Commit: 12777fb0f440475134c912b857c732b92d1da133
Author: Antonio Vazquez
Date:   Sat Feb 8 10:26:14 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB12777fb0f440475134c912b857c732b92d1da133

GPencil: Fix compiler warnings

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/material.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_convert.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_select.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 02cbbcc4060..e515b92283d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2651,42 +2651,6 @@ void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points,
   *r_direction = (int)locy[2];
 }
 
-/* calc bounding box in 2d using flat projection data */
-static void gpencil_calc_2d_bounding_box(const float (*points2d)[2],
-                                         int totpoints,
-                                         float minv[2],
-                                         float maxv[2])
-{
-  minv[0] = points2d[0][0];
-  minv[1] = points2d[0][1];
-  maxv[0] = points2d[0][0];
-  maxv[1] = points2d[0][1];
-
-  for (int i = 1; i < totpoints; i++) {
-    /* min */
-    if (points2d[i][0] < minv[0]) {
-      minv[0] = points2d[i][0];
-    }
-    if (points2d[i][1] < minv[1]) {
-      minv[1] = points2d[i][1];
-    }
-    /* max */
-    if (points2d[i][0] > maxv[0]) {
-      maxv[0] = points2d[i][0];
-    }
-    if (points2d[i][1] > maxv[1]) {
-      maxv[1] = points2d[i][1];
-    }
-  }
-  /* use a perfect square */
-  if (maxv[0] > maxv[1]) {
-    maxv[1] = maxv[0];
-  }
-  else {
-    maxv[0] = maxv[1];
-  }
-}
-
 /* calc texture coordinates using flat projected points */
 static void gpencil_calc_stroke_fill_uv(const float (*points2d)[2],
                                         bGPDstroke *gps,
@@ -3386,7 +3350,6 @@ static void gpencil_convert_spline(Main *bmain,
       copy_v4_v4(gp_style_gp->mix_rgba, gp_style_cur->mix_rgba);
       gp_style_gp->fill_style = gp_style_cur->fill_style;
       gp_style_gp->mix_factor = gp_style_cur->mix_factor;
-      gp_style_gp->gradient_angle = gp_style_cur->gradient_angle;
     }
 
     /* If object has more than 1 material, use second material for stroke color. */
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index e0b7f3114eb..ac95921f813 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -106,9 +106,7 @@ void BKE_gpencil_material_attr_init(Material *ma)
     /* set basic settings */
     gp_style->stroke_rgba[3] = 1.0f;
     gp_style->fill_rgba[3] = 1.0f;
-    gp_style->gradient_radius = 0.5f;
     ARRAY_SET_ITEMS(gp_style->mix_rgba, 1.0f, 1.0f, 1.0f, 0.2f);
-    ARRAY_SET_ITEMS(gp_style->gradient_scale, 1.0f, 1.0f);
     ARRAY_SET_ITEMS(gp_style->texture_scale, 1.0f, 1.0f);
     gp_style->texture_opacity = 1.0f;
     gp_style->texture_pixsize = 100.0f;
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 888d78e4434..db13f57b192 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -233,56 +233,6 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points,
 }
 
 /* --------------- Stroke Fills ----------------- */
-/* calc bounding box in 2d using flat projection data */
-static void gp_calc_2d_bounding_box(
-    const float (*points2d)[2], int totpoints, float minv[2], float maxv[2], bool expand)
-{
-  copy_v2_v2(minv, points2d[0]);
-  copy_v2_v2(maxv, points2d[0]);
-
-  for (int i = 1; i < totpoints; i++) {
-    /* min */
-    if (points2d[i][0] < minv[0]) {
-      minv[0] = points2d[i][0];
-    }
-    if (points2d[i][1] < minv[1]) {
-      minv[1] = points2d[i][1];
-    }
-    /* max */
-    if (points2d[i][0] > maxv[0]) {
-      maxv[0] = points2d[i][0];
-    }
-    if (points2d[i][1] > maxv[1]) {
-      maxv[1] = points2d[i][1];
-    }
-  }
-  /* If not expanded, use a perfect square */
-  if (expand == false) {
-    if (maxv[0] > maxv[1]) {
-      maxv[1] = maxv[0];
-    }
-    else {
-      maxv[0] = maxv[1];
-    }
-  }
-}
-
-/* calc texture coordinates using flat projected points */
-static void gp_calc_stroke_text_coordinates(const float (*points2d)[2],
-                                            int totpoints,
-                                            const float minv[2],
-                                            float maxv[2],
-                                            float (*r_uv)[2])
-{
-  float d[2];
-  d[0] = maxv[0] - minv[0];
-  d[1] = maxv[1] - minv[1];
-  for (int i = 0; i < totpoints; i++) {
-    r_uv[i][0] = (points2d[i][0] - minv[0]) / d[0];
-    r_uv[i][1] = (points2d[i][1] - minv[1]) / d[1];
-  }
-}
-
 /* add a new fill point and texture coordinates to vertex buffer */
 static void gp_add_filldata_tobuffer(const bGPDspoint *pt,
                                      uint pos,
@@ -336,11 +286,6 @@ static void gp_draw_stroke_fill(bGPdata *gpd,
   immUniform1i("fill_type", gp_style->fill_style);
   immUniform1f("mix_factor", gp_style->mix_factor);
 
-  immUniform1f("gradient_angle", gp_style->gradient_angle);
-  immUniform1f("gradient_radius", gp_style->gradient_radius);
-  immUniform2fv("gradient_scale", gp_style->gradient_scale);
-  immUniform2fv("gradient_shift", gp_style->gradient_shift);
-
   immUniform1f("texture_angle", gp_style->texture_angle);
   immUniform2fv("texture_scale", gp_style->texture_scale);
   immUniform2fv("texture_offset", gp_style->texture_offset);
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 54f8b749199..f9341e7fc38 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -152,7 +152,7 @@ static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C),
  * - assumes that the active space is the 3D-View
  */
 static void gp_strokepoint_convertcoords(bContext *C,
-                                         bGPdata *gpd,
+                                         bGPdata *UNUSED(gpd),
                                          bGPDlayer *gpl,
                                          bGPDstroke *gps,
                                          bGPDspoint *source_pt,
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 781e431841c..72b6eaaeafc 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2655,7 +2655,7 @@ static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op))
 
             /* return data */
             copy_v3_v3(&pt->x, fpt);
-            gp_apply_parent_point(depsgraph, obact, gpd, gpl, pt);
+            gp_apply_parent_point(depsgraph, obact, gpl, pt);
           }
         }
       }
@@ -2739,7 +2739,7 @@ static int gp_snap_to_cursor(bContext *C, wmOperator *op)
           for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
             if (pt->flag & GP_SPOINT_SELECT) {
               copy_v3_v3(&pt->x, cursor_global);
-              gp_apply_parent_point(depsgraph, obact, gpd, gpl, pt);
+              gp_apply_parent_point(depsgraph, obact, gpl, pt);
             }
           }
         }
@@ -3584,7 +3584,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
           copy_v3_v3(&pt->x, &pt2.x);
 
           /* apply parent again */
-          gp_apply_parent_point(depsgraph, ob, gpd, gpl, pt);
+          gp_apply_parent_point(depsgraph, ob, gpl, pt);
         }
         /* Project screen-space back to 3D space (from current perspective)
          * so that all points have been treated the same way. */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 8c8a9c5238f..e2faa926c30 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1192,7 +1192,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
   /* if parented change position relative to parent object */
   for (int a = 0; a < tgpf->sbuffer_used; a++) {
     pt = &gps->points[a];
-    gp_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpd, tgpf->gpl, pt);
+    gp_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt);
   }
 
   /* if camera view, reproject flat to view to avoid perspective effect */
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 4f6aedf8495..96a80f27963 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -278,7 +278,6 @@ void gp_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4],
  */
 void gp_apply_parent(struct Depsgraph *depsgraph,
                      struct Object *obact,
-                     bGPdata *gpd,
                      bGPDlayer *gpl,
                      bGPDstroke *gps);
 /**
@@ -286,7 +285,6 @@ void gp_apply_parent(struct Depsgraph *depsgraph,
  */
 void gp_apply_parent_point(struct Depsgraph *depsgraph,
                            struct Object *obact,
-                           bGPdata *gpd,
                            bGPDlayer *gpl,
                            bGPDspoint *pt);
 
@@ -672,9 +670,9 @@ struct GP_EditableStrokes_Iter {
     Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
     Object *obact_ = CTX_data_active_object(C); \
     Object *ob_eval_ = (Object *)DEG_get_evaluated_id(depsgraph_, &obact_->id); \
-    bGPdata *gpd = (bGPdata *)ob_eval_->data; \
-    const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); \
-    LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { \
+    bGPdata *gpd_ = (bGPdata *)ob_eval_->data; \
+    const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
+    LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_->layers) { \
       if (BKE_gpencil_layer_is_editable(gpl)) { \
         bGPDframe *init_gpf_ = gpl->actframe; \
         if (is_multiedit_) { \
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index e31800f20e5..a395527c52d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1006,7 +1006,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
     pt = gps->points;
     for (i = 0; i < gps->totpoints; i++, pt++) {
       /* if parented change position rel

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list