[Bf-blender-cvs] [c1ffea157c5] master: Mask editor: Always use smooth drawing

Sergey Sharybin noreply at git.blender.org
Tue Jun 28 11:04:20 CEST 2022


Commit: c1ffea157c5be4359a3f265ea4711a8fb5474ad2
Author: Sergey Sharybin
Date:   Wed Jun 22 11:00:26 2022 +0200
Branches: master
https://developer.blender.org/rBc1ffea157c5be4359a3f265ea4711a8fb5474ad2

Mask editor: Always use smooth drawing

The mask is expected to be always be displayed smooth, and the
option mainly existed for some legacy drivers. IF smooth drawing
causes issues it should be fixed in the drawing code, not as an
option in the interface.

Differential Revision: https://developer.blender.org/D15266

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

M	release/scripts/startup/bl_ui/properties_mask_common.py
M	source/blender/editors/mask/mask_draw.c
M	source/blender/makesdna/DNA_mask_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py
index ff4f1ee02bf..9dc1ef3cc4b 100644
--- a/release/scripts/startup/bl_ui/properties_mask_common.py
+++ b/release/scripts/startup/bl_ui/properties_mask_common.py
@@ -231,7 +231,6 @@ class MASK_PT_display:
         layout = self.layout
 
         space_data = context.space_data
-        layout.prop(space_data, "show_mask_smooth", text="Smooth")
 
         row = layout.row(align=True)
         row.prop(space_data, "show_mask_spline", text="Spline")
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index a18419ad422..4662fe9d1a8 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -171,12 +171,10 @@ static void draw_single_handle(const MaskLayer *mask_layer,
 static void draw_spline_points(const bContext *C,
                                MaskLayer *mask_layer,
                                MaskSpline *spline,
-                               const char draw_flag,
                                const char draw_type)
 {
   const bool is_spline_sel = (spline->flag & SELECT) &&
                              (mask_layer->visibility_flag & MASK_HIDE_SELECT) == 0;
-  const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0;
 
   uchar rgb_spline[4];
   MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -253,9 +251,7 @@ static void draw_spline_points(const bContext *C,
 
   immUnbindProgram();
 
-  if (is_smooth) {
-    GPU_line_smooth(true);
-  }
+  GPU_line_smooth(true);
 
   /* control points */
   INIT_MINMAX2(min, max);
@@ -323,9 +319,7 @@ static void draw_spline_points(const bContext *C,
     minmax_v2v2_v2(min, max, vert);
   }
 
-  if (is_smooth) {
-    GPU_line_smooth(false);
-  }
+  GPU_line_smooth(false);
 
   if (is_spline_sel) {
     float x = (min[0] + max[0]) * 0.5f;
@@ -502,7 +496,6 @@ static void mask_draw_curve_type(const bContext *C,
 static void draw_spline_curve(const bContext *C,
                               MaskLayer *mask_layer,
                               MaskSpline *spline,
-                              const char draw_flag,
                               const char draw_type,
                               const bool is_active,
                               const int width,
@@ -515,7 +508,6 @@ static void draw_spline_curve(const bContext *C,
 
   const bool is_spline_sel = (spline->flag & SELECT) &&
                              (mask_layer->visibility_flag & MASK_HIDE_SELECT) == 0;
-  const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0;
   const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
 
   uint tot_diff_point;
@@ -530,9 +522,7 @@ static void draw_spline_curve(const bContext *C,
     return;
   }
 
-  if (is_smooth) {
-    GPU_line_smooth(true);
-  }
+  GPU_line_smooth(true);
 
   feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(
       spline, resol, (is_fill != false), &tot_feather_point);
@@ -567,14 +557,11 @@ static void draw_spline_curve(const bContext *C,
       C, spline, diff_points, tot_diff_point, false, is_active, rgb_tmp, draw_type);
   MEM_freeN(diff_points);
 
-  if (is_smooth) {
-    GPU_line_smooth(false);
-  }
+  GPU_line_smooth(false);
 }
 
 static void draw_layer_splines(const bContext *C,
                                MaskLayer *layer,
-                               const char draw_flag,
                                const char draw_type,
                                const int width,
                                const int height,
@@ -582,11 +569,11 @@ static void draw_layer_splines(const bContext *C,
 {
   LISTBASE_FOREACH (MaskSpline *, spline, &layer->splines) {
     /* draw curve itself first... */
-    draw_spline_curve(C, layer, spline, draw_flag, draw_type, is_active, width, height);
+    draw_spline_curve(C, layer, spline, draw_type, is_active, width, height);
 
     if (!(layer->visibility_flag & MASK_HIDE_SELECT)) {
       /* ...and then handles over the curve so they're nicely visible */
-      draw_spline_points(C, layer, spline, draw_flag, draw_type);
+      draw_spline_points(C, layer, spline, draw_type);
     }
 
     /* show undeform for testing */
@@ -594,19 +581,15 @@ static void draw_layer_splines(const bContext *C,
       void *back = spline->points_deform;
 
       spline->points_deform = NULL;
-      draw_spline_curve(C, layer, spline, draw_flag, draw_type, is_active, width, height);
-      draw_spline_points(C, layer, spline, draw_flag, draw_type);
+      draw_spline_curve(C, layer, spline, draw_type, is_active, width, height);
+      draw_spline_points(C, layer, spline, draw_type);
       spline->points_deform = back;
     }
   }
 }
 
-static void draw_mask_layers(const bContext *C,
-                             Mask *mask,
-                             const char draw_flag,
-                             const char draw_type,
-                             const int width,
-                             const int height)
+static void draw_mask_layers(
+    const bContext *C, Mask *mask, const char draw_type, const int width, const int height)
 {
   GPU_blend(GPU_BLEND_ALPHA);
   GPU_program_point_size(true);
@@ -628,11 +611,11 @@ static void draw_mask_layers(const bContext *C,
       continue;
     }
 
-    draw_layer_splines(C, mask_layer, draw_flag, draw_type, width, height, is_active);
+    draw_layer_splines(C, mask_layer, draw_type, width, height, is_active);
   }
 
   if (active != NULL) {
-    draw_layer_splines(C, active, draw_flag, draw_type, width, height, true);
+    draw_layer_splines(C, active, draw_type, width, height, true);
   }
 
   GPU_program_point_size(false);
@@ -777,7 +760,7 @@ void ED_mask_draw_region(
 
   /* draw! */
   if (draw_flag & MASK_DRAWFLAG_SPLINE) {
-    draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height);
+    draw_mask_layers(C, mask_eval, draw_type, width, height);
   }
 
   if (do_draw_cb) {
diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h
index df4e6f788ff..fbbcd340ae9 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -196,7 +196,7 @@ enum {
 #define MASK_HIDE_RENDER (1 << 2)
 
 /* SpaceClip->mask_draw_flag */
-#define MASK_DRAWFLAG_SMOOTH (1 << 0)
+/* #define MASK_DRAWFLAG_SMOOTH_DEPRECATED (1 << 0) */ /* Deprecated */
 #define MASK_DRAWFLAG_OVERLAY (1 << 1)
 #define MASK_DRAWFLAG_SPLINE (1 << 2)
 
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0b780a3fcc6..70f111359a5 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3478,11 +3478,6 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m
   RNA_def_property_ui_text(prop, "Edge Display Type", "Display type for mask splines");
   RNA_def_property_update(prop, noteflag, NULL);
 
-  prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH);
-  RNA_def_property_ui_text(prop, "Display Smooth Splines", "");
-  RNA_def_property_update(prop, noteflag, NULL);
-
   prop = RNA_def_property(srna, "show_mask_spline", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SPLINE);
   RNA_def_property_ui_text(prop, "Show Mask Spline", "");



More information about the Bf-blender-cvs mailing list