Differential D15954 Diff 56253 source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | uint64_t hash() const override | ||||
| /* Some random constant hash. */ | /* Some random constant hash. */ | ||||
| return 823543774; | return 823543774; | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const override | bool is_equal_to(const fn::FieldNode &other) const override | ||||
| { | { | ||||
| return dynamic_cast<const FaceNeighborCountFieldInput *>(&other) != nullptr; | return dynamic_cast<const FaceNeighborCountFieldInput *>(&other) != nullptr; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_FACE; | |||||
| } | |||||
| }; | }; | ||||
| static VArray<int> construct_vertex_count_varray(const Mesh &mesh, const eAttrDomain domain) | static VArray<int> construct_vertex_count_varray(const Mesh &mesh, const eAttrDomain domain) | ||||
| { | { | ||||
| const Span<MPoly> polys = mesh.polys(); | const Span<MPoly> polys = mesh.polys(); | ||||
| return mesh.attributes().adapt_domain<int>( | return mesh.attributes().adapt_domain<int>( | ||||
| VArray<int>::ForFunc(polys.size(), | VArray<int>::ForFunc(polys.size(), | ||||
| [polys](const int i) -> float { return polys[i].totloop; }), | [polys](const int i) -> float { return polys[i].totloop; }), | ||||
| Show All 20 Lines | uint64_t hash() const override | ||||
| /* Some random constant hash. */ | /* Some random constant hash. */ | ||||
| return 236235463634; | return 236235463634; | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const override | bool is_equal_to(const fn::FieldNode &other) const override | ||||
| { | { | ||||
| return dynamic_cast<const FaceVertexCountFieldInput *>(&other) != nullptr; | return dynamic_cast<const FaceVertexCountFieldInput *>(&other) != nullptr; | ||||
| } | } | ||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | |||||
| { | |||||
| return ATTR_DOMAIN_FACE; | |||||
| } | |||||
| }; | }; | ||||
| static void node_geo_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| Field<int> vertex_count_field{std::make_shared<FaceVertexCountFieldInput>()}; | Field<int> vertex_count_field{std::make_shared<FaceVertexCountFieldInput>()}; | ||||
| Field<int> neighbor_count_field{std::make_shared<FaceNeighborCountFieldInput>()}; | Field<int> neighbor_count_field{std::make_shared<FaceNeighborCountFieldInput>()}; | ||||
| params.set_output("Vertex Count", std::move(vertex_count_field)); | params.set_output("Vertex Count", std::move(vertex_count_field)); | ||||
| params.set_output("Face Count", std::move(neighbor_count_field)); | params.set_output("Face Count", std::move(neighbor_count_field)); | ||||
| Show All 16 Lines | |||||