Fix T99450: Animated Holdout not updating on frame change

Problem here was that layer_collection_objects_sync wasn't called when
the holdout property is updated due to frame change, so the changed
visibility flag was never applied to ob->base_flag.

Turns out there's no real reason to handle the per-object holdout
property through the layer system. So, instead of merging both the
layer holdout and object holdout into base_flag and checking that
from the render engines, only handle the layer holdout (which can't
be animated, so no issue here) through base_flag and explicitly also
check the object holdout in the render engines.
This commit is contained in:
Lukas Stockner 2022-10-15 22:51:21 +02:00 committed by Philipp Oeser
parent e5af9a12d7
commit 1492f566c8
Notes: blender-bot 2023-02-14 09:36:46 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #99450, Animated Holdout & Shadow do not update in Cycles
4 changed files with 6 additions and 4 deletions

View File

@ -1012,7 +1012,7 @@ static void layer_collection_objects_sync(ViewLayer *view_layer,
}
/* Holdout and indirect only */
if ((layer->flag & LAYER_COLLECTION_HOLDOUT) || (base->object->visibility_flag & OB_HOLDOUT)) {
if ((layer->flag & LAYER_COLLECTION_HOLDOUT)) {
base->flag_from_collection |= BASE_HOLDOUT;
}
if (layer->flag & LAYER_COLLECTION_INDIRECT_ONLY) {

View File

@ -752,7 +752,8 @@ BLI_INLINE Material *eevee_object_material_get(Object *ob, int slot, bool holdou
BLI_INLINE EeveeMaterialCache eevee_material_cache_get(
EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, Object *ob, int slot, bool is_hair)
{
const bool holdout = (ob->base_flag & BASE_HOLDOUT) != 0;
const bool holdout = ((ob->base_flag & BASE_HOLDOUT) != 0) ||
((ob->visibility_flag & OB_HOLDOUT) != 0);
EeveeMaterialCache matcache;
Material *ma = eevee_object_material_get(ob, slot, holdout);
switch (ma->blend_method) {

View File

@ -69,7 +69,8 @@ NodeGroup *BlenderFileLoader::Load()
break;
}
if (ob->base_flag & (BASE_HOLDOUT | BASE_INDIRECT_ONLY)) {
if ((ob->base_flag & (BASE_HOLDOUT | BASE_INDIRECT_ONLY)) ||
(ob->visibility_flag & OB_HOLDOUT)) {
continue;
}

View File

@ -192,7 +192,7 @@ static bool rna_Object_holdout_get(Object *ob, bContext *C, ViewLayer *view_laye
return false;
}
return ((base->flag & BASE_HOLDOUT) != 0);
return ((base->flag & BASE_HOLDOUT) != 0) || ((ob->visibility_flag & OB_HOLDOUT) != 0);
}
static bool rna_Object_indirect_only_get(Object *ob, bContext *C, ViewLayer *view_layer)