diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-16 18:03:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-16 18:40:13 +0300 |
commit | 9f6670ca375552c1382ac340ad184e2e1882c2aa (patch) | |
tree | f303417f32a784129398ffe6a8ab621a358165e1 /source | |
parent | 2ee762344f8742618804e869536e3efee6ab0bd0 (diff) |
Cycles/Eeeve: unify film transparent setting
For existing files, it will use the setting from Cycles or Eevee depending on
the render engine in the scene.
Differential Revision: https://developer.blender.org/D4874
Diffstat (limited to 'source')
4 files changed, 20 insertions, 22 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index e6692959c95..0afcd37c81b 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ * \note Use #STRINGIFY() rather than defining with quotes. */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 67 +#define BLENDER_SUBVERSION 68 /** Several breakages with 280, e.g. collections vs layers. */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index ace90350a21..3fc6d982e0f 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -396,6 +396,20 @@ void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main *bm } } } + + if (!MAIN_VERSION_ATLEAST(bmain, 280, 68)) { + /* Unify Cycles and EEVEE Film Transparency. */ + for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { + if (STREQ(scene->r.engine, RE_engine_id_CYCLES)) { + IDProperty *cscene = cycles_properties_from_ID(&scene->id); + if (cscene) { + bool cycles_film_transparency = cycles_property_boolean( + cscene, "film_transparent", false); + scene->r.alphamode = cycles_film_transparency ? R_ALPHAPREMUL : R_ADDSKY; + } + } + } + } } void do_versions_after_linking_cycles(Main *bmain) diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 082ed34c353..dbd770eb5e8 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -125,13 +125,6 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str /* Render with transparent background. */ freestyle_scene->r.alphamode = R_ALPHAPREMUL; - if (STREQ(freestyle_scene->r.engine, RE_engine_id_CYCLES)) { - PointerRNA freestyle_scene_ptr; - RNA_id_pointer_create(&freestyle_scene->id, &freestyle_scene_ptr); - PointerRNA freestyle_cycles_ptr = RNA_pointer_get(&freestyle_scene_ptr, "cycles"); - RNA_boolean_set(&freestyle_cycles_ptr, "film_transparent", 1); - } - if (G.debug & G_DEBUG_FREESTYLE) { printf("%s: %d thread(s)\n", __func__, BKE_render_num_threads(&freestyle_scene->r)); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b7399202624..c91b32bf7d1 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -5498,16 +5498,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem alpha_mode_items[] = { - {R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"}, - {R_ALPHAPREMUL, - "TRANSPARENT", - 0, - "Transparent", - "World background is transparent with premultiplied alpha"}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem display_mode_items[] = { {R_OUTPUT_SCREEN, "SCREEN", @@ -5735,11 +5725,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop, "Filter Size", "Width over which the reconstruction filter combines samples"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "alphamode"); - RNA_def_property_enum_items(prop, alpha_mode_items); + prop = RNA_def_property(srna, "film_transparent", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "alphamode", R_ALPHAPREMUL); RNA_def_property_ui_text( - prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); + prop, + "Transparent", + "World background is transparent, for compositing the render over another background"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); |