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();
58 b.add_input<
decl::Vector>(
"UV").hide_value().supports_field();
59 b.add_output<
decl::Vector>(
"UV").field_source_reference_all().align_with_previous();
64 .description(
"Faces to consider when packing islands");
66 "Space between islands");
72 .description(
"Method used for packing UV islands");
85 const Span<int> corner_verts = mesh.corner_verts();
89 face_evaluator.
add(selection_field);
111 const int corner = face[
i];
112 const int vert = corner_verts[corner];
114 mp_co[
i] = positions[vert];
115 mp_uv[
i] = uv[corner];
117 mp_select[
i] =
false;
132 params.shape_method = shape_method;
159 selection_field_(selection_field),
163 shape_method_(shape_method)
173 mesh, selection_field_, uv_field_, rotate_, margin_, shape_method_, domain);
178 selection_field_.node().for_each_field_input_recursive(
fn);
179 uv_field_.node().for_each_field_input_recursive(
fn);
184 return AttrDomain::Corner;
195 const bool rotate =
params.extract_input<
bool>(
"Rotate");
196 const float margin =
params.extract_input<
float>(
"Margin");
199 selection_field, uv_field,
rotate, margin, shape_method)));
207 ntype.
ui_name =
"Pack UV Islands";
209 "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 BLI_assert_unreachable()
eUVPackIsland_ShapeMethod
@ ED_UVPACK_SHAPE_CONCAVE
@ ED_UVPACK_ROTATION_NONE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
constexpr int64_t size() const
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)
void foreach_index(Fn &&fn) const
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 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 AttrDomain domain)
static eUVPackIsland_ShapeMethod convert_shape_method(const ShapeMethod method)
static void node_register()
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
static void rotate(float new_co[3], float a, const float ax[3], const float co[3])
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare