138#define PROJ_BUCKET_BRUSH_DIV 4
140#define PROJ_BUCKET_RECT_MIN 4
141#define PROJ_BUCKET_RECT_MAX 256
143#define PROJ_BOUNDBOX_DIV 8
144#define PROJ_BOUNDBOX_SQUARED (PROJ_BOUNDBOX_DIV * PROJ_BOUNDBOX_DIV)
149#define PROJ_DEBUG_WINCLIP 1
151#ifndef PROJ_DEBUG_NOSEAMBLEED
157# define PROJ_FACE_SEAM0 (1 << 0)
158# define PROJ_FACE_SEAM1 (1 << 1)
159# define PROJ_FACE_SEAM2 (1 << 2)
161# define PROJ_FACE_NOSEAM0 (1 << 4)
162# define PROJ_FACE_NOSEAM1 (1 << 5)
163# define PROJ_FACE_NOSEAM2 (1 << 6)
166# define PROJ_FACE_SEAM_INIT0 (1 << 8)
167# define PROJ_FACE_SEAM_INIT1 (1 << 9)
168# define PROJ_FACE_SEAM_INIT2 (1 << 10)
170# define PROJ_FACE_DEGENERATE (1 << 12)
173# define PROJ_FACE_WINDING_INIT 1
174# define PROJ_FACE_WINDING_CW 2
179# define PROJ_FACE_SCALE_SEAM 0.99f
182#define PROJ_SRC_VIEW 1
183#define PROJ_SRC_IMAGE_CAM 2
184#define PROJ_SRC_IMAGE_VIEW 3
185#define PROJ_SRC_VIEW_FILL 4
187#define PROJ_VIEW_DATA_ID "view_data"
189#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
191#define PROJ_BUCKET_NULL 0
192#define PROJ_BUCKET_INIT (1 << 0)
196#define PROJ_GEOM_TOLERANCE 0.00075f
197#define PROJ_PIXEL_TOLERANCE 0.01f
200#define PROJ_VERT_CULL 1
203#define TILE_PENDING POINTER_FROM_INT(-1)
369#ifndef PROJ_DEBUG_NOSEAMBLEED
409#define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src) \
410 MEMCPY_STRUCT_AFTER(ps_dst, ps_src, is_shared_user)
412#define PROJ_PAINT_STATE_SHARED_CLEAR(ps) MEMSET_STRUCT_AFTER(ps, 0, is_shared_user)
420#ifndef PROJ_DEBUG_NOSEAMBLEED
538#define PS_CORNER_TRI_AS_VERT_INDEX_3(ps, tri) \
539 ps->corner_verts_eval[tri[0]], ps->corner_verts_eval[tri[1]], ps->corner_verts_eval[tri[2]],
541#define PS_CORNER_TRI_AS_UV_3(uvlayer, face_i, tri) \
542 uvlayer[face_i][tri[0]], uvlayer[face_i][tri[1]], uvlayer[face_i][tri[2]],
544#define PS_CORNER_TRI_ASSIGN_UV_3(uv_tri, uvlayer, face_i, tri) \
546 (uv_tri)[0] = uvlayer[face_i][tri[0]]; \
547 (uv_tri)[1] = uvlayer[face_i][tri[1]]; \
548 (uv_tri)[2] = uvlayer[face_i][tri[2]]; \
565 return 1001 + 10 * ty + tx;
571 if (mat_nr >= 0 && mat_nr <= ps->ob->totcol) {
643 const float pt[2],
const float v1[3],
const float v2[3],
const float v3[3],
float w[3])
646 return (v1[2] *
w[0]) + (
v2[2] *
w[1]) + (v3[2] *
w[2]);
650 const float pt[2],
const float v1[4],
const float v2[4],
const float v3[4],
float w[3])
652 float wtot_inv, wtot;
662 w_tmp[0] =
w[0] * v1[3];
663 w_tmp[1] =
w[1] *
v2[3];
664 w_tmp[2] =
w[2] * v3[3];
666 wtot = w_tmp[0] + w_tmp[1] + w_tmp[2];
669 wtot_inv = 1.0f / wtot;
671 w_tmp[0] = w_tmp[0] * wtot_inv;
672 w_tmp[1] = w_tmp[1] * wtot_inv;
673 w_tmp[2] = w_tmp[2] * wtot_inv;
676 w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
680 return (v1[2] * w_tmp[0]) + (
v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
689 int best_tri_index = -1;
690 float z_depth_best =
FLT_MAX, z_depth;
693 if (bucket_index == -1) {
703 const float *vtri_ss[3] = {
717 if (z_depth < z_depth_best) {
718 best_tri_index = tri_index;
719 z_depth_best = z_depth;
726 return best_tri_index;
735 const float *tri_uv[3];
743 if (tri_index == -1) {
759 iuser.
tile = tile_number;
762 if (ibuf ==
nullptr) {
766 float x = uv[0] * ibuf->
x;
767 float y = uv[1] * ibuf->
y;
778 memcpy(rgba_fp, &
col,
sizeof(
col));
788 memcpy(rgba, &
col,
sizeof(
col));
814 if (v1[2] > pt[2] &&
v2[2] > pt[2] && v3[2] > pt[2]) {
825 if (v1[2] < pt[2] &&
v2[2] < pt[2] && v3[2] < pt[2]) {
848 const float v1_3d[3],
849 const float v2_3d[3],
850 const float v3_3d[3],
888 const float pixelScreenCo[4])
896 for (; bucketFace; bucketFace = bucketFace->
next) {
899 if (orig_face != tri_index) {
901 const float *vtri_ss[3] = {
909 const float *vtri_co[3] = {
921 if (isect_ret >= 1) {
934#define ISECT_TRUE_P1 2
935#define ISECT_TRUE_P2 3
936static int line_isect_y(
const float p1[2],
const float p2[2],
const float y_level,
float *x_isect)
941 if (y_level == p1[1]) {
946 if (y_level == p2[1]) {
952 y_diff =
fabsf(p1[1] - p2[1]);
954 if (y_diff < 0.000001f) {
955 *x_isect = (p1[0] + p2[0]) * 0.5f;
959 if (p1[1] > y_level && p2[1] < y_level) {
961 *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
964 if (p1[1] < y_level && p2[1] > y_level) {
966 *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
972static int line_isect_x(
const float p1[2],
const float p2[2],
const float x_level,
float *y_isect)
976 if (x_level == p1[0]) {
980 if (x_level == p2[0]) {
986 x_diff =
fabsf(p1[0] - p2[0]);
989 if (x_diff < 0.000001f) {
990 *y_isect = (p1[0] + p2[0]) * 0.5f;
994 if (p1[0] > x_level && p2[0] < x_level) {
996 *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
999 if (p1[0] < x_level && p2[0] > x_level) {
1001 *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
1011#ifndef PROJ_DEBUG_NOSEAMBLEED
1012static bool cmp_uv(
const float vec2a[2],
const float vec2b[2])
1015 float xa =
fmodf(vec2a[0], 1.0f);
1016 float ya =
fmodf(vec2a[1], 1.0f);
1018 float xb =
fmodf(vec2b[0], 1.0f);
1019 float yb =
fmodf(vec2b[1], 1.0f);
1043#ifndef PROJ_DEBUG_NOSEAMBLEED
1050 float min_uv[2], max_uv[2];
1059 r_bounds_px->
xmin = int(ibuf_x * min_uv[0]);
1060 r_bounds_px->
ymin = int(ibuf_y * min_uv[1]);
1062 r_bounds_px->
xmax = int(ibuf_x * max_uv[0]) + 1;
1063 r_bounds_px->
ymax = int(ibuf_y * max_uv[1]) + 1;
1068 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1075 float (*uv)[2],
const int ibuf_x,
const int ibuf_y,
int tot,
rcti *r_bounds_px)
1078 float min_uv[2], max_uv[2];
1091 r_bounds_px->
xmin = int(ibuf_x * min_uv[0]);
1092 r_bounds_px->
ymin = int(ibuf_y * min_uv[1]);
1094 r_bounds_px->
xmax = int(ibuf_x * max_uv[0]) + 1;
1095 r_bounds_px->
ymax = int(ibuf_y * max_uv[1]) + 1;
1100 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1105#ifndef PROJ_DEBUG_NOSEAMBLEED
1113 float winding =
cross_tri_v2(tri_uv[0], tri_uv[1], tri_uv[2]);
1125 const int orig_face,
1126 const int orig_i1_fidx,
1127 const int orig_i2_fidx,
1133 const float *orig_tri_uv[3] = {
1140 int i1_fidx = -1, i2_fidx = -1;
1145 if (tri_index != orig_face) {
1159 if (i2_fidx != -1) {
1171 *other_face = tri_index;
1174 *orig_fidx = (i1_fidx < i2_fidx && (i2_fidx - i1_fidx == 1)) ? i1_fidx : i2_fidx;
1182 if ((orig_tpage == tpage) && (orig_tile ==
tile) &&
1183 cmp_uv(orig_tri_uv[orig_i1_fidx], tri_uv[i1_fidx]) &&
1184 cmp_uv(orig_tri_uv[orig_i2_fidx], tri_uv[i2_fidx]))
1216 while (seam->
loop != loop_index) {
1252 const float PI_2 =
M_PI * 2.0f;
1254 float angle_rel, angle_no;
1267 if (angle_rel < 0.0f) {
1273 angle_no = angle_rel +
angle[0];
1275 if (angle_no >
M_PI) {
1279 r_no[0] =
cosf(angle_no);
1280 r_no[1] =
sinf(angle_no);
1289 float (*orig_uv)[2],
1302 ibuf_inv[0] = 1.0f / float(ibuf_x);
1303 ibuf_inv[1] = 1.0f / float(ibuf_y);
1305 for (fidx[0] = 0; fidx[0] < 3; fidx[0]++) {
1307 float(*seam_uvs)[2];
1314 loop_index = tri[fidx[0]];
1319 if (seam_uvs[0][0] !=
FLT_MAX) {
1323 fidx[1] = (fidx[0] == 2) ? 0 : fidx[0] + 1;
1328 for (
uint i = 0;
i < 2;
i++) {
1338 if (tri_ang > 0.0f) {
1346 len_fact =
cosf(tri_ang);
1347 len_fact =
UNLIKELY(len_fact < FLT_EPSILON) ?
FLT_MAX : (1.0f / len_fact);
1350 len_fact = std::min(len_fact, 10.0f);
1360 if ((ang[0] + ang[1]) <
M_PI) {
1365 orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1], isect_co);
1376 const int tri_index,
1384 const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
1389 vseam->
prev =
nullptr;
1390 vseam->
next =
nullptr;
1392 vseam->
tri = tri_index;
1393 vseam->
loop = tri[fidx[0]];
1395 sub_v2_v2v2(vec, tri_uv[fidx[1]], tri_uv[fidx[0]]);
1406 vseam[1] = vseam[0];
1411 for (
uint i = 0;
i < 2;
i++) {
1432 const int tri_index,
1433 const uint vert_index,
1439 int other_face, other_fidx;
1441 int fidx[2] = {2, 0};
1457 if (
check_seam(ps, tri_index, fidx[0], fidx[1], &other_face, &other_fidx)) {
1461 if (other_face != -1) {
1474 if (other_face != -1) {
1484 }
while (fidx[0]--);
1487 char checked_verts = 0;
1494 for (
uint i = 0;
i < 2;
i++) {
1497 if ((checked_verts & (1 << fidx[
i])) != 0) {
1509 checked_verts |= 1 << fidx[
i];
1516 }
while (fidx[0]--);
1526 const float v1co[3],
1527 const float v2co[3],
1528 const float v3co[3],
1529 const float uv1co[2],
1530 const float uv2co[2],
1531 const float uv3co[2],
1532 float pixelScreenCo[4],
1542 const float v1co[4],
1543 const float v2co[4],
1544 const float v3co[4],
1545 const float uv1co[2],
1546 const float uv2co[2],
1547 const float uv3co[2],
1548 float pixelScreenCo[4],
1552 float wtot_inv, wtot;
1556 w_int[0] =
w[0] * v1co[3];
1557 w_int[1] =
w[1] * v2co[3];
1558 w_int[2] =
w[2] * v3co[3];
1560 wtot = w_int[0] + w_int[1] + w_int[2];
1563 wtot_inv = 1.0f / wtot;
1564 w_int[0] *= wtot_inv;
1565 w_int[1] *= wtot_inv;
1566 w_int[2] *= wtot_inv;
1570 w[0] =
w[1] =
w[2] = w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
1588 const float projmat_inv[4][4],
1589 const float view_pos[3],
1590 const float co_px[2],
1593 r_dir[0] = 2.0f * (co_px[0] / winx) - 1.0f;
1594 r_dir[1] = 2.0f * (co_px[1] / winy) - 1.0f;
1613 const float zero[3] = {0};
1614 float v1_proj[3], v2_proj[3];
1629 const float *tri_uv[3],
ImBuf *ibuf_other,
const float w[3],
uchar rgba_ub[4],
float rgba_f[4])
1636 float x = uv_other[0] * ibuf_other->
x - 0.5f;
1637 float y = uv_other[1] * ibuf_other->
y - 0.5f;
1642 memcpy(rgba_f, &
col,
sizeof(
col));
1646 memcpy(rgba_ub, &
col,
sizeof(
col));
1652 const int tri_index,
1676 mask = ((rgba_f[0] + rgba_f[1] + rgba_f[2]) * (1.0f / 3.0f)) * rgba_f[3];
1679 mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) * (1.0f / (255.0f * 3.0f))) *
1680 (rgba_ub[3] * (1.0f / 255.0f));
1705 float ca1, ca2, ca3, ca_mask;
1710 ca_mask =
w[0] * ca1 +
w[1] * ca2 +
w[2] * ca3;
1712 CLAMP(ca_mask, 0.0f, 1.0f);
1721 float no[3], angle_cos;
1724 const float *no1, *no2, *no3;
1729 no[0] =
w[0] * no1[0] +
w[1] * no2[0] +
w[2] * no3[0];
1730 no[1] =
w[0] * no1[1] +
w[1] * no2[1] +
w[2] * no3[1];
1731 no[2] =
w[0] * no1[2] +
w[1] * no2[2] +
w[2] * no3[2];
1753 float viewDirPersp[3];
1754 const float *co1, *co2, *co3;
1760 viewDirPersp[0] = (ps->
viewPos[0] - (
w[0] * co1[0] +
w[1] * co2[0] +
w[2] * co3[0]));
1761 viewDirPersp[1] = (ps->
viewPos[1] - (
w[0] * co1[1] +
w[1] * co2[1] +
w[2] * co3[1]));
1762 viewDirPersp[2] = (ps->
viewPos[2] - (
w[0] * co1[2] +
w[1] * co2[2] +
w[2] * co3[2]));
1768 angle_cos =
dot_v3v3(viewDirPersp, no);
1773 angle_cos =
fabsf(angle_cos);
1776 if (angle_cos <= ps->normal_angle__cos) {
1780 if (angle_cos < ps->normal_angle_inner__cos) {
1804 bool generate_tile =
false;
1813 generate_tile =
true;
1820 if (generate_tile) {
1822 volatile void *undorect;
1872 const int tri_index,
1873 const float pixelScreenCo[4],
1874 const float world_spaceCo[3],
1879 int x_round, y_round;
1888 x_px =
mod_i(x_px, ibuf->
x);
1889 y_px =
mod_i(y_px, ibuf->
y);
1935 projPixel->
x_px = x_px;
1936 projPixel->
y_px = y_px;
1960 const float *other_tri_uv[3] = {
1968 other_tri_uv, ibuf_other,
w,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.f);
1988 other_tri_uv, ibuf_other,
w, ((
ProjPixelClone *)projPixel)->clonepx.ch,
nullptr);
2011 ps, co, ((
ProjPixelClone *)projPixel)->clonepx.f,
nullptr,
true))
2019 ps, co,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.ch,
true))
2028#ifdef PROJ_DEBUG_PAINT
2053 if (l1[1] < rect->
ymin || l1[1] > rect->
ymax) {
2057 if ((l1[0] < rect->
xmin && l2[0] < rect->
xmin) || (l1[0] > rect->
xmax && l2[0] > rect->
xmax)) {
2079 if (l1[0] < rect->
xmin || l1[0] > rect->
xmax) {
2084 if ((l1[1] < rect->
ymin && l2[1] < rect->
ymin) || (l1[1] > rect->
ymax && l2[1] > rect->
ymax)) {
2129 (isect <= cliprect->xmax))
2131 if (l1[1] < l2[1]) {
2133 l1_clip[1] = rect->
ymin;
2138 l2_clip[1] = rect->
ymin;
2148 (isect <= cliprect->xmax))
2150 if (l1[1] > l2[1]) {
2152 l1_clip[1] = rect->
ymax;
2157 l2_clip[1] = rect->
ymax;
2168 (isect <= cliprect->ymax))
2170 if (l1[0] < l2[0]) {
2171 l1_clip[0] = rect->
xmin;
2176 l2_clip[0] = rect->
xmin;
2187 (isect <= cliprect->ymax))
2189 if (l1[0] > l2[0]) {
2190 l1_clip[0] = rect->
xmax;
2195 l2_clip[0] = rect->
xmax;
2212#ifndef PROJ_DEBUG_NOSEAMBLEED
2214static void scale_tri(
float insetCos[3][3],
const float *origCos[3],
const float inset)
2217 cent[0] = (origCos[0][0] + origCos[1][0] + origCos[2][0]) * (1.0f / 3.0f);
2218 cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1]) * (1.0f / 3.0f);
2219 cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2]) * (1.0f / 3.0f);
2241 return x *
x +
y *
y;
2251 const float radius_squared,
2252 const rctf *bucket_bounds)
2266 if ((bucket_bounds->
xmin <= cent[0] && bucket_bounds->
xmax >= cent[0]) ||
2267 (bucket_bounds->
ymin <= cent[1] && bucket_bounds->
ymax >= cent[1]))
2273 if (cent[0] < bucket_bounds->
xmin) {
2275 if (cent[1] < bucket_bounds->
ymin) {
2282 if (cent[1] > bucket_bounds->
ymax) {
2289 else if (cent[0] > bucket_bounds->
xmax) {
2291 if (cent[1] < bucket_bounds->
ymin) {
2298 if (cent[1] > bucket_bounds->
ymax) {
2319 const float *v1coSS,
2320 const float *v2coSS,
2321 const float *v3coSS,
2325 float bucket_bounds_uv[4][2],
2332 uv[0] = bucket_bounds->
xmax;
2333 uv[1] = bucket_bounds->
ymin;
2338 uv[1] = bucket_bounds->
ymax;
2342 uv[0] = bucket_bounds->
xmin;
2348 uv[1] = bucket_bounds->
ymin;
2357 const float *v1coSS,
2358 const float *v2coSS,
2359 const float *v3coSS,
2363 float bucket_bounds_uv[4][2],
2370 uv[0] = bucket_bounds->
xmax;
2371 uv[1] = bucket_bounds->
ymin;
2376 uv[1] = bucket_bounds->
ymax;
2380 uv[0] = bucket_bounds->
xmin;
2386 uv[1] = bucket_bounds->
ymin;
2394static float angle_2d_clockwise(
const float p1[2],
const float p2[2],
const float p3[2])
2398 v1[0] = p1[0] - p2[0];
2399 v1[1] = p1[1] - p2[1];
2400 v2[0] = p3[0] - p2[0];
2401 v2[1] = p3[1] - p2[1];
2403 return -
atan2f(v1[0] *
v2[1] - v1[1] *
v2[0], v1[0] *
v2[0] + v1[1] *
v2[1]);
2408#define ISECT_2 (1 << 1)
2409#define ISECT_3 (1 << 2)
2410#define ISECT_4 (1 << 3)
2411#define ISECT_ALL3 ((1 << 3) - 1)
2412#define ISECT_ALL4 ((1 << 4) - 1)
2416 const float pt[2],
const float v1[2],
const float v2[2],
const float v3[2],
const float limit)
2428 return (((
float *)p1)[2] < ((
float *)p2)[2] ? 1 : -1);
2433 return (((
float *)p1)[2] < ((
float *)p2)[2] ? -1 : 1);
2446 float xlen = l2[0] - l1[0];
2447 float ylen = l2[1] - l1[1];
2451 if ((l1[0] - rect->
xmin) * (l2[0] - rect->
xmin) <= 0) {
2455 else if ((l1[0] - rect->
xmax) * (l2[0] - rect->
xmax) < 0) {
2462 if ((l1[1] - rect->
ymin) * (l2[1] - rect->
ymin) <= 0) {
2466 else if ((l1[1] - rect->
ymax) * (l2[1] - rect->
ymax) < 0) {
2476 tmp = (is_ortho) ? 1.0f : (l1[3] +
min * (l2[3] - l1[3]));
2478 uv[0] = (uv1[0] +
min / tmp * (uv2[0] - uv1[0]));
2479 uv[1] = (uv1[1] +
min / tmp * (uv2[1] - uv1[1]));
2485 const bool is_flip_object,
2486 const rctf *cliprect,
2487 const rctf *bucket_bounds,
2488 const float *v1coSS,
2489 const float *v2coSS,
2490 const float *v3coSS,
2494 float bucket_bounds_uv[8][2],
2498 int inside_bucket_flag = 0;
2499 int inside_face_flag = 0;
2501 bool collinear =
false;
2503 float bucket_bounds_ss[4][2];
2552 if (inside_bucket_flag &
ISECT_1) {
2560 bucket_bounds, v1coSS, v2coSS, uv1co, uv2co, bucket_bounds_uv[*tot], is_ortho))
2566 if (inside_bucket_flag &
ISECT_2) {
2574 bucket_bounds, v2coSS, v3coSS, uv2co, uv3co, bucket_bounds_uv[*tot], is_ortho))
2580 if (inside_bucket_flag &
ISECT_3) {
2588 bucket_bounds, v3coSS, v1coSS, uv3co, uv1co, bucket_bounds_uv[*tot], is_ortho))
2614 bucket_bounds_ss[0][0] = bucket_bounds->
xmax;
2615 bucket_bounds_ss[0][1] = bucket_bounds->
ymin;
2621 bucket_bounds_ss[1][0] = bucket_bounds->
xmax;
2622 bucket_bounds_ss[1][1] = bucket_bounds->
ymax;
2628 bucket_bounds_ss[2][0] = bucket_bounds->
xmin;
2629 bucket_bounds_ss[2][1] = bucket_bounds->
ymax;
2635 bucket_bounds_ss[3][0] = bucket_bounds->
xmin;
2636 bucket_bounds_ss[3][1] = bucket_bounds->
ymin;
2650 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2654 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2681 float isectVCosSS[8][3];
2682 float v1_clipSS[2], v2_clipSS[2];
2686 float cent[2] = {0.0f, 0.0f};
2692 if (inside_face_flag &
ISECT_1) {
2693 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]);
2696 if (inside_face_flag &
ISECT_2) {
2697 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]);
2700 if (inside_face_flag &
ISECT_3) {
2701 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]);
2704 if (inside_face_flag &
ISECT_4) {
2705 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]);
2709 if (inside_bucket_flag &
ISECT_1) {
2713 if (inside_bucket_flag &
ISECT_2) {
2717 if (inside_bucket_flag &
ISECT_3) {
2723 if (
line_clip_rect2f(cliprect, bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
2724 if ((inside_bucket_flag &
ISECT_1) == 0) {
2728 if ((inside_bucket_flag &
ISECT_2) == 0) {
2736 if (
line_clip_rect2f(cliprect, bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
2737 if ((inside_bucket_flag &
ISECT_2) == 0) {
2741 if ((inside_bucket_flag &
ISECT_3) == 0) {
2749 if (
line_clip_rect2f(cliprect, bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
2750 if ((inside_bucket_flag &
ISECT_3) == 0) {
2754 if ((inside_bucket_flag &
ISECT_1) == 0) {
2768 for (
int i = 0;
i < (*tot);
i++) {
2769 cent[0] += isectVCosSS[
i][0];
2770 cent[1] += isectVCosSS[
i][1];
2772 cent[0] = cent[0] / float(*tot);
2773 cent[1] = cent[1] / float(*tot);
2778 for (
int i = 0;
i < (*tot);
i++) {
2779 isectVCosSS[
i][2] = angle_2d_clockwise(up, cent, isectVCosSS[
i]);
2784 v1_clipSS[0] = cent[0];
2785 v1_clipSS[1] = cent[1] + 1.0f;
2787 for (
int i = 0;
i < (*tot);
i++) {
2788 v2_clipSS[0] = isectVCosSS[
i][0] - cent[0];
2789 v2_clipSS[1] = isectVCosSS[
i][1] - cent[1];
2790 isectVCosSS[
i][2] =
atan2f(v1_clipSS[0] * v2_clipSS[1] - v1_clipSS[1] * v2_clipSS[0],
2791 v1_clipSS[0] * v2_clipSS[0] + v1_clipSS[1] * v2_clipSS[1]);
2798 qsort(isectVCosSS, *tot,
sizeof(
float[3]),
float_z_sort);
2802 while (doubles ==
true) {
2805 for (
int i = 0;
i < (*tot);
i++) {
2809 for (
int j =
i; j < (*tot) - 1; j++) {
2810 isectVCosSS[j][0] = isectVCosSS[j + 1][0];
2811 isectVCosSS[j][1] = isectVCosSS[j + 1][1];
2828 for (
int i = 0;
i < (*tot);
i++) {
2834 for (
int i = 0;
i < (*tot);
i++) {
2841#ifdef PROJ_DEBUG_PRINT_CLIP
2846 float test_uv[4][2];
2850 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2854 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2856 printf(
"( [(%f,%f), (%f,%f), (%f,%f), (%f,%f)], ",
2866 printf(
" [(%f,%f), (%f,%f), (%f,%f)], ",
2875 for (
int i = 0;
i < (*tot);
i++) {
2876 printf(
"(%f, %f),", bucket_bounds_uv[
i][0], bucket_bounds_uv[
i][1]);
2940static bool IsectPoly2Df(
const float pt[2],
const float uv[][2],
const int tot)
2947 for (
i = 1;
i < tot;
i++) {
2959 for (
int i = 1;
i < tot;
i++) {
2974 const int thread_index,
2975 const int bucket_index,
2976 const int tri_index,
2977 const int image_index,
2978 const rctf *clip_rect,
2979 const rctf *bucket_bounds,
3010 const float *v1coSS, *v2coSS, *v3coSS;
3013 const float *vCo[3];
3018 float *uv1co, *uv2co, *uv3co;
3019 float pixelScreenCo[4];
3027 float tri_uv_pxoffset[3][2];
3028 float xhalfpx, yhalfpx;
3029 const float ibuf_xf = float(ibuf->
x), ibuf_yf = float(ibuf->
y);
3032 int has_x_isect = 0, has_isect = 0;
3034 float uv_clip[8][2];
3036 const bool is_ortho = ps->
is_ortho;
3060 tri_uv_pxoffset[0][0] = tri_uv[0][0] - xhalfpx;
3061 tri_uv_pxoffset[0][1] = tri_uv[0][1] - yhalfpx;
3063 tri_uv_pxoffset[1][0] = tri_uv[1][0] - xhalfpx;
3064 tri_uv_pxoffset[1][1] = tri_uv[1][1] - yhalfpx;
3066 tri_uv_pxoffset[2][0] = tri_uv[2][0] - xhalfpx;
3067 tri_uv_pxoffset[2][1] = tri_uv[2][1] - yhalfpx;
3070 uv1co = tri_uv_pxoffset[0];
3071 uv2co = tri_uv_pxoffset[1];
3072 uv3co = tri_uv_pxoffset[2];
3096 if (uv_clip_tot > 6) {
3097 printf(
"this should never happen! %d\n", uv_clip_tot);
3103 project_paint_undo_tiles_init(
3109 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3112 uv[1] = float(
y) / ibuf_yf;
3115 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3118 uv[0] = float(
x) / ibuf_xf;
3122 if ((do_backfacecull ==
true &&
IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
3126 has_x_isect = has_isect = 1;
3130 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3134 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3139 if (do_clip || do_3d_mapping) {
3163 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3169 else if (has_x_isect) {
3179 if (has_x_isect == 0 && has_isect) {
3187#ifndef PROJ_DEBUG_NOSEAMBLEED
3206 printf(
"seams - %d %d %d %d\n",
3227 float insetCos[3][3];
3230 const float *vCoSS[3];
3234 float bucket_clip_edges[2][2];
3235 float edge_verts_inset_clip[2][3];
3240 float seam_subsection[4][2];
3244 float tri_puv[3][2];
3246 tri_puv[0][0] = tri_uv_pxoffset[0][0] * ibuf->
x;
3247 tri_puv[0][1] = tri_uv_pxoffset[0][1] * ibuf->
y;
3249 tri_puv[1][0] = tri_uv_pxoffset[1][0] * ibuf->
x;
3250 tri_puv[1][1] = tri_uv_pxoffset[1][1] * ibuf->
y;
3252 tri_puv[2][0] = tri_uv_pxoffset[2][0] * ibuf->
x;
3253 tri_puv[2][1] = tri_uv_pxoffset[2][1] * ibuf->
y;
3280 for (fidx1 = 0; fidx1 < 3; fidx1++) {
3282 fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
3284 if ((face_seam_flag & (1 << fidx1)) &&
3289 bucket_clip_edges[0],
3290 bucket_clip_edges[1]))
3296 float(*seam_uvs)[2] = seam_data->
seam_uvs;
3304 ps, bucket_clip_edges[0], vCo[fidx1], vCo[fidx2]);
3306 ps, bucket_clip_edges[1], vCo[fidx1], vCo[fidx2]);
3310 seam_subsection[0], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac1);
3312 seam_subsection[1], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac2);
3314 interp_v2_v2v2(seam_subsection[2], seam_uvs[0], seam_uvs[1], fac2);
3315 interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1);
3319 interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
3320 interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
3326 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3329 uv[1] = float(
y) / ibuf_yf;
3332 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3333 const float puv[2] = {float(
x), float(
y)};
3337 uv[0] = float(
x) / ibuf_xf;
3365 float pixel_on_edge[4];
3370 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3374 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3380 pixel_on_edge, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
3383 pixel_on_edge[3] = 1.0f;
3386 pixel_on_edge[0] = float(ps->
winx * 0.5f) +
3387 (ps->
winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
3388 pixel_on_edge[1] = float(ps->
winy * 0.5f) +
3389 (ps->
winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
3391 pixel_on_edge[2] = pixel_on_edge[2] / pixel_on_edge[3];
3396 ps, bucketFaceNodes, tri_index, pixel_on_edge))
3400 if (do_clip || do_3d_mapping) {
3416 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3421 else if (has_x_isect) {
3431 if (has_x_isect == 0 && has_isect) {
3485 rctf *r_bucket_bounds)
3504 const int thread_index,
3505 const int bucket_index,
3506 const rctf *clip_rect,
3507 const rctf *bucket_bounds)
3510 int tri_index, image_index = 0;
3511 ImBuf *ibuf =
nullptr;
3512 Image *tpage_last =
nullptr, *tpage;
3513 ImBuf *tmpibuf =
nullptr;
3545 if (tpage_last != tpage || tile_last !=
tile) {
3550 for (image_index = 0; image_index < ps->
image_tot; image_index++) {
3553 ibuf = projIma->
ibuf;
3595 float p1[2], p2[2], p3[2], p4[2];
3596 const float *
v, *v1, *
v2, *v3;
3615 p1[0] = bucket_bounds.
xmin;
3616 p1[1] = bucket_bounds.
ymin;
3617 p2[0] = bucket_bounds.
xmin;
3618 p2[1] = bucket_bounds.
ymax;
3619 p3[0] = bucket_bounds.
xmax;
3620 p3[1] = bucket_bounds.
ymax;
3621 p4[0] = bucket_bounds.
xmax;
3622 p4[1] = bucket_bounds.
ymin;
3642 const int3 &corner_tri,
3643 const int tri_index)
3646 float min[2],
max[2], *vCoSS;
3648 int bucketMin[2], bucketMax[2];
3649 int fidx, bucket_x, bucket_y;
3651 int has_x_isect = -1, has_isect = 0;
3665 for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
3667 for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
3669 int bucket_index = bucket_x + (bucket_y * ps->
buckets_x);
3675 has_x_isect = has_isect = 1;
3677 else if (has_x_isect) {
3685 if (has_x_isect == 0 && has_isect) {
3690#ifndef PROJ_DEBUG_NOSEAMBLEED
3703 float viewmat[4][4];
3704 float viewinv[4][4];
3712 if (symmetry_flag) {
3714 for (
i = 0;
i < 3;
i++) {
3715 if ((symmetry_flag >>
i) & 1) {
3755 memcpy(winmat,
array,
sizeof(winmat));
3756 array +=
sizeof(winmat) /
sizeof(
float);
3757 memcpy(viewmat,
array,
sizeof(viewmat));
3758 array +=
sizeof(viewmat) /
sizeof(
float);
3770 copy_m4_m4(viewinv, cam_ob_eval->object_to_world().ptr());
3816 float *projScreenCo;
3827 for (a = 0; a < ps->totvert_eval; a++, projScreenCo += 4) {
3828 mul_v3_m4v3(projScreenCo, ps->projectMat, ps->vert_positions_eval[a]);
3831 projScreenCo[0] = float(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0];
3832 projScreenCo[1] = float(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1];
3833 minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
3837 for (a = 0; a < ps->
totvert_eval; a++, projScreenCo += 4) {
3839 projScreenCo[3] = 1.0f;
3845 projScreenCo[0] = float(ps->
winx * 0.5f) +
3846 (ps->
winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
3847 projScreenCo[1] = float(ps->
winy * 0.5f) +
3848 (ps->
winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
3850 projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
3874#ifdef PROJ_DEBUG_WINCLIP
3875 CLAMP(ps->screenMin[0], float(-diameter), float(ps->winx + diameter));
3876 CLAMP(ps->screenMax[0], float(-diameter), float(ps->winx + diameter));
3878 CLAMP(ps->screenMin[1], float(-diameter), float(ps->winy + diameter));
3879 CLAMP(ps->screenMax[1], float(-diameter), float(ps->winy + diameter));
3881 UNUSED_VARS(diameter);
3885 ps->screenMin[0] = 0;
3886 ps->screenMax[0] = float(ps->winx);
3888 ps->screenMin[1] = 0;
3889 ps->screenMax[1] = float(ps->winy);
3900 float(*edges)[3] =
static_cast<float(*)[3]
>(
3916 if (counter[a] > 0) {
3931#ifndef PROJ_DEBUG_NOSEAMBLEED
3956 if (reset_threads) {
3977 float viewDirPersp[3];
4013#ifndef PROJ_DEBUG_NOSEAMBLEED
4016 const int3 &corner_tri,
4017 const int tri_index)
4063 const int totmat = ob->
totcol + 1;
4069 for (
int i = 0;
i < totmat - 1;
i++) {
4109 const float(*mloopuv_clone_base)[2] =
nullptr;
4119 if (layer_num != -1) {
4120 mloopuv_clone_base =
static_cast<const float(*)[2]
>(
4124 if (mloopuv_clone_base ==
nullptr) {
4126 mloopuv_clone_base =
static_cast<const float(*)[2]
>(
4131 memset(layer_clone, 0,
sizeof(*layer_clone));
4139 const int tri_index)
4180 memset(face_lookup, 0,
sizeof(*face_lookup));
4224 const int3 &corner_tri,
4244#ifdef PROJ_DEBUG_WINCLIP
4283 entry = entry->
next,
i++, projIma++)
4287 projIma->
ima = entry->
ima;
4288 projIma->
touch =
false;
4290 if (projIma->
ibuf ==
nullptr) {
4313 const float (*mloopuv_base)[2],
4314 const bool is_multi_view)
4319 Image *tpage_last =
nullptr, *tpage;
4322 int tile_last = -1,
tile;
4323 int image_index = -1, tri_index;
4330 for (tri_index = 0; tri_index < ps->
corner_tris_eval.size(); tri_index++) {
4331 bool is_face_paintable;
4332 bool skip_tri =
false;
4339 if (slot ==
nullptr) {
4340 mloopuv_base =
static_cast<const float(*)[2]
>(
4345 if (slot != slot_last) {
4350 mloopuv_base =
static_cast<const float(*)[2]
>(
4357 if (slot->
ima !=
nullptr &&
4386#ifndef PROJ_DEBUG_NOSEAMBLEED
4396 if (is_face_paintable && tpage) {
4400 if (is_multi_view ==
false) {
4405#ifdef PROJ_DEBUG_WINCLIP
4415 if (prev_poly != tri_faces[tri_index]) {
4418 prev_poly = tri_faces[tri_index];
4419 for (
const int corner : poly) {
4429 int poly_tri = poly.
size() - 3;
4430 tri_index += poly_tri;
4443 if (tpage_last != tpage || tile_last !=
tile) {
4446 e =
e->next, image_index++)
4448 if (
e->ima == tpage &&
e->iuser.tile ==
tile) {
4458 iuser.
framenr = tpage->lastframe;
4475 if (image_index != -1) {
4495 const bool is_multi_view,
4496 const char symmetry_flag)
4500 const float(*mloopuv_base)[2] =
nullptr;
4507 bool reset_threads =
false;
4533 if (layer_num != -1) {
4571 reset_threads =
true;
4580 "paint-bucketRect");
4582 "paint-bucketFaces");
4585#ifndef PROJ_DEBUG_NOSEAMBLEED
4597 ps, arena, &face_lookup, &layer_clone, mloopuv_base, is_multi_view);
4611 (float(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projCo[0] / projCo[3]);
4613 (float(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projCo[1] / projCo[3]);
4624 for (a = 0, projIma = ps->
projImages; a < ps->image_tot; a++, projIma++) {
4665#ifndef PROJ_DEBUG_NOSEAMBLEED
4735 bool redraw =
false;
4737 for (a = 0, projIma = ps->
projImages; a < ps->image_tot; a++, projIma++) {
4738 if (projIma->
touch) {
4752 projIma->
touch =
false;
4763 float min_brush[2], max_brush[2];
4769 if (radius < 1.0f) {
4774 min_brush[0] = mval_f[0] - radius;
4775 min_brush[1] = mval_f[1] - radius;
4777 max_brush[0] = mval_f[0] + radius;
4778 max_brush[1] = mval_f[1] + radius;
4802 rctf *bucket_bounds,
4803 const float mval[2])
4812 const int bucket_y = bidx / ps->
buckets_x;
4813 const int bucket_x = bidx - (bucket_y * ps->
buckets_x);
4816 if (bucket_x >= ps->
bucketMin[0] && bucket_x < ps->bucketMax[0]) {
4823 *bucket_index = bidx;
4857 uchar clone_rgba[4];
4859 clone_rgba[0] = clone_pt[0];
4860 clone_rgba[1] = clone_pt[1];
4861 clone_rgba[2] = clone_pt[2];
4862 clone_rgba[3] =
uchar(clone_pt[3] *
mask);
4879 const float *clone_pt = ((
ProjPixelClone *)projPixel)->clonepx.f;
4882 float clone_rgba[4];
4944 float accum_tot = 0.0f;
4952 for (yk = 0; yk < kernel->
side; yk++) {
4953 for (xk = 0; xk < kernel->
side; xk++) {
4955 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
4960 float weight = kernel->
wdata[xk + yk * kernel->
side];
4963 accum_tot += weight;
4968 if (
LIKELY(accum_tot != 0)) {
5004 float accum_tot = 0;
5013 for (yk = 0; yk < kernel->
side; yk++) {
5014 for (xk = 0; xk < kernel->
side; xk++) {
5016 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
5021 float weight = kernel->
wdata[xk + yk * kernel->
side];
5024 accum_tot += weight;
5029 if (
LIKELY(accum_tot != 0)) {
5035 float rgba_pixel[4];
5045 float alpha = rgba_pixel[3];
5046 rgba[3] = rgba_pixel[3] =
mask;
5068 const float texrgb[3],
5086 if (dither > 0.0f) {
5106 const float texrgb[3],
5133 rgba_ub[0] = rgba_ub[1] = rgba_ub[2] = ps->
stencil_value * 255.0f;
5167 &rect_to_add, projPixel->
x_px, projPixel->
x_px + 1, projPixel->
y_px, projPixel->
y_px + 1);
5177 float rgb_straight[4];
5195 const int thread_index = ((
ProjectHandle *)ph_v)->thread_index;
5203 int last_index = -1;
5207 float dist_sq, dist;
5211 bool is_floatbuf =
false;
5216 float pos_ofs[2] = {0};
5222 const float brush_radius_sq = brush_radius * brush_radius;
5234 LinkNode *softenPixels_f =
nullptr;
5239 pos_ofs[0] =
pos[0] - lastpos[0];
5240 pos_ofs[1] =
pos[1] - lastpos[1];
5255 rctf clip_rect = bucket_bounds;
5268 for (node = ps->
bucketRect[bucket_index]; node; node = node->
next) {
5274 last_projIma = projImages + last_index;
5276 last_projIma->
touch =
true;
5286 float line_len_sq_inv, line_len;
5289 const float p[2] = {
5290 projPixel->
projCoSS[0] - lastpos[0],
5291 projPixel->
projCoSS[1] - lastpos[1],
5296 line_len_sq_inv = 1.0f / line_len;
5297 line_len =
sqrtf(line_len);
5301 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
5306 f =
len_v2(p) / line_len;
5311 color_f[3] *= float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5340 float newColor_f[4];
5341 newColor_f[3] = float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5350 float mask = float(projPixel->
mask) * (1.0f / 65535.0f);
5377 float mask = float(projPixel->
mask) * (1.0f / 65535.0f);
5392 float mask = float(projPixel->
mask) * (1.0f / 65535.0f);
5405 for (node = ps->
bucketRect[bucket_index]; node; node = node->
next) {
5412 if (dist_sq <= brush_radius_sq) {
5413 dist =
sqrtf(dist_sq);
5417 if (falloff > 0.0f) {
5422 float custom_mask = float(projPixel->
mask) * (1.0f / 65535.0f);
5428 CLAMP(texmask, 0.0f, 1.0f);
5429 custom_mask *= texmask;
5445 samplecos[2] = 0.0f;
5451 ps->
scene, brush, mtex, samplecos, texrgba, thread_index, pool);
5454 custom_mask *= texrgba[3];
5468 float max_mask = brush_alpha * custom_mask * falloff * 65535.0f;
5471 mask = mask_accum + max_mask;
5474 mask = mask_accum + (max_mask - mask_accum * falloff);
5482 mask = mask_short * (1.0f / 65535.0f);
5490 mask = brush_alpha * custom_mask * falloff;
5498 last_projIma = projImages + last_index;
5500 last_projIma->
touch =
true;
5506 *projPixel->
valid =
true;
5512 switch (brush_type) {
5572 for (node = smearPixels; node; node = node->
next) {
5580 for (node = smearPixels_f; node; node = node->
next) {
5592 for (node = softenPixels; node; node = node->
next) {
5600 for (node = softenPixels_f; node; node = node->
next) {
5616 bool touch_any =
false;
5637 bool float_dest =
false;
5638 bool uchar_dest =
false;
5683 memcpy(
handles[a].projImages[
i].partRedrawRect,
5710 handles[a].projImages[
i].partRedrawRect,
5727 if (tri_index != -1) {
5751 const float prev_pos[2],
5803 const float prev_pos[2],
5820 const int mval_i[2] = {int(
pos[0]), int(
pos[1])};
5927#ifndef PROJ_DEBUG_NOSEAMBLEED
5961 char symmetry_flag_views[BOUNDED_ARRAY_TYPE_SIZE<
decltype(ps_handle->
ps_views)>()] = {0};
5963 ps_handle = MEM_new<ProjStrokeHandle>(
"ProjStrokeHandle");
5964 ps_handle->
scene = scene;
5988 ProjPaintState *ps = MEM_new<ProjPaintState>(
"ProjectionPaintState");
6003 BLI_assert(index <= ps_handle->ps_views_tot);
6015 if (ps->
ob ==
nullptr) {
6057 MEM_delete(ps_handle);
6087 MEM_delete(ps_handle);
6106 MEM_delete(ps_handle);
6117 int orig_brush_size;
6137 if (image ==
nullptr) {
6158 if (view_data !=
nullptr &&
6173 if (scene.
camera ==
nullptr) {
6203 const float pos[2] = {0.0, 0.0};
6204 const float lastpos[2] = {0.0, 0.0};
6231 ot->name =
"Project Image";
6232 ot->idname =
"PAINT_OT_project_image";
6233 ot->description =
"Project an edited render from the active camera back onto the object";
6275 char err_out[256] =
"unknown";
6294 w = std::min(
w, maxsize);
6295 h = std::min(h, maxsize);
6300 View3D v3d_copy = blender::dna::shallow_copy(*v3d);
6352 depsgraph, v3d, rv3d,
true, &clip_start, &clip_end);
6367 ot->name =
"Image from View";
6368 ot->idname =
"PAINT_OT_image_from_view";
6369 ot->description =
"Make an image from biggest 3D view for reprojection";
6379 ot->srna,
"filepath",
nullptr,
FILE_MAX,
"File Path",
"Name of the file");
6387 ReportList *
reports,
bool has_uvs,
bool has_mat,
bool has_tex,
bool has_stencil)
6391 "Missing%s%s%s%s detected!",
6392 !has_uvs ?
RPT_(
" UVs,") :
"",
6393 !has_mat ?
RPT_(
" Materials,") :
"",
6394 !has_tex ?
RPT_(
" Textures (or linked),") :
"",
6395 !has_stencil ?
RPT_(
" Stencil,") :
"");
6403 bool *r_has_stencil)
6407 bool has_mat =
true;
6408 bool has_tex =
true;
6409 bool has_stencil =
true;
6410 bool has_uvs =
true;
6427 for (
int i = 1;
i < ob.
totcol + 1;
i++) {
6457 if (layernum == 0) {
6465 if (imapaint.
stencil ==
nullptr) {
6466 has_stencil =
false;
6484 *r_has_uvs = has_uvs;
6487 *r_has_mat = has_mat;
6490 *r_has_tex = has_tex;
6492 if (r_has_stencil) {
6493 *r_has_stencil = has_stencil;
6496 return has_uvs && has_mat && has_tex && has_stencil;
6518 {0,
nullptr, 0,
nullptr,
nullptr},
6535 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6536 char imagename[
MAX_ID_NAME - 2] =
"Material Diffuse Color";
6539 bool use_float =
false;
6580 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6617 switch (layer_type) {
6623 bNode *in_node =
nullptr;
6625 ma->
nodetree->ensure_topology_cache();
6627 "ShaderNodeBsdfPrincipled");
6639 switch (in_sock->
type) {
6684 Image *ima =
nullptr;
6714 switch (slot_type) {
6718 new_node->
id = &ima->
id;
6735 ntree->ensure_topology_cache();
6738 bNode *out_node = new_node;
6740 if (in_node !=
nullptr) {
6757 out_node = nor_node;
6769 out_node = bump_node;
6774 "ShaderNodeOutputMaterial");
6777 if (in_node !=
nullptr) {
6787 if (in_sock !=
nullptr && link ==
nullptr) {
6845 const char *base_name = ma ? &ma->
id.
name[2] : &ob->
id.
name[2];
6888 switch (slot_type) {
6911#define IMA_DEF_NAME N_("Untitled")
6917 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6922 {0,
nullptr, 0,
nullptr,
nullptr},
6926 ot->name =
"Add Paint Slot";
6927 ot->description =
"Add a paint slot";
6928 ot->idname =
"PAINT_OT_add_texture_paint_slot";
6944 "Material Layer Type",
6945 "Material layer type of new paint slot");
6949 ot->srna,
"slot_type", slot_type_items, 0,
"Slot Type",
"Type of new paint slot");
6956 ot->srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
6961 prop =
RNA_def_int(
ot->srna,
"width", 1024, 1, INT_MAX,
"Width",
"Image width", 1, 16384);
6964 prop =
RNA_def_int(
ot->srna,
"height", 1024, 1, INT_MAX,
"Height",
"Image height", 1, 16384);
6967 RNA_def_boolean(
ot->srna,
"alpha",
true,
"Alpha",
"Create an image with an alpha channel");
6974 "Fill the image with a grid for UV map testing");
6980 "Create image with 32-bit floating-point bit depth");
6988 "Type of element that attribute is stored on");
6995 "Type of data stored in attribute");
7028 ot->name =
"Add Simple UVs";
7029 ot->description =
"Add cube map UVs on mesh";
7030 ot->idname =
"PAINT_OT_add_simple_uvs";
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< blender::StringRef > name)
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, blender::StringRef name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
const MTex * BKE_brush_color_texture_get(const Brush *brush, eObjectMode object_mode)
int BKE_brush_size_get(const Scene *scene, const Brush *brush)
void BKE_brush_size_set(Scene *scene, Brush *brush, int size)
float BKE_brush_sample_tex_3d(const Scene *scene, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
const std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Scene *scene, const Paint *paint, const Brush *brush)
float BKE_brush_alpha_get(const Scene *scene, const Brush *brush)
float BKE_brush_curve_strength_clamped(const Brush *br, float p, float len)
float BKE_brush_sample_masktex(const Scene *scene, Brush *br, const float point[2], int thread, ImagePool *pool)
Camera data-block and utility functions.
void BKE_camera_params_init(CameraParams *params)
void BKE_camera_params_from_object(CameraParams *params, const struct Object *cam_ob)
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy)
void BKE_camera_params_compute_matrix(CameraParams *params)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
bScreen * CTX_wm_screen(const bContext *C)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_clone_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_n(const CustomData *data, eCustomDataType type, int n)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_get_stencil_layer(const CustomData *data, eCustomDataType type)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * IDP_GetPropertyTypeFromGroup(const IDProperty *prop, blender::StringRef name, char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDProperty * IDP_GetProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_mark_dirty(Image *image, ImBuf *ibuf)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_image_pool_free(ImagePool *pool)
Image * BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
ImagePool * BKE_image_pool_new()
void BKE_imageuser_default(ImageUser *iuser)
void BKE_image_free_gputextures(Image *ima)
#define IMA_SIGNAL_USER_NEW_IMAGE
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
Image * BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4], bool stereo3d, bool is_data, bool tiled)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_main_ensure_invariants(Main &bmain, std::optional< blender::Span< ID * > > modified_ids=std::nullopt)
General operations, lookup, etc. for materials.
void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const Object *ob)
@ BKE_MAT_ASSIGN_USERPREF
Material * BKE_material_add(Main *bmain, const char *name)
Material * BKE_object_material_get(Object *ob, short act)
void BKE_object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type)
Mesh * BKE_mesh_from_object(Object *ob)
#define BKE_MESH_TESSTRI_VINDEX_ORDER(_tri, _v)
#define SH_NODE_TEX_IMAGE
#define SH_NODE_BSDF_PRINCIPLED
#define SH_NODE_NORMAL_MAP
#define SH_NODE_ATTRIBUTE
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
blender::float3 seed_hsv_jitter()
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
int BKE_scene_num_threads(const Scene *scene)
ARegion * BKE_area_find_region_active_win(const ScrArea *area)
ScrArea * BKE_screen_find_big_area(const bScreen *screen, int spacetype, short min)
#define BLI_assert_unreachable()
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_END(type, lb, lb_iter, lb_init)
#define LISTBASE_CIRCULAR_FORWARD_BEGIN(type, lb, lb_iter, lb_init)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_BEGIN(type, lb, lb_iter, lb_init)
#define LISTBASE_CIRCULAR_FORWARD_END(type, lb, lb_iter, lb_init)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
int pow_i(int base, int exp)
MINLINE float min_ff(float a, float b)
MINLINE int mod_i(int i, int n)
MINLINE float square_f(float a)
MINLINE float min_fff(float a, float b, float c)
MINLINE int square_s(short a)
MINLINE float safe_acosf(float a)
MINLINE int count_bits_i(unsigned int n)
MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4])
MINLINE void rgba_float_args_set(float col[4], float r, float g, float b, float a)
MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4])
MINLINE void premul_to_straight_v4(float color[4])
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, int x, int y)
MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3])
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4])
MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_interpolate_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], float ft)
MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], const float src2[4], float t)
int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2])
bool isect_seg_seg_v2_simple(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
float resolve_quad_u_v2(const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3])
float dist_squared_to_line_v2(const float p[2], const float l1[2], const float l2[2])
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float r_vi[2])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mul_project_m4_v3(const float mat[4][4], float vec[3])
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void mul_m4_v4(const float mat[4][4], float r[4])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void mul_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[2], const float t[3])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void zero_v4(float r[4])
MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_rcti_init_minmax(struct rcti *rect)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
bool BLI_rcti_is_valid(const struct rcti *rect)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
bool BLI_rcti_is_empty(const struct rcti *rect)
void BLI_rcti_do_minmax_rcti(struct rcti *rect, const struct rcti *other)
char * STRNCPY(char(&dst)[N], const char *src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
TaskPool * BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority)
void BLI_task_pool_work_and_wait(TaskPool *pool)
void BLI_task_pool_free(TaskPool *pool)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
pthread_spinlock_t SpinLock
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
#define BLENDER_MAX_THREADS
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_spin_end(SpinLock *spin)
#define INIT_MINMAX2(min, max)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
Compatibility-like things for windows.
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ IMAGE_PAINT_BRUSH_TYPE_MASK
@ IMAGE_PAINT_BRUSH_TYPE_FILL
@ IMAGE_PAINT_BRUSH_TYPE_DRAW
@ IMAGE_PAINT_BRUSH_TYPE_CLONE
@ IMAGE_PAINT_BRUSH_TYPE_SOFTEN
@ IMAGE_PAINT_BRUSH_TYPE_SMEAR
Object is a sort of wrapper for general info.
@ IMAGEPAINT_MISSING_MATERIAL
@ IMAGEPAINT_MISSING_STENCIL
@ IMAGEPAINT_PROJECT_LAYER_STENCIL_INV
@ IMAGEPAINT_PROJECT_BACKFACE
@ IMAGEPAINT_PROJECT_XRAY
@ IMAGEPAINT_PROJECT_LAYER_STENCIL
@ IMAGEPAINT_PROJECT_LAYER_CLONE
@ IMAGEPAINT_PROJECT_FLAT
#define IMAGEPAINT_MODE_IMAGE
#define IMAGEPAINT_MODE_MATERIAL
@ PAINT_CANVAS_SOURCE_COLOR_ATTRIBUTE
@ PAINT_CANVAS_SOURCE_IMAGE
@ PAINT_CANVAS_SOURCE_MATERIAL
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_HIDE_CURSOR
void ED_space_image_sync(Main *bmain, Image *image, bool ignore_render_viewer)
void ED_node_shader_default(const bContext *C, ID *id)
void * ED_image_paint_tile_push(PaintTileMap *paint_tile_map, Image *image, ImBuf *ibuf, ImBuf **tmpibuf, ImageUser *iuser, int x_tile, int y_tile, unsigned short **r_mask, bool **r_valid, bool use_thread_lock, bool find_prev)
void ED_image_paint_tile_lock_end()
void ED_image_undo_push_begin(const char *name, PaintMode paint_mode)
#define ED_IMAGE_UNDO_TILE_NUMBER(size)
void ED_image_undo_push_end()
#define ED_IMAGE_UNDO_TILE_SIZE
PaintTileMap * ED_image_paint_tile_map_get()
void ED_image_paint_tile_lock_init()
#define ED_IMAGE_UNDO_TILE_BITS
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_object_active_editable_mesh(bContext *C)
void ED_region_tag_redraw(ARegion *region)
void ED_uvedit_add_simple_uvs(Main *bmain, const Scene *scene, Object *ob)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
bool ED_view3d_autodist(ARegion *region, View3D *v3d, const int mval[2], float mouse_worldloc[3], const float fallback_depth_pt[3])
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
bool ED_view3d_clip_range_get(const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, bool use_ortho_factor, float *r_clip_start, float *r_clip_end)
void view3d_operator_needs_gpu(const bContext *C)
bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], bool is_local)
blender::float4x4 ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d, const blender::float4x4 &obmat)
ImBuf * ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, int sizex, int sizey, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
int GPU_max_texture_size()
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
void IMB_byte_from_float(ImBuf *ibuf)
void IMB_blend_color_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], IMB_BlendMode mode)
void IMB_freeImBuf(ImBuf *ibuf)
void IMB_free_float_pixels(ImBuf *ibuf)
void IMB_free_byte_pixels(ImBuf *ibuf)
void IMB_blend_color_float(float dst[4], const float src1[4], const float src2[4], IMB_BlendMode mode)
void IMB_float_from_byte(ImBuf *ibuf)
Read Guarded memory(de)allocation.
struct blender::bke::bNodeTreeType * ntreeType_Shader
const EnumPropertyItem * RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, int32_t x)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static AttributeOwner from_id(ID *id)
void append(const array< T > &from)
constexpr int64_t size() const
constexpr const T & first() const
constexpr bool is_empty() const
VecBase< float, 4 > float4
float distance(VecOp< float, D >, VecOp< float, D >) RET
#define MEM_SIZE_OPTIMAL(size)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
const ccl_global KernelWorkTile * tile
void * MEM_mallocN(size_t len, const char *str)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float interp(const float a, const float b, const float t)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
#define unit_float_to_uchar_clamp_v3(v1, v2)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
std::unique_ptr< IDProperty, IDPropertyDeleter > create(StringRef prop_name, int32_t value, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_INT, set its name and value.
void node_position_propagate(bNode &node)
void node_tree_free_tree(bNodeTree &ntree)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_position_relative(bNode &from_node, const bNode &to_node, const bNodeSocket *from_sock, const bNodeSocket &to_sock)
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
bNodeTree * node_tree_add_tree(Main *bmain, StringRef name, StringRef idname)
void node_set_active(bNodeTree &ntree, bNode &node)
Object * context_active_object(const bContext *C)
bool object_active_color_fill(Object &ob, const float fill_color[4], bool only_selected)
uchar4 interpolate_nearest_wrap_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_bilinear_wrap_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_cubic_bspline_byte(const ImBuf *in, float u, float v)
float4 interpolate_nearest_wrap_fl(const ImBuf *in, float u, float v)
float4 interpolate_cubic_bspline_fl(const ImBuf *in, float u, float v)
float4 interpolate_bilinear_wrap_fl(const ImBuf *in, float u, float v)
T clamp(const T &a, const T &min, const T &max)
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 2 > int2
VecBase< int32_t, 3 > int3
void paint_delete_blur_kernel(BlurKernel *kernel)
void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, ImageUser *iuser, short texpaint)
void paint_brush_init_tex(Brush *brush)
bool paint_use_opacity_masking(const Scene *scene, const Paint *paint, const Brush *brush)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void paint_brush_color_get(Scene *scene, const Paint *paint, Brush *br, std::optional< blender::float3 > &initial_hsv_jitter, bool color_correction, bool invert, float distance, float pressure, const ColorManagedDisplay *display, float r_color[3])
void paint_brush_exit_tex(Brush *brush)
void set_imapaintpartial(ImagePaintPartialRedraw *ippr)
#define PS_CORNER_TRI_AS_UV_3(uvlayer, face_i, tri)
static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *softenArena, LinkNode **softenPixels)
static bool project_paint_clone_face_skip(ProjPaintState *ps, ProjPaintLayerClone *lc, const TexPaintSlot *slot, const int tri_index)
static bool project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *bucketFace, const int orig_face, const float pixelScreenCo[4])
static void screen_px_from_ortho(const float uv[2], const float v1co[3], const float v2co[3], const float v3co[3], const float uv1co[2], const float uv2co[2], const float uv3co[2], float pixelScreenCo[4], float w[3])
static int project_paint_face_paint_tile(Image *ima, const float *uv)
static int project_paint_PickFace(const ProjPaintState *ps, const float pt[2], float w[3])
static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[2])
static bool project_paint_PickColor(const ProjPaintState *ps, const float pt[2], float *rgba_fp, uchar *rgba, const bool interp)
static void image_paint_partial_redraw_expand(ImagePaintPartialRedraw *cell, const ProjPixel *projPixel)
static void project_paint_begin(const bContext *C, ProjPaintState *ps, const bool is_multi_view, const char symmetry_flag)
#define PROJ_SRC_VIEW_FILL
static int project_bucket_offset_safe(const ProjPaintState *ps, const float projCoSS[2])
static bool project_paint_winclip(const ProjPaintState *ps, const ProjPaintFaceCoSS *coSS)
static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *ps)
static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int diameter)
static ProjPixel * project_paint_uvpixel_init(const ProjPaintState *ps, MemArena *arena, const TileInfo *tinf, int x_px, int y_px, const float mask, const int tri_index, const float pixelScreenCo[4], const float world_spaceCo[3], const float w[3])
static void proj_paint_face_coSS_init(const ProjPaintState *ps, const int3 &corner_tri, ProjPaintFaceCoSS *coSS)
static void rect_to_uvspace_ortho(const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[4][2], const int flip)
static bool add_simple_uvs_poll(bContext *C)
static const char * proj_paint_color_attribute_create(wmOperator *op, Object &ob)
#define PROJ_VIEW_DATA_SIZE
static int project_paint_pixel_sizeof(const short brush_type)
static bool IsectPT2Df_limit(const float pt[2], const float v1[2], const float v2[2], const float v3[2], const float limit)
static int get_texture_layer_type(wmOperator *op, const char *prop_name)
static void project_paint_bleed_add_face_user(const ProjPaintState *ps, MemArena *arena, const int3 &corner_tri, const int tri_index)
void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
static bool texture_paint_image_from_view_poll(bContext *C)
#define PROJ_BOUNDBOX_DIV
static void do_projectpaint_mask(ProjPaintState *ps, ProjPixel *projPixel, float mask)
static void screen_px_from_persp(const float uv[2], const float v1co[4], const float v2co[4], const float v3co[4], const float uv1co[2], const float uv2co[2], const float uv3co[2], float pixelScreenCo[4], float w[3])
static wmOperatorStatus add_simple_uvs_exec(bContext *C, wmOperator *)
static int project_paint_undo_subtiles(const TileInfo *tinf, int tx, int ty)
static void project_bucket_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const rctf *clip_rect, const rctf *bucket_bounds)
static bool line_rect_clip(const rctf *rect, const float l1[4], const float l2[4], const float uv1[2], const float uv2[2], float uv[2], bool is_ortho)
static void proj_paint_face_lookup_init(const ProjPaintState *ps, ProjPaintFaceLookup *face_lookup)
static void paint_proj_stroke_ps(const bContext *, void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size, ProjPaintState *ps)
static bool cmp_uv(const float vec2a[2], const float vec2b[2])
static Image * project_paint_face_clone_image(const ProjPaintState *ps, int tri_index)
void * paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], int mode)
#define PROJ_GEOM_TOLERANCE
static void partial_redraw_array_init(ImagePaintPartialRedraw *pr)
static bool project_paint_check_face_paintable(const ProjPaintState *ps, const ProjPaintFaceLookup *face_lookup, const int tri_i)
static wmOperatorStatus texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, const float texrgb[3], float mask)
static void project_paint_build_proj_ima(ProjPaintState *ps, MemArena *arena, ListBase *used_images)
#define PS_CORNER_TRI_ASSIGN_UV_3(uv_tri, uvlayer, face_i, tri)
#define PROJ_SRC_IMAGE_CAM
static void proj_paint_layer_clone_init(ProjPaintState *ps, ProjPaintLayerClone *layer_clone)
#define PROJ_FACE_NOSEAM0
static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *r_bucket_bounds)
static int line_isect_x(const float p1[2], const float p2[2], const float x_level, float *y_isect)
#define PROJ_BUCKET_BRUSH_DIV
#define PS_CORNER_TRI_AS_VERT_INDEX_3(ps, tri)
#define PROJ_FACE_SEAM_INIT2
#define PROJ_BUCKET_RECT_MAX
BLI_INLINE uchar f_to_char(const float val)
static bool pixel_bounds_uv(const float uv_quad[4][2], const int ibuf_x, const int ibuf_y, rcti *r_bounds_px)
static int float_z_sort_flip(const void *p1, const void *p2)
static void do_projectpaint_thread(TaskPool *__restrict, void *ph_v)
#define PROJ_SRC_IMAGE_VIEW
static bool project_bucket_isect_circle(const float cent[2], const float radius_squared, const rctf *bucket_bounds)
static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *smearArena, LinkNode **smearPixels, const float co[2])
#define PROJ_FACE_WINDING_INIT
static Image * proj_paint_image_create(wmOperator *op, Main *bmain, bool is_data)
void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
static bool project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
#define PROJ_BUCKET_RECT_MIN
static bool project_image_refresh_tagged(ProjPaintState *ps)
#define PROJ_FACE_WINDING_CW
static bool check_seam(const ProjPaintState *ps, const int orig_face, const int orig_i1_fidx, const int orig_i2_fidx, int *other_face, int *orig_fidx)
static int float_z_sort(const void *p1, const void *p2)
static void scale_tri(float insetCos[3][3], const float *origCos[3], const float inset)
static void proj_paint_state_cavity_init(ProjPaintState *ps)
static bool partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPartialRedraw *pr_other, int tot)
void paint_proj_stroke(const bContext *C, void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size)
static int project_paint_occlude_ptv(const float pt[3], const float v1[4], const float v2[4], const float v3[4], float w[3], const bool is_ortho)
static void project_paint_end(ProjPaintState *ps)
static void get_default_texture_layer_name_for_object(Object *ob, int texture_type, char *dst, int dst_maxncpy)
void paint_proj_redraw(const bContext *C, void *ps_handle_p, bool final)
static void project_face_winding_init(const ProjPaintState *ps, const int tri_index)
static int line_isect_y(const float p1[2], const float p2[2], const float y_level, float *x_isect)
static void default_paint_slot_color_get(int layer_type, Material *ma, float color[4])
static void partial_redraw_single_init(ImagePaintPartialRedraw *pr)
static void insert_seam_vert_array(const ProjPaintState *ps, MemArena *arena, const int tri_index, const int fidx1, const int ibuf_x, const int ibuf_y)
static float project_paint_uvpixel_mask(const ProjPaintState *ps, const int tri_index, const float w[3])
static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *softenArena, LinkNode **softenPixels)
static void project_paint_bucket_bounds(const ProjPaintState *ps, const float min[2], const float max[2], int bucketMin[2], int bucketMax[2])
static void project_paint_prepare_all_faces(ProjPaintState *ps, MemArena *arena, const ProjPaintFaceLookup *face_lookup, ProjPaintLayerClone *layer_clone, const float(*mloopuv_base)[2], const bool is_multi_view)
static const EnumPropertyItem layer_type_items[]
static wmOperatorStatus texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
#define PROJ_PIXEL_TOLERANCE
static void project_face_pixel(const float *tri_uv[3], ImBuf *ibuf_other, const float w[3], uchar rgba_ub[4], float rgba_f[4])
static void do_projectpaint_mask_f(ProjPaintState *ps, ProjPixel *projPixel, float mask)
static void paint_proj_begin_clone(ProjPaintState *ps, const float mouse[2])
static void proj_paint_state_seam_bleed_init(ProjPaintState *ps)
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float mask)
#define PROJ_VIEW_DATA_ID
static float len_squared_v2v2_alt(const float v1[2], const float v2_1, const float v2_2)
#define PROJ_PAINT_STATE_SHARED_CLEAR(ps)
#define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src)
static wmOperatorStatus texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op)
void PAINT_OT_project_image(wmOperatorType *ot)
static bool project_paint_op(void *state, const float lastpos[2], const float pos[2])
static float screen_px_line_point_factor_v2_persp(const ProjPaintState *ps, const float p[2], const float v1[3], const float v2[3])
static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const int3 &tri)
static TexPaintSlot * project_paint_face_paint_slot(const ProjPaintState *ps, int tri_index)
static bool project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
static bool proj_paint_add_slot(bContext *C, wmOperator *op)
static void copy_original_alpha_channel(ProjPixel *pixel, bool is_floatbuf)
static float VecZDepthOrtho(const float pt[2], const float v1[3], const float v2[3], const float v3[3], float w[3])
#define PROJ_BOUNDBOX_SQUARED
void paint_proj_stroke_done(void *ps_handle_p)
static bool IsectPoly2Df(const float pt[2], const float uv[][2], const int tot)
static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, const float texrgb[3], float mask, float dither, int u, int v)
static void project_face_seams_init(const ProjPaintState *ps, MemArena *arena, const int tri_index, const uint vert_index, bool init_all, const int ibuf_x, const int ibuf_y)
#define PROJ_FACE_SEAM_INIT0
static bool line_clip_rect2f(const rctf *cliprect, const rctf *rect, const float l1[2], const float l2[2], float l1_clip[2], float l2_clip[2])
static wmOperatorStatus texture_paint_camera_project_exec(bContext *C, wmOperator *op)
static float VecZDepthPersp(const float pt[2], const float v1[4], const float v2[4], const float v3[4], float w[3])
static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
static TexPaintSlot * project_paint_face_clone_slot(const ProjPaintState *ps, int tri_index)
void ED_paint_data_warning(ReportList *reports, bool has_uvs, bool has_mat, bool has_tex, bool has_stencil)
#define PROJ_FACE_DEGENERATE
static bool pixel_bounds_array(float(*uv)[2], const int ibuf_x, const int ibuf_y, int tot, rcti *r_bounds_px)
static VertSeam * find_adjacent_seam(const ProjPaintState *ps, uint loop_index, uint vert_index, VertSeam **r_seam)
static int project_paint_occlude_ptv_clip(const float pt[3], const float v1[4], const float v2[4], const float v3[4], const float v1_3d[3], const float v2_3d[3], const float v3_3d[3], float w[3], const bool is_ortho, RegionView3D *rv3d)
static Material * get_or_create_current_material(bContext *C, Object *ob)
static float compute_seam_normal(VertSeam *seam, VertSeam *adj, float r_no[2])
static bool IsectPoly2Df_twoside(const float pt[2], const float uv[][2], const int tot)
static void proj_paint_state_thread_init(ProjPaintState *ps, const bool reset_threads)
static Material * tex_get_material(const ProjPaintState *ps, int face_i)
static void screen_px_to_vector_persp(int winx, int winy, const float projmat_inv[4][4], const float view_pos[3], const float co_px[2], float r_dir[3])
static void project_bucket_clip_face(const bool is_ortho, const bool is_flip_object, const rctf *cliprect, const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[8][2], int *tot, bool cull)
static void project_paint_delayed_face_init(ProjPaintState *ps, const int3 &corner_tri, const int tri_index)
static void texture_paint_add_texture_paint_slot_ui(bContext *C, wmOperator *op)
static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmetry_flag)
static void project_paint_face_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const int tri_index, const int image_index, const rctf *clip_rect, const rctf *bucket_bounds, ImBuf *ibuf, ImBuf **tmpibuf)
bool ED_paint_proj_mesh_data_check(Scene &scene, Object &ob, bool *r_has_uvs, bool *r_has_mat, bool *r_has_tex, bool *r_has_stencil)
static bool project_paint_flt_max_cull(const ProjPaintState *ps, const ProjPaintFaceCoSS *coSS)
#define PROJ_FACE_SCALE_SEAM
void PAINT_OT_image_from_view(wmOperatorType *ot)
static void uv_image_outset(const ProjPaintState *ps, float(*orig_uv)[2], float(*puv)[2], uint tri_index, const int ibuf_x, const int ibuf_y)
static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int mode)
static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float mask)
static Image * project_paint_face_paint_image(const ProjPaintState *ps, int tri_index)
#define PROJ_FACE_SEAM_INIT1
static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
static void rect_to_uvspace_persp(const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[4][2], const int flip)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_color_attribute_domain_items[]
const EnumPropertyItem rna_enum_color_attribute_type_items[]
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_image_generated_type_items[]
const EnumPropertyItem rna_enum_dummy_NULL_items[]
struct ColorBand * gradient
char filepath[IMB_FILEPATH_SIZE]
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
short screen_grab_size[2]
struct bNodeTree * nodetree
struct TexPaintSlot * texpaintslot
char * default_color_attribute
struct CurveMapping * cavity_curve
const bool * hide_poly_orig
const int * index_mp_to_orig
const bool * select_poly_orig
ImagePaintPartialRedraw * partRedrawRect
volatile void ** undoRect
const TexPaintSlot * slot_last_clone
const float(* mloopuv_clone_base)[2]
const TexPaintSlot * slot_clone
const int * material_indices
LoopSeamData * loopSeamData
blender::Span< int > corner_verts_eval
blender::Span< blender::int2 > edges_eval
float paint_color_linear[3]
const float(** poly_to_loop_uv)[2]
bool reproject_ibuf_free_float
const bool * select_poly_eval
blender::Span< blender::float3 > vert_normals
float projectMatInv[4][4]
blender::Span< int3 > corner_tris_eval
blender::Span< int > corner_tri_faces_eval
const float(* mloopuv_stencil_eval)[2]
CurveMapping * cavity_curve
ProjPaintImage * projImages
blender::OffsetIndices< int > faces_eval
blender::Span< blender::float3 > vert_positions_eval
const bool * hide_poly_eval
MemArena * arena_mt[BLENDER_MAX_THREADS]
const bool * sharp_faces_eval
bool do_layer_stencil_inv
bool reproject_ibuf_free_uchar
float normal_angle_inner__cos
const float(** poly_to_loop_uv_clone)[2]
bool is_clone_cursor_pick
std::optional< blender::float3 > initial_hsv_jitter
ProjPaintState * ps_views[8]
ProjPaintImage * projImages
struct ToolSettings * toolsettings
float average_stroke_accum[3]
int average_stroke_counter
float texture_paint_mode_opacity
const c_style_mat & ptr() const
uiLayout & column(bool align)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
struct ReportList * reports
struct wmOperatorType * type
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default)
wmOperatorStatus WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *)