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:
authorBrecht Van Lommel <brecht@blender.org>2021-08-04 20:43:40 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-08-05 18:22:38 +0300
commitca64bd0aacdaa9fcf75d693321d4d73c4a6a991a (patch)
treecfbecc0f9cb815d3b17efc0f60261ac590c69d8a /source/blender/blenloader
parent6c326ba0a24f24763b751483a0ee0cc98abdd921 (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/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_cycles.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c
index 94ee89c5120..90e6b43f02e 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -78,6 +78,12 @@ static IDProperty *cycles_properties_from_ID(ID *id)
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles", IDP_GROUP) : NULL;
}
+static IDProperty *cycles_visibility_properties_from_ID(ID *id)
+{
+ IDProperty *idprop = IDP_GetProperties(id, false);
+ return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles_visibility", IDP_GROUP) : NULL;
+}
+
static IDProperty *cycles_properties_from_view_layer(ViewLayer *view_layer)
{
IDProperty *idprop = view_layer->id_properties;
@@ -1600,4 +1606,35 @@ void do_versions_after_linking_cycles(Main *bmain)
}
}
}
+
+ /* Move visibility from Cycles to Blender. */
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 17)) {
+ LISTBASE_FOREACH (Object *, object, &bmain->objects) {
+ IDProperty *cvisibility = cycles_visibility_properties_from_ID(&object->id);
+ int flag = 0;
+
+ if (cvisibility) {
+ flag |= cycles_property_boolean(cvisibility, "camera", true) ? 0 : OB_HIDE_CAMERA;
+ flag |= cycles_property_boolean(cvisibility, "diffuse", true) ? 0 : OB_HIDE_DIFFUSE;
+ flag |= cycles_property_boolean(cvisibility, "glossy", true) ? 0 : OB_HIDE_GLOSSY;
+ flag |= cycles_property_boolean(cvisibility, "transmission", true) ? 0 :
+ OB_HIDE_TRANSMISSION;
+ flag |= cycles_property_boolean(cvisibility, "scatter", true) ? 0 : OB_HIDE_VOLUME_SCATTER;
+ flag |= cycles_property_boolean(cvisibility, "shadow", true) ? 0 : OB_HIDE_SHADOW;
+ }
+
+ IDProperty *cobject = cycles_properties_from_ID(&object->id);
+ if (cobject) {
+ flag |= cycles_property_boolean(cobject, "is_holdout", false) ? OB_HOLDOUT : 0;
+ flag |= cycles_property_boolean(cobject, "is_shadow_catcher", false) ? OB_SHADOW_CATCHER :
+ 0;
+ }
+
+ if (object->type == OB_LAMP) {
+ flag |= OB_HIDE_CAMERA | OB_SHADOW_CATCHER;
+ }
+
+ object->visibility_flag |= flag;
+ }
+ }
}