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
This commit is contained in:
Sergey Sharybin 2022-06-22 11:00:26 +02:00
parent f9076f3869
commit c1ffea157c
4 changed files with 14 additions and 37 deletions

View File

@ -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")

View File

@ -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) {

View File

@ -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)

View File

@ -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", "");