91 *r_use_subsurf = subsurf;
103 int cd_loop_uv_offset;
140 memset(udim_params, 0,
sizeof(*udim_params));
156 int active_udim = 1001;
170 int tile_number = 1001;
173 active_udim = tile_number;
223 if (cd_loop_uv_offset == -1) {
245 if (
options->only_selected_uvs && !
l) {
257 const uint objects_len,
260 bool have_select =
false;
261 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
262 Object *obedit = objects[ob_index];
273 const int material_index,
277 if (
UNLIKELY(material_index < 0 || material_index >= ob->
totcol)) {
292 bool selected =
false;
306 const int cd_loop_uv_offset)
316 if (
options->only_selected_uvs) {
336 const int cd_loop_uv_offset)
343 if (
options->pin_unselected && !pin) {
358 const int cd_loop_uv_offset)
393 if (
options->topology_from_uvs && !
options->topology_from_uvs_use_seams) {
398 if (cd_loop_uv_offset == -1) {
483 const uint objects_len,
507 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
508 Object *obedit = objects[ob_index];
514 if (cd_loop_uv_offset == -1) {
542 const int cd_loop_uv_offset,
597 const int *origVertIndices, *origEdgeIndices, *origPolyIndices;
599 MVert *subsurfedVerts;
600 MEdge *subsurfedEdges;
601 MPoly *subsurfedPolys;
602 MLoop *subsurfedLoops;
604 int numOfEdges, numOfFaces;
639 initialDerived->
release(initialDerived);
644 subsurfedVerts = derivedMesh->
getVertArray(derivedMesh);
645 subsurfedEdges = derivedMesh->
getEdgeArray(derivedMesh);
646 subsurfedPolys = derivedMesh->
getPolyArray(derivedMesh);
647 subsurfedLoops = derivedMesh->
getLoopArray(derivedMesh);
653 numOfEdges = derivedMesh->
getNumEdges(derivedMesh);
654 numOfFaces = derivedMesh->
getNumPolys(derivedMesh);
662 for (i = 0; i < numOfFaces; i++) {
669 for (i = 0; i < numOfEdges; i++) {
677 for (i = 0, mpoly = subsurfedPolys; i < numOfFaces; i++, mpoly++) {
696 mloop = &subsurfedLoops[mpoly->
loopstart];
706 co[0] = subsurfedVerts[mloop[0].
v].
co;
707 co[1] = subsurfedVerts[mloop[1].
v].
co;
708 co[2] = subsurfedVerts[mloop[2].
v].
co;
709 co[3] = subsurfedVerts[mloop[3].
v].
co;
717 origVertIndices[mloop[0].
v],
724 origVertIndices[mloop[1].
v],
731 origVertIndices[mloop[2].
v],
738 origVertIndices[mloop[3].
v],
747 for (edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
764 derivedMesh->
release(derivedMesh);
792 .topology_from_uvs =
true,
794 .only_selected_faces =
true,
795 .only_selected_uvs =
true,
796 .correct_aspect =
true,
799 uint objects_len = 0;
819 if (ms->
blend != 0.0f) {
920 for (i = 0; i < iterations; i++) {
949 switch (event->
type) {
962 if (ms->
blend < 0.95f) {
973 if (ms->
blend > 0.05f) {
1008 ot->
name =
"Minimize Stretch";
1009 ot->
idname =
"UV_OT_minimize_stretch";
1011 ot->
description =
"Reduce UV stretching by relaxing angles";
1025 "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and "
1026 "preserve symmetry");
1033 "Blend factor between stretch minimized and original",
1042 "Number of iterations to run, 0 is unlimited when run interactively",
1056 .topology_from_uvs =
true,
1057 .only_selected_faces =
false,
1058 .only_selected_uvs =
true,
1059 .fill_holes =
false,
1060 .correct_aspect =
false,
1064 bool ignore_pinned =
false;
1080 const uint objects_len,
1090 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1091 Object *obedit = objects[ob_index];
1110 .topology_from_uvs =
true,
1111 .only_selected_faces =
true,
1112 .only_selected_uvs =
true,
1113 .fill_holes =
false,
1114 .correct_aspect =
true,
1117 uint objects_len = 0;
1140 sima, use_active, &udim_params);
1145 use_udim_params ? &udim_params :
NULL,
1148 .rotate_align_axis = -1,
1149 .only_selected_uvs =
true,
1150 .only_selected_faces =
true,
1151 .correct_aspect =
true,
1166 "Pack islands to active UDIM image tile or UDIM grid tile where 2D cursor is located"},
1170 ot->
name =
"Pack Islands";
1173 "Transform all islands so that they fill up the UV/UDIM space as much as possible";
1185 ot->
srna,
"margin", 0.001f, 0.0f, 1.0f,
"Margin",
"Space between islands", 0.0f, 1.0f);
1202 .topology_from_uvs =
true,
1203 .only_selected_faces =
true,
1204 .only_selected_uvs =
true,
1205 .fill_holes =
false,
1206 .correct_aspect =
true,
1209 uint objects_len = 0;
1227 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1228 Object *obedit = objects[ob_index];
1245 ot->
name =
"Average Islands Scale";
1246 ot->
idname =
"UV_OT_average_islands_scale";
1247 ot->
description =
"Average the size of separate UV islands, based on their area in 3D space";
1285 .topology_from_uvs =
false,
1286 .only_selected_faces =
false,
1287 .only_selected_uvs =
false,
1305 "uvedit_live_unwrap_liveHandles");
1350 #define VIEW_ON_EQUATOR 0
1351 #define VIEW_ON_POLES 1
1352 #define ALIGN_TO_OBJECT 2
1373 uint center_accum_num = 0;
1380 center_accum_num += 1;
1383 mul_v3_fl(r_center, 1.0f / (
float)center_accum_num);
1391 float r_bounds[2][3])
1398 bool is_minmax_set =
false;
1404 is_minmax_set =
true;
1434 if (!is_minmax_set) {
1450 float rotup[4][4], rotside[4][4], viewmatrix[4][4], rotobj[4][4];
1451 float sideangle = 0.0f, upangle = 0.0f;
1470 rotobj[3][3] = 0.0f;
1478 sideangle = (
float)
M_PI * (sideangledeg + 180.0f) / 180.0f;
1479 rotside[0][0] =
cosf(sideangle);
1480 rotside[0][1] = -
sinf(sideangle);
1481 rotside[1][0] =
sinf(sideangle);
1482 rotside[1][1] =
cosf(sideangle);
1483 rotside[2][2] = 1.0f;
1485 upangle = (
float)
M_PI * upangledeg / 180.0f;
1486 rotup[1][1] =
cosf(upangle) / radius;
1487 rotup[1][2] = -
sinf(upangle) / radius;
1488 rotup[2][1] =
sinf(upangle) / radius;
1489 rotup[2][2] =
cosf(upangle) / radius;
1490 rotup[0][0] = 1.0f / radius;
1503 const float offset[4] = {0};
1517 float upangledeg, sideangledeg;
1521 sideangledeg = 0.0f;
1526 sideangledeg = 0.0f;
1529 sideangledeg = 90.0f;
1545 {
VIEW_ON_EQUATOR,
"VIEW_ON_EQUATOR", 0,
"View on Equator",
"3D view is on the equator"},
1546 {
VIEW_ON_POLES,
"VIEW_ON_POLES", 0,
"View on Poles",
"3D view is on the poles"},
1551 "Align according to object transform"},
1555 {
POLAR_ZX,
"POLAR_ZX", 0,
"Polar ZX",
"Polar 0 is X"},
1556 {
POLAR_ZY,
"POLAR_ZY", 0,
"Polar ZY",
"Polar 0 is Y"},
1565 "Direction of the sphere or cylinder");
1571 "How to determine rotation around the pole");
1579 "Radius of the sphere or cylinder",
1586 const int cd_loop_uv_offset,
1587 const float aspect_y)
1596 if (aspect_y > 1.0f) {
1598 luv->
uv[0] = luv->
uv[0] / aspect_y + (0.5f - 0.5f / aspect_y);
1602 luv->
uv[1] = luv->
uv[1] * aspect_y + (0.5f - 0.5f * aspect_y);
1612 const float aspect_y = aspx / aspy;
1613 if (aspect_y == 1.0f) {
1628 const int materials_num = ob->
totcol;
1629 if (materials_num == 0) {
1634 float *material_aspect_y =
BLI_array_alloca(material_aspect_y, materials_num);
1636 copy_vn_fl(material_aspect_y, materials_num, -1.0f);
1647 const int material_index = efa->
mat_nr;
1648 if (
UNLIKELY(material_index < 0 || material_index >= materials_num)) {
1653 float aspect_y = material_aspect_y[material_index];
1654 if (aspect_y == -1.0f) {
1658 aspect_y = aspx / aspy;
1659 material_aspect_y[material_index] = aspect_y;
1662 if (aspect_y == 1.0f) {
1670 #undef VIEW_ON_EQUATOR
1671 #undef VIEW_ON_POLES
1672 #undef ALIGN_TO_OBJECT
1689 "Map UVs taking image aspect ratio into account");
1691 if (clip_to_bounds) {
1696 "Clip UV coordinates to bounds after unwrapping");
1702 "Scale UV coordinates to bounds after unwrapping");
1720 bool per_face_aspect)
1726 float dx, dy,
min[2],
max[2];
1734 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1735 Object *ob = objects[ob_index];
1741 if (correct_aspect) {
1742 if (per_face_aspect) {
1750 if (scale_to_bounds) {
1763 else if (clip_to_bounds) {
1778 if (scale_to_bounds) {
1790 if (dx == 1.0f && dy == 1.0f) {
1795 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1796 Object *ob = objects[ob_index];
1809 luv->
uv[0] = (luv->
uv[0] -
min[0]) * dx;
1810 luv->
uv[1] = (luv->
uv[1] -
min[1]) * dy;
1865 const int objects_len,
1869 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1870 Object *obedit = objects[ob_index];
1881 .topology_from_uvs =
false,
1882 .only_selected_faces =
false,
1883 .only_selected_uvs =
false,
1889 bool ignore_pinned =
true;
1907 int reported_errors = 0;
1910 bool subsurf_error = use_subsurf;
1912 uint objects_len = 0;
1917 .topology_from_uvs =
false,
1918 .only_selected_faces =
true,
1919 .only_selected_uvs =
false,
1925 bool ignore_pinned =
true;
1928 options.only_selected_uvs =
true;
1929 options.pin_unselected =
true;
1938 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1939 Object *obedit = objects[ob_index];
1941 bool use_subsurf_final;
1947 if (subsurf_error) {
1951 if (use_subsurf_final) {
1952 subsurf_error =
false;
1961 if (!(
fabsf(obsize[0] - obsize[1]) < 1e-4f &&
fabsf(obsize[1] - obsize[2]) < 1e-4f)) {
1965 "Object has non-uniform scale, unwrap will operate on a non-scaled version of "
1975 "Object has negative scale, unwrap will operate on a non-flipped version of the mesh");
1981 if (subsurf_error) {
1984 "Subdivision Surface modifier needs to be first to work with unwrap");
2037 "Unwrap could not solve any island(s), edge seams may need to be added");
2042 "Unwrap failed to solve %d of %d island(s), edge seams may need to be added",
2053 {0,
"ANGLE_BASED", 0,
"Angle Based",
""},
2054 {1,
"CONFORMAL", 0,
"Conformal",
""},
2060 ot->
description =
"Unwrap the mesh of the object being edited";
2074 "Unwrapping method (Angle Based usually gives better results than Conformal, while "
2075 "being somewhat slower)");
2080 "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and "
2081 "preserve symmetry");
2086 "Map UVs taking image aspect ratio into account");
2091 "Use Subdivision Surface",
2092 "Map UVs taking vertex position after Subdivision Surface modifier has been applied");
2094 ot->
srna,
"margin", 0.001f, 0.0f, 1.0f,
"Margin",
"Space between islands", 0.0f, 1.0f);
2134 const uint thick_faces_len,
2136 const float project_angle_limit_half_cos,
2137 const float project_angle_limit_cos,
2138 const float area_weight,
2139 float (**r_project_normal_array)[3])
2141 if (
UNLIKELY(thick_faces_len == 0)) {
2142 *r_project_normal_array =
NULL;
2146 const float *project_normal = thick_faces[0].
efa->
no;
2157 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
2162 if (
dot_v3v3(thick_faces[f_index].efa->no, project_normal) > project_angle_limit_half_cos) {
2168 float average_normal[3] = {0.0f, 0.0f, 0.0f};
2170 if (area_weight <= 0.0f) {
2171 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
2173 const ThickFace *tf = project_thick_faces[f_proj_index];
2177 else if (area_weight >= 1.0f) {
2178 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
2180 const ThickFace *tf = project_thick_faces[f_proj_index];
2185 for (
int f_proj_index = 0; f_proj_index <
BLI_array_len(project_thick_faces);
2187 const ThickFace *tf = project_thick_faces[f_proj_index];
2188 const float area_blend = (tf->
area * area_weight) + (1.0f - area_weight);
2200 float anble_best = 1.0f;
2201 uint angle_best_index = 0;
2203 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
2208 float angle_test = -1.0f;
2209 for (
int p_index = 0; p_index <
BLI_array_len(project_normal_array); p_index++) {
2210 angle_test =
max_ff(angle_test,
2211 dot_v3v3(project_normal_array[p_index], thick_faces[f_index].efa->no));
2214 if (angle_test < anble_best) {
2215 anble_best = angle_test;
2216 angle_best_index = f_index;
2220 if (anble_best < project_angle_limit_cos) {
2221 project_normal = thick_faces[angle_best_index].
efa->
no;
2236 *r_project_normal_array = project_normal_array;
2252 const float project_angle_limit_cos =
cosf(project_angle_limit);
2253 const float project_angle_limit_half_cos =
cosf(project_angle_limit / 2);
2258 uint objects_len = 0;
2260 view_layer, v3d, &objects_len);
2262 Object **objects_changed =
MEM_mallocN(
sizeof(*objects_changed) * objects_len, __func__);
2263 uint object_changed_len = 0;
2269 for (ob_index = 0; ob_index < objects_len; ob_index++) {
2270 Object *obedit = objects[ob_index];
2272 bool changed =
false;
2281 uint thick_faces_len = 0;
2287 thick_faces[thick_faces_len].
efa = efa;
2294 while ((thick_faces_len > 0) &&
2306 thick_faces_len -= 1;
2314 project_angle_limit_half_cos,
2315 project_angle_limit_cos,
2317 &project_normal_array);
2319 if (project_normals_len == 0) {
2327 sizeof(*thickface_project_groups) * project_normals_len, __func__);
2331 for (
int f_index = thick_faces_len - 1; f_index >= 0; f_index--) {
2332 const float *f_normal = thick_faces[f_index].
efa->
no;
2334 float angle_best =
dot_v3v3(f_normal, project_normal_array[0]);
2335 uint angle_best_index = 0;
2337 for (
int p_index = 1; p_index < project_normals_len; p_index++) {
2338 const float angle_test =
dot_v3v3(f_normal, project_normal_array[p_index]);
2339 if (angle_test > angle_best) {
2340 angle_best = angle_test;
2341 angle_best_index = p_index;
2346 &thickface_project_groups[angle_best_index], &thick_faces[f_index], arena);
2349 for (
int p_index = 0; p_index < project_normals_len; p_index++) {
2350 if (thickface_project_groups[p_index] ==
NULL) {
2354 float axis_mat[3][3];
2357 for (
LinkNode *list = thickface_project_groups[p_index]; list; list = list->
next) {
2376 objects_changed[object_changed_len] = objects[ob_index];
2377 object_changed_len += 1;
2386 if (object_changed_len > 0) {
2399 .rotate_align_axis = 1,
2400 .only_selected_faces =
true,
2401 .correct_aspect = correct_aspect,
2406 const bool per_face_aspect =
false;
2420 ot->
name =
"Smart UV Project";
2421 ot->
idname =
"UV_OT_smart_project";
2422 ot->
description =
"Projection unwraps the selected faces of mesh objects";
2439 "Lower for more projection groups, higher for less distortion",
2450 "Margin to reduce bleed from adjacent islands",
2459 "Weight projection's vector by faces with larger areas",
2506 float objects_pos_offset[4];
2507 bool changed_multi =
false;
2512 uint objects_len = 0;
2514 view_layer, v3d, &objects_len);
2516 if (use_orthographic) {
2518 float objects_pos_avg[4] = {0};
2520 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2521 add_v4_v4(objects_pos_avg, objects[ob_index]->obmat[3]);
2524 mul_v4_fl(objects_pos_avg, 1.0f / objects_len);
2528 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2529 Object *obedit = objects[ob_index];
2531 bool changed =
false;
2540 if (use_orthographic) {
2597 changed_multi =
true;
2608 if (changed_multi) {
2614 if (changed_multi) {
2628 return (rv3d !=
NULL);
2634 ot->
name =
"Project from View";
2635 ot->
idname =
"UV_OT_project_from_view";
2636 ot->
description =
"Project the UV vertices of the mesh as seen in current 3D view";
2651 "Map UVs to the camera region taking resolution and aspect into account");
2666 uint objects_len = 0;
2668 view_layer, v3d, &objects_len);
2669 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2670 Object *obedit = objects[ob_index];
2674 if (em->bm->totfacesel == 0) {
2714 const float source[3],
2716 const float rotmat[4][4])
2726 if (target[0] >= 1.0f) {
2748 for (i = 1; i < efa->
len; i++) {
2749 if (uvs[i][0] > uvs[mi][0]) {
2754 for (i = 0; i < efa->
len; i++) {
2756 dx = uvs[mi][0] - uvs[i][0];
2770 uint objects_len = 0;
2772 view_layer, v3d, &objects_len);
2773 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2774 Object *obedit = objects[ob_index];
2823 ot->
name =
"Sphere Projection";
2824 ot->
idname =
"UV_OT_sphere_project";
2825 ot->
description =
"Project the UV vertices of the mesh over the curved surface of a sphere";
2845 const float source[3],
2847 const float rotmat[4][4])
2854 map_to_tube(&target[0], &target[1], pv[0], pv[1], pv[2]);
2857 if (target[0] >= 1.0f) {
2868 uint objects_len = 0;
2870 view_layer, v3d, &objects_len);
2871 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
2872 Object *obedit = objects[ob_index];
2921 ot->
name =
"Cylinder Projection";
2922 ot->
idname =
"UV_OT_cylinder_project";
2923 ot->
description =
"Project the UV vertices of the mesh over the curved wall of a cylinder";
2954 int cd_loop_uv_offset;
2981 luv->
uv[0] = 0.5f + ((
l->
v->
co[cox] - loc[cox]) / cube_size);
2982 luv->
uv[1] = 0.5f + ((
l->
v->
co[coy] - loc[coy]) / cube_size);
2996 uint objects_len = 0;
2998 view_layer, v3d, &objects_len);
2999 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
3000 Object *obedit = objects[ob_index];
3023 float cube_size = cube_size_init;
3028 if (ob_index == 0) {
3049 ot->
name =
"Cube Projection";
3051 ot->
description =
"Project the UV vertices of the mesh over the six faces of a cube";
3066 "Size of the cube to project on",
3085 .use_toolflags =
false,
3097 .calc_face_normal =
true,
3098 .calc_vert_normal =
true,
3110 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 SpaceImage * CTX_wm_space_image(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_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
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
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
void map_to_tube(float *r_u, float *r_v, float x, float y, float z)
void map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
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 copy_vn_fl(float *array_tar, int size, float val)
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 negate_v4_v4(float r[4], const float a[4])
MINLINE void clamp_v2(float vec[2], float min, 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])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
#define BLI_MEMARENA_STD_BUFSIZE
void void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
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 ED_mesh_uv_ensure(struct Mesh *me, const char *name)
int ED_mesh_uv_add(struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports)
void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, uint objects_len, char htype)
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_select_all(struct BMesh *bm)
bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset)
bool ED_uvedit_test(struct Object *obedit)
bool uv_coords_isect_udim(const struct Image *image, const int udim_grid[2], const float coords[2])
void ED_uvedit_pack_islands_multi(const struct Scene *scene, Object **objects, uint objects_len, const struct UVMapUDIM_Params *udim_params, const struct UVPackIsland_Params *params)
struct Camera * ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d)
void GEO_uv_parametrizer_flush(ParamHandle *handle)
void GEO_uv_parametrizer_stretch_iter(ParamHandle *handle)
ParamHandle * GEO_uv_parametrizer_construct_begin(void)
void GEO_uv_prepare_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2])
void GEO_uv_parametrizer_lscm_end(ParamHandle *handle)
void GEO_uv_parametrizer_stretch_begin(ParamHandle *handle)
void GEO_uv_parametrizer_face_add(ParamHandle *handle, const ParamKey key, const int nverts, const ParamKey *vkeys, const float **co, float **uv, const bool *pin, const bool *select)
void GEO_uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear)
void GEO_uv_parametrizer_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
void GEO_uv_parametrizer_flush_restore(ParamHandle *handle)
void GEO_uv_parametrizer_construct_end(ParamHandle *handle, bool fill, bool topology_from_uvs, int *count_fail)
void GEO_uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed)
void GEO_uv_parametrizer_delete(ParamHandle *handle)
void GEO_uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys)
void GEO_uv_parametrizer_stretch_end(ParamHandle *handle)
ParamKey GEO_uv_find_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2])
void GEO_uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspx, float aspy)
void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf)
void GEO_uv_parametrizer_stretch_blend(ParamHandle *handle, float blend)
NSNotificationCenter * center
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
Platform independent time functions.
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
#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)
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)
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
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
IconTextureDrawCall normal
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
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
const struct Image * image
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)
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)
static void construct_param_handle_face_add(ParamHandle *handle, const Scene *scene, BMFace *efa, ParamKey face_index, const UnwrapOptions *options, const int cd_loop_uv_offset)
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 void uv_map_clip_correct_multi(Object **objects, uint objects_len, wmOperator *op, bool per_face_aspect)
static void construct_param_edge_set_seams(ParamHandle *handle, BMesh *bm, const UnwrapOptions *options)
void ED_uvedit_get_aspect_from_material(Object *ob, const int material_index, float *r_aspx, float *r_aspy)
struct UnwrapResultInfo UnwrapResultInfo
bool ED_uvedit_udim_params_from_image_space(const SpaceImage *sima, bool use_active, struct UVMapUDIM_Params *udim_params)
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)
static bool uvedit_is_face_affected(const Scene *scene, BMFace *efa, const UnwrapOptions *options, const int cd_loop_uv_offset)
void UV_OT_cylinder_project(wmOperatorType *ot)
void UV_OT_project_from_view(wmOperatorType *ot)
void UV_OT_smart_project(wmOperatorType *ot)
@ UNWRAP_ERROR_NONUNIFORM
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)
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)
static void uvedit_prepare_pinned_indices(ParamHandle *handle, const Scene *scene, BMFace *efa, const UnwrapOptions *options, const int cd_loop_uv_offset)
static int average_islands_scale_exec(bContext *C, wmOperator *op)
static int sphere_project_exec(bContext *C, wmOperator *op)
static struct @632 g_live_unwrap
struct MinStretch MinStretch
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 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])
void UV_OT_reset(wmOperatorType *ot)
void UV_OT_minimize_stretch(wmOperatorType *ot)
static void texface_from_original_index(const Scene *scene, const int cd_loop_uv_offset, BMFace *efa, int index, float **r_uv, bool *r_pin, bool *r_select)
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)
static void shrink_loop_uv_by_aspect_ratio(BMFace *efa, const int cd_loop_uv_offset, const float aspect_y)
static void correct_uv_aspect_per_face(Object *ob, BMEditMesh *em)
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)