Blender V4.3
node_geo_mesh_topology_vertex_of_corner.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BKE_mesh.hh"
6
7#include "BLI_task.hh"
8
10
12
14{
15 b.add_input<decl::Int>("Corner Index")
16 .implicit_field(implicit_field_inputs::index)
17 .description("The corner to retrieve data from. Defaults to the corner from the context");
18 b.add_output<decl::Int>("Vertex Index")
19 .field_source_reference_all()
20 .description("The vertex the corner is attached to");
21}
22
24 public:
25 CornerVertFieldInput() : bke::MeshFieldInput(CPPType::get<int>(), "Corner Vertex")
26 {
28 }
29
31 const AttrDomain domain,
32 const IndexMask & /*mask*/) const final
33 {
34 if (domain != AttrDomain::Corner) {
35 return {};
36 }
37 return VArray<int>::ForSpan(mesh.corner_verts());
38 }
39
40 uint64_t hash() const final
41 {
42 return 30495867093876;
43 }
44
45 bool is_equal_to(const fn::FieldNode &other) const final
46 {
47 return dynamic_cast<const CornerVertFieldInput *>(&other) != nullptr;
48 }
49
50 std::optional<AttrDomain> preferred_domain(const Mesh & /*mesh*/) const final
51 {
52 return AttrDomain::Corner;
53 }
54};
55
57{
58 params.set_output("Vertex Index",
59 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
60 params.extract_input<Field<int>>("Corner Index"),
61 Field<int>(std::make_shared<CornerVertFieldInput>()),
62 AttrDomain::Corner)));
63}
64
65static void node_register()
66{
67 static blender::bke::bNodeType ntype;
69 &ntype, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, "Vertex of Corner", NODE_CLASS_INPUT);
71 ntype.declare = node_declare;
73}
75
76} // namespace blender::nodes::node_geo_mesh_topology_vertex_of_corner_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
#define NOD_REGISTER_NODE(REGISTER_FUNC)
static VArray ForSpan(Span< T > values)
GVArray get_varray_for_context(const Mesh &mesh, const AttrDomain domain, const IndexMask &) const final
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
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
void index(const bNode &, void *r_value)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
Definition stdint.h:90
Defines a node type.
Definition BKE_node.hh:218
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:339
NodeDeclareFunction declare
Definition BKE_node.hh:347