Differential D16858 Diff 59005 source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
| Show All 16 Lines | b.add_input<decl::Float>(N_("Weights")) | ||||
| .supports_field() | .supports_field() | ||||
| .hide_value() | .hide_value() | ||||
| .description(N_("Values used to sort the face's corners. Uses indices by default")); | .description(N_("Values used to sort the face's corners. Uses indices by default")); | ||||
| b.add_input<decl::Int>(N_("Sort Index")) | b.add_input<decl::Int>(N_("Sort Index")) | ||||
| .min(0) | .min(0) | ||||
| .supports_field() | .supports_field() | ||||
| .description(N_("Which of the sorted corners to output")); | .description(N_("Which of the sorted corners to output")); | ||||
| b.add_output<decl::Int>(N_("Corner Index")) | b.add_output<decl::Int>(N_("Corner Index")) | ||||
| .dependent_field() | .field_source_reference_all() | ||||
| .description(N_("A corner of the face, chosen by the sort index")); | .description(N_("A corner of the face, chosen by the sort index")); | ||||
| b.add_output<decl::Int>(N_("Total")) | b.add_output<decl::Int>(N_("Total")) | ||||
| .dependent_field() | .field_source() | ||||
| .reference_pass({0}) | |||||
| .description(N_("The number of corners in the face")); | .description(N_("The number of corners in the face")); | ||||
| } | } | ||||
| class CornersOfFaceInput final : public bke::MeshFieldInput { | class CornersOfFaceInput final : public bke::MeshFieldInput { | ||||
| const Field<int> face_index_; | const Field<int> face_index_; | ||||
| const Field<int> sort_index_; | const Field<int> sort_index_; | ||||
| const Field<float> sort_weight_; | const Field<float> sort_weight_; | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | threading::parallel_for(mask.index_range(), 1024, [&](const IndexRange range) { | ||||
| const int index_in_sort_wrapped = mod_i(index_in_sort, corners.size()); | const int index_in_sort_wrapped = mod_i(index_in_sort, corners.size()); | ||||
| corner_of_face[selection_i] = corners[sort_indices[index_in_sort_wrapped]]; | corner_of_face[selection_i] = corners[sort_indices[index_in_sort_wrapped]]; | ||||
| } | } | ||||
| }); | }); | ||||
| return VArray<int>::ForContainer(std::move(corner_of_face)); | return VArray<int>::ForContainer(std::move(corner_of_face)); | ||||
| } | } | ||||
| void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const | |||||
| { | |||||
| face_index_.node().for_each_field_input_recursive(fn); | |||||
| sort_index_.node().for_each_field_input_recursive(fn); | |||||
| sort_weight_.node().for_each_field_input_recursive(fn); | |||||
| } | |||||
| uint64_t hash() const final | uint64_t hash() const final | ||||
| { | { | ||||
| return 6927982716657; | return 6927982716657; | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const final | bool is_equal_to(const fn::FieldNode &other) const final | ||||
| { | { | ||||
| if (const auto *typed = dynamic_cast<const CornersOfFaceInput *>(&other)) { | if (const auto *typed = dynamic_cast<const CornersOfFaceInput *>(&other)) { | ||||
| ▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines | |||||