diff options
author | Hans Goudey <h.goudey@me.com> | 2021-12-15 18:51:57 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-12-15 18:51:57 +0300 |
commit | 11be151d58ec0ca955f019b0eed738e3245110b8 (patch) | |
tree | 5f9673d5a91060fb3bb2156dddb32c2e95409b48 /source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc | |
parent | 474adc6f883c2d5a854d7324364f7996044d83cb (diff) |
Node Editor: Link Drag Search Menu
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.
A few special operators for creating a reroute or a group input node
are also added to the search.
Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.
A small "+" is displayed next to the cursor to give a hint about this.
Further improvements are possible after this first iteration:
- Support custom node trees.
- Better drawing of items in the search menu.
- Potential tweaks to filtering of items, depending on user feedback.
Thanks to Juanfran Matheu for developing an initial patch.
Differential Revision: https://developer.blender.org/D8286
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc index 2f9dfa8158b..0e9425246cb 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc @@ -47,8 +47,18 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveToPoints) static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE); - b.add_input<decl::Int>(N_("Count")).default_value(10).min(2).max(100000); - b.add_input<decl::Float>(N_("Length")).default_value(0.1f).min(0.001f).subtype(PROP_DISTANCE); + b.add_input<decl::Int>(N_("Count")) + .default_value(10) + .min(2) + .max(100000) + .make_available( + [](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_RESAMPLE_COUNT; }); + b.add_input<decl::Float>(N_("Length")) + .default_value(0.1f) + .min(0.001f) + .subtype(PROP_DISTANCE) + .make_available( + [](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_RESAMPLE_LENGTH; }); b.add_output<decl::Geometry>(N_("Points")); b.add_output<decl::Vector>(N_("Tangent")).field_source(); b.add_output<decl::Vector>(N_("Normal")).field_source(); @@ -401,6 +411,5 @@ void register_node_type_geo_curve_to_points() &ntype, "NodeGeometryCurveToPoints", node_free_standard_storage, node_copy_standard_storage); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); - nodeRegisterType(&ntype); } |