Realtime Compositor: Implement Mask node

This patch implements the Mask node for the realtime compositor. The
evaluation of the mask is not GPU accelerated, but is cached as a form
of temporary implementation until we implement a GPU evaluator for
masks.

One limitation currently is that we do not redraw the viewport while the
mask is getting edited by the user, because always doing that will be
redundant in most situations, and conditioning the redraw requires a lot
of work that should be handled outside of this patch.

This is similar to the Texture node implementation in 151a53110c.

Pull Request: https://projects.blender.org/blender/blender/pulls/107464
This commit is contained in:
Omar Emara
2023-05-01 11:29:06 +02:00
committed by Omar Emara
parent 92983967cb
commit 3f6912ece2
15 changed files with 387 additions and 11 deletions

View File

@@ -40,6 +40,8 @@
#include "DEG_depsgraph_build.h"
#include "DRW_engine.h"
#include "BLO_read_write.h"
static CLG_LogRef LOG = {"bke.mask"};
@@ -57,6 +59,8 @@ static void mask_copy_data(Main *UNUSED(bmain),
/* TODO: add unused flag to those as well. */
BKE_mask_layer_copy_list(&mask_dst->masklayers, &mask_src->masklayers);
BLI_listbase_clear((ListBase *)&mask_dst->drawdata);
/* enable fake user by default */
id_fake_user_set(&mask_dst->id);
}
@@ -67,6 +71,8 @@ static void mask_free_data(ID *id)
/* free mask data */
BKE_mask_layer_free_list(&mask->masklayers);
DRW_drawdata_free(id);
}
static void mask_foreach_id(ID *id, LibraryForeachIDData *data)