Fix: Assert in Menu Switch node

Blender asserts when updating declaration of Menu Switch node, that's
because a compositor specific function always ran. Fix this by running
for compositor node trees only.

Pull Request: https://projects.blender.org/blender/blender/pulls/142331
This commit is contained in:
Omar Emara
2025-07-18 12:32:30 +02:00
committed by Omar Emara
parent 80b2302ec5
commit 42fbb6149c

View File

@@ -47,11 +47,14 @@ static void node_declare(blender::nodes::NodeDeclarationBuilder &b)
const eNodeSocketDatatype data_type = eNodeSocketDatatype(storage.data_type);
const bool supports_fields = socket_type_supports_fields(data_type) &&
ntree->type == NTREE_GEOMETRY;
const bool is_single_compositor_type = compositor::Result::is_single_value_only_type(
compositor::socket_data_type_to_result_type(data_type));
const StructureType compositor_structure_type = is_single_compositor_type ?
StructureType::Single :
StructureType::Dynamic;
StructureType compositor_structure_type = StructureType::Dynamic;
if (ntree->type == NTREE_COMPOSIT) {
const bool is_single_compositor_type = compositor::Result::is_single_value_only_type(
compositor::socket_data_type_to_result_type(data_type));
compositor_structure_type = is_single_compositor_type ? StructureType::Single :
StructureType::Dynamic;
}
auto &menu = b.add_input<decl::Menu>("Menu");
if (supports_fields) {