diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc index d4d7ecf6ae3..fe64b799409 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc @@ -145,11 +145,16 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms) } class LazyFunctionForSwitchNode : public LazyFunction { + private: + bool can_be_field_ = false; + public: LazyFunctionForSwitchNode(const bNode &node) { const NodeSwitch &storage = node_storage(node); const eNodeSocketDatatype data_type = eNodeSocketDatatype(storage.input_type); + can_be_field_ = ELEM(data_type, SOCK_FLOAT, SOCK_INT, SOCK_BOOLEAN, SOCK_VECTOR, SOCK_RGBA); + const bNodeSocketType *socket_type = nullptr; for (const bNodeSocket *socket : node.output_sockets()) { if (socket->type == data_type) { @@ -169,7 +174,7 @@ class LazyFunctionForSwitchNode : public LazyFunction { void execute_impl(lf::Params ¶ms, const lf::Context & /*context*/) const override { const ValueOrField condition = params.get_input>(0); - if (condition.is_field()) { + if (condition.is_field() && can_be_field_) { Field condition_field = condition.as_field(); if (condition_field.node().depends_on_input()) { this->execute_field(condition.as_field(), params);