19 .
description(
"The edge to retrieve data from. Defaults to the edge from the context")
20 .structure_type(StructureType::Field);
22 "Values that sort the corners attached to the edge");
26 .
description(
"Which of the sorted corners to output");
28 .field_source_reference_all()
30 "A corner of the input edge in its face's winding order, chosen by the sort index");
31 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
32 "The number of faces or corners connected to each edge");
42 :
bke::MeshFieldInput(
CPPType::get<int>(),
"Corner of Edge"),
43 edge_index_(std::move(edge_index)),
44 sort_index_(std::move(sort_index)),
45 sort_weight_(std::move(sort_weight))
57 const Span<int> corner_edges = mesh.corner_edges();
59 mesh.corner_edges(), mesh.edges_num, map_offsets, map_indices);
63 evaluator.
add(edge_index_);
64 evaluator.
add(sort_index_);
71 corner_evaluator.
add(sort_weight_);
74 const bool use_sorting = !all_sort_weights.
is_single();
83 for (
const int selection_i : segment) {
84 const int edge_i = edge_indices[selection_i];
85 const int index_in_sort = indices_in_sort[selection_i];
87 corner_of_edge[selection_i] = 0;
91 const Span<int> corners = edge_to_corner_map[edge_i];
92 if (corners.is_empty()) {
93 corner_of_edge[selection_i] = 0;
97 const int index_in_sort_wrapped =
mod_i(index_in_sort, corners.size());
111 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
112 return sort_weights[a] < sort_weights[b];
114 corner_of_edge[selection_i] = corners[sort_indices[index_in_sort_wrapped]];
117 corner_of_edge[selection_i] = corners[index_in_sort_wrapped];
127 edge_index_.node().for_each_field_input_recursive(
fn);
128 sort_index_.node().for_each_field_input_recursive(
fn);
129 sort_weight_.node().for_each_field_input_recursive(
fn);
134 return AttrDomain::Edge;
149 if (domain != AttrDomain::Edge) {
159 return 2345897985577;
169 return AttrDomain::Edge;
176 if (
params.output_is_required(
"Total")) {
177 params.set_output(
"Total",
178 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
180 Field<int>(std::make_shared<CornersOfEdgeCountInput>()),
183 if (
params.output_is_required(
"Corner Index")) {
184 params.set_output(
"Corner Index",
185 Field<int>(std::make_shared<CornersOfEdgeInput>(
196 ntype.
ui_name =
"Corners of Edge";
197 ntype.
ui_description =
"Retrieve face corners connected to edges";
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE
MINLINE int mod_i(int i, int n)
@ NODE_DEFAULT_INPUT_INDEX_FIELD
#define NOD_REGISTER_NODE(REGISTER_FUNC)
unsigned long long int uint64_t
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
static IndexMask from_indices(Span< T > indices, IndexMaskMemory &memory)
constexpr bool contains(int64_t value) const
constexpr int64_t size() const
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
static VArray from_container(ContainerT container)
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void count_indices(Span< int > indices, MutableSpan< int > counts)
void fill_index_range(MutableSpan< T > span, const T start=0)
GroupedSpan< int > build_edge_to_corner_map(Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices)
void node_register_type(bNodeType &ntype)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare