Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc
| Show All 21 Lines | static void node_declare(NodeDeclarationBuilder &b) | ||||
| b.add_input<decl::Float>(N_("Margin")) | b.add_input<decl::Float>(N_("Margin")) | ||||
| .default_value(0.001f) | .default_value(0.001f) | ||||
| .min(0.0f) | .min(0.0f) | ||||
| .max(1.0f) | .max(1.0f) | ||||
| .description(N_("Space between islands")); | .description(N_("Space between islands")); | ||||
| b.add_input<decl::Bool>(N_("Rotate")) | b.add_input<decl::Bool>(N_("Rotate")) | ||||
| .default_value(true) | .default_value(true) | ||||
| .description(N_("Rotate islands for best fit")); | .description(N_("Rotate islands for best fit")); | ||||
| b.add_output<decl::Vector>(N_("UV")).field_source(); | b.add_output<decl::Vector>(N_("UV")).field_source_reference_all(); | ||||
| } | } | ||||
| static VArray<float3> construct_uv_gvarray(const Mesh &mesh, | static VArray<float3> construct_uv_gvarray(const Mesh &mesh, | ||||
| const Field<bool> selection_field, | const Field<bool> selection_field, | ||||
| const Field<float3> uv_field, | const Field<float3> uv_field, | ||||
| const bool rotate, | const bool rotate, | ||||
| const float margin, | const float margin, | ||||
| const eAttrDomain domain) | const eAttrDomain domain) | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | public: | ||||
| GVArray get_varray_for_context(const Mesh &mesh, | GVArray get_varray_for_context(const Mesh &mesh, | ||||
| const eAttrDomain domain, | const eAttrDomain domain, | ||||
| const IndexMask /*mask*/) const final | const IndexMask /*mask*/) const final | ||||
| { | { | ||||
| return construct_uv_gvarray(mesh, selection_field, uv_field, rotate, margin, domain); | return construct_uv_gvarray(mesh, selection_field, uv_field, rotate, margin, domain); | ||||
| } | } | ||||
| void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const | |||||
| { | |||||
| selection_field.node().for_each_field_input_recursive(fn); | |||||
| uv_field.node().for_each_field_input_recursive(fn); | |||||
| } | |||||
| std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | std::optional<eAttrDomain> preferred_domain(const Mesh & /*mesh*/) const override | ||||
| { | { | ||||
| return ATTR_DOMAIN_CORNER; | return ATTR_DOMAIN_CORNER; | ||||
| } | } | ||||
| }; | }; | ||||
| static void node_geo_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| Show All 22 Lines | |||||