21 N_(
"This method gives a good 2D representation of a mesh")},
26 N_(
"Uses LSCM (Least Squares Conformal Mapping). This usually gives a less accurate UV "
27 "mapping than Angle Based, but works better for simpler objects")},
31 N_(
"Minimum Stretch"),
32 N_(
"Uses SLIM (Scalable Locally Injective Mapping). Minimizes distortion in areas and "
34 {0,
nullptr, 0,
nullptr,
nullptr},
42 .structure_type(StructureType::Field)
43 .description(
"Faces to participate in the unwrap operation");
47 .description(
"Edges to mark where the mesh is \"cut\" for the purposes of unwrapping");
49 .default_value(0.001f)
56 "Virtually fill holes in mesh before unwrapping, to better avoid overlaps "
57 "and preserve symmetry");
63 .
description(
"Number of iterations to run the SLIM solver for");
68 .structure_type(StructureType::Field)
69 .propagate_references()
70 .
description(
"UV coordinates between 0 and 1 for each face corner in the selected faces");
76 node->storage = MEM_new<NodeGeometryUVUnwrap>(__func__);
82 const bool fill_holes,
85 const int iterations_,
96 face_evaluator.
add(selection_field);
105 edge_evaluator.
add(seam_field);
120 const int corner = face[i];
121 const int vert = corner_verts[corner];
123 mp_co[i] = positions[vert];
124 mp_uv[i] = uv[corner];
126 mp_select[i] =
false;
155 slim_options.
no_flip = no_flip_;
157 uv_parametrizer_slim_solve(handle, &slim_options,
false,
nullptr,
nullptr);
170 return mesh.attributes().adapt_domain<
float3>(
178 const bool fill_holes_;
181 const int iterations_;
187 const bool fill_holes,
190 const int iterations,
193 selection_(selection),
195 fill_holes_(fill_holes),
198 iterations_(iterations),
208 mesh, selection_, seam_, fill_holes_, margin_, method_, iterations_, no_flip_, domain);
219 return AttrDomain::Corner;
228 const bool fill_holes = params.
extract_input<
bool>(
"Fill Holes"_ustr);
229 const float margin = params.
extract_input<
float>(
"Margin"_ustr);
231 bool no_flip =
false;
239 selection_field, seam_field, fill_holes, margin, method, iterations, no_flip));
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_UV_UNWRAP
#define NOD_REGISTER_NODE(REGISTER_FUNC)
constexpr int64_t size() const
constexpr IndexRange()=default
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)
eUVPackIsland_RotationMethod rotate_method
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
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void uv_parametrizer_construct_end(ParamHandle *phandle, bool fill_holes, bool topology_from_uvs, int *r_count_failed=nullptr)
void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys)
void uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear)
void uv_parametrizer_flush(ParamHandle *handle)
void uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf, bool use_original_bounds)
void uv_parametrizer_lscm_end(ParamHandle *handle)
void uv_parametrizer_pack(ParamHandle *handle, const UVPackIsland_Params ¶ms)
void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed)
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_declare(NodeDeclarationBuilder &b)
static VArray< float3 > construct_uv_gvarray(const Mesh &mesh, const Field< bool > selection_field, const Field< bool > seam_field, const bool fill_holes, const float margin, const GeometryNodeUVUnwrapMethod method, const int iterations_, const bool no_flip_, const AttrDomain domain)
static void node_geo_exec(GeoNodeExecParams params)
static void node_register()
static void node_init(bNodeTree *, bNode *node)
static EnumPropertyItem method_items[]
GeometryNodeUVUnwrapMethod
@ GEO_NODE_UV_UNWRAP_METHOD_CONFORMAL
@ GEO_NODE_UV_UNWRAP_METHOD_ANGLE_BASED
@ GEO_NODE_UV_UNWRAP_METHOD_MINIMUM_STRETCH
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
VecBase< float, 3 > float3
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
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare