[Bf-blender-cvs] [92528ded7b2] cycles_procedural_api: use getters and setters for Film
Kévin Dietrich
noreply at git.blender.org
Mon Sep 7 05:03:34 CEST 2020
Commit: 92528ded7b2b741d859cf6aacd3e252b47a8f800
Author: Kévin Dietrich
Date: Tue Sep 1 05:17:30 2020 +0200
Branches: cycles_procedural_api
https://developer.blender.org/rB92528ded7b2b741d859cf6aacd3e252b47a8f800
use getters and setters for Film
Removes Film::modified and several calls to Film::tag_update, and adds a
few more sockets.
===================================================================
M intern/cycles/blender/blender_session.cpp
M intern/cycles/blender/blender_sync.cpp
M intern/cycles/render/film.cpp
M intern/cycles/render/film.h
M intern/cycles/render/light.cpp
M intern/cycles/render/scene.cpp
M intern/cycles/render/session.cpp
===================================================================
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 757fe978a85..da6bca0a0b8 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -440,17 +440,17 @@ void BlenderSession::stamp_view_layer_metadata(Scene *scene, const string &view_
}
/* Write cryptomatte metadata. */
- if (scene->film->cryptomatte_passes & CRYPT_OBJECT) {
+ if (scene->film->get_cryptomatte_passes() & CRYPT_OBJECT) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoObject",
scene->object_manager->get_cryptomatte_objects(scene));
}
- if (scene->film->cryptomatte_passes & CRYPT_MATERIAL) {
+ if (scene->film->get_cryptomatte_passes() & CRYPT_MATERIAL) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoMaterial",
scene->shader_manager->get_cryptomatte_materials(scene));
}
- if (scene->film->cryptomatte_passes & CRYPT_ASSET) {
+ if (scene->film->get_cryptomatte_passes() & CRYPT_ASSET) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoAsset",
scene->object_manager->get_cryptomatte_assets(scene));
@@ -501,9 +501,9 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
/* Set buffer params, using film settings from sync_render_passes. */
buffer_params.passes = passes;
- buffer_params.denoising_data_pass = scene->film->denoising_data_pass;
- buffer_params.denoising_clean_pass = scene->film->denoising_clean_pass;
- buffer_params.denoising_prefiltered_pass = scene->film->denoising_prefiltered_pass;
+ buffer_params.denoising_data_pass = scene->film->get_denoising_data_pass();
+ buffer_params.denoising_clean_pass = scene->film->get_denoising_clean_pass();
+ buffer_params.denoising_prefiltered_pass = scene->film->get_denoising_prefiltered_pass();
BL::RenderResult::views_iterator b_view_iter;
@@ -710,7 +710,7 @@ void BlenderSession::do_write_update_render_result(BL::RenderLayer &b_rlay,
if (!buffers->copy_from_device())
return;
- float exposure = scene->film->exposure;
+ float exposure = scene->film->get_exposure();
vector<float> pixels(rtile.w * rtile.h * 4);
@@ -827,10 +827,7 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
session->set_denoising(session_params.denoising);
/* Update film if denoising data was enabled or disabled. */
- if (scene->film->denoising_data_pass != buffer_params.denoising_data_pass) {
- scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
- scene->film->tag_update(scene);
- }
+ scene->film->set_denoising_data_pass(buffer_params.denoising_data_pass);
/* reset if needed */
if (scene->need_reset()) {
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 55fa231fb5d..25a5407f41e 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -374,43 +374,39 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
Film *film = scene->film;
- Film prevfilm = *film;
vector<Pass> prevpasses = scene->passes;
if (b_v3d) {
- film->display_pass = update_viewport_display_passes(b_v3d, scene->passes);
+ film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
}
- film->exposure = get_float(cscene, "film_exposure");
- film->filter_type = (FilterType)get_enum(
- cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS);
- film->filter_width = (film->filter_type == FILTER_BOX) ? 1.0f :
+ film->set_exposure(get_float(cscene, "film_exposure"));
+ film->set_filter_type((FilterType)get_enum(
+ cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS));
+ float filter_width = (film->get_filter_type() == FILTER_BOX) ? 1.0f :
get_float(cscene, "filter_width");
+ film->set_filter_width(filter_width);
if (b_scene.world()) {
BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
- film->mist_start = b_mist.start();
- film->mist_depth = b_mist.depth();
+ film->set_mist_start(b_mist.start());
+ film->set_mist_depth(b_mist.depth());
switch (b_mist.falloff()) {
case BL::WorldMistSettings::falloff_QUADRATIC:
- film->mist_falloff = 2.0f;
+ film->set_mist_falloff(2.0f);
break;
case BL::WorldMistSettings::falloff_LINEAR:
- film->mist_falloff = 1.0f;
+ film->set_mist_falloff(1.0f);
break;
case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
- film->mist_falloff = 0.5f;
+ film->set_mist_falloff(0.5f);
break;
}
}
- if (film->modified(prevfilm)) {
- film->tag_update(scene);
- }
-
if (!Pass::equals(prevpasses, scene->passes)) {
film->tag_passes_update(scene, prevpasses, false);
film->tag_update(scene);
@@ -581,12 +577,12 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
- scene->film->denoising_flags = 0;
+ int denoising_flags = 0;
if (denoising.use || denoising.store_passes) {
if (denoising.type == DENOISER_NLM) {
#define MAP_OPTION(name, flag) \
if (!get_boolean(crl, name)) \
- scene->film->denoising_flags |= flag;
+ denoising_flags |= flag;
MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
MAP_OPTION("denoising_glossy_direct", DENOISING_CLEAN_GLOSSY_DIR);
@@ -597,6 +593,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
}
b_engine.add_pass("Noisy Image", 4, "RGBA", b_view_layer.name().c_str());
}
+ scene->film->set_denoising_flags(denoising_flags);
if (denoising.store_passes) {
b_engine.add_pass("Denoising Normal", 3, "XYZ", b_view_layer.name().c_str());
@@ -651,16 +648,15 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
* User facing parameter is the number of pairs. */
int crypto_depth = divide_up(min(16, get_int(crl, "pass_crypto_depth")), 2);
- scene->film->cryptomatte_depth = crypto_depth;
- scene->film->cryptomatte_passes = CRYPT_NONE;
+ scene->film->set_cryptomatte_depth(crypto_depth);
+ CryptomatteType cryptomatte_passes = CRYPT_NONE;
if (get_boolean(crl, "use_pass_crypto_object")) {
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Object%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
- scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
- CRYPT_OBJECT);
+ cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_OBJECT);
}
if (get_boolean(crl, "use_pass_crypto_material")) {
for (int i = 0; i < crypto_depth; i++) {
@@ -668,8 +664,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
- scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
- CRYPT_MATERIAL);
+ cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_MATERIAL);
}
if (get_boolean(crl, "use_pass_crypto_asset")) {
for (int i = 0; i < crypto_depth; i++) {
@@ -677,13 +672,12 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
- scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
- CRYPT_ASSET);
+ cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ASSET);
}
- if (get_boolean(crl, "pass_crypto_accurate") && scene->film->cryptomatte_passes != CRYPT_NONE) {
- scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
- CRYPT_ACCURATE);
+ if (get_boolean(crl, "pass_crypto_accurate") && cryptomatte_passes != CRYPT_NONE) {
+ cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ACCURATE);
}
+ scene->film->set_cryptomatte_passes(cryptomatte_passes);
if (adaptive_sampling) {
Pass::add(PASS_ADAPTIVE_AUX_BUFFER, passes);
@@ -707,14 +701,13 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
}
RNA_END;
- scene->film->denoising_data_pass = denoising.use || denoising.store_passes;
- scene->film->denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
- scene->film->denoising_prefiltered_pass = denoising.store_passes &&
- denoising.type == DENOISER_NLM;
+ scene->film->set_denoising_data_pass(denoising.use || denoising.store_passes);
+ scene->film->set_denoising_clean_pass(scene->film->get_denoising_flags() & DENOISING_CLEAN_ALL_PASSES);
+ scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
+ denoising.type == DENOISER_NLM);
- scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold();
+ scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
scene->film->tag_passes_update(scene, passes);
- scene->film->tag_update(scene);
scene->integrator->tag_update(scene);
return passes;
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index 2da28222a7f..c280a1ab8b5 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list