19 .
description(
"The edge to retrieve data from. Defaults to the edge from the context")
20 .structure_type(StructureType::Field);
22 .structure_type(StructureType::Field)
24 .description(
"Values that sort the corners attached to the edge");
26 .structure_type(StructureType::Field)
27 .
description(
"Which of the sorted corners to output. Negative indexing is supported");
29 .structure_type(StructureType::Field)
30 .propagate_references()
32 "A corner of the input edge in its face's winding order, chosen by the sort index");
34 .structure_type(StructureType::Field)
35 .propagate_references({0})
36 .description(
"The number of faces or corners connected to each edge");
47 edge_index_(std::move(edge_index)),
48 sort_index_(std::move(sort_index)),
49 sort_weight_(std::move(sort_weight))
62 mesh.corner_edges(),
mesh.edges_num, map_offsets, map_indices);
66 evaluator.
add(edge_index_);
67 evaluator.
add(sort_index_);
74 corner_evaluator.
add(sort_weight_);
77 const bool use_sorting = !all_sort_weights.
is_single();
87 for (
const int selection_i : segment) {
88 const int edge_i = edge_indices[selection_i];
89 const int index_in_sort = indices_in_sort[selection_i];
91 corner_of_edge[selection_i] = 0;
95 const Span<int> corners = edge_to_corner_map[edge_i];
96 if (corners.is_empty()) {
97 corner_of_edge[selection_i] = 0;
101 const int index_in_sort_wrapped =
mod_i(index_in_sort, corners.size());
115 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
116 return sort_weights[a] < sort_weights[b];
118 corner_of_edge[selection_i] = corners[sort_indices[index_in_sort_wrapped]];
121 corner_of_edge[selection_i] = corners[index_in_sort_wrapped];
132 static constexpr int8_t id = 0;
134 hash.add(deep_hash_cache.
ensure(edge_index_));
135 hash.add(deep_hash_cache.
ensure(sort_index_));
136 hash.add(deep_hash_cache.
ensure(sort_weight_));
148 return AttrDomain::Edge;
160 if (domain != AttrDomain::Edge) {
170 static constexpr int8_t id = 0;
176 return AttrDomain::Edge;
203 ntype.
ui_name =
"Corners of Edge";
204 ntype.
ui_description =
"Retrieve face corners connected to edges";
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
static IndexMask from_indices(Span< T > indices, LinearAllocator<> &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
static Field from_input(Args &&...args)
T extract_input(const UString identifier)
bool output_is_required(const UString identifier) const
void set_output(const UString identifier, T &&value)
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)
constexpr ParallelGrainSize grain_size(int grain_size)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
MINLINE int mod_i(int i, int n)
@ NODE_DEFAULT_INPUT_INDEX_FIELD
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare
UniqueHash ensure(const GFieldRef &field)