19 .
description(
"The vertex to retrieve data from. Defaults to the vertex from the context")
20 .structure_type(StructureType::Field);
22 "Values used to sort the edges connected to the vertex. Uses indices by default");
26 .
description(
"Which of the sorted edges to output");
28 .field_source_reference_all()
29 .
description(
"An edge connected to the face, chosen by the sort index");
30 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
31 "The number of edges connected to each vertex");
41 :
bke::MeshFieldInput(
CPPType::get<int>(),
"Edge of Vertex"),
42 vert_index_(std::move(vert_index)),
43 sort_index_(std::move(sort_index)),
44 sort_weight_(std::move(sort_weight))
58 edges, mesh.verts_num, map_offsets, map_indices);
62 evaluator.
add(vert_index_);
63 evaluator.
add(sort_index_);
70 edge_evaluator.
add(sort_weight_);
73 const bool use_sorting = !all_sort_weights.
is_single();
81 for (
const int selection_i : segment) {
82 const int vert_i = vert_indices[selection_i];
83 const int index_in_sort = indices_in_sort[selection_i];
85 edge_of_vertex[selection_i] = 0;
89 const Span<int> edges = vert_to_edge_map[vert_i];
91 edge_of_vertex[selection_i] = 0;
95 const int index_in_sort_wrapped =
mod_i(index_in_sort, edges.
size());
109 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
110 return sort_weights[a] < sort_weights[b];
113 edge_of_vertex[selection_i] = edges[sort_indices[index_in_sort_wrapped]];
116 edge_of_vertex[selection_i] = edges[index_in_sort_wrapped];
126 vert_index_.node().for_each_field_input_recursive(
fn);
127 sort_index_.node().for_each_field_input_recursive(
fn);
128 sort_weight_.node().for_each_field_input_recursive(
fn);
133 return 98762349875636;
139 return typed->vert_index_ == vert_index_ && typed->sort_index_ == sort_index_ &&
140 typed->sort_weight_ == sort_weight_;
147 return AttrDomain::Point;
162 if (domain != AttrDomain::Point) {
172 return 436758278618374;
182 return AttrDomain::Point;
189 if (
params.output_is_required(
"Total")) {
190 params.set_output(
"Total",
191 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
193 Field<int>(std::make_shared<EdgesOfVertCountInput>()),
194 AttrDomain::Point)));
196 if (
params.output_is_required(
"Edge Index")) {
197 params.set_output(
"Edge Index",
198 Field<int>(std::make_shared<EdgesOfVertInput>(
209 ntype.
ui_name =
"Edges of Vertex";
210 ntype.
ui_description =
"Retrieve the edges connected to each vertex";
#define GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX
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
constexpr bool is_empty() 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_vert_to_edge_map(Span< int2 > edges, int verts_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_register()
static void node_declare(NodeDeclarationBuilder &b)
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