diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-08-04 20:43:40 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-08-05 18:22:38 +0300 |
commit | ca64bd0aacdaa9fcf75d693321d4d73c4a6a991a (patch) | |
tree | cfbecc0f9cb815d3b17efc0f60261ac590c69d8a /source/blender/blenkernel | |
parent | 6c326ba0a24f24763b751483a0ee0cc98abdd921 (diff) |
Render: move Cycles visibility, holdout and shadow catcher properties to Blender
The immediate reason for this is that we want to be able to initialize them
to different defaults for light objects, which is hard with Python properties.
But in general it is useful to be able to share these with other renderers.
As a side effect, Eevee now supports a per-object holdout instead of only
per-collection.
Differential Revision: https://developer.blender.org/D12133
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 5940569ba76..e7d83c668c8 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1020,7 +1020,7 @@ static void layer_collection_objects_sync(ViewLayer *view_layer, } /* Holdout and indirect only */ - if (layer->flag & LAYER_COLLECTION_HOLDOUT) { + if ((layer->flag & LAYER_COLLECTION_HOLDOUT) || (base->object->visibility_flag & OB_HOLDOUT)) { base->flag_from_collection |= BASE_HOLDOUT; } if (layer->flag & LAYER_COLLECTION_INDIRECT_ONLY) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6a309e040c0..f969ca0ff1c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2081,6 +2081,12 @@ static void object_init(Object *ob, const short ob_type) if (ob->type == OB_GPENCIL) { ob->dtx |= OB_USE_GPENCIL_LIGHTS; } + + if (ob->type == OB_LAMP) { + /* Lights are invisible to camera rays and are assumed to be a + * shadow catcher by default. */ + ob->visibility_flag |= OB_HIDE_CAMERA | OB_SHADOW_CATCHER; + } } void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name) |