Cycles: add view layer setting to exclude volumes, like hair and surfaces

This commit is contained in:
Brecht Van Lommel 2020-03-11 11:22:13 +01:00
parent b70a13fb66
commit 796683db8e
6 changed files with 19 additions and 2 deletions

View File

@ -770,6 +770,8 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_solid", text="Surfaces")
col = flow.column()
col.prop(view_layer, "use_strand", text="Hair")
col = flow.column()
col.prop(view_layer, "use_volumes", text="Volumes")
if with_freestyle:
col = flow.column()
col.prop(view_layer, "use_freestyle", text="Freestyle")

View File

@ -405,6 +405,7 @@ void BlenderSync::sync_view_layer(BL::SpaceView3D & /*b_v3d*/, BL::ViewLayer &b_
view_layer.use_background_ao = b_view_layer.use_ao();
view_layer.use_surfaces = b_view_layer.use_solid();
view_layer.use_hair = b_view_layer.use_strand();
view_layer.use_volumes = b_view_layer.use_volumes();
/* Material override. */
view_layer.material_override = b_view_layer.material_override();

View File

@ -236,6 +236,7 @@ class BlenderSync {
use_background_ao(true),
use_surfaces(true),
use_hair(true),
use_volumes(true),
samples(0),
bound_samples(false)
{
@ -247,6 +248,7 @@ class BlenderSync {
bool use_background_ao;
bool use_surfaces;
bool use_hair;
bool use_volumes;
int samples;
bool bound_samples;
} view_layer;

View File

@ -1,4 +1,3 @@
/*
* Copyright 2011-2013 Blender Foundation
*
@ -83,7 +82,9 @@ void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader
mesh->used_shaders = used_shaders;
/* Smoke domain. */
sync_smoke_volume(scene, b_ob, mesh, b_scene.frame_current());
if (view_layer.use_volumes) {
sync_smoke_volume(scene, b_ob, mesh, b_scene.frame_current());
}
/* Tag update. */
bool rebuild = (old_has_voxel_attributes != mesh->has_voxel_attributes());

View File

@ -242,6 +242,7 @@ typedef struct SceneRenderLayer {
#define SCE_LAY_STRAND (1 << 5)
#define SCE_LAY_FRS (1 << 6)
#define SCE_LAY_AO (1 << 7)
#define SCE_LAY_VOLUMES (1 << 8)
/* flags between (1 << 8) and (1 << 15) are set to 1 already, for future options */
#define SCE_LAY_ALL_Z (1 << 15)

View File

@ -4018,6 +4018,16 @@ void rna_def_view_layer_common(StructRNA *srna, const bool scene)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
prop = RNA_def_property(srna, "use_volumes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_VOLUMES);
RNA_def_property_ui_text(prop, "Volumes", "Render volumes in this Layer");
if (scene) {
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
else {
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
/* passes */
prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);