[Bf-blender-cvs] [172b0ebe6ad] master: GPencil: Rename Fill closure methods

Antonio Vazquez noreply at git.blender.org
Sat Sep 17 12:41:19 CEST 2022


Commit: 172b0ebe6adf8f97ba6ac56df06b103acaa0d3a9
Author: Antonio Vazquez
Date:   Fri Sep 16 11:06:44 2022 +0200
Branches: master
https://developer.blender.org/rB172b0ebe6adf8f97ba6ac56df06b103acaa0d3a9

GPencil: Rename Fill closure methods

The new names are:

* Radius
* Extend

The mode Radius + Extend has been removed.

Also, some code cleanup and format.

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

M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/makesdna/DNA_brush_enums.h
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 819e3b271ac..809ddadd92d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -199,10 +199,8 @@ static void gpencil_delete_temp_stroke_extension(tGPDfill *tgpf, const bool all_
     for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
       LISTBASE_FOREACH_MUTABLE (bGPDstroke *, gps, &gpf->strokes) {
         /* free stroke */
-        if (
-            (gps->flag & GP_STROKE_NOFILL) &&
-            (gps->flag & GP_STROKE_TAG || gps->flag & GP_STROKE_HELP))
-        {
+        if ((gps->flag & GP_STROKE_NOFILL) &&
+            (gps->flag & GP_STROKE_TAG || gps->flag & GP_STROKE_HELP)) {
           BLI_remlink(&gpf->strokes, gps);
           BKE_gpencil_free_stroke(gps);
         }
@@ -214,11 +212,8 @@ static void gpencil_delete_temp_stroke_extension(tGPDfill *tgpf, const bool all_
   }
 }
 
-static bool extended_bbox_overlap(float min1[3],
-                                  float max1[3],
-                                  float min2[3],
-                                  float max2[3],
-                                  float extend)
+static bool extended_bbox_overlap(
+    float min1[3], float max1[3], float min2[3], float max2[3], float extend)
 {
   for (int axis = 0; axis < 3; axis++) {
     float intersection_min = max_ff(min1[axis], min2[axis]) - extend;
@@ -230,10 +225,7 @@ static bool extended_bbox_overlap(float min1[3],
   return true;
 }
 
-static void add_stroke_extension(bGPDframe *gpf,
-                                 bGPDstroke *gps,
-                                 float p1[3],
-                                 float p2[3])
+static void add_stroke_extension(bGPDframe *gpf, bGPDstroke *gps, float p1[3], float p2[3])
 {
   bGPDstroke *gps_new = BKE_gpencil_stroke_new(gps->mat_nr, 2, gps->thickness);
   gps_new->flag |= GP_STROKE_NOFILL | GP_STROKE_TAG;
@@ -355,7 +347,7 @@ static void gpencil_create_extensions(tGPDfill *tgpf)
         d2 = normalize_v3(tan2);
         total_length += d2;
         if (i > 1) {
-          if (tgpf->fill_extend_mode == GP_FILL_EMODE_CIRCLES) {
+          if (tgpf->fill_extend_mode == GP_FILL_EMODE_RADIUS) {
             continue;
           }
           float curvature[3];
@@ -390,7 +382,7 @@ static void gpencil_create_extensions(tGPDfill *tgpf)
         }
       }
 
-      if (tgpf->fill_extend_mode != GP_FILL_EMODE_CIRCLES) {
+      if (tgpf->fill_extend_mode != GP_FILL_EMODE_RADIUS) {
         /* Extend start. */
         bGPDspoint *pt0 = &gps->points[1];
         bGPDspoint *pt1 = &gps->points[0];
@@ -427,7 +419,7 @@ static void gpencil_create_extensions(tGPDfill *tgpf)
       }
 
       /* Connect endpoints within a radius */
-      if (tgpf->fill_extend_mode == GP_FILL_EMODE_LINES) {
+      if (tgpf->fill_extend_mode == GP_FILL_EMODE_EXTEND) {
         continue;
       }
       float *stroke1_start = &gps->points[0].x;
@@ -436,16 +428,13 @@ static void gpencil_create_extensions(tGPDfill *tgpf)
        * isn't already so short that it's within that distance
        */
       if (len_v3v3(stroke1_start, stroke1_end) < connection_dist &&
-          total_length > connection_dist)
-      {
+          total_length > connection_dist) {
         add_stroke_extension(gpf, gps, stroke1_start, stroke1_end);
         BLI_gset_add(connected_endpoints, stroke1_start);
         BLI_gset_add(connected_endpoints, stroke1_end);
       }
-      for (bGPDstroke *gps2 = (bGPDstroke *)(((Link *)gps)->next);
-          gps2 != NULL;
-          gps2 = (bGPDstroke *)(((Link *)gps2)->next))
-      {
+      for (bGPDstroke *gps2 = (bGPDstroke *)(((Link *)gps)->next); gps2 != NULL;
+           gps2 = (bGPDstroke *)(((Link *)gps2)->next)) {
         /* Don't check distance to temporary extensions. */
         if ((gps2->flag & GP_STROKE_NOFILL) && (gps2->flag & GP_STROKE_TAG)) {
           continue;
@@ -551,8 +540,8 @@ static void gpencil_draw_basic_stroke(tGPDfill *tgpf,
   float col[4];
   const float extend_col[4] = {0.0f, 1.0f, 1.0f, 1.0f};
   const float help_col[4] = {1.0f, 0.0f, 0.5f, 1.0f};
-  const bool is_extend =
-    (gps->flag & GP_STROKE_NOFILL) && (gps->flag & GP_STROKE_TAG) && !(gps->flag & GP_STROKE_HELP);
+  const bool is_extend = (gps->flag & GP_STROKE_NOFILL) && (gps->flag & GP_STROKE_TAG) &&
+                         !(gps->flag & GP_STROKE_HELP);
   const bool is_help = gps->flag & GP_STROKE_HELP;
 
   if (!gpencil_stroke_is_drawable(tgpf, gps)) {
@@ -562,12 +551,14 @@ static void gpencil_draw_basic_stroke(tGPDfill *tgpf,
   if (is_help && tgpf->is_render) {
     /* Help strokes are for display only and shouldn't render */
     return;
-  } else if (is_help) {
+  }
+  else if (is_help) {
     /* Color help strokes that won't affect fill or render separately from
      * extended strokes, as they will affect them */
     copy_v4_v4(col, help_col);
     col[3] = (gps->flag & GP_STROKE_TAG) ? 0.5f : 0.1f;
-  } else if ((is_extend) && (!tgpf->is_render)) {
+  }
+  else if ((is_extend) && (!tgpf->is_render)) {
     copy_v4_v4(col, extend_col);
   }
   else {
@@ -786,8 +777,7 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4])
 
       /* Normal strokes. */
       if (ELEM(tgpf->fill_draw_mode, GP_FILL_DMODE_STROKE, GP_FILL_DMODE_BOTH)) {
-        if (gpencil_stroke_is_drawable(tgpf, gps) &&
-            ((gps->flag & GP_STROKE_TAG) == 0) &&
+        if (gpencil_stroke_is_drawable(tgpf, gps) && ((gps->flag & GP_STROKE_TAG) == 0) &&
             ((gps->flag & GP_STROKE_HELP) == 0)) {
           ED_gpencil_draw_fill(&tgpw);
         }
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index 0762d304313..97abf0fec5e 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -127,9 +127,8 @@ typedef enum eGP_FillDrawModes {
 
 /* BrushGpencilSettings->fill_extend_mode */
 typedef enum eGP_FillExtendModes {
-  GP_FILL_EMODE_LINES_AND_CIRCLES = 0,
-  GP_FILL_EMODE_LINES = 1,
-  GP_FILL_EMODE_CIRCLES = 2,
+  GP_FILL_EMODE_RADIUS = 0,
+  GP_FILL_EMODE_EXTEND = 1,
 } eGP_FillExtendModes;
 
 /* BrushGpencilSettings->fill_layer_mode */
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index f91321c253f..4048867607f 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -70,7 +70,7 @@ typedef struct BrushGpencilSettings {
   int fill_simplylvl;
   /** Type of control lines drawing mode. */
   int fill_draw_mode;
-  /** Type of gap filling to use */
+  /** Type of gap filling extension to use. */
   int fill_extend_mode;
   /** Icon identifier. */
   int icon_id;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 364805f0395..c11ab4dd23d 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -287,22 +287,8 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
     {0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem rna_enum_gpencil_fill_extend_modes_items[] = {
-    {GP_FILL_EMODE_LINES,
-      "LINES",
-      0,
-      "Line",
-      "Extend strokes in straight lines"},
-    {
-      GP_FILL_EMODE_CIRCLES,
-      "CIRCLES",
-      0,
-      "Circle",
-      "Connect endpoints that are close together"},
-		{GP_FILL_EMODE_LINES_AND_CIRCLES,
-     "LINES_AND_CIRCLES",
-     0,
-     "Line & Circle",
-     "Extend strokes and connect close endpoints"},
+    {GP_FILL_EMODE_RADIUS, "RADIUS", 0, "Radius", "Connect endpoints that are close together"},
+    {GP_FILL_EMODE_EXTEND, "EXTEND", 0, "Extend", "Extend strokes in straight lines"},
     {0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem rna_enum_gpencil_fill_layers_modes_items[] = {
@@ -1671,9 +1657,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
   RNA_def_property_enum_sdna(prop, NULL, "fill_extend_mode");
   RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_extend_modes_items);
   RNA_def_property_ui_text(
-      prop,
-      "Gap Closure",
-      "Types of stroke extensions used for closing gaps");
+      prop, "Gap Closure", "Types of stroke extensions used for closing gaps");
   RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 
   /* Number of pixels to dilate fill area. Negative values contract the filled area. */



More information about the Bf-blender-cvs mailing list