[Bf-blender-cvs] [570acac7959] master: Geometry Nodes: Improve switch node search for booleans
Hans Goudey
noreply at git.blender.org
Thu Dec 8 18:59:18 CET 2022
Commit: 570acac79596021c4f50ddb200fb0b0eab380e0e
Author: Hans Goudey
Date: Thu Dec 8 11:09:24 2022 -0600
Branches: master
https://developer.blender.org/rB570acac79596021c4f50ddb200fb0b0eab380e0e
Geometry Nodes: Improve switch node search for booleans
Prioritize the "Switch" input for boolean sockets, since that is by
far the most common goal when connecting a boolean to the
switch node.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_switch.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc
index 4a8bbf65f41..e286d5bd364 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc
@@ -120,22 +120,32 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
});
}
else {
+ /* Make sure the switch input comes first in the search for boolean sockets. */
+ int true_false_weights = 0;
if (params.other_socket().type == SOCK_BOOLEAN) {
params.add_item(IFACE_("Switch"), [](LinkSearchOpParams ¶ms) {
bNode &node = params.add_node("GeometryNodeSwitch");
params.update_and_connect_available_socket(node, "Switch");
});
+ true_false_weights--;
}
- params.add_item(IFACE_("False"), [](LinkSearchOpParams ¶ms) {
- bNode &node = params.add_node("GeometryNodeSwitch");
- node_storage(node).input_type = params.socket.type;
- params.update_and_connect_available_socket(node, "False");
- });
- params.add_item(IFACE_("True"), [](LinkSearchOpParams ¶ms) {
- bNode &node = params.add_node("GeometryNodeSwitch");
- node_storage(node).input_type = params.socket.type;
- params.update_and_connect_available_socket(node, "True");
- });
+
+ params.add_item(
+ IFACE_("False"),
+ [](LinkSearchOpParams ¶ms) {
+ bNode &node = params.add_node("GeometryNodeSwitch");
+ node_storage(node).input_type = params.socket.type;
+ params.update_and_connect_available_socket(node, "False");
+ },
+ true_false_weights);
+ params.add_item(
+ IFACE_("True"),
+ [](LinkSearchOpParams ¶ms) {
+ bNode &node = params.add_node("GeometryNodeSwitch");
+ node_storage(node).input_type = params.socket.type;
+ params.update_and_connect_available_socket(node, "True");
+ },
+ true_false_weights);
}
}
More information about the Bf-blender-cvs
mailing list