26 N_(
"Use axis-aligned bounding boxes for packing (fastest, least space efficient)")},
31 N_(
"Use convex hull approximation of islands (good balance of speed and space efficiency)")},
36 N_(
"Use exact geometry for most efficient packing (slowest)")},
37 {0,
nullptr, 0,
nullptr,
nullptr},
56 b.use_custom_socket_order();
57 b.allow_any_socket_order();
60 .structure_type(StructureType::Field)
61 .propagate_references()
62 .align_with_previous();
66 .structure_type(StructureType::Field)
67 .description(
"Faces to consider when packing islands");
69 .default_value(0.001f)
80 .description(
"Method used for packing UV islands");
82 .default_value({0.0f, 0.0f})
85 .description(
"Bottom-left corner of packing bounds");
87 .default_value({1.0f, 1.0f})
90 .description(
"Top-right corner of packing bounds");
109 face_evaluator.
add(selection_field);
131 const int corner = face[i];
132 const int vert = corner_verts[corner];
134 mp_co[i] = positions[vert];
135 mp_uv[i] = uv[corner];
137 mp_select[i] =
false;
155 if (top.x > bottom.x && top.y > bottom.y) {
165 return mesh.attributes().adapt_domain<
float3>(
188 selection_field_(selection_field),
192 shape_method_(shape_method),
203 mesh, selection_field_, uv_field_, rotate_, margin_, shape_method_, bottom_, top_, domain);
208 fn(selection_field_);
214 return AttrDomain::Corner;
226 const float margin = params.
extract_input<
float>(
"Margin"_ustr);
231 selection_field, uv_field,
rotate, margin, shape_method, bottom, top));
239 ntype.
ui_name =
"Pack UV Islands";
241 "Scale islands of a UV map and move them so they fill the UV space as much as possible";
#define NODE_CLASS_CONVERTER
#define GEO_NODE_UV_PACK_ISLANDS
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define BLI_assert_unreachable()
MutableSpan< T > as_mutable_span()
constexpr int64_t size() const
constexpr IndexRange()=default
static VArray from_container(ContainerT container)
int add(GField field, GVArray *varray_ptr)
IndexMask get_evaluated_as_mask(int field_index)
int add_with_destination(GField field, GVMutableArray dst)
eUVPackIsland_RotationMethod rotate_method
eUVPackIsland_ShapeMethod shape_method
float udim_base_offset[2]
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
static Field from_input(Args &&...args)
T extract_input(const UString identifier)
T get_input(const UString identifier) const
void set_output(const UString identifier, T &&value)
StructureType structure_type
float3x3 rotate(float3x3 mat, AxisAngle rotation)
void node_register_type(bNodeType &ntype)
void uv_parametrizer_construct_end(ParamHandle *phandle, bool fill_holes, bool topology_from_uvs, int *r_count_failed=nullptr)
void uv_parametrizer_flush(ParamHandle *handle)
void uv_parametrizer_pack(ParamHandle *handle, const UVPackIsland_Params ¶ms)
void uv_parametrizer_face_add(ParamHandle *handle, const ParamKey key, const int nverts, const ParamKey *vkeys, const float **co, float **uv, const float *weight, const bool *pin, const bool *select)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static const EnumPropertyItem shape_method_items[]
static eUVPackIsland_ShapeMethod convert_shape_method(const ShapeMethod method)
static void node_register()
static VArray< float3 > construct_uv_gvarray(const Mesh &mesh, const Field< bool > selection_field, const Field< float3 > uv_field, const bool rotate, const float margin, const eUVPackIsland_ShapeMethod shape_method, const float3 bottom, const float3 top, const AttrDomain domain)
@ ED_UVPACK_ROTATION_NONE
VecBase< float, 3 > float3
eUVPackIsland_ShapeMethod
@ ED_UVPACK_SHAPE_CONCAVE
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare