Merge branch 'blender-v4.3-release'

This commit is contained in:
Falk David
2024-11-07 11:58:44 +01:00
3 changed files with 17 additions and 10 deletions

View File

@@ -515,15 +515,17 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
return tgp_layer;
}
GPENCIL_tLayer *gpencil_layer_cache_get(GPENCIL_tObject *tgp_ob, int number)
GPENCIL_tLayer *grease_pencil_layer_cache_get(GPENCIL_tObject *tgp_ob,
int layer_id,
const bool skip_onion)
{
if (number >= 0) {
GPENCIL_tLayer *layer = tgp_ob->layers.first;
while (layer != nullptr) {
if (layer->layer_id == number) {
return layer;
}
layer = layer->next;
BLI_assert(layer_id >= 0);
for (GPENCIL_tLayer *layer = tgp_ob->layers.first; layer != nullptr; layer = layer->next) {
if (skip_onion && layer->is_onion) {
continue;
}
if (layer->layer_id == layer_id) {
return layer;
}
}
return nullptr;
@@ -576,6 +578,7 @@ GPENCIL_tLayer *grease_pencil_layer_cache_add(GPENCIL_PrivateData *pd,
GPENCIL_tLayer *tgp_layer = static_cast<GPENCIL_tLayer *>(BLI_memblock_alloc(pd->gp_layer_pool));
BLI_LINKS_APPEND(&tgp_ob->layers, tgp_layer);
tgp_layer->layer_id = *grease_pencil.get_layer_index(layer);
tgp_layer->is_onion = onion_id != 0;
tgp_layer->mask_bits = nullptr;
tgp_layer->mask_invert_bits = nullptr;
tgp_layer->blend_ps = nullptr;

View File

@@ -109,6 +109,8 @@ typedef struct GPENCIL_tLayer {
BLI_bitmap *mask_invert_bits;
/** Index in the layer list. Used as id for masking. */
int layer_id;
/** True if this pass is part of the onion skinning. */
bool is_onion;
} GPENCIL_tLayer;
typedef struct GPENCIL_tObject {
@@ -327,7 +329,9 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
const bGPDlayer *gpl,
const bGPDframe *gpf,
GPENCIL_tObject *tgp_ob);
GPENCIL_tLayer *gpencil_layer_cache_get(GPENCIL_tObject *tgp_ob, int number);
GPENCIL_tLayer *grease_pencil_layer_cache_get(GPENCIL_tObject *tgp_ob,
int layer_id,
bool skip_onion);
GPENCIL_tLayer *grease_pencil_layer_cache_add(GPENCIL_PrivateData *pd,
const Object *ob,

View File

@@ -767,7 +767,7 @@ static void gpencil_draw_mask(GPENCIL_Data *vedata, GPENCIL_tObject *ob, GPENCIL
GPU_framebuffer_clear_color_depth(fbl->mask_fb, clear_col, clear_depth);
}
GPENCIL_tLayer *mask_layer = gpencil_layer_cache_get(ob, i);
GPENCIL_tLayer *mask_layer = grease_pencil_layer_cache_get(ob, i, true);
/* When filtering by view-layer, the mask could be null and must be ignored. */
if (mask_layer == nullptr) {
continue;