Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc
| Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms) | ||||
| if (params.in_out() == SOCK_IN) { | if (params.in_out() == SOCK_IN) { | ||||
| params.add_item(IFACE_("Attribute"), [node_type, type](LinkSearchOpParams ¶ms) { | params.add_item(IFACE_("Attribute"), [node_type, type](LinkSearchOpParams ¶ms) { | ||||
| bNode &node = params.add_node(node_type); | bNode &node = params.add_node(node_type); | ||||
| node.custom1 = *type; | node.custom1 = *type; | ||||
| params.update_and_connect_available_socket(node, "Attribute"); | params.update_and_connect_available_socket(node, "Attribute"); | ||||
| }); | }); | ||||
| } | } | ||||
| else { | else { | ||||
| for (const SocketDeclarationPtr &socket_decl : declaration.outputs()) { | for (const StringRefNull name : | ||||
| StringRefNull name = socket_decl->name(); | {"Mean", "Median", "Sum", "Min", "Max", "Range", "Standard Deviation", "Variance"}) { | ||||
| params.add_item(IFACE_(name.c_str()), [node_type, name, type](LinkSearchOpParams ¶ms) { | params.add_item(IFACE_(name.c_str()), [node_type, name, type](LinkSearchOpParams ¶ms) { | ||||
| bNode &node = params.add_node(node_type); | bNode &node = params.add_node(node_type); | ||||
| node.custom1 = *type; | node.custom1 = *type; | ||||
| params.update_and_connect_available_socket(node, name); | params.update_and_connect_available_socket(node, name); | ||||
| }); | }); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | |||||
| void register_node_type_geo_attribute_statistic() | void register_node_type_geo_attribute_statistic() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_attribute_statistic_cc; | namespace file_ns = blender::nodes::node_geo_attribute_statistic_cc; | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| geo_node_type_base( | geo_node_type_base( | ||||
| &ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE, 0); | &ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE); | ||||
| ntype.declare = file_ns::node_declare; | ntype.declare = file_ns::node_declare; | ||||
| node_type_init(&ntype, file_ns::node_init); | node_type_init(&ntype, file_ns::node_init); | ||||
| node_type_update(&ntype, file_ns::node_update); | node_type_update(&ntype, file_ns::node_update); | ||||
| ntype.geometry_node_execute = file_ns::node_geo_exec; | ntype.geometry_node_execute = file_ns::node_geo_exec; | ||||
| ntype.draw_buttons = file_ns::node_layout; | ntype.draw_buttons = file_ns::node_layout; | ||||
| ntype.gather_link_search_ops = file_ns::node_gather_link_searches; | ntype.gather_link_search_ops = file_ns::node_gather_link_searches; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||