17 .
description(
"The vertex to retrieve data from. Defaults to the vertex from the context");
19 "Values used to sort corners attached to the vertex. Uses indices by default");
23 .
description(
"Which of the sorted corners to output");
25 .field_source_reference_all()
26 .
description(
"A corner connected to the face, chosen by the sort index");
27 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
28 "The number of faces or corners connected to each vertex");
38 : bke::MeshFieldInput(
CPPType::get<
int>(),
"Corner of Vertex"),
39 vert_index_(std::move(vert_index)),
40 sort_index_(std::move(sort_index)),
41 sort_weight_(std::move(sort_weight))
47 const AttrDomain domain,
55 evaluator.
add(vert_index_);
56 evaluator.add(sort_index_);
58 const VArray<int> vert_indices = evaluator.get_evaluated<
int>(0);
59 const VArray<int> indices_in_sort = evaluator.get_evaluated<
int>(1);
63 corner_evaluator.
add(sort_weight_);
64 corner_evaluator.evaluate();
65 const VArray<float> all_sort_weights = corner_evaluator.get_evaluated<
float>(0);
66 const bool use_sorting = !all_sort_weights.
is_single();
68 Array<int> corner_of_vertex(mask.min_array_size());
74 for (
const int selection_i : segment) {
75 const int vert_i = vert_indices[selection_i];
76 const int index_in_sort = indices_in_sort[selection_i];
78 corner_of_vertex[selection_i] = 0;
82 const Span<int> corners = vert_to_corner_map[vert_i];
83 if (corners.is_empty()) {
84 corner_of_vertex[selection_i] = 0;
88 const int index_in_sort_wrapped =
mod_i(index_in_sort, corners.size());
102 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
103 return sort_weights[a] < sort_weights[b];
105 corner_of_vertex[selection_i] = corners[sort_indices[index_in_sort_wrapped]];
108 corner_of_vertex[selection_i] = corners[index_in_sort_wrapped];
118 vert_index_.node().for_each_field_input_recursive(fn);
125 return 3541871368173645;
131 return typed->vert_index_ == vert_index_ && typed->sort_index_ == sort_index_ &&
132 typed->sort_weight_ == sort_weight_;
139 return AttrDomain::Point;
151 const AttrDomain domain,
154 if (domain != AttrDomain::Point) {
164 return 253098745374645;
174 return AttrDomain::Point;
181 if (
params.output_is_required(
"Total")) {
182 params.set_output(
"Total",
183 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
185 Field<int>(std::make_shared<CornersOfVertCountInput>()),
186 AttrDomain::Point)));
188 if (
params.output_is_required(
"Corner Index")) {
189 params.set_output(
"Corner Index",
190 Field<int>(std::make_shared<CornersOfVertInput>(
201 &ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX,
"Corners of Vertex",
NODE_CLASS_INPUT);
MINLINE int mod_i(int i, int n)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
constexpr bool contains(int64_t value) const
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
static VArray ForContainer(ContainerT container)
int add(GField field, GVArray *varray_ptr)
virtual void for_each_field_input_recursive(FunctionRef< void(const FieldInput &)> fn) const
const FieldNode & node() const
static IndexMask from_indices(Span< T > indices, IndexMaskMemory &memory)
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
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)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare