[Bf-blender-cvs] [1cda3749069] master: GPencil: Cleanup - Rename annotation function to new prefix

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


Commit: 1cda37490690c259c716160dcb77ea43dccd5a03
Author: Antonio Vazquez
Date:   Mon Jun 29 12:25:45 2020 +0200
Branches: master
https://developer.blender.org/rB1cda37490690c259c716160dcb77ea43dccd5a03

GPencil: Cleanup - Rename annotation function to new prefix

These functions were using the old gpencil or gp prefix.

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

M	source/blender/editors/gpencil/annotate_draw.c
M	source/blender/editors/gpencil/annotate_paint.c

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

diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 089f41b4a66..20307e7f809 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -787,13 +787,7 @@ static void annotation_draw_data_all(Scene *scene,
   }
 }
 
-/* ----- Grease Pencil Sketches Drawing API ------ */
-
-/* ............................
- * XXX
- * We need to review the calls below, since they may be/are not that suitable for
- * the new ways that we intend to be drawing data...
- * ............................ */
+/* ----- Annotation Sketches Drawing API ------ */
 
 /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
 void ED_annotation_draw_2dimage(const bContext *C)
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 2bd83475f00..9fc3e864f54 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -204,12 +204,12 @@ typedef struct tGPsdata {
 /* minimum length of new segment before new point can be added */
 #define MIN_EUCLIDEAN_PX (U.gp_euclideandist)
 
-static bool gp_stroke_added_check(tGPsdata *p)
+static bool annotation_stroke_added_check(tGPsdata *p)
 {
   return (p->gpf && p->gpf->strokes.last && p->flags & GP_PAINTFLAG_STROKEADDED);
 }
 
-static void gp_stroke_added_enable(tGPsdata *p)
+static void annotation_stroke_added_enable(tGPsdata *p)
 {
   BLI_assert(p->gpf->strokes.last != NULL);
   p->flags |= GP_PAINTFLAG_STROKEADDED;
@@ -218,13 +218,13 @@ static void gp_stroke_added_enable(tGPsdata *p)
 /* ------ */
 /* Forward defines for some functions... */
 
-static void gp_session_validatebuffer(tGPsdata *p);
+static void annotation_session_validatebuffer(tGPsdata *p);
 
 /* ******************************************* */
 /* Context Wrangling... */
 
 /* check if context is suitable for drawing */
-static bool gpencil_draw_poll(bContext *C)
+static bool annotation_draw_poll(bContext *C)
 {
   if (ED_operator_regionactive(C)) {
     /* check if current context can support GPencil data */
@@ -249,7 +249,7 @@ static bool gpencil_draw_poll(bContext *C)
 }
 
 /* check if projecting strokes into 3d-geometry in the 3D-View */
-static bool gpencil_project_check(tGPsdata *p)
+static bool annotation_project_check(tGPsdata *p)
 {
   bGPdata *gpd = p->gpd;
   return ((gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) &&
@@ -262,7 +262,7 @@ static bool gpencil_project_check(tGPsdata *p)
 /* Utilities --------------------------------- */
 
 /* get the reference point for stroke-point conversions */
-static void gp_get_3d_reference(tGPsdata *p, float vec[3])
+static void annotation_get_3d_reference(tGPsdata *p, float vec[3])
 {
   const float *fp = p->scene->cursor.location;
 
@@ -273,7 +273,7 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3])
 /* Stroke Editing ---------------------------- */
 
 /* check if the current mouse position is suitable for adding a new point */
-static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2])
+static bool annotation_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2])
 {
   int dx = (int)fabsf(mval[0] - pmval[0]);
   int dy = (int)fabsf(mval[1] - pmval[1]);
@@ -318,7 +318,10 @@ static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2
 }
 
 /* convert screen-coordinates to buffer-coordinates */
-static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[3], float *depth)
+static void annotation_stroke_convertcoords(tGPsdata *p,
+                                            const float mval[2],
+                                            float out[3],
+                                            float *depth)
 {
   bGPdata *gpd = p->gpd;
 
@@ -326,7 +329,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
   if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
     int mval_i[2];
     round_v2i_v2fl(mval_i, mval);
-    if (gpencil_project_check(p) &&
+    if (annotation_project_check(p) &&
         (ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) {
       /* projecting onto 3D-Geometry
        * - nothing more needs to be done here, since view_autodist_simple() has already done it
@@ -346,7 +349,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
        *   reference point instead or as offset, for easier stroke matching
        */
 
-      gp_get_3d_reference(p, rvec);
+      annotation_get_3d_reference(p, rvec);
       zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
 
       if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
@@ -391,7 +394,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
  * \param inf: Influence factor
  * \param idx: Index of the last point (need minimum 3 points in the array)
  */
-static void gp_smooth_buffer(tGPsdata *p, float inf, int idx)
+static void annotation_smooth_buffer(tGPsdata *p, float inf, int idx)
 {
   bGPdata *gpd = p->gpd;
   short num_points = gpd->runtime.sbuffer_used;
@@ -439,12 +442,12 @@ static void gp_smooth_buffer(tGPsdata *p, float inf, int idx)
   copy_v2_v2(&ptc->x, c);
 }
 
-static void gp_stroke_arrow_calc_points_segment(float stroke_points[8],
-                                                const float ref_point[2],
-                                                const float dir_cw[2],
-                                                const float dir_ccw[2],
-                                                const float lenght,
-                                                const float sign)
+static void annotation_stroke_arrow_calc_points_segment(float stroke_points[8],
+                                                        const float ref_point[2],
+                                                        const float dir_cw[2],
+                                                        const float dir_ccw[2],
+                                                        const float lenght,
+                                                        const float sign)
 {
   stroke_points[0] = ref_point[0] + dir_cw[0] * lenght * sign;
   stroke_points[1] = ref_point[1] + dir_cw[1] * lenght * sign;
@@ -452,7 +455,7 @@ static void gp_stroke_arrow_calc_points_segment(float stroke_points[8],
   stroke_points[3] = ref_point[1] + dir_ccw[1] * lenght * sign;
 }
 
-static void gp_stroke_arrow_calc_points(tGPspoint *point,
+static void annotation_stroke_arrow_calc_points(tGPspoint *point,
                                         const float stroke_dir[2],
                                         float corner[2],
                                         float stroke_points[8],
@@ -474,12 +477,12 @@ static void gp_stroke_arrow_calc_points(tGPspoint *point,
       stroke_points[3] = corner[1] + inv_norm_dir_counterclockwise[1] * arrow_lenght + norm_dir[1];
       break;
     case GP_STROKE_ARROWSTYLE_SEGMENT:
-      gp_stroke_arrow_calc_points_segment(stroke_points,
-                                          corner,
-                                          inv_norm_dir_clockwise,
-                                          inv_norm_dir_counterclockwise,
-                                          arrow_lenght,
-                                          1.0f);
+      annotation_stroke_arrow_calc_points_segment(stroke_points,
+                                                  corner,
+                                                  inv_norm_dir_clockwise,
+                                                  inv_norm_dir_counterclockwise,
+                                                  arrow_lenght,
+                                                  1.0f);
       break;
     case GP_STROKE_ARROWSTYLE_CLOSED:
       mul_v2_fl(norm_dir, arrow_lenght);
@@ -487,12 +490,12 @@ static void gp_stroke_arrow_calc_points(tGPspoint *point,
         add_v2_v2(&point->x, norm_dir);
         copy_v2_v2(corner, &point->x);
       }
-      gp_stroke_arrow_calc_points_segment(stroke_points,
-                                          corner,
-                                          inv_norm_dir_clockwise,
-                                          inv_norm_dir_counterclockwise,
-                                          arrow_lenght,
-                                          -1.0f);
+      annotation_stroke_arrow_calc_points_segment(stroke_points,
+                                                  corner,
+                                                  inv_norm_dir_clockwise,
+                                                  inv_norm_dir_counterclockwise,
+                                                  arrow_lenght,
+                                                  -1.0f);
       stroke_points[4] = corner[0] - norm_dir[0];
       stroke_points[5] = corner[1] - norm_dir[1];
       break;
@@ -502,12 +505,12 @@ static void gp_stroke_arrow_calc_points(tGPspoint *point,
         add_v2_v2(&point->x, norm_dir);
         copy_v2_v2(corner, &point->x);
       }
-      gp_stroke_arrow_calc_points_segment(stroke_points,
-                                          corner,
-                                          inv_norm_dir_clockwise,
-                                          inv_norm_dir_counterclockwise,
-                                          arrow_lenght * 0.75f,
-                                          -1.0f);
+      annotation_stroke_arrow_calc_points_segment(stroke_points,
+                                                  corner,
+                                                  inv_norm_dir_clockwise,
+                                                  inv_norm_dir_counterclockwise,
+                                                  arrow_lenght * 0.75f,
+                                                  -1.0f);
       stroke_points[4] = stroke_points[0] - norm_dir[0];
       stroke_points[5] = stroke_points[1] - norm_dir[1];
       stroke_points[6] = stroke_points[2] - norm_dir[0];
@@ -519,7 +522,10 @@ static void gp_stroke_arrow_calc_points(tGPspoint *point,
 }
 
 /* add current strok

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list