[Bf-blender-cvs] [399dbb1aa39] master: GPencil: Cleanup - Rename some functions from gp_ to gpencil_

Antonio Vazquez noreply at git.blender.org
Mon Jun 29 15:52:11 CEST 2020


Commit: 399dbb1aa391f04357f91ab875241db3c6041aa5
Author: Antonio Vazquez
Date:   Mon Jun 29 12:49:30 2020 +0200
Branches: master
https://developer.blender.org/rB399dbb1aa391f04357f91ab875241db3c6041aa5

GPencil: Cleanup - Rename some functions from gp_ to gpencil_

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

M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/editaction_gpencil.c
M	source/blender/editors/gpencil/gpencil_convert.c
M	source/blender/editors/gpencil/gpencil_data.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_merge.c
M	source/blender/editors/gpencil/gpencil_mesh.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_sculpt_paint.c
M	source/blender/editors/gpencil/gpencil_select.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/gpencil/gpencil_uv.c
M	source/blender/editors/gpencil/gpencil_vertex_paint.c
M	source/blender/editors/gpencil/gpencil_weight_paint.c
M	source/blender/editors/include/ED_gpencil.h
M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_action/action_select.c

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

diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 9fc3e864f54..f0954a198a3 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -456,10 +456,10 @@ static void annotation_stroke_arrow_calc_points_segment(float stroke_points[8],
 }
 
 static void annotation_stroke_arrow_calc_points(tGPspoint *point,
-                                        const float stroke_dir[2],
-                                        float corner[2],
-                                        float stroke_points[8],
-                                        const int arrow_style)
+                                                const float stroke_dir[2],
+                                                float corner[2],
+                                                float stroke_points[8],
+                                                const int arrow_style)
 {
   const int arrow_lenght = 8;
   float norm_dir[2];
@@ -1131,7 +1131,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p,
   else if (gps->totpoints == 1) {
     /* only process if it hasn't been masked out... */
     if (!(p->flags & GP_PAINTFLAG_SELECTMASK) || (gps->points->flag & GP_SPOINT_SELECT)) {
-      gp_point_to_xy(&p->gsc, gps, gps->points, &pc1[0], &pc1[1]);
+      gpencil_point_to_xy(&p->gsc, gps, gps->points, &pc1[0], &pc1[1]);
 
       /* do boundbox check first */
       if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) {
@@ -1172,8 +1172,8 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p,
         continue;
       }
 
-      gp_point_to_xy(&p->gsc, gps, pt1, &pc1[0], &pc1[1]);
-      gp_point_to_xy(&p->gsc, gps, pt2, &pc2[0], &pc2[1]);
+      gpencil_point_to_xy(&p->gsc, gps, pt1, &pc1[0], &pc1[1]);
+      gpencil_point_to_xy(&p->gsc, gps, pt2, &pc2[0], &pc2[1]);
 
       /* Check that point segment of the boundbox of the eraser stroke */
       if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) ||
@@ -1182,7 +1182,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p,
          * eraser region  (either within stroke painted, or on its lines)
          *  - this assumes that linewidth is irrelevant
          */
-        if (gp_stroke_inside_circle(mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) {
+        if (gpencil_stroke_inside_circle(mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) {
           if ((annotation_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) ||
               (annotation_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) {
             /* Edge is affected - Check individual points now */
@@ -1200,7 +1200,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p,
 
     /* Second Pass: Remove any points that are tagged */
     if (do_cull) {
-      gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
+      gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
     }
   }
 }
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 3aff943a093..60fd52db707 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -114,10 +114,10 @@ typedef enum eDrawStrokeFlags {
 /* ----- Tool Buffer Drawing ------ */
 /* helper functions to set color of buffer point */
 
-static void gp_set_point_varying_color(const bGPDspoint *pt,
-                                       const float ink[4],
-                                       uint attr_id,
-                                       bool fix_strength)
+static void gpencil_set_point_varying_color(const bGPDspoint *pt,
+                                            const float ink[4],
+                                            uint attr_id,
+                                            bool fix_strength)
 {
   float alpha = ink[3] * pt->strength;
   if ((fix_strength) && (alpha >= 0.1f)) {
@@ -130,10 +130,10 @@ static void gp_set_point_varying_color(const bGPDspoint *pt,
 /* ----------- Volumetric Strokes --------------- */
 
 /* draw a 3D stroke in "volumetric" style */
-static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points,
-                                         int totpoints,
-                                         short thickness,
-                                         const float ink[4])
+static void gpencil_draw_stroke_volumetric_3d(const bGPDspoint *points,
+                                              int totpoints,
+                                              short thickness,
+                                              const float ink[4])
 {
   GPUVertFormat *format = immVertexFormat();
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
@@ -147,7 +147,7 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points,
 
   const bGPDspoint *pt = points;
   for (int i = 0; i < totpoints && pt; i++, pt++) {
-    gp_set_point_varying_color(pt, ink, color, false);
+    gpencil_set_point_varying_color(pt, ink, color, false);
     /* TODO: scale based on view transform */
     immAttr1f(size, pt->pressure * thickness);
     /* we can adjust size in vertex shader based on view/projection! */
@@ -162,7 +162,10 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points,
 /* ----- Existing Strokes Drawing (3D and Point) ------ */
 
 /* draw a given stroke in 3d (i.e. in 3d-space) */
-static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4], bool cyclic)
+static void gpencil_draw_stroke_3d(tGPDdraw *tgpw,
+                                   short thickness,
+                                   const float ink[4],
+                                   bool cyclic)
 {
   bGPDspoint *points = tgpw->gps->points;
   int totpoints = tgpw->gps->totpoints;
@@ -209,7 +212,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
   for (int i = 0; i < totpoints; i++, pt++) {
     /* first point for adjacency (not drawn) */
     if (i == 0) {
-      gp_set_point_varying_color(points, ink, attr_id.color, (bool)tgpw->is_fill_stroke);
+      gpencil_set_point_varying_color(points, ink, attr_id.color, (bool)tgpw->is_fill_stroke);
 
       if ((cyclic) && (totpoints > 2)) {
         immAttr1f(attr_id.thickness, max_ff((points + totpoints - 1)->pressure * thickness, 1.0f));
@@ -222,7 +225,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
       immVertex3fv(attr_id.pos, fpt);
     }
     /* set point */
-    gp_set_point_varying_color(pt, ink, attr_id.color, (bool)tgpw->is_fill_stroke);
+    gpencil_set_point_varying_color(pt, ink, attr_id.color, (bool)tgpw->is_fill_stroke);
     immAttr1f(attr_id.thickness, max_ff(pt->pressure * thickness, 1.0f));
     mul_v3_m4v3(fpt, tgpw->diff_mat, &pt->x);
     immVertex3fv(attr_id.pos, fpt);
@@ -241,7 +244,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
   }
   /* last adjacency point (not drawn) */
   else {
-    gp_set_point_varying_color(
+    gpencil_set_point_varying_color(
         points + totpoints - 2, ink, attr_id.color, (bool)tgpw->is_fill_stroke);
 
     immAttr1f(attr_id.thickness, max_ff((points + totpoints - 2)->pressure * thickness, 1.0f));
@@ -256,7 +259,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
 /* ----- Strokes Drawing ------ */
 
 /* Helper for doing all the checks on whether a stroke can be drawn */
-static bool gp_can_draw_stroke(const bGPDstroke *gps, const int dflag)
+static bool gpencil_can_draw_stroke(const bGPDstroke *gps, const int dflag)
 {
   /* skip stroke if it isn't in the right display space for this drawing context */
   /* 1) 3D Strokes */
@@ -293,7 +296,7 @@ static bool gp_can_draw_stroke(const bGPDstroke *gps, const int dflag)
 }
 
 /* draw a set of strokes */
-static void gp_draw_strokes(tGPDdraw *tgpw)
+static void gpencil_draw_strokes(tGPDdraw *tgpw)
 {
   float tcolor[4];
   short sthickness;
@@ -307,7 +310,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
 
   for (bGPDstroke *gps = gps_init; gps; gps = gps->next) {
     /* check if stroke can be drawn */
-    if (gp_can_draw_stroke(gps, tgpw->dflag) == false) {
+    if (gpencil_can_draw_stroke(gps, tgpw->dflag) == false) {
       continue;
     }
     /* check if the color is visible */
@@ -379,14 +382,14 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
       if (gp_style->mode == GP_MATERIAL_MODE_DOT) {
         /* volumetric stroke drawing */
         if (tgpw->disable_fill != 1) {
-          gp_draw_stroke_volumetric_3d(gps->points, gps->totpoints, sthickness, ink);
+          gpencil_draw_stroke_volumetric_3d(gps->points, gps->totpoints, sthickness, ink);
         }
       }
       else {
         /* 3D Lines - OpenGL primitives-based */
         if (gps->totpoints > 1) {
           tgpw->gps = gps;
-          gp_draw_stroke_3d(tgpw, sthickness, ink, gps->flag & GP_STROKE_CYCLIC);
+          gpencil_draw_stroke_3d(tgpw, sthickness, ink, gps->flag & GP_STROKE_CYCLIC);
         }
       }
       if (no_xray) {
@@ -408,7 +411,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
 /* ----- General Drawing ------ */
 
 /* wrapper to draw strokes for filling operator */
-void ED_gp_draw_fill(tGPDdraw *tgpw)
+void ED_gpencil_draw_fill(tGPDdraw *tgpw)
 {
-  gp_draw_strokes(tgpw);
+  gpencil_draw_strokes(tgpw);
 }
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 5db2e904dee..752b8a74f4f 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -56,7 +56,9 @@
 /* Generics - Loopers */
 
 /* Loops over the gp-frames for a gp-layer, and applies the given callback */
-bool ED_gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *))
+bool ED_gpencil_layer_frames_looper(bGPDlayer *gpl,
+                                    Scene *scene,
+                                    short (*gpf_cb)(bGPDframe *, Scene *))
 {
   /* 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list