104 *r_use_subsurf = subsurf;
116 int cd_loop_uv_offset;
180 if (cd_loop_uv_offset == -1) {
202 if (
options->topology_from_uvs && !
l) {
214 const uint objects_len,
217 bool have_select =
false;
218 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
219 Object *obedit = objects[ob_index];
234 bool selected =
false;
255 const int cd_loop_uv_offset)
323 if (
options->topology_from_uvs) {
324 bool is_loopsel =
false;
327 if (
options->only_selected_uvs &&
334 if (is_loopsel ==
false) {
342 if (!
options->topology_from_uvs ||
options->topology_from_uvs_use_seams) {
366 const uint objects_len,
394 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
395 Object *obedit = objects[ob_index];
401 if (cd_loop_uv_offset == -1) {
412 if (
options->topology_from_uvs) {
413 bool is_loopsel =
false;
416 if (
options->only_selected_uvs &&
423 if (is_loopsel ==
false) {
431 if (!
options->topology_from_uvs ||
options->topology_from_uvs_use_seams) {
450 const int cd_loop_uv_offset,
506 const int *origVertIndices, *origEdgeIndices, *origPolyIndices;
508 MVert *subsurfedVerts;
509 MEdge *subsurfedEdges;
510 MPoly *subsurfedPolys;
511 MLoop *subsurfedLoops;
513 int numOfEdges, numOfFaces;
548 initialDerived->
release(initialDerived);
553 subsurfedVerts = derivedMesh->
getVertArray(derivedMesh);
554 subsurfedEdges = derivedMesh->
getEdgeArray(derivedMesh);
555 subsurfedPolys = derivedMesh->
getPolyArray(derivedMesh);
556 subsurfedLoops = derivedMesh->
getLoopArray(derivedMesh);
562 numOfEdges = derivedMesh->
getNumEdges(derivedMesh);
563 numOfFaces = derivedMesh->
getNumPolys(derivedMesh);
571 for (i = 0; i < numOfFaces; i++) {
578 for (i = 0; i < numOfEdges; i++) {
586 for (i = 0, mpoly = subsurfedPolys; i < numOfFaces; i++, mpoly++) {
605 mloop = &subsurfedLoops[mpoly->
loopstart];
615 co[0] = subsurfedVerts[mloop[0].
v].
co;
616 co[1] = subsurfedVerts[mloop[1].
v].
co;
617 co[2] = subsurfedVerts[mloop[2].
v].
co;
618 co[3] = subsurfedVerts[mloop[3].
v].
co;
626 origVertIndices[mloop[0].
v],
633 origVertIndices[mloop[1].
v],
640 origVertIndices[mloop[2].
v],
647 origVertIndices[mloop[3].
v],
656 for (edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
673 derivedMesh->
release(derivedMesh);
701 .topology_from_uvs =
true,
703 .only_selected_faces =
true,
704 .only_selected_uvs =
true,
705 .correct_aspect =
true,
708 uint objects_len = 0;
728 if (ms->
blend != 0.0f) {
829 for (i = 0; i < iterations; i++) {
858 switch (event->
type) {
871 if (ms->
blend < 0.95f) {
882 if (ms->
blend > 0.05f) {
917 ot->
name =
"Minimize Stretch";
918 ot->
idname =
"UV_OT_minimize_stretch";
934 "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and "
935 "preserve symmetry");
942 "Blend factor between stretch minimized and original",
951 "Number of iterations to run, 0 is unlimited when run interactively",
965 .topology_from_uvs =
true,
966 .only_selected_faces =
false,
967 .only_selected_uvs =
true,
969 .correct_aspect =
false,
973 bool ignore_pinned =
false;
990 const uint objects_len,
1001 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1002 Object *obedit = objects[ob_index];
1014 .topology_from_uvs =
true,
1015 .only_selected_faces =
true,
1016 .only_selected_uvs =
true,
1017 .fill_holes =
false,
1018 .correct_aspect =
true,
1023 uint objects_len = 0;
1044 .rotate_align_axis = -1,
1045 .only_selected_uvs =
true,
1046 .only_selected_faces =
true,
1047 .correct_aspect =
true,
1058 ot->
name =
"Pack Islands";
1060 ot->
description =
"Transform all islands so that they fill up the UV space as much as possible";
1071 ot->
srna,
"margin", 0.001f, 0.0f, 1.0f,
"Margin",
"Space between islands", 0.0f, 1.0f);
1088 .topology_from_uvs =
true,
1089 .only_selected_faces =
true,
1090 .only_selected_uvs =
true,
1091 .fill_holes =
false,
1092 .correct_aspect =
true,
1095 uint objects_len = 0;
1109 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1110 Object *obedit = objects[ob_index];
1127 ot->
name =
"Average Islands Scale";
1128 ot->
idname =
"UV_OT_average_islands_scale";
1129 ot->
description =
"Average the size of separate UV islands, based on their area in 3D space";
1163 .topology_from_uvs =
false,
1164 .only_selected_faces =
false,
1165 .only_selected_uvs =
true,
1183 "uvedit_live_unwrap_liveHandles");
1228 #define VIEW_ON_EQUATOR 0
1229 #define VIEW_ON_POLES 1
1230 #define ALIGN_TO_OBJECT 2
1251 uint center_accum_num = 0;
1258 center_accum_num += 1;
1261 mul_v3_fl(r_center, 1.0f / (
float)center_accum_num);
1269 float r_bounds[2][3])
1276 bool is_minmax_set =
false;
1282 is_minmax_set =
true;
1312 if (!is_minmax_set) {
1326 const float offset[4])
1328 float rotup[4][4], rotside[4][4], viewmatrix[4][4], rotobj[4][4];
1329 float sideangle = 0.0f, upangle = 0.0f;
1348 rotobj[3][3] = 0.0f;
1356 sideangle = (
float)
M_PI * (sideangledeg + 180.0f) / 180.0f;
1357 rotside[0][0] =
cosf(sideangle);
1358 rotside[0][1] = -
sinf(sideangle);
1359 rotside[1][0] =
sinf(sideangle);
1360 rotside[1][1] =
cosf(sideangle);
1361 rotside[2][2] = 1.0f;
1363 upangle = (
float)
M_PI * upangledeg / 180.0f;
1364 rotup[1][1] =
cosf(upangle) / radius;
1365 rotup[1][2] = -
sinf(upangle) / radius;
1366 rotup[2][1] =
sinf(upangle) / radius;
1367 rotup[2][2] =
cosf(upangle) / radius;
1368 rotup[0][0] = 1.0f / radius;
1381 const float offset[4] = {0};
1395 float upangledeg, sideangledeg;
1399 sideangledeg = 0.0f;
1404 sideangledeg = 0.0f;
1407 sideangledeg = 90.0f;
1423 {
VIEW_ON_EQUATOR,
"VIEW_ON_EQUATOR", 0,
"View on Equator",
"3D view is on the equator"},
1424 {
VIEW_ON_POLES,
"VIEW_ON_POLES", 0,
"View on Poles",
"3D view is on the poles"},
1429 "Align according to object transform"},
1433 {
POLAR_ZX,
"POLAR_ZX", 0,
"Polar ZX",
"Polar 0 is X"},
1434 {
POLAR_ZY,
"POLAR_ZY", 0,
"Polar ZY",
"Polar 0 is Y"},
1443 "Direction of the sphere or cylinder");
1449 "How to determine rotation around the pole");
1457 "Radius of the sphere or cylinder",
1469 float scale, aspx, aspy;
1480 scale = aspy / aspx;
1489 luv->
uv[0] = ((luv->
uv[0] - 0.5f) * scale) + 0.5f;
1494 scale = aspx / aspy;
1503 luv->
uv[1] = ((luv->
uv[1] - 0.5f) * scale) + 0.5f;
1509 #undef VIEW_ON_EQUATOR
1510 #undef VIEW_ON_POLES
1511 #undef ALIGN_TO_OBJECT
1528 "Map UVs taking image aspect ratio into account");
1530 if (clip_to_bounds) {
1535 "Clip UV coordinates to bounds after unwrapping");
1541 "Scale UV coordinates to bounds after unwrapping");
1555 float dx, dy,
min[2],
max[2];
1563 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1564 Object *ob = objects[ob_index];
1570 if (correct_aspect) {
1574 if (scale_to_bounds) {
1587 else if (clip_to_bounds) {
1602 if (scale_to_bounds) {
1614 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1615 Object *ob = objects[ob_index];
1628 luv->
uv[0] = (luv->
uv[0] -
min[0]) * dx;
1629 luv->
uv[1] = (luv->
uv[1] -
min[1]) * dy;
1684 const int objects_len,
1688 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1689 Object *obedit = objects[ob_index];
1700 .topology_from_uvs =
false,
1701 .only_selected_faces =
false,
1702 .only_selected_uvs =
true,
1708 bool ignore_pinned =
true;
1726 int reported_errors = 0;
1729 bool subsurf_error = use_subsurf;
1731 uint objects_len = 0;
1736 .topology_from_uvs =
false,
1737 .only_selected_faces =
true,
1738 .only_selected_uvs =
true,
1744 bool ignore_pinned =
true;
1752 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1753 Object *obedit = objects[ob_index];
1755 bool use_subsurf_final;
1761 if (subsurf_error) {
1765 if (use_subsurf_final) {
1766 subsurf_error =
false;
1775 if (!(
fabsf(obsize[0] - obsize[1]) < 1e-4f &&
fabsf(obsize[1] - obsize[2]) < 1e-4f)) {
1779 "Object has non-uniform scale, unwrap will operate on a non-scaled version of "
1789 "Object has negative scale, unwrap will operate on a non-flipped version of the mesh");
1795 if (subsurf_error) {
1798 "Subdivision Surface modifier needs to be first to work with unwrap");
1851 "Unwrap could not solve any island(s), edge seams may need to be added");
1856 "Unwrap failed to solve %d of %d island(s), edge seams may need to be added",
1867 {0,
"ANGLE_BASED", 0,
"Angle Based",
""},
1868 {1,
"CONFORMAL", 0,
"Conformal",
""},
1874 ot->
description =
"Unwrap the mesh of the object being edited";
1888 "Unwrapping method (Angle Based usually gives better results than Conformal, while "
1889 "being somewhat slower)");
1894 "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and "
1895 "preserve symmetry");
1900 "Map UVs taking image aspect ratio into account");
1905 "Use Subdivision Surface",
1906 "Map UVs taking vertex position after Subdivision Surface modifier has been applied");
1908 ot->
srna,
"margin", 0.001f, 0.0f, 1.0f,
"Margin",
"Space between islands", 0.0f, 1.0f);
1948 const uint thick_faces_len,
1950 const float project_angle_limit_half_cos,
1951 const float project_angle_limit_cos,
1952 const float area_weight,
1953 float (**r_project_normal_array)[3])
1955 if (
UNLIKELY(thick_faces_len == 0)) {
1956 *r_project_normal_array =
NULL;
1960 const float *project_normal = thick_faces[0].
efa->
no;
1971 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
1976 if (
dot_v3v3(thick_faces[f_index].efa->no, project_normal) > project_angle_limit_half_cos) {
1982 float average_normal[3] = {0.0f, 0.0f, 0.0f};
1984 if (area_weight <= 0.0f) {
1985 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
1987 const ThickFace *tf = project_thick_faces[f_proj_index];
1991 else if (area_weight >= 1.0f) {
1992 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
1994 const ThickFace *tf = project_thick_faces[f_proj_index];
1999 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
2001 const ThickFace *tf = project_thick_faces[f_proj_index];
2002 const float area_blend = (tf->
area * area_weight) + (1.0f - area_weight);
2014 float anble_best = 1.0f;
2015 uint angle_best_index = 0;
2017 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
2022 float angle_test = -1.0f;
2023 for (
int p_index = 0; p_index <
BLI_array_len(project_normal_array); p_index++) {
2024 angle_test =
max_ff(angle_test,
2025 dot_v3v3(project_normal_array[p_index], thick_faces[f_index].efa->no));
2028 if (angle_test < anble_best) {
2029 anble_best = angle_test;
2030 angle_best_index = f_index;
2034 if (anble_best < project_angle_limit_cos) {
2035 project_normal = thick_faces[angle_best_index].
efa->
no;
2050 *r_project_normal_array = project_normal_array;
2066 const float project_angle_limit_cos =
cosf(project_angle_limit);
2067 const float project_angle_limit_half_cos =
cosf(project_angle_limit / 2);
2072 uint objects_len = 0;
2074 view_layer, v3d, &objects_len);
2076 Object **objects_changed =
MEM_mallocN(
sizeof(*objects_changed) * objects_len, __func__);
2077 uint object_changed_len = 0;
2083 for (ob_index = 0; ob_index < objects_len; ob_index++) {
2084 Object *obedit = objects[ob_index];
2086 bool changed =
false;
2095 uint thick_faces_len = 0;
2101 thick_faces[thick_faces_len].
efa = efa;
2108 while ((thick_faces_len > 0) &&
2120 thick_faces_len -= 1;
2128 project_angle_limit_half_cos,
2129 project_angle_limit_cos,
2131 &project_normal_array);
2133 if (project_normals_len == 0) {
2141 sizeof(*thickface_project_groups) * project_normals_len, __func__);
2145 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
2146 const float *f_normal = thick_faces[f_index].
efa->
no;
2148 float angle_best =
dot_v3v3(f_normal, project_normal_array[0]);
2149 uint angle_best_index = 0;
2151 for (
int p_index = 1; p_index < project_normals_len; p_index++) {
2152 const float angle_test =
dot_v3v3(f_normal, project_normal_array[p_index]);
2153 if (angle_test > angle_best) {
2154 angle_best = angle_test;
2155 angle_best_index = p_index;
2160 &thickface_project_groups[angle_best_index], &thick_faces[f_index], arena);
2163 for (
int p_index = 0; p_index < project_normals_len; p_index++) {
2164 if (thickface_project_groups[p_index] ==
NULL) {
2168 float axis_mat[3][3];
2171 for (
LinkNode *list = thickface_project_groups[p_index]; list; list = list->
next) {
2190 objects_changed[object_changed_len] = objects[ob_index];
2191 object_changed_len += 1;
2200 if (object_changed_len > 0) {
2212 .rotate_align_axis = 1,
2213 .only_selected_faces =
true,
2214 .correct_aspect = correct_aspect,
2231 ot->
name =
"Smart UV Project";
2232 ot->
idname =
"UV_OT_smart_project";
2233 ot->
description =
"Projection unwraps the selected faces of mesh objects";
2250 "Lower for more projection groups, higher for less distortion",
2261 "Margin to reduce bleed from adjacent islands",
2270 "Weight projection's vector by faces with larger areas",
2317 float objects_pos_offset[4];
2318 bool changed_multi =
false;
2323 uint objects_len = 0;
2325 view_layer, v3d, &objects_len);
2327 if (use_orthographic) {
2329 float objects_pos_avg[4] = {0};
2331 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2332 add_v4_v4(objects_pos_avg, objects[ob_index]->obmat[3]);
2335 mul_v4_fl(objects_pos_avg, 1.0f / objects_len);
2339 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2340 Object *obedit = objects[ob_index];
2342 bool changed =
false;
2351 if (use_orthographic) {
2408 changed_multi =
true;
2419 if (changed_multi) {
2425 if (changed_multi) {
2439 return (rv3d !=
NULL);
2445 ot->
name =
"Project from View";
2446 ot->
idname =
"UV_OT_project_from_view";
2447 ot->
description =
"Project the UV vertices of the mesh as seen in current 3D view";
2462 "Map UVs to the camera region taking resolution and aspect into account");
2477 uint objects_len = 0;
2479 view_layer, v3d, &objects_len);
2480 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2481 Object *obedit = objects[ob_index];
2485 if (em->bm->totfacesel == 0) {
2525 const float source[3],
2527 const float rotmat[4][4])
2537 if (target[0] >= 1.0f) {
2559 for (i = 1; i < efa->
len; i++) {
2560 if (uvs[i][0] > uvs[mi][0]) {
2565 for (i = 0; i < efa->
len; i++) {
2567 dx = uvs[mi][0] - uvs[i][0];
2581 uint objects_len = 0;
2583 view_layer, v3d, &objects_len);
2584 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2585 Object *obedit = objects[ob_index];
2634 ot->
name =
"Sphere Projection";
2635 ot->
idname =
"UV_OT_sphere_project";
2636 ot->
description =
"Project the UV vertices of the mesh over the curved surface of a sphere";
2656 const float source[3],
2658 const float rotmat[4][4])
2665 map_to_tube(&target[0], &target[1], pv[0], pv[1], pv[2]);
2668 if (target[0] >= 1.0f) {
2679 uint objects_len = 0;
2681 view_layer, v3d, &objects_len);
2682 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2683 Object *obedit = objects[ob_index];
2732 ot->
name =
"Cylinder Projection";
2733 ot->
idname =
"UV_OT_cylinder_project";
2734 ot->
description =
"Project the UV vertices of the mesh over the curved wall of a cylinder";
2763 int cd_loop_uv_offset;
2786 luv->
uv[0] = 0.5f + 0.5f * cube_size * (
l->
v->
co[cox] - loc[cox]);
2787 luv->
uv[1] = 0.5f + 0.5f * cube_size * (
l->
v->
co[coy] - loc[coy]);
2801 uint objects_len = 0;
2803 view_layer, v3d, &objects_len);
2804 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2805 Object *obedit = objects[ob_index];
2828 float cube_size = cube_size_init;
2833 cube_size = cube_size ? 2.0f / cube_size : 1.0f;
2834 if (ob_index == 0) {
2855 ot->
name =
"Cube Projection";
2857 ot->
description =
"Project the UV vertices of the mesh over the six faces of a cube";
2872 "Size of the cube to project on",
2891 .use_toolflags =
false,
2903 .calc_face_normal =
true,
2914 if (sync_selection) {
typedef float(TangentPoint)[2]
struct DerivedMesh * CDDM_from_mesh(struct Mesh *mesh)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
bool CustomData_has_layer(const struct CustomData *data, int type)
int CustomData_get_offset(const struct CustomData *data, int type)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, v3d, r_len)
void BKE_id_free(struct Main *bmain, void *idv)
General operations, lookup, etc. for materials.
struct Mesh * BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra, const struct Mesh *me_settings)
void BKE_report(ReportList *reports, ReportType type, const char *message)
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
struct DerivedMesh * subsurf_make_derived_from_derived(struct DerivedMesh *dm, struct SubsurfModifierData *smd, const struct Scene *scene, float(*vertCos)[3], SubsurfFlags flags)
#define BLI_array_alloca(arr, realsize)
A (mainly) macro array library.
#define BLI_array_append(arr, item)
#define BLI_array_append_ret(arr)
#define BLI_array_declare(arr)
#define BLI_array_len(arr)
#define BLI_array_clear(arr)
#define BLI_array_free(arr)
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z)
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z)
MINLINE void axis_dominant_v3(int *r_axis_a, int *r_axis_b, const float axis[3])
void zero_m4(float m[4][4])
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
void unit_m4(float m[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
#define mul_m4_series(...)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool is_negative_m4(const float mat[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void mat4_to_size(float size[3], const float M[4][4])
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void clamp_v2(float vec[2], const float min, const float max)
MINLINE void zero_v2(float r[2])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void negate_v4_v4(float r[4], const float a[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
#define BLI_MEMARENA_STD_BUFSIZE
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define INIT_MINMAX2(min, max)
#define INIT_MINMAX(min, max)
#define ARRAY_DELETE_REORDER_LAST(arr, index, delete_len, arr_len)
void BLI_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy)
void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4])
void BLI_uvproject_from_camera(float target[2], float source[3], struct ProjCameraInfo *uci)
struct ProjCameraInfo * BLI_uvproject_camera_info(struct Object *ob, float rotmat[4][4], float winx, float winy)
void DEG_id_tag_update(struct ID *id, int flag)
Object is a sort of wrapper for general info.
#define UVCALC_USESUBSURF
#define UV_SYNC_SELECTION
#define UVCALC_NO_ASPECT_CORRECT
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_CENTER_MEDIAN
@ V3D_AROUND_LOCAL_ORIGINS
void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *r_aspx, float *r_aspy)
void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, const uint objects_len, const char htype)
void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set, const bool do_init)
void ED_area_status_text(ScrArea *area, const char *str)
bool ED_operator_uvmap(struct bContext *C)
bool ED_operator_uvedit(struct bContext *C)
void ED_workspace_status_text(struct bContext *C, const char *str)
bool ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree)
void ED_uvedit_pack_islands_multi(const struct Scene *scene, Object **objects, const uint objects_len, const struct UVPackIsland_Params *params)
void ED_uvedit_select_all(struct BMesh *bm)
bool ED_uvedit_test(struct Object *obedit)
bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, const int cd_loop_uv_offset)
struct Camera * ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d)
NSNotificationCenter * center
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
Platform independent time functions.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_editselection_center(BMEditSelection *ese, float r_center[3])
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
BMFace * BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
const BMAllocTemplate bm_mesh_allocsize_default
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params)
BMesh Make Mesh.
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshParams *params)
Mesh -> BMesh.
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMeshParams *params)
void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3])
float BM_face_calc_area(const BMFace *f)
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
SIMD_FORCE_INLINE btVector3 rotate(const btVector3 &wAxis, const btScalar angle) const
Return a rotated version of this vector.
CCL_NAMESPACE_BEGIN struct Options options
IconTextureDrawCall normal
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct MLoop *(* getLoopArray)(DerivedMesh *dm)
void *(* getVertDataArray)(DerivedMesh *dm, int type)
struct MVert *(* getVertArray)(DerivedMesh *dm)
int(* getNumPolys)(DerivedMesh *dm)
int(* getNumEdges)(DerivedMesh *dm)
void *(* getPolyDataArray)(DerivedMesh *dm, int type)
void *(* getEdgeDataArray)(DerivedMesh *dm, int type)
struct MEdge *(* getEdgeArray)(DerivedMesh *dm)
struct MPoly *(* getPolyArray)(DerivedMesh *dm)
void(* release)(DerivedMesh *dm)
struct ToolSettings * toolsettings
bool topology_from_uvs_use_seams
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
double PIL_check_seconds_timer(void)
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
void param_stretch_begin(ParamHandle *handle)
void param_stretch_iter(ParamHandle *handle)
void param_stretch_end(ParamHandle *handle)
void param_delete(ParamHandle *handle)
void param_flush_restore(ParamHandle *handle)
void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy)
void param_flush(ParamHandle *handle)
ParamHandle * param_construct_begin(void)
void param_average(ParamHandle *handle, bool ignore_pinned)
void param_face_add(ParamHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, float *co[4], float *uv[4], ParamBool *pin, ParamBool *select)
void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
void param_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
void param_edge_set_seam(ParamHandle *handle, ParamKey *vkeys)
void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool topology_from_uvs, int *count_fail)
void param_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed)
void param_lscm_end(ParamHandle *handle)
void param_stretch_blend(ParamHandle *handle, float blend)
static void uvedit_unwrap_multi(const Scene *scene, Object **objects, const int objects_len, const UnwrapOptions *options, UnwrapResultInfo *result_info)
static int uv_from_view_exec(bContext *C, wmOperator *op)
struct ThickFace ThickFace
static void uv_map_transform_center(const Scene *scene, View3D *v3d, Object *ob, BMEditMesh *em, float r_center[3], float r_bounds[2][3])
static int cube_project_exec(bContext *C, wmOperator *op)
static bool uv_from_view_poll(bContext *C)
static void uvedit_pack_islands_multi(const Scene *scene, Object **objects, const uint objects_len, const UnwrapOptions *options, bool rotate, bool ignore_pinned)
static int cylinder_project_exec(bContext *C, wmOperator *op)
static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
void ED_uvedit_get_aspect(Object *ob, float *r_aspx, float *r_aspy)
void ED_uvedit_add_simple_uvs(Main *bmain, const Scene *scene, Object *ob)
void ED_uvedit_live_unwrap(const Scene *scene, Object **objects, int objects_len)
static bool uvedit_have_selection_multi(const Scene *scene, Object **objects, const uint objects_len, const UnwrapOptions *options)
static struct @603 g_live_unwrap
struct UnwrapResultInfo UnwrapResultInfo
static void minimize_stretch_cancel(bContext *C, wmOperator *op)
static void uv_sphere_project(float target[2], const float source[3], const float center[3], const float rotmat[4][4])
static void uv_transform_properties(wmOperatorType *ot, int radius)
void UV_OT_cylinder_project(wmOperatorType *ot)
void UV_OT_project_from_view(wmOperatorType *ot)
void UV_OT_smart_project(wmOperatorType *ot)
static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void uvedit_unwrap_cube_project(BMesh *bm, float cube_size, bool use_select, const float center[3])
void UV_OT_unwrap(wmOperatorType *ot)
static int minimize_stretch_exec(bContext *C, wmOperator *op)
static int minimize_stretch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static const float smart_uv_project_area_ignore
static ParamHandle * construct_param_handle(const Scene *scene, Object *ob, BMesh *bm, const UnwrapOptions *options, UnwrapResultInfo *result_info)
static int unwrap_exec(bContext *C, wmOperator *op)
static int smart_uv_project_thickface_area_cmp_fn(const void *tf_a_p, const void *tf_b_p)
static int uv_from_view_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void modifier_unwrap_state(Object *obedit, const Scene *scene, bool *r_use_subsurf)
void UV_OT_sphere_project(wmOperatorType *ot)
static void correct_uv_aspect(Object *ob, BMEditMesh *em)
static void construct_param_handle_face_add(ParamHandle *handle, const Scene *scene, BMFace *efa, int face_index, const int cd_loop_uv_offset)
void UV_OT_cube_project(wmOperatorType *ot)
static int pack_islands_exec(bContext *C, wmOperator *op)
void ED_uvedit_live_unwrap_re_solve(void)
static void uvedit_unwrap(const Scene *scene, Object *obedit, const UnwrapOptions *options, UnwrapResultInfo *result_info)
static void uv_map_transform_calc_center_median(BMEditMesh *em, float r_center[3])
static void uv_map_clip_correct_properties(wmOperatorType *ot)
static void uv_map_rotation_matrix(float result[4][4], RegionView3D *rv3d, Object *ob, float upangledeg, float sideangledeg, float radius)
static void uv_map_clip_correct_properties_ex(wmOperatorType *ot, bool clip_to_bounds)
static void uv_map_clip_correct(Object *ob, wmOperator *op)
static void uv_map_rotation_matrix_ex(float result[4][4], RegionView3D *rv3d, Object *ob, float upangledeg, float sideangledeg, float radius, const float offset[4])
static ParamHandle * construct_param_handle_multi(const Scene *scene, Object **objects, const uint objects_len, const UnwrapOptions *options, int *count_fail)
static int sphere_project_exec(bContext *C, wmOperator *op)
struct MinStretch MinStretch
static void texface_from_original_index(const Scene *scene, const int cd_loop_uv_offset, BMFace *efa, int index, float **r_uv, ParamBool *r_pin, ParamBool *r_select)
static ParamHandle * construct_param_handle_subsurfed(const Scene *scene, Object *ob, BMEditMesh *em, const UnwrapOptions *options, UnwrapResultInfo *result_info)
static void uv_map_transform(bContext *C, wmOperator *op, float rotmat[4][4])
static void uv_map_clip_correct_multi(Object **objects, uint objects_len, wmOperator *op)
static int smart_project_exec(bContext *C, wmOperator *op)
static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interactive)
static uint smart_uv_project_calculate_project_normals(const ThickFace *thick_faces, const uint thick_faces_len, BMesh *bm, const float project_angle_limit_half_cos, const float project_angle_limit_cos, const float area_weight, float(**r_project_normal_array)[3])
void UV_OT_average_islands_scale(wmOperatorType *ot)
static bool uvedit_have_selection(const Scene *scene, BMEditMesh *em, const UnwrapOptions *options)
static void uv_cylinder_project(float target[2], const float source[3], const float center[3], const float rotmat[4][4])
static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
@ UNWRAP_ERROR_NONUNIFORM
void UV_OT_reset(wmOperatorType *ot)
void UV_OT_minimize_stretch(wmOperatorType *ot)
static bool minimize_stretch_init(bContext *C, wmOperator *op)
static void uv_map_transform_calc_bounds(BMEditMesh *em, float r_min[3], float r_max[3])
static bool ED_uvedit_ensure_uvs(Object *obedit)
struct UnwrapOptions UnwrapOptions
static void uvedit_pack_islands(const Scene *scene, Object *ob, BMesh *bm)
void UV_OT_pack_islands(wmOperatorType *ot)
static void uv_map_mirror(BMEditMesh *em, BMFace *efa)
void ED_uvedit_live_unwrap_end(short cancel)
static int reset_exec(bContext *C, wmOperator *UNUSED(op))
void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)