Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lenz <Amudtogal>2021-11-26 13:01:04 +0300
committerSergey Sharybin <sergey@blender.org>2021-11-26 13:08:05 +0300
commitc6eaa9c552eb5e505075dda4c7c4e59dc7497738 (patch)
tree3763448f8719d4ba298bcacba31f170ffbe67b9b /source/blender/editors/mask
parent658fd8df0bd2427cd77e7fc4bcca8a102f67b626 (diff)
MaskEditor: draw active layer on top
Instead of drawing the mask layers in the sequence of their occurence, draw the active mask *always* on top. Implementation: - move drawing loop for splines to separate static function - draw active mask last Example: lowest layer is active, yet still drawn on top. {F12140355} This is part of an effort to make mask editing more intuitive & easy to use: https://developer.blender.org/T93097 Reviewed By: sergey Differential Revision: https://developer.blender.org/D13372
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_draw.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 22232e9c87e..92e774bfe86 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -587,6 +587,35 @@ static void draw_spline_curve(const bContext *C,
}
}
+static void draw_layer_splines(const bContext *C,
+ MaskLayer *layer,
+ const char draw_flag,
+ const char draw_type,
+ const int width,
+ const int height,
+ const bool is_active)
+{
+ LISTBASE_FOREACH (MaskSpline *, spline, &layer->splines) {
+ /* draw curve itself first... */
+ draw_spline_curve(C, layer, spline, draw_flag, 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);
+ }
+
+ /* show undeform for testing */
+ if (0) {
+ 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);
+ spline->points_deform = back;
+ }
+ }
+}
+
static void draw_mask_layers(const bContext *C,
Mask *mask,
const char draw_flag,
@@ -600,6 +629,7 @@ static void draw_mask_layers(const bContext *C,
MaskLayer *mask_layer;
int i;
+ MaskLayer *active = NULL;
for (mask_layer = mask->masklayers.first, i = 0; mask_layer != NULL;
mask_layer = mask_layer->next, i++) {
const bool is_active = (i == mask->masklay_act);
@@ -608,26 +638,16 @@ static void draw_mask_layers(const bContext *C,
continue;
}
- LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
-
- /* draw curve itself first... */
- draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height);
-
- if (!(mask_layer->visibility_flag & MASK_HIDE_SELECT)) {
- /* ...and then handles over the curve so they're nicely visible */
- draw_spline_points(C, mask_layer, spline, draw_flag, draw_type);
- }
+ if (is_active) {
+ active = mask_layer;
+ continue;
+ }
- /* show undeform for testing */
- if (0) {
- void *back = spline->points_deform;
+ draw_layer_splines(C, mask_layer, draw_flag, draw_type, width, height, is_active);
+ }
- spline->points_deform = NULL;
- draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height);
- draw_spline_points(C, mask_layer, spline, draw_flag, draw_type);
- spline->points_deform = back;
- }
- }
+ if (active != NULL) {
+ draw_layer_splines(C, active, draw_flag, draw_type, width, height, true);
}
GPU_program_point_size(false);