Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-12-16 03:05:45 +0300
committerHans Goudey <h.goudey@me.com>2021-12-16 03:05:45 +0300
commitb265b447b639601ab53d1dc3cae0c3a95020cd64 (patch)
tree76bda73cece22524358a78fab7f593584406a09f /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
parent36a830b4d36d31ae29166e0defa6ed62a9a7a321 (diff)
Fix various cases of incorrect filtering in node link drag search
Some nodes didn't check the type of the link's socket for filtering. Do this with a combination of manually calling the node tree's validate links function and using the helper function for declarations. Also clean up a few cases that added geometry sockets manually when they can use the simpler helper function.
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc53
1 files changed, 28 insertions, 25 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
index 389dc278197..41ad4d79f1e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
@@ -109,31 +109,34 @@ static void node_gather_link_searches(GatherLinkSearchOpParams &params)
search_link_ops_for_declarations(params, declaration.outputs());
return;
}
- params.add_item(IFACE_("Count"), [](LinkSearchOpParams &params) {
- bNode &node = params.add_node("GeometryNodeMeshLine");
- node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_OFFSET;
- params.connect_available_socket(node, "Count");
- });
- params.add_item(IFACE_("Resolution"), [](LinkSearchOpParams &params) {
- bNode &node = params.add_node("GeometryNodeMeshLine");
- node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_OFFSET;
- node_storage(node).count_mode = GEO_NODE_MESH_LINE_COUNT_RESOLUTION;
- params.connect_available_socket(node, "Resolution");
- });
- params.add_item(IFACE_("Start Location"), [](LinkSearchOpParams &params) {
- bNode &node = params.add_node("GeometryNodeMeshLine");
- params.connect_available_socket(node, "Start Location");
- });
- params.add_item(IFACE_("Offset"), [](LinkSearchOpParams &params) {
- bNode &node = params.add_node("GeometryNodeMeshLine");
- params.connect_available_socket(node, "Offset");
- });
- /* The last socket is reused in end points mode. */
- params.add_item(IFACE_("End Location"), [](LinkSearchOpParams &params) {
- bNode &node = params.add_node("GeometryNodeMeshLine");
- node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_END_POINTS;
- params.connect_available_socket(node, "Offset");
- });
+ else if (params.node_tree().typeinfo->validate_link(
+ static_cast<eNodeSocketDatatype>(params.other_socket().type), SOCK_FLOAT)) {
+ params.add_item(IFACE_("Count"), [](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeMeshLine");
+ node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_OFFSET;
+ params.connect_available_socket(node, "Count");
+ });
+ params.add_item(IFACE_("Resolution"), [](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeMeshLine");
+ node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_OFFSET;
+ node_storage(node).count_mode = GEO_NODE_MESH_LINE_COUNT_RESOLUTION;
+ params.connect_available_socket(node, "Resolution");
+ });
+ params.add_item(IFACE_("Start Location"), [](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeMeshLine");
+ params.connect_available_socket(node, "Start Location");
+ });
+ params.add_item(IFACE_("Offset"), [](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeMeshLine");
+ params.connect_available_socket(node, "Offset");
+ });
+ /* The last socket is reused in end points mode. */
+ params.add_item(IFACE_("End Location"), [](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeMeshLine");
+ node_storage(node).mode = GEO_NODE_MESH_LINE_MODE_END_POINTS;
+ params.connect_available_socket(node, "Offset");
+ });
+ }
}
static void node_geo_exec(GeoNodeExecParams params)