Differential D16858 Diff 59005 source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc
| Show All 14 Lines | b.add_input<decl::Int>(N_("Corner Index")) | ||||
| .implicit_field(implicit_field_inputs::index) | .implicit_field(implicit_field_inputs::index) | ||||
| .description( | .description( | ||||
| N_("The corner to retrieve data from. Defaults to the corner from the context")); | N_("The corner to retrieve data from. Defaults to the corner from the context")); | ||||
| b.add_input<decl::Int>(N_("Offset")) | b.add_input<decl::Int>(N_("Offset")) | ||||
| .supports_field() | .supports_field() | ||||
| .description(N_("The number of corners to move around the face before finding the result, " | .description(N_("The number of corners to move around the face before finding the result, " | ||||
| "circling around the start of the face if necessary")); | "circling around the start of the face if necessary")); | ||||
| b.add_output<decl::Int>(N_("Corner Index")) | b.add_output<decl::Int>(N_("Corner Index")) | ||||
| .dependent_field() | .field_source_reference_all() | ||||
| .description(N_("The index of the offset corner")); | .description(N_("The index of the offset corner")); | ||||
| } | } | ||||
| class OffsetCornerInFaceFieldInput final : public bke::MeshFieldInput { | class OffsetCornerInFaceFieldInput final : public bke::MeshFieldInput { | ||||
| const Field<int> corner_index_; | const Field<int> corner_index_; | ||||
| const Field<int> offset_; | const Field<int> offset_; | ||||
| public: | public: | ||||
| Show All 36 Lines | threading::parallel_for(mask.index_range(), 2048, [&](const IndexRange range) { | ||||
| const IndexRange poly_range(polys[poly_i].loopstart, polys[poly_i].totloop); | const IndexRange poly_range(polys[poly_i].loopstart, polys[poly_i].totloop); | ||||
| offset_corners[selection_i] = apply_offset_in_cyclic_range(poly_range, corner_i, offset); | offset_corners[selection_i] = apply_offset_in_cyclic_range(poly_range, corner_i, offset); | ||||
| } | } | ||||
| }); | }); | ||||
| return VArray<int>::ForContainer(std::move(offset_corners)); | return VArray<int>::ForContainer(std::move(offset_corners)); | ||||
| } | } | ||||
| void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const | |||||
| { | |||||
| corner_index_.node().for_each_field_input_recursive(fn); | |||||
| offset_.node().for_each_field_input_recursive(fn); | |||||
| } | |||||
| uint64_t hash() const final | uint64_t hash() const final | ||||
| { | { | ||||
| return get_default_hash(offset_); | return get_default_hash(offset_); | ||||
| } | } | ||||
| bool is_equal_to(const fn::FieldNode &other) const final | bool is_equal_to(const fn::FieldNode &other) const final | ||||
| { | { | ||||
| if (const OffsetCornerInFaceFieldInput *other_field = | if (const OffsetCornerInFaceFieldInput *other_field = | ||||
| Show All 35 Lines | |||||