Geometry Nodes: Add Image Socket to Switch Node

Add the image type to the switch node without field support.

Differential Revision: https://developer.blender.org/D13012
This commit is contained in:
Johnny Matthews 2021-10-27 09:03:29 -05:00
parent 974002743e
commit dc37990e24
2 changed files with 9 additions and 1 deletions

View File

@ -2056,7 +2056,8 @@ static bool switch_type_supported(const EnumPropertyItem *item)
SOCK_OBJECT,
SOCK_COLLECTION,
SOCK_TEXTURE,
SOCK_MATERIAL);
SOCK_MATERIAL,
SOCK_IMAGE);
}
static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C),

View File

@ -60,6 +60,8 @@ static void geo_node_switch_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Texture>("True", "True_009");
b.add_input<decl::Material>("False", "False_010");
b.add_input<decl::Material>("True", "True_010");
b.add_input<decl::Image>("False", "False_011");
b.add_input<decl::Image>("True", "True_011");
b.add_output<decl::Float>("Output").dependent_field();
b.add_output<decl::Int>("Output", "Output_001").dependent_field();
@ -72,6 +74,7 @@ static void geo_node_switch_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Collection>("Output", "Output_008");
b.add_output<decl::Texture>("Output", "Output_009");
b.add_output<decl::Material>("Output", "Output_010");
b.add_output<decl::Image>("Output", "Output_011");
}
static void geo_node_switch_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@ -274,6 +277,10 @@ static void geo_node_switch_exec(GeoNodeExecParams params)
switch_no_fields<Material *>(params, "_010");
break;
}
case SOCK_IMAGE: {
switch_no_fields<Image *>(params, "_011");
break;
}
default:
BLI_assert_unreachable();
break;