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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-05-21 18:29:58 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-05-23 10:47:13 +0300
commitfec9615ea06c94b5224c14479c31c55c567fb7ee (patch)
tree3193277e063be03ad7218fecd778735f673686ea /source/blender/editors/mask/mask_draw.c
parent1d48fa2206934688a4c1b303279c26b3a8d1a5ec (diff)
Masks: Properly port to Copy-on-Write concept
Masks were not really covered by Copy-on-Write due to mistake in the dependency graph. After correcting that mistake a lot of tools became broken, so majority of the patch is related on making it so access to evaluated/tessellated masks is done. When accessing evaluated mask state make sure access to an evaluated dependency graph is done. This solves possible access to NULL data on redo. Fixes T64899: Re-doing new point addition causes crash Reviewers: brecht Reviewed By: brecht Maniphest Tasks: T64899 Differential Revision: https://developer.blender.org/D4918
Diffstat (limited to 'source/blender/editors/mask/mask_draw.c')
-rw-r--r--source/blender/editors/mask/mask_draw.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 305e3a328ab..33e89b1a7c5 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -52,6 +52,8 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "DEG_depsgraph_query.h"
+
#include "mask_intern.h" /* own include */
static void mask_spline_color_get(MaskLayer *masklay,
@@ -672,7 +674,8 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
/* sets up the opengl context.
* width, height are to match the values from ED_mask_get_size() */
void ED_mask_draw_region(
- Mask *mask,
+ Depsgraph *depsgraph,
+ Mask *mask_,
ARegion *ar,
const char draw_flag,
const char draw_type,
@@ -690,6 +693,7 @@ void ED_mask_draw_region(
const bContext *C)
{
struct View2D *v2d = &ar->v2d;
+ Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_->id);
/* aspect always scales vertically in movie and image spaces */
const float width = width_i, height = (float)height_i * (aspy / aspx);
@@ -735,7 +739,7 @@ void ED_mask_draw_region(
if (draw_flag & MASK_DRAWFLAG_OVERLAY) {
float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
- float *buffer = mask_rasterize(mask, width, height);
+ float *buffer = mask_rasterize(mask_eval, width, height);
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
/* More blending types could be supported in the future. */
@@ -779,7 +783,7 @@ void ED_mask_draw_region(
}
/* draw! */
- draw_masklays(C, mask, draw_flag, draw_type, width, height);
+ draw_masklays(C, mask_eval, draw_flag, draw_type, width, height);
if (do_draw_cb) {
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);