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:
authorJeroen Bakker <jeroen@blender.org>2021-01-05 15:43:32 +0300
committerJeroen Bakker <jeroen@blender.org>2021-01-05 15:53:33 +0300
commit7cd6f667e33e60f3d53e465023bb75f90f499b07 (patch)
treef799d32f50aa4c84e0c446f7d95edf3f6e83b1ae /source/blender/draw/engines/overlay/overlay_private.h
parentf41de6dc46ad0849d93b72580fefffdde4546cba (diff)
Fix T84053: Mask overlay in image editor not working
The mask overlay wasn't part of the overlay engine. The reasoning nehind this was that more editors used the mask overlay and most of them used old drawing code. This patch adds the mask overlay drawing to the draw overlay engine. This code path will only be used by the image editor VSE, Compositor and Movie Clip editor will still use the previous method. During this patch some alternatives have been researched: 1. `ED_mask_draw_region`: this would lead to different code paths when drawing in the image editor, and some hacks to retrieve the correct framebuffer. 2. Add mask drawing to image engine: Would lead to incorrect color management when viewing the mask. 3. Add mask drawing to image engine and overlay engine: Would lead to duplicated code. 4. Add mask drawing to overlay engine and for combined overlay select the correct framebuffer. Option 4 was chosen as the exception (switching framebuffers) can be done without hacks. The code stays clean.
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_private.h')
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index 3355e1bdf16..3aee391c281 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -34,9 +34,9 @@ extern "C" {
# define USE_GEOM_SHADER_WORKAROUND 0
#endif
-/* Needed for eSpaceImage_UVDT_Stretch */
+/* Needed for eSpaceImage_UVDT_Stretch and eMaskOverlayMode */
+#include "DNA_mask_types.h"
#include "DNA_space_types.h"
-
/* Forward declarations */
struct ImBuf;
@@ -99,6 +99,7 @@ typedef struct OVERLAY_PassList {
DRWPass *edit_uv_stretching_ps;
DRWPass *edit_uv_tiled_image_borders_ps;
DRWPass *edit_uv_stencil_ps;
+ DRWPass *edit_uv_mask_ps;
DRWPass *extra_ps[2];
DRWPass *extra_blend_ps;
DRWPass *extra_centers_ps;
@@ -368,18 +369,23 @@ typedef struct OVERLAY_PrivateData {
bool do_tiled_image_overlay;
bool do_tiled_image_border_overlay;
bool do_stencil_overlay;
+ bool do_mask_overlay;
bool do_faces;
bool do_face_dots;
float uv_opacity;
+
+ int image_size[2];
+ float image_aspect[2];
+
/* edge drawing */
OVERLAY_UVLineStyle line_style;
float dash_length;
int do_smooth_wire;
/* stretching overlay */
- float aspect[2];
+ float uv_aspect[2];
eSpaceImage_UVDT_Stretch draw_type;
ListBase totals;
float total_area_ratio;
@@ -389,6 +395,11 @@ typedef struct OVERLAY_PrivateData {
struct Image *stencil_image;
struct ImBuf *stencil_ibuf;
void *stencil_lock;
+
+ /* mask overlay */
+ Mask *mask;
+ eMaskOverlayMode mask_overlay_mode;
+ GPUTexture *mask_texture;
} edit_uv;
struct {
bool transparent;
@@ -690,6 +701,7 @@ GPUShader *OVERLAY_shader_edit_uv_stretching_area_get(void);
GPUShader *OVERLAY_shader_edit_uv_stretching_angle_get(void);
GPUShader *OVERLAY_shader_edit_uv_tiled_image_borders_get(void);
GPUShader *OVERLAY_shader_edit_uv_stencil_image(void);
+GPUShader *OVERLAY_shader_edit_uv_mask_image(void);
GPUShader *OVERLAY_shader_extra(bool is_select);
GPUShader *OVERLAY_shader_extra_groundline(void);
GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select);