From 53c98e45cf73eadd044e5b87db47f41ea3ff8f42 Mon Sep 17 00:00:00 2001 From: Eitan Date: Thu, 10 Jun 2021 10:16:37 -0500 Subject: Geometry Nodes: Add Texture and Material options to switch node These new socket types can be supported in the switch node along with the others. Differential Revision: https://developer.blender.org/D11560 --- source/blender/makesrna/intern/rna_nodetree.c | 4 +++- source/blender/nodes/geometry/nodes/node_geo_switch.cc | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6a38a22f9b2..b625f0fc204 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1985,7 +1985,9 @@ static bool switch_type_supported(const EnumPropertyItem *item) SOCK_RGBA, SOCK_GEOMETRY, SOCK_OBJECT, - SOCK_COLLECTION); + SOCK_COLLECTION, + SOCK_TEXTURE, + SOCK_MATERIAL); } static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C), diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc index 742fafba9e6..0aa5c68aaf5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc @@ -40,6 +40,10 @@ static bNodeSocketTemplate geo_node_switch_in[] = { {SOCK_OBJECT, N_("True")}, {SOCK_COLLECTION, N_("False")}, {SOCK_COLLECTION, N_("True")}, + {SOCK_TEXTURE, N_("False")}, + {SOCK_TEXTURE, N_("True")}, + {SOCK_MATERIAL, N_("False")}, + {SOCK_MATERIAL, N_("True")}, {-1, ""}, }; @@ -53,6 +57,8 @@ static bNodeSocketTemplate geo_node_switch_out[] = { {SOCK_GEOMETRY, N_("Output")}, {SOCK_OBJECT, N_("Output")}, {SOCK_COLLECTION, N_("Output")}, + {SOCK_TEXTURE, N_("Output")}, + {SOCK_MATERIAL, N_("Output")}, {-1, ""}, }; @@ -153,6 +159,14 @@ static void geo_node_switch_exec(GeoNodeExecParams params) output_input(params, input, "_008", "Output_008"); break; } + case SOCK_TEXTURE: { + output_input(params, input, "_009", "Output_009"); + break; + } + case SOCK_MATERIAL: { + output_input(params, input, "_010", "Output_010"); + break; + } default: BLI_assert_unreachable(); break; -- cgit v1.2.3