17 .
description(
"The vertex to retrieve data from. Defaults to the vertex from the context")
18 .structure_type(StructureType::Field);
20 .structure_type(StructureType::Field)
22 .description(
"Values used to sort corners attached to the vertex. Uses indices by default");
24 .structure_type(StructureType::Field)
25 .
description(
"Which of the sorted corners to output. Negative indexing is supported");
27 .structure_type(StructureType::Field)
28 .propagate_references()
29 .
description(
"A corner connected to the face, chosen by the sort index");
31 .structure_type(StructureType::Field)
32 .propagate_references({0})
33 .description(
"The number of faces or corners connected to each vertex");
44 vert_index_(std::move(vert_index)),
45 sort_index_(std::move(sort_index)),
46 sort_weight_(std::move(sort_weight))
59 evaluator.
add(vert_index_);
60 evaluator.
add(sort_index_);
67 corner_evaluator.
add(sort_weight_);
70 const bool use_sorting = !all_sort_weights.
is_single();
79 for (
const int selection_i : segment) {
80 const int vert_i = vert_indices[selection_i];
81 const int index_in_sort = indices_in_sort[selection_i];
83 corner_of_vertex[selection_i] = 0;
87 const Span<int> corners = vert_to_corner_map[vert_i];
88 if (corners.is_empty()) {
89 corner_of_vertex[selection_i] = 0;
93 const int index_in_sort_wrapped =
mod_i(index_in_sort, corners.size());
107 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
108 return sort_weights[a] < sort_weights[b];
110 corner_of_vertex[selection_i] = corners[sort_indices[index_in_sort_wrapped]];
113 corner_of_vertex[selection_i] = corners[index_in_sort_wrapped];
131 static constexpr int8_t id = 0;
133 hash.add(deep_hash_cache.
ensure(vert_index_));
134 hash.add(deep_hash_cache.
ensure(sort_index_));
135 hash.add(deep_hash_cache.
ensure(sort_weight_));
140 return AttrDomain::Point;
152 if (domain != AttrDomain::Point) {
162 static constexpr int8_t id = 0;
168 return AttrDomain::Point;
195 ntype.
ui_name =
"Corners of Vertex";
196 ntype.
ui_description =
"Retrieve face corners connected to vertices";
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX
#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
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)
void node_register_type(bNodeType &ntype)
constexpr ParallelGrainSize grain_size(int grain_size)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
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)