From 78ae7ec39212ed2432765bd8f7ae7ca5b514983e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 25 Sep 2025 18:04:14 +0200 Subject: [PATCH] Render: Rename render passes for clarity In very old OpenEXR version there was a limit on the channel names, which meant the pass names needed to be short like "DiffDir". Change them to be longer like "Diffuse Direct". * This breaks forward compatibility. Old Blender version will lose links when reading compositing node setups with such passes, but #146571 will fix it for 4.5 LTS. * Add-ons, scripts and compositing setups in other applications that rely on these names will also break. * The find_by_type function for render passes has also been removed, as this was already deprecated and replaced by find_by_name. * We assume spaces in the name are ok, since we have passes with them already and have not seen reports about compatibility issues. Pull Request: https://projects.blender.org/blender/blender/pulls/142731 --- intern/cycles/blender/addon/engine.py | 52 ++++++------- intern/cycles/blender/addon/properties.py | 2 +- intern/cycles/blender/sync.cpp | 32 ++++---- .../node_wrangler/utils/constants.py | 34 ++++----- .../blender/blenkernel/intern/layer_test.cc | 20 +++-- .../blender/editors/object/object_bake_api.cc | 4 +- source/blender/makesdna/DNA_scene_types.h | 41 +++++------ source/blender/makesrna/RNA_enum_items.hh | 2 - source/blender/makesrna/intern/rna_render.cc | 48 +----------- source/blender/makesrna/intern/rna_scene.cc | 4 +- .../composite/nodes/node_composite_image.cc | 73 +++++++++++++++++++ source/blender/render/RE_pipeline.h | 6 -- source/blender/render/intern/pipeline.cc | 38 ---------- 13 files changed, 171 insertions(+), 185 deletions(-) diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index de33952bbfc..327315d1de5 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -186,34 +186,34 @@ def list_render_passes(scene, srl): # autopep8: off # Data passes. - if srl.use_pass_z: yield ("Depth", "Z", 'VALUE') - if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE') - if srl.use_pass_position: yield ("Position", "XYZ", 'VECTOR') - if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR') - if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR') - if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR') - if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE') - if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE') - if crl.use_pass_volume_majorant: yield ("Volume Majorant", "Z", 'VALUE') + if srl.use_pass_z: yield ("Depth", "Z", 'VALUE') + if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE') + if srl.use_pass_position: yield ("Position", "XYZ", 'VECTOR') + if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR') + if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR') + if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR') + if srl.use_pass_object_index: yield ("Object Index", "X", 'VALUE') + if srl.use_pass_material_index: yield ("Material Index", "X", 'VALUE') # Light passes. - if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR') - if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR') - if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR') - if srl.use_pass_glossy_direct: yield ("GlossDir", "RGB", 'COLOR') - if srl.use_pass_glossy_indirect: yield ("GlossInd", "RGB", 'COLOR') - if srl.use_pass_glossy_color: yield ("GlossCol", "RGB", 'COLOR') - if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR') - if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR') - if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR') - if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR') - if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR') - if crl.use_pass_volume_scatter: yield ("Volume Scatter", "RGB", 'COLOR') - if crl.use_pass_volume_transmit: yield ("Volume Transmit", "RGB", 'COLOR') - if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR') - if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR') - if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR') - if crl.use_pass_shadow_catcher: yield ("Shadow Catcher", "RGB", 'COLOR') + if srl.use_pass_diffuse_direct: yield ("Diffuse Direct", "RGB", 'COLOR') + if srl.use_pass_diffuse_indirect: yield ("Diffuse Indirect", "RGB", 'COLOR') + if srl.use_pass_diffuse_color: yield ("Diffuse Color", "RGB", 'COLOR') + if srl.use_pass_glossy_direct: yield ("Glossy Direct", "RGB", 'COLOR') + if srl.use_pass_glossy_indirect: yield ("Glossy Indirect", "RGB", 'COLOR') + if srl.use_pass_glossy_color: yield ("Glossy Color", "RGB", 'COLOR') + if srl.use_pass_transmission_direct: yield ("Transmission Direct", "RGB", 'COLOR') + if srl.use_pass_transmission_indirect: yield ("Transmission Indirect", "RGB", 'COLOR') + if srl.use_pass_transmission_color: yield ("Transmission Color", "RGB", 'COLOR') + if crl.use_pass_volume_direct: yield ("Volume Direct", "RGB", 'COLOR') + if crl.use_pass_volume_indirect: yield ("Volume Indirect", "RGB", 'COLOR') + if crl.use_pass_volume_scatter: yield ("Volume Scatter", "RGB", 'COLOR') + if crl.use_pass_volume_transmit: yield ("Volume Transmit", "RGB", 'COLOR') + if crl.use_pass_volume_majorant: yield ("Volume Majorant", "Z", 'VALUE') + if srl.use_pass_emit: yield ("Emission", "RGB", 'COLOR') + if srl.use_pass_environment: yield ("Environment", "RGB", 'COLOR') + if srl.use_pass_ambient_occlusion: yield ("Ambient Occlusion", "RGB", 'COLOR') + if crl.use_pass_shadow_catcher: yield ("Shadow Catcher", "RGB", 'COLOR') # autopep8: on # Debug passes. diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 0012948ad08..ca3936c10ad 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -928,7 +928,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): ('NORMAL', "Normal", "", 3), ('UV', "UV", "", 4), ('ROUGHNESS', "Roughness", "", 5), - ('EMIT', "Emit", "", 6), + ('EMIT', "Emission", "", 6), ('ENVIRONMENT', "Environment", "", 7), ('DIFFUSE', "Diffuse", "", 8), ('GLOSSY', "Glossy", "", 9), diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp index 6401e9bc4eb..0e24821409e 100644 --- a/intern/cycles/blender/sync.cpp +++ b/intern/cycles/blender/sync.cpp @@ -671,31 +671,31 @@ static bool get_known_pass_type(BL::RenderPass &b_pass, PassType &type, PassMode MAP_PASS("Mist", PASS_MIST, false); MAP_PASS("Position", PASS_POSITION, false); MAP_PASS("Normal", PASS_NORMAL, false); - MAP_PASS("IndexOB", PASS_OBJECT_ID, false); + MAP_PASS("Object Index", PASS_OBJECT_ID, false); MAP_PASS("UV", PASS_UV, false); MAP_PASS("Vector", PASS_MOTION, false); - MAP_PASS("IndexMA", PASS_MATERIAL_ID, false); + MAP_PASS("Material Index", PASS_MATERIAL_ID, false); - MAP_PASS("DiffDir", PASS_DIFFUSE_DIRECT, false); - MAP_PASS("GlossDir", PASS_GLOSSY_DIRECT, false); - MAP_PASS("TransDir", PASS_TRANSMISSION_DIRECT, false); - MAP_PASS("VolumeDir", PASS_VOLUME_DIRECT, false); + MAP_PASS("Diffuse Direct", PASS_DIFFUSE_DIRECT, false); + MAP_PASS("Glossy Direct", PASS_GLOSSY_DIRECT, false); + MAP_PASS("Transmission Direct", PASS_TRANSMISSION_DIRECT, false); + MAP_PASS("Volume Direct", PASS_VOLUME_DIRECT, false); - MAP_PASS("DiffInd", PASS_DIFFUSE_INDIRECT, false); - MAP_PASS("GlossInd", PASS_GLOSSY_INDIRECT, false); - MAP_PASS("TransInd", PASS_TRANSMISSION_INDIRECT, false); - MAP_PASS("VolumeInd", PASS_VOLUME_INDIRECT, false); + MAP_PASS("Diffuse Indirect", PASS_DIFFUSE_INDIRECT, false); + MAP_PASS("Glossy Indirect", PASS_GLOSSY_INDIRECT, false); + MAP_PASS("Transmission Indirect", PASS_TRANSMISSION_INDIRECT, false); + MAP_PASS("Volume Indirect", PASS_VOLUME_INDIRECT, false); MAP_PASS("Volume Scatter", PASS_VOLUME_SCATTER, false); MAP_PASS("Volume Transmit", PASS_VOLUME_TRANSMIT, false); MAP_PASS("Volume Majorant", PASS_VOLUME_MAJORANT, false); - MAP_PASS("DiffCol", PASS_DIFFUSE_COLOR, false); - MAP_PASS("GlossCol", PASS_GLOSSY_COLOR, false); - MAP_PASS("TransCol", PASS_TRANSMISSION_COLOR, false); + MAP_PASS("Diffuse Color", PASS_DIFFUSE_COLOR, false); + MAP_PASS("Glossy Color", PASS_GLOSSY_COLOR, false); + MAP_PASS("Transmission Color", PASS_TRANSMISSION_COLOR, false); - MAP_PASS("Emit", PASS_EMISSION, false); - MAP_PASS("Env", PASS_BACKGROUND, false); - MAP_PASS("AO", PASS_AO, false); + MAP_PASS("Emission", PASS_EMISSION, false); + MAP_PASS("Environment", PASS_BACKGROUND, false); + MAP_PASS("Ambient Occlusion", PASS_AO, false); MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE, false); MAP_PASS("BakeSeed", PASS_BAKE_SEED, false); diff --git a/scripts/addons_core/node_wrangler/utils/constants.py b/scripts/addons_core/node_wrangler/utils/constants.py index c46f6da1a81..0f6e1d54b00 100644 --- a/scripts/addons_core/node_wrangler/utils/constants.py +++ b/scripts/addons_core/node_wrangler/utils/constants.py @@ -14,28 +14,28 @@ from collections import namedtuple # rl_outputs entry = (render_pass, rl_output_name, exr_output_name, in_eevee, in_cycles) RL_entry = namedtuple('RL_Entry', ['render_pass', 'output_name', 'exr_output_name', 'in_eevee', 'in_cycles']) rl_outputs = ( - RL_entry('use_pass_ambient_occlusion', 'AO', 'AO', True, True), + RL_entry('use_pass_ambient_occlusion', 'Ambient Occlusion', 'Ambient Occlusion', True, True), RL_entry('use_pass_combined', 'Image', 'Combined', True, True), - RL_entry('use_pass_diffuse_color', 'Diffuse Color', 'DiffCol', False, True), - RL_entry('use_pass_diffuse_direct', 'Diffuse Direct', 'DiffDir', False, True), - RL_entry('use_pass_diffuse_indirect', 'Diffuse Indirect', 'DiffInd', False, True), - RL_entry('use_pass_emit', 'Emit', 'Emit', False, True), - RL_entry('use_pass_environment', 'Environment', 'Env', False, False), - RL_entry('use_pass_glossy_color', 'Glossy Color', 'GlossCol', False, True), - RL_entry('use_pass_glossy_direct', 'Glossy Direct', 'GlossDir', False, True), - RL_entry('use_pass_glossy_indirect', 'Glossy Indirect', 'GlossInd', False, True), + RL_entry('use_pass_diffuse_color', 'Diffuse Color', 'Diffuse Color', False, True), + RL_entry('use_pass_diffuse_direct', 'Diffuse Direct', 'Diffuse Direct', False, True), + RL_entry('use_pass_diffuse_indirect', 'Diffuse Indirect', 'Diffuse Indirect', False, True), + RL_entry('use_pass_emit', 'Emission', 'Emission', False, True), + RL_entry('use_pass_environment', 'Environment', 'Environment', False, False), + RL_entry('use_pass_glossy_color', 'Glossy Color', 'Glossy Color', False, True), + RL_entry('use_pass_glossy_direct', 'Glossy Direct', 'Glossy Direct', False, True), + RL_entry('use_pass_glossy_indirect', 'Glossy Indirect', 'Glossy Indirect', False, True), RL_entry('use_pass_indirect', 'Indirect', 'Indirect', False, False), - RL_entry('use_pass_material_index', 'IndexMA', 'IndexMA', False, True), + RL_entry('use_pass_material_index', 'Material Index', 'Material Index', False, True), RL_entry('use_pass_mist', 'Mist', 'Mist', True, True), RL_entry('use_pass_normal', 'Normal', 'Normal', True, True), - RL_entry('use_pass_object_index', 'IndexOB', 'IndexOB', False, True), + RL_entry('use_pass_object_index', 'Object Index', 'Object Index', False, True), RL_entry('use_pass_shadow', 'Shadow', 'Shadow', False, True), - RL_entry('use_pass_subsurface_color', 'Subsurface Color', 'SubsurfaceCol', True, True), - RL_entry('use_pass_subsurface_direct', 'Subsurface Direct', 'SubsurfaceDir', True, True), - RL_entry('use_pass_subsurface_indirect', 'Subsurface Indirect', 'SubsurfaceInd', False, True), - RL_entry('use_pass_transmission_color', 'Transmission Color', 'TransCol', False, True), - RL_entry('use_pass_transmission_direct', 'Transmission Direct', 'TransDir', False, True), - RL_entry('use_pass_transmission_indirect', 'Transmission Indirect', 'TransInd', False, True), + RL_entry('use_pass_subsurface_color', 'Subsurface Color', 'Subsurface Color', True, True), + RL_entry('use_pass_subsurface_direct', 'Subsurface Direct', 'Subsurface Direct', True, True), + RL_entry('use_pass_subsurface_indirect', 'Subsurface Indirect', 'Subsurface Indirect', False, True), + RL_entry('use_pass_transmission_color', 'Transmission Color', 'Transmission Color', False, True), + RL_entry('use_pass_transmission_direct', 'Transmission Direct', 'Transmission Direct', False, True), + RL_entry('use_pass_transmission_indirect', 'Transmission Indirect', 'Transmission Indirect', False, True), RL_entry('use_pass_uv', 'UV', 'UV', True, True), RL_entry('use_pass_vector', 'Speed', 'Vector', False, True), RL_entry('use_pass_z', 'Z', 'Depth', True, True), diff --git a/source/blender/blenkernel/intern/layer_test.cc b/source/blender/blenkernel/intern/layer_test.cc index 813c8c8b5c7..90764e2be2d 100644 --- a/source/blender/blenkernel/intern/layer_test.cc +++ b/source/blender/blenkernel/intern/layer_test.cc @@ -142,13 +142,19 @@ TEST(view_layer, aov_conflict) test_render_pass_conflict(&scene, engine, view_layer, aov, "Normal", "use_pass_normal"); test_render_pass_conflict(&scene, engine, view_layer, aov, "Mist", "use_pass_mist"); test_render_pass_conflict(&scene, engine, view_layer, aov, "Shadow", "use_pass_shadow"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "AO", "use_pass_ambient_occlusion"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "Emit", "use_pass_emit"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "Env", "use_pass_environment"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "DiffDir", "use_pass_diffuse_direct"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "DiffCol", "use_pass_diffuse_color"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "GlossDir", "use_pass_glossy_direct"); - test_render_pass_conflict(&scene, engine, view_layer, aov, "GlossCol", "use_pass_glossy_color"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Ambient Occlusion", "use_pass_ambient_occlusion"); + test_render_pass_conflict(&scene, engine, view_layer, aov, "Emission", "use_pass_emit"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Environment", "use_pass_environment"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Diffuse Direct", "use_pass_diffuse_direct"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Diffuse Color", "use_pass_diffuse_color"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Glossy Direct", "use_pass_glossy_direct"); + test_render_pass_conflict( + &scene, engine, view_layer, aov, "Glossy Color", "use_pass_glossy_color"); /* Tear down */ RE_engine_free(engine); diff --git a/source/blender/editors/object/object_bake_api.cc b/source/blender/editors/object/object_bake_api.cc index f113df2dbd6..d3ddec66fc6 100644 --- a/source/blender/editors/object/object_bake_api.cc +++ b/source/blender/editors/object/object_bake_api.cc @@ -613,14 +613,14 @@ static bool bake_pass_filter_check(eScenePassType pass_type, BKE_report(reports, RPT_ERROR, - "Combined bake pass requires Emit, or a light pass with " + "Combined bake pass requires Emission, or a light pass with " "Direct or Indirect contributions enabled"); return false; } BKE_report(reports, RPT_ERROR, - "Combined bake pass requires Emit, or a light pass with " + "Combined bake pass requires Emission, or a light pass with " "Direct or Indirect contributions enabled"); return false; case SCE_PASS_DIFFUSE_COLOR: diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 2ded1c0a399..49376905717 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -330,39 +330,38 @@ typedef enum eScenePassType { #define RE_PASSNAME_POSITION "Position" #define RE_PASSNAME_NORMAL "Normal" #define RE_PASSNAME_UV "UV" -#define RE_PASSNAME_EMIT "Emit" +#define RE_PASSNAME_EMIT "Emission" #define RE_PASSNAME_SHADOW "Shadow" -#define RE_PASSNAME_AO "AO" -#define RE_PASSNAME_ENVIRONMENT "Env" -#define RE_PASSNAME_INDEXOB "IndexOB" -#define RE_PASSNAME_INDEXMA "IndexMA" +#define RE_PASSNAME_AO "Ambient Occlusion" +#define RE_PASSNAME_ENVIRONMENT "Environment" +#define RE_PASSNAME_INDEXOB "Object Index" +#define RE_PASSNAME_INDEXMA "Material Index" #define RE_PASSNAME_MIST "Mist" -#define RE_PASSNAME_DIFFUSE_DIRECT "DiffDir" -#define RE_PASSNAME_DIFFUSE_INDIRECT "DiffInd" -#define RE_PASSNAME_DIFFUSE_COLOR "DiffCol" -#define RE_PASSNAME_GLOSSY_DIRECT "GlossDir" -#define RE_PASSNAME_GLOSSY_INDIRECT "GlossInd" -#define RE_PASSNAME_GLOSSY_COLOR "GlossCol" -#define RE_PASSNAME_TRANSM_DIRECT "TransDir" -#define RE_PASSNAME_TRANSM_INDIRECT "TransInd" -#define RE_PASSNAME_TRANSM_COLOR "TransCol" +#define RE_PASSNAME_DIFFUSE_DIRECT "Diffuse Direct" +#define RE_PASSNAME_DIFFUSE_INDIRECT "Diffuse Indirect" +#define RE_PASSNAME_DIFFUSE_COLOR "Diffuse Color" +#define RE_PASSNAME_GLOSSY_DIRECT "Glossy Direct" +#define RE_PASSNAME_GLOSSY_INDIRECT "Glossy Indirect" +#define RE_PASSNAME_GLOSSY_COLOR "Glossy Color" +#define RE_PASSNAME_TRANSM_DIRECT "Transmission Direct" +#define RE_PASSNAME_TRANSM_INDIRECT "Transmission Indirect" +#define RE_PASSNAME_TRANSM_COLOR "Transmission Color" -#define RE_PASSNAME_SUBSURFACE_DIRECT "SubsurfaceDir" -#define RE_PASSNAME_SUBSURFACE_INDIRECT "SubsurfaceInd" -#define RE_PASSNAME_SUBSURFACE_COLOR "SubsurfaceCol" +#define RE_PASSNAME_SUBSURFACE_DIRECT "Subsurface Direct" +#define RE_PASSNAME_SUBSURFACE_INDIRECT "Subsurface Indirect" +#define RE_PASSNAME_SUBSURFACE_COLOR "Subsurface Color" #define RE_PASSNAME_FREESTYLE "Freestyle" -#define RE_PASSNAME_BLOOM "BloomCol" -#define RE_PASSNAME_VOLUME_LIGHT "VolumeDir" -#define RE_PASSNAME_TRANSPARENT "Transp" +#define RE_PASSNAME_VOLUME_LIGHT "Volume Direct" +#define RE_PASSNAME_TRANSPARENT "Transparent" #define RE_PASSNAME_CRYPTOMATTE_OBJECT "CryptoObject" #define RE_PASSNAME_CRYPTOMATTE_ASSET "CryptoAsset" #define RE_PASSNAME_CRYPTOMATTE_MATERIAL "CryptoMaterial" -#define RE_PASSNAME_GREASE_PENCIL "GreasePencil" +#define RE_PASSNAME_GREASE_PENCIL "Grease Pencil" /** \} */ diff --git a/source/blender/makesrna/RNA_enum_items.hh b/source/blender/makesrna/RNA_enum_items.hh index 612f8d5188f..5f9b424617e 100644 --- a/source/blender/makesrna/RNA_enum_items.hh +++ b/source/blender/makesrna/RNA_enum_items.hh @@ -148,8 +148,6 @@ DEF_ENUM(rna_enum_rigidbody_constraint_type_items) DEF_ENUM(rna_enum_object_axis_items) -DEF_ENUM(rna_enum_render_pass_type_items) - DEF_ENUM(rna_enum_bake_pass_type_items) DEF_ENUM(rna_enum_bake_pass_filter_type_items) diff --git a/source/blender/makesrna/intern/rna_render.cc b/source/blender/makesrna/intern/rna_render.cc index 730997d1b9c..9a7f244437e 100644 --- a/source/blender/makesrna/intern/rna_render.cc +++ b/source/blender/makesrna/intern/rna_render.cc @@ -24,36 +24,6 @@ #include "RE_engine.h" -/* Deprecated, only provided for API compatibility. */ -const EnumPropertyItem rna_enum_render_pass_type_items[] = { - {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, - {SCE_PASS_DEPTH, "Z", 0, "Z", ""}, - {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""}, - {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""}, - {SCE_PASS_POSITION, "POSITION", 0, "Position", ""}, - {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, - {SCE_PASS_VECTOR, "VECTOR", 0, "Vector", ""}, - {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""}, - {SCE_PASS_UV, "UV", 0, "UV", ""}, - {SCE_PASS_MIST, "MIST", 0, "Mist", ""}, - {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""}, - {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""}, - {SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""}, - {SCE_PASS_DIFFUSE_DIRECT, "DIFFUSE_DIRECT", 0, "Diffuse Direct", ""}, - {SCE_PASS_DIFFUSE_INDIRECT, "DIFFUSE_INDIRECT", 0, "Diffuse Indirect", ""}, - {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""}, - {SCE_PASS_GLOSSY_DIRECT, "GLOSSY_DIRECT", 0, "Glossy Direct", ""}, - {SCE_PASS_GLOSSY_INDIRECT, "GLOSSY_INDIRECT", 0, "Glossy Indirect", ""}, - {SCE_PASS_GLOSSY_COLOR, "GLOSSY_COLOR", 0, "Glossy Color", ""}, - {SCE_PASS_TRANSM_DIRECT, "TRANSMISSION_DIRECT", 0, "Transmission Direct", ""}, - {SCE_PASS_TRANSM_INDIRECT, "TRANSMISSION_INDIRECT", 0, "Transmission Indirect", ""}, - {SCE_PASS_TRANSM_COLOR, "TRANSMISSION_COLOR", 0, "Transmission Color", ""}, - {SCE_PASS_SUBSURFACE_DIRECT, "SUBSURFACE_DIRECT", 0, "Subsurface Direct", ""}, - {SCE_PASS_SUBSURFACE_INDIRECT, "SUBSURFACE_INDIRECT", 0, "Subsurface Indirect", ""}, - {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE_COLOR", 0, "Subsurface Color", ""}, - {0, nullptr, 0, nullptr, nullptr}, -}; - const EnumPropertyItem rna_enum_bake_pass_type_items[] = { {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""}, @@ -62,7 +32,7 @@ const EnumPropertyItem rna_enum_bake_pass_type_items[] = { {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, {SCE_PASS_UV, "UV", 0, "UV", ""}, {int(SCE_PASS_ROUGHNESS), "ROUGHNESS", 0, "ROUGHNESS", ""}, - {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""}, + {SCE_PASS_EMIT, "EMIT", 0, "Emission", ""}, {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""}, {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE", 0, "Diffuse", ""}, {SCE_PASS_GLOSSY_COLOR, "GLOSSY", 0, "Glossy", ""}, @@ -532,11 +502,6 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) memcpy(buffer, values, size_in_bytes); } -static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view) -{ - return RE_pass_find_by_type(rl, passtype, view); -} - static RenderPass *rna_RenderPass_find_by_name(RenderLayer *rl, const char *name, const char *view) { return RE_pass_find_by_name(rl, name, view); @@ -1130,17 +1095,6 @@ static void rna_def_render_passes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_sdna(srna, "RenderLayer"); RNA_def_struct_ui_text(srna, "Render Passes", "Collection of render passes"); - func = RNA_def_function(srna, "find_by_type", "rna_RenderPass_find_by_type"); - RNA_def_function_ui_description(func, "Get the render pass for a given type and view"); - parm = RNA_def_enum( - func, "pass_type", rna_enum_render_pass_type_items, SCE_PASS_COMBINED, "Pass", ""); - RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED); - parm = RNA_def_string( - func, "view", nullptr, 0, "View", "Render view to get pass from"); /* nullptr ok here */ - RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED); - parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass"); - RNA_def_function_return(func, parm); - func = RNA_def_function(srna, "find_by_name", "rna_RenderPass_find_by_name"); RNA_def_function_ui_description(func, "Get the render pass for a given name and view"); parm = RNA_def_string(func, "name", RE_PASSNAME_COMBINED, 0, "Pass", ""); diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index e39a2f57d9e..672467cd885 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -5189,7 +5189,7 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "passflag", SCE_PASS_EMIT); - RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass"); + RNA_def_property_ui_text(prop, "Emission", "Deliver emission pass"); if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); } @@ -6027,7 +6027,7 @@ static void rna_def_bake_data(BlenderRNA *brna) /* custom passes flags */ prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "pass_filter", R_BAKE_PASS_FILTER_EMIT); - RNA_def_property_ui_text(prop, "Emit", "Add emission contribution"); + RNA_def_property_ui_text(prop, "Emission", "Add emission contribution"); prop = RNA_def_property(srna, "use_pass_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "pass_filter", R_BAKE_PASS_FILTER_DIRECT); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 1a67d33b8d2..74e57b3f7c7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -86,6 +86,66 @@ static blender::bke::bNodeSocketTemplate cmp_node_rlayers_out[] = { }; #define NUM_LEGACY_SOCKETS (ARRAY_SIZE(cmp_node_rlayers_out) - 1) +static const char *cmp_node_legacy_pass_name(const char *name) +{ + if (STREQ(name, "Diffuse Direct")) { + return "DiffDir"; + } + if (STREQ(name, "Diffuse Indirect")) { + return "DiffInd"; + } + if (STREQ(name, "Diffuse Color")) { + return "DiffCol"; + } + if (STREQ(name, "Glossy Direct")) { + return "GlossDir"; + } + if (STREQ(name, "Glossy Indirect")) { + return "GlossInd"; + } + if (STREQ(name, "Glossy Color")) { + return "GlossCol"; + } + if (STREQ(name, "Transmission Direct")) { + return "TransDir"; + } + if (STREQ(name, "Transmission Indirect")) { + return "TransInd"; + } + if (STREQ(name, "Transmission Color")) { + return "TransCol"; + } + if (STREQ(name, "Volume Direct")) { + return "VolumeDir"; + } + if (STREQ(name, "Volume Indirect")) { + return "VolumeInd"; + } + if (STREQ(name, "Volume Color")) { + return "VolumeCol"; + } + if (STREQ(name, "Ambient Occlusion")) { + return "AO"; + } + if (STREQ(name, "Environment")) { + return "Env"; + } + if (STREQ(name, "Material Index")) { + return "IndexMA"; + } + if (STREQ(name, "Object Index")) { + return "IndexOB"; + } + if (STREQ(name, "Grease Pencil")) { + return "GreasePencil"; + } + if (STREQ(name, "Emission")) { + return "Emit"; + } + + return nullptr; +} + static void cmp_node_image_add_pass_output(bNodeTree *ntree, bNode *node, const char *name, @@ -99,6 +159,19 @@ static void cmp_node_image_add_pass_output(bNodeTree *ntree, bNodeSocket *sock = (bNodeSocket *)BLI_findstring( &node->outputs, name, offsetof(bNodeSocket, name)); + /* Rename legacy socket names to new ones. */ + if (sock == nullptr) { + const char *legacy_name = cmp_node_legacy_pass_name(name); + if (legacy_name) { + sock = (bNodeSocket *)BLI_findstring( + &node->outputs, legacy_name, offsetof(bNodeSocket, name)); + if (sock) { + STRNCPY(sock->name, name); + STRNCPY(sock->identifier, name); + } + } + } + /* Replace if types don't match. */ if (sock && sock->type != type) { blender::bke::node_remove_socket(*ntree, *node, *sock); diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index 3f3e94dbeb9..a86f82cc2ac 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -468,12 +468,6 @@ bool RE_passes_have_name(struct RenderLayer *rl); struct RenderPass *RE_pass_find_by_name(struct RenderLayer *rl, const char *name, const char *viewname); -/** - * Only provided for API compatibility, don't use this in new code! - */ -struct RenderPass *RE_pass_find_by_type(struct RenderLayer *rl, - int passtype, - const char *viewname); /** * Set the buffer data of the render pass. diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc index 30c7c9e654e..59892af23a6 100644 --- a/source/blender/render/intern/pipeline.cc +++ b/source/blender/render/intern/pipeline.cc @@ -2916,44 +2916,6 @@ RenderPass *RE_pass_find_by_name(RenderLayer *rl, const char *name, const char * return nullptr; } -RenderPass *RE_pass_find_by_type(RenderLayer *rl, int passtype, const char *viewname) -{ -#define CHECK_PASS(NAME) \ - if (passtype == SCE_PASS_##NAME) { \ - return RE_pass_find_by_name(rl, RE_PASSNAME_##NAME, viewname); \ - } \ - ((void)0) - - CHECK_PASS(COMBINED); - CHECK_PASS(DEPTH); - CHECK_PASS(VECTOR); - CHECK_PASS(NORMAL); - CHECK_PASS(UV); - CHECK_PASS(EMIT); - CHECK_PASS(SHADOW); - CHECK_PASS(AO); - CHECK_PASS(ENVIRONMENT); - CHECK_PASS(INDEXOB); - CHECK_PASS(INDEXMA); - CHECK_PASS(MIST); - CHECK_PASS(DIFFUSE_DIRECT); - CHECK_PASS(DIFFUSE_INDIRECT); - CHECK_PASS(DIFFUSE_COLOR); - CHECK_PASS(GLOSSY_DIRECT); - CHECK_PASS(GLOSSY_INDIRECT); - CHECK_PASS(GLOSSY_COLOR); - CHECK_PASS(TRANSM_DIRECT); - CHECK_PASS(TRANSM_INDIRECT); - CHECK_PASS(TRANSM_COLOR); - CHECK_PASS(SUBSURFACE_DIRECT); - CHECK_PASS(SUBSURFACE_INDIRECT); - CHECK_PASS(SUBSURFACE_COLOR); - -#undef CHECK_PASS - - return nullptr; -} - RenderPass *RE_create_gp_pass(RenderResult *rr, const char *layername, const char *viewname) { RenderLayer *rl = RE_GetRenderLayer(rr, layername);