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)
374#ifndef PROJ_DEBUG_NOSEAMBLEED
414#define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src) \
415 MEMCPY_STRUCT_AFTER(ps_dst, ps_src, is_shared_user)
417#define PROJ_PAINT_STATE_SHARED_CLEAR(ps) MEMSET_STRUCT_AFTER(ps, 0, is_shared_user)
425#ifndef PROJ_DEBUG_NOSEAMBLEED
546#define PS_CORNER_TRI_AS_VERT_INDEX_3(ps, tri) \
547 ps->corner_verts_eval[tri[0]], ps->corner_verts_eval[tri[1]], ps->corner_verts_eval[tri[2]],
549#define PS_CORNER_TRI_AS_UV_3(uvlayer, face_i, tri) \
550 uvlayer[face_i][tri[0]], uvlayer[face_i][tri[1]], uvlayer[face_i][tri[2]],
552#define PS_CORNER_TRI_ASSIGN_UV_3(uv_tri, uvlayer, face_i, tri) \
554 (uv_tri)[0] = uvlayer[face_i][tri[0]]; \
555 (uv_tri)[1] = uvlayer[face_i][tri[1]]; \
556 (uv_tri)[2] = uvlayer[face_i][tri[2]]; \
573 return 1001 + 10 * ty + tx;
579 if (mat_nr >= 0 && mat_nr <= ps->ob->totcol) {
651 const float pt[2],
const float v1[3],
const float v2[3],
const float v3[3],
float w[3])
654 return (v1[2] *
w[0]) + (
v2[2] *
w[1]) + (v3[2] *
w[2]);
658 const float pt[2],
const float v1[4],
const float v2[4],
const float v3[4],
float w[3])
660 float wtot_inv, wtot;
670 w_tmp[0] =
w[0] * v1[3];
671 w_tmp[1] =
w[1] *
v2[3];
672 w_tmp[2] =
w[2] * v3[3];
674 wtot = w_tmp[0] + w_tmp[1] + w_tmp[2];
677 wtot_inv = 1.0f / wtot;
679 w_tmp[0] = w_tmp[0] * wtot_inv;
680 w_tmp[1] = w_tmp[1] * wtot_inv;
681 w_tmp[2] = w_tmp[2] * wtot_inv;
684 w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
688 return (v1[2] * w_tmp[0]) + (
v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
697 int best_tri_index = -1;
698 float z_depth_best =
FLT_MAX, z_depth;
701 if (bucket_index == -1) {
711 const float *vtri_ss[3] = {
725 if (z_depth < z_depth_best) {
726 best_tri_index = tri_index;
727 z_depth_best = z_depth;
734 return best_tri_index;
743 const float *tri_uv[3];
751 if (tri_index == -1) {
767 iuser.
tile = tile_number;
770 if (ibuf ==
nullptr) {
774 float x = uv[0] * ibuf->
x;
775 float y = uv[1] * ibuf->
y;
786 memcpy(rgba_fp, &
col,
sizeof(
col));
796 memcpy(rgba, &
col,
sizeof(
col));
822 if (v1[2] > pt[2] &&
v2[2] > pt[2] && v3[2] > pt[2]) {
833 if (v1[2] < pt[2] &&
v2[2] < pt[2] && v3[2] < pt[2]) {
856 const float v1_3d[3],
857 const float v2_3d[3],
858 const float v3_3d[3],
896 const float pixelScreenCo[4])
904 for (; bucketFace; bucketFace = bucketFace->
next) {
907 if (orig_face != tri_index) {
909 const float *vtri_ss[3] = {
917 const float *vtri_co[3] = {
929 if (isect_ret >= 1) {
942#define ISECT_TRUE_P1 2
943#define ISECT_TRUE_P2 3
944static int line_isect_y(
const float p1[2],
const float p2[2],
const float y_level,
float *x_isect)
949 if (y_level == p1[1]) {
954 if (y_level == p2[1]) {
960 y_diff =
fabsf(p1[1] - p2[1]);
962 if (y_diff < 0.000001f) {
963 *x_isect = (p1[0] + p2[0]) * 0.5f;
967 if (p1[1] > y_level && p2[1] < y_level) {
969 *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
972 if (p1[1] < y_level && p2[1] > y_level) {
974 *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
980static int line_isect_x(
const float p1[2],
const float p2[2],
const float x_level,
float *y_isect)
984 if (x_level == p1[0]) {
988 if (x_level == p2[0]) {
994 x_diff =
fabsf(p1[0] - p2[0]);
997 if (x_diff < 0.000001f) {
998 *y_isect = (p1[0] + p2[0]) * 0.5f;
1002 if (p1[0] > x_level && p2[0] < x_level) {
1004 *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
1007 if (p1[0] < x_level && p2[0] > x_level) {
1009 *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
1019#ifndef PROJ_DEBUG_NOSEAMBLEED
1020static bool cmp_uv(
const float vec2a[2],
const float vec2b[2])
1023 float xa =
fmodf(vec2a[0], 1.0f);
1024 float ya =
fmodf(vec2a[1], 1.0f);
1026 float xb =
fmodf(vec2b[0], 1.0f);
1027 float yb =
fmodf(vec2b[1], 1.0f);
1051#ifndef PROJ_DEBUG_NOSEAMBLEED
1058 float min_uv[2], max_uv[2];
1067 r_bounds_px->
xmin = int(ibuf_x * min_uv[0]);
1068 r_bounds_px->
ymin = int(ibuf_y * min_uv[1]);
1070 r_bounds_px->
xmax = int(ibuf_x * max_uv[0]) + 1;
1071 r_bounds_px->
ymax = int(ibuf_y * max_uv[1]) + 1;
1076 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1083 float (*uv)[2],
const int ibuf_x,
const int ibuf_y,
int tot,
rcti *r_bounds_px)
1086 float min_uv[2], max_uv[2];
1099 r_bounds_px->
xmin = int(ibuf_x * min_uv[0]);
1100 r_bounds_px->
ymin = int(ibuf_y * min_uv[1]);
1102 r_bounds_px->
xmax = int(ibuf_x * max_uv[0]) + 1;
1103 r_bounds_px->
ymax = int(ibuf_y * max_uv[1]) + 1;
1108 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1113#ifndef PROJ_DEBUG_NOSEAMBLEED
1121 float winding =
cross_tri_v2(tri_uv[0], tri_uv[1], tri_uv[2]);
1133 const int orig_face,
1134 const int orig_i1_fidx,
1135 const int orig_i2_fidx,
1141 const float *orig_tri_uv[3] = {
1148 int i1_fidx = -1, i2_fidx = -1;
1153 if (tri_index != orig_face) {
1167 if (i2_fidx != -1) {
1179 *other_face = tri_index;
1182 *orig_fidx = (i1_fidx < i2_fidx && (i2_fidx - i1_fidx == 1)) ? i1_fidx : i2_fidx;
1190 if ((orig_tpage == tpage) && (orig_tile ==
tile) &&
1191 cmp_uv(orig_tri_uv[orig_i1_fidx], tri_uv[i1_fidx]) &&
1192 cmp_uv(orig_tri_uv[orig_i2_fidx], tri_uv[i2_fidx]))
1224 while (seam->
loop != loop_index) {
1260 const float PI_2 =
M_PI * 2.0f;
1262 float angle_rel, angle_no;
1275 if (angle_rel < 0.0f) {
1281 angle_no = angle_rel +
angle[0];
1283 if (angle_no >
M_PI) {
1287 r_no[0] =
cosf(angle_no);
1288 r_no[1] =
sinf(angle_no);
1297 float (*orig_uv)[2],
1310 ibuf_inv[0] = 1.0f /
float(ibuf_x);
1311 ibuf_inv[1] = 1.0f /
float(ibuf_y);
1313 for (fidx[0] = 0; fidx[0] < 3; fidx[0]++) {
1315 float (*seam_uvs)[2];
1322 loop_index = tri[fidx[0]];
1327 if (seam_uvs[0][0] !=
FLT_MAX) {
1331 fidx[1] = (fidx[0] == 2) ? 0 : fidx[0] + 1;
1336 for (
uint i = 0;
i < 2;
i++) {
1346 if (tri_ang > 0.0f) {
1354 len_fact =
cosf(tri_ang);
1355 len_fact =
UNLIKELY(len_fact < FLT_EPSILON) ?
FLT_MAX : (1.0f / len_fact);
1358 len_fact = std::min(len_fact, 10.0f);
1368 if ((ang[0] + ang[1]) <
M_PI) {
1373 orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1], isect_co);
1384 const int tri_index,
1392 const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
1397 vseam->
prev =
nullptr;
1398 vseam->
next =
nullptr;
1400 vseam->
tri = tri_index;
1401 vseam->
loop = tri[fidx[0]];
1403 sub_v2_v2v2(vec, tri_uv[fidx[1]], tri_uv[fidx[0]]);
1414 vseam[1] = vseam[0];
1419 for (
uint i = 0;
i < 2;
i++) {
1440 const int tri_index,
1441 const uint vert_index,
1447 int other_face, other_fidx;
1449 int fidx[2] = {2, 0};
1465 if (
check_seam(ps, tri_index, fidx[0], fidx[1], &other_face, &other_fidx)) {
1469 if (other_face != -1) {
1482 if (other_face != -1) {
1492 }
while (fidx[0]--);
1495 char checked_verts = 0;
1502 for (
uint i = 0;
i < 2;
i++) {
1505 if ((checked_verts & (1 << fidx[
i])) != 0) {
1517 checked_verts |= 1 << fidx[
i];
1524 }
while (fidx[0]--);
1534 const float v1co[3],
1535 const float v2co[3],
1536 const float v3co[3],
1537 const float uv1co[2],
1538 const float uv2co[2],
1539 const float uv3co[2],
1540 float pixelScreenCo[4],
1550 const float v1co[4],
1551 const float v2co[4],
1552 const float v3co[4],
1553 const float uv1co[2],
1554 const float uv2co[2],
1555 const float uv3co[2],
1556 float pixelScreenCo[4],
1560 float wtot_inv, wtot;
1564 w_int[0] =
w[0] * v1co[3];
1565 w_int[1] =
w[1] * v2co[3];
1566 w_int[2] =
w[2] * v3co[3];
1568 wtot = w_int[0] + w_int[1] + w_int[2];
1571 wtot_inv = 1.0f / wtot;
1572 w_int[0] *= wtot_inv;
1573 w_int[1] *= wtot_inv;
1574 w_int[2] *= wtot_inv;
1578 w[0] =
w[1] =
w[2] = w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
1596 const float projmat_inv[4][4],
1597 const float view_pos[3],
1598 const float co_px[2],
1601 r_dir[0] = 2.0f * (co_px[0] / winx) - 1.0f;
1602 r_dir[1] = 2.0f * (co_px[1] / winy) - 1.0f;
1621 const float zero[3] = {0};
1622 float v1_proj[3], v2_proj[3];
1637 const float *tri_uv[3],
ImBuf *ibuf_other,
const float w[3],
uchar rgba_ub[4],
float rgba_f[4])
1644 float x = uv_other[0] * ibuf_other->
x - 0.5f;
1645 float y = uv_other[1] * ibuf_other->
y - 0.5f;
1650 memcpy(rgba_f, &
col,
sizeof(
col));
1654 memcpy(rgba_ub, &
col,
sizeof(
col));
1660 const int tri_index,
1684 mask = ((rgba_f[0] + rgba_f[1] + rgba_f[2]) * (1.0f / 3.0f)) * rgba_f[3];
1687 mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) * (1.0f / (255.0f * 3.0f))) *
1688 (rgba_ub[3] * (1.0f / 255.0f));
1713 float ca1, ca2, ca3, ca_mask;
1718 ca_mask =
w[0] * ca1 +
w[1] * ca2 +
w[2] * ca3;
1720 CLAMP(ca_mask, 0.0f, 1.0f);
1729 float no[3], angle_cos;
1732 const float *no1, *no2, *no3;
1737 no[0] =
w[0] * no1[0] +
w[1] * no2[0] +
w[2] * no3[0];
1738 no[1] =
w[0] * no1[1] +
w[1] * no2[1] +
w[2] * no3[1];
1739 no[2] =
w[0] * no1[2] +
w[1] * no2[2] +
w[2] * no3[2];
1761 float viewDirPersp[3];
1762 const float *co1, *co2, *co3;
1768 viewDirPersp[0] = (ps->
viewPos[0] - (
w[0] * co1[0] +
w[1] * co2[0] +
w[2] * co3[0]));
1769 viewDirPersp[1] = (ps->
viewPos[1] - (
w[0] * co1[1] +
w[1] * co2[1] +
w[2] * co3[1]));
1770 viewDirPersp[2] = (ps->
viewPos[2] - (
w[0] * co1[2] +
w[1] * co2[2] +
w[2] * co3[2]));
1776 angle_cos =
dot_v3v3(viewDirPersp, no);
1781 angle_cos =
fabsf(angle_cos);
1784 if (angle_cos <= ps->normal_angle__cos) {
1788 if (angle_cos < ps->normal_angle_inner__cos) {
1812 bool generate_tile =
false;
1821 generate_tile =
true;
1828 if (generate_tile) {
1830 volatile void *undorect;
1880 const int tri_index,
1881 const float pixelScreenCo[4],
1882 const float world_spaceCo[3],
1887 int x_round, y_round;
1896 x_px =
mod_i(x_px, ibuf->
x);
1897 y_px =
mod_i(y_px, ibuf->
y);
1943 projPixel->
x_px = x_px;
1944 projPixel->
y_px = y_px;
1968 const float *other_tri_uv[3] = {
1976 other_tri_uv, ibuf_other,
w,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.f);
1998 other_tri_uv, ibuf_other,
w, ((
ProjPixelClone *)projPixel)->clonepx.ch,
nullptr);
2021 ps, co, ((
ProjPixelClone *)projPixel)->clonepx.f,
nullptr,
true))
2029 ps, co,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.ch,
true))
2038#ifdef PROJ_DEBUG_PAINT
2063 if (l1[1] < rect->
ymin || l1[1] > rect->
ymax) {
2067 if ((l1[0] < rect->
xmin && l2[0] < rect->
xmin) || (l1[0] > rect->
xmax && l2[0] > rect->
xmax)) {
2089 if (l1[0] < rect->
xmin || l1[0] > rect->
xmax) {
2094 if ((l1[1] < rect->
ymin && l2[1] < rect->
ymin) || (l1[1] > rect->
ymax && l2[1] > rect->
ymax)) {
2139 (isect <= cliprect->xmax))
2141 if (l1[1] < l2[1]) {
2143 l1_clip[1] = rect->
ymin;
2148 l2_clip[1] = rect->
ymin;
2158 (isect <= cliprect->xmax))
2160 if (l1[1] > l2[1]) {
2162 l1_clip[1] = rect->
ymax;
2167 l2_clip[1] = rect->
ymax;
2178 (isect <= cliprect->ymax))
2180 if (l1[0] < l2[0]) {
2181 l1_clip[0] = rect->
xmin;
2186 l2_clip[0] = rect->
xmin;
2197 (isect <= cliprect->ymax))
2199 if (l1[0] > l2[0]) {
2200 l1_clip[0] = rect->
xmax;
2205 l2_clip[0] = rect->
xmax;
2222#ifndef PROJ_DEBUG_NOSEAMBLEED
2224static void scale_tri(
float insetCos[3][3],
const float *origCos[3],
const float inset)
2227 cent[0] = (origCos[0][0] + origCos[1][0] + origCos[2][0]) * (1.0f / 3.0f);
2228 cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1]) * (1.0f / 3.0f);
2229 cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2]) * (1.0f / 3.0f);
2251 return x *
x +
y *
y;
2261 const float radius_squared,
2262 const rctf *bucket_bounds)
2276 if ((bucket_bounds->
xmin <= cent[0] && bucket_bounds->
xmax >= cent[0]) ||
2277 (bucket_bounds->
ymin <= cent[1] && bucket_bounds->
ymax >= cent[1]))
2283 if (cent[0] < bucket_bounds->
xmin) {
2285 if (cent[1] < bucket_bounds->
ymin) {
2292 if (cent[1] > bucket_bounds->
ymax) {
2299 else if (cent[0] > bucket_bounds->
xmax) {
2301 if (cent[1] < bucket_bounds->
ymin) {
2308 if (cent[1] > bucket_bounds->
ymax) {
2329 const float *v1coSS,
2330 const float *v2coSS,
2331 const float *v3coSS,
2335 float bucket_bounds_uv[4][2],
2342 uv[0] = bucket_bounds->
xmax;
2343 uv[1] = bucket_bounds->
ymin;
2348 uv[1] = bucket_bounds->
ymax;
2352 uv[0] = bucket_bounds->
xmin;
2358 uv[1] = bucket_bounds->
ymin;
2367 const float *v1coSS,
2368 const float *v2coSS,
2369 const float *v3coSS,
2373 float bucket_bounds_uv[4][2],
2380 uv[0] = bucket_bounds->
xmax;
2381 uv[1] = bucket_bounds->
ymin;
2386 uv[1] = bucket_bounds->
ymax;
2390 uv[0] = bucket_bounds->
xmin;
2396 uv[1] = bucket_bounds->
ymin;
2404static float angle_2d_clockwise(
const float p1[2],
const float p2[2],
const float p3[2])
2408 v1[0] = p1[0] - p2[0];
2409 v1[1] = p1[1] - p2[1];
2410 v2[0] = p3[0] - p2[0];
2411 v2[1] = p3[1] - p2[1];
2413 return -
atan2f(v1[0] *
v2[1] - v1[1] *
v2[0], v1[0] *
v2[0] + v1[1] *
v2[1]);
2418#define ISECT_2 (1 << 1)
2419#define ISECT_3 (1 << 2)
2420#define ISECT_4 (1 << 3)
2421#define ISECT_ALL3 ((1 << 3) - 1)
2422#define ISECT_ALL4 ((1 << 4) - 1)
2426 const float pt[2],
const float v1[2],
const float v2[2],
const float v3[2],
const float limit)
2438 return (((
float *)p1)[2] < ((
float *)p2)[2] ? 1 : -1);
2443 return (((
float *)p1)[2] < ((
float *)p2)[2] ? -1 : 1);
2456 float xlen = l2[0] - l1[0];
2457 float ylen = l2[1] - l1[1];
2461 if ((l1[0] - rect->
xmin) * (l2[0] - rect->
xmin) <= 0) {
2465 else if ((l1[0] - rect->
xmax) * (l2[0] - rect->
xmax) < 0) {
2472 if ((l1[1] - rect->
ymin) * (l2[1] - rect->
ymin) <= 0) {
2476 else if ((l1[1] - rect->
ymax) * (l2[1] - rect->
ymax) < 0) {
2486 tmp = (is_ortho) ? 1.0f : (l1[3] +
min * (l2[3] - l1[3]));
2488 uv[0] = (uv1[0] +
min / tmp * (uv2[0] - uv1[0]));
2489 uv[1] = (uv1[1] +
min / tmp * (uv2[1] - uv1[1]));
2495 const bool is_flip_object,
2496 const rctf *cliprect,
2497 const rctf *bucket_bounds,
2498 const float *v1coSS,
2499 const float *v2coSS,
2500 const float *v3coSS,
2504 float bucket_bounds_uv[8][2],
2508 int inside_bucket_flag = 0;
2509 int inside_face_flag = 0;
2511 bool collinear =
false;
2513 float bucket_bounds_ss[4][2];
2562 if (inside_bucket_flag &
ISECT_1) {
2570 bucket_bounds, v1coSS, v2coSS, uv1co, uv2co, bucket_bounds_uv[*tot], is_ortho))
2576 if (inside_bucket_flag &
ISECT_2) {
2584 bucket_bounds, v2coSS, v3coSS, uv2co, uv3co, bucket_bounds_uv[*tot], is_ortho))
2590 if (inside_bucket_flag &
ISECT_3) {
2598 bucket_bounds, v3coSS, v1coSS, uv3co, uv1co, bucket_bounds_uv[*tot], is_ortho))
2624 bucket_bounds_ss[0][0] = bucket_bounds->
xmax;
2625 bucket_bounds_ss[0][1] = bucket_bounds->
ymin;
2631 bucket_bounds_ss[1][0] = bucket_bounds->
xmax;
2632 bucket_bounds_ss[1][1] = bucket_bounds->
ymax;
2638 bucket_bounds_ss[2][0] = bucket_bounds->
xmin;
2639 bucket_bounds_ss[2][1] = bucket_bounds->
ymax;
2645 bucket_bounds_ss[3][0] = bucket_bounds->
xmin;
2646 bucket_bounds_ss[3][1] = bucket_bounds->
ymin;
2660 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2664 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2691 float isectVCosSS[8][3];
2692 float v1_clipSS[2], v2_clipSS[2];
2696 float cent[2] = {0.0f, 0.0f};
2702 if (inside_face_flag &
ISECT_1) {
2703 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]);
2706 if (inside_face_flag &
ISECT_2) {
2707 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]);
2710 if (inside_face_flag &
ISECT_3) {
2711 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]);
2714 if (inside_face_flag &
ISECT_4) {
2715 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]);
2719 if (inside_bucket_flag &
ISECT_1) {
2723 if (inside_bucket_flag &
ISECT_2) {
2727 if (inside_bucket_flag &
ISECT_3) {
2733 if (
line_clip_rect2f(cliprect, bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
2734 if ((inside_bucket_flag &
ISECT_1) == 0) {
2738 if ((inside_bucket_flag &
ISECT_2) == 0) {
2746 if (
line_clip_rect2f(cliprect, bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
2747 if ((inside_bucket_flag &
ISECT_2) == 0) {
2751 if ((inside_bucket_flag &
ISECT_3) == 0) {
2759 if (
line_clip_rect2f(cliprect, bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
2760 if ((inside_bucket_flag &
ISECT_3) == 0) {
2764 if ((inside_bucket_flag &
ISECT_1) == 0) {
2778 for (
int i = 0;
i < (*tot);
i++) {
2779 cent[0] += isectVCosSS[
i][0];
2780 cent[1] += isectVCosSS[
i][1];
2782 cent[0] = cent[0] /
float(*tot);
2783 cent[1] = cent[1] /
float(*tot);
2788 for (
int i = 0;
i < (*tot);
i++) {
2789 isectVCosSS[
i][2] = angle_2d_clockwise(up, cent, isectVCosSS[
i]);
2794 v1_clipSS[0] = cent[0];
2795 v1_clipSS[1] = cent[1] + 1.0f;
2797 for (
int i = 0;
i < (*tot);
i++) {
2798 v2_clipSS[0] = isectVCosSS[
i][0] - cent[0];
2799 v2_clipSS[1] = isectVCosSS[
i][1] - cent[1];
2800 isectVCosSS[
i][2] =
atan2f(v1_clipSS[0] * v2_clipSS[1] - v1_clipSS[1] * v2_clipSS[0],
2801 v1_clipSS[0] * v2_clipSS[0] + v1_clipSS[1] * v2_clipSS[1]);
2808 qsort(isectVCosSS, *tot,
sizeof(
float[3]),
float_z_sort);
2812 while (doubles ==
true) {
2815 for (
int i = 0;
i < (*tot);
i++) {
2819 for (
int j =
i; j < (*tot) - 1; j++) {
2820 isectVCosSS[j][0] = isectVCosSS[j + 1][0];
2821 isectVCosSS[j][1] = isectVCosSS[j + 1][1];
2838 for (
int i = 0;
i < (*tot);
i++) {
2844 for (
int i = 0;
i < (*tot);
i++) {
2851#ifdef PROJ_DEBUG_PRINT_CLIP
2856 float test_uv[4][2];
2860 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2864 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2866 printf(
"( [(%f,%f), (%f,%f), (%f,%f), (%f,%f)], ",
2876 printf(
" [(%f,%f), (%f,%f), (%f,%f)], ",
2885 for (
int i = 0;
i < (*tot);
i++) {
2886 printf(
"(%f, %f),", bucket_bounds_uv[
i][0], bucket_bounds_uv[
i][1]);
2950static bool IsectPoly2Df(
const float pt[2],
const float uv[][2],
const int tot)
2957 for (
i = 1;
i < tot;
i++) {
2969 for (
int i = 1;
i < tot;
i++) {
2984 const int thread_index,
2985 const int bucket_index,
2986 const int tri_index,
2987 const int image_index,
2988 const rctf *clip_rect,
2989 const rctf *bucket_bounds,
3020 const float *v1coSS, *v2coSS, *v3coSS;
3023 const float *vCo[3];
3028 float *uv1co, *uv2co, *uv3co;
3029 float pixelScreenCo[4];
3037 float tri_uv_pxoffset[3][2];
3038 float xhalfpx, yhalfpx;
3039 const float ibuf_xf =
float(ibuf->
x), ibuf_yf =
float(ibuf->
y);
3042 int has_x_isect = 0, has_isect = 0;
3044 float uv_clip[8][2];
3046 const bool is_ortho = ps->
is_ortho;
3070 tri_uv_pxoffset[0][0] = tri_uv[0][0] - xhalfpx;
3071 tri_uv_pxoffset[0][1] = tri_uv[0][1] - yhalfpx;
3073 tri_uv_pxoffset[1][0] = tri_uv[1][0] - xhalfpx;
3074 tri_uv_pxoffset[1][1] = tri_uv[1][1] - yhalfpx;
3076 tri_uv_pxoffset[2][0] = tri_uv[2][0] - xhalfpx;
3077 tri_uv_pxoffset[2][1] = tri_uv[2][1] - yhalfpx;
3080 uv1co = tri_uv_pxoffset[0];
3081 uv2co = tri_uv_pxoffset[1];
3082 uv3co = tri_uv_pxoffset[2];
3106 if (uv_clip_tot > 6) {
3107 printf(
"this should never happen! %d\n", uv_clip_tot);
3113 project_paint_undo_tiles_init(
3119 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3122 uv[1] =
float(
y) / ibuf_yf;
3125 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3128 uv[0] =
float(
x) / ibuf_xf;
3132 if ((do_backfacecull ==
true &&
IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
3136 has_x_isect = has_isect = 1;
3140 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3144 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3149 if (do_clip || do_3d_mapping) {
3173 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3179 else if (has_x_isect) {
3189 if (has_x_isect == 0 && has_isect) {
3197#ifndef PROJ_DEBUG_NOSEAMBLEED
3216 printf(
"seams - %d %d %d %d\n",
3237 float insetCos[3][3];
3240 const float *vCoSS[3];
3244 float bucket_clip_edges[2][2];
3245 float edge_verts_inset_clip[2][3];
3250 float seam_subsection[4][2];
3254 float tri_puv[3][2];
3256 tri_puv[0][0] = tri_uv_pxoffset[0][0] * ibuf->
x;
3257 tri_puv[0][1] = tri_uv_pxoffset[0][1] * ibuf->
y;
3259 tri_puv[1][0] = tri_uv_pxoffset[1][0] * ibuf->
x;
3260 tri_puv[1][1] = tri_uv_pxoffset[1][1] * ibuf->
y;
3262 tri_puv[2][0] = tri_uv_pxoffset[2][0] * ibuf->
x;
3263 tri_puv[2][1] = tri_uv_pxoffset[2][1] * ibuf->
y;
3290 for (fidx1 = 0; fidx1 < 3; fidx1++) {
3292 fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
3294 if ((face_seam_flag & (1 << fidx1)) &&
3299 bucket_clip_edges[0],
3300 bucket_clip_edges[1]))
3314 ps, bucket_clip_edges[0], vCo[fidx1], vCo[fidx2]);
3316 ps, bucket_clip_edges[1], vCo[fidx1], vCo[fidx2]);
3320 seam_subsection[0], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac1);
3322 seam_subsection[1], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac2);
3324 interp_v2_v2v2(seam_subsection[2], seam_uvs[0], seam_uvs[1], fac2);
3325 interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1);
3329 interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
3330 interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
3336 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3339 uv[1] =
float(
y) / ibuf_yf;
3342 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3347 uv[0] =
float(
x) / ibuf_xf;
3375 float pixel_on_edge[4];
3380 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3384 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3390 pixel_on_edge, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
3393 pixel_on_edge[3] = 1.0f;
3396 pixel_on_edge[0] =
float(ps->
winx * 0.5f) +
3397 (ps->
winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
3398 pixel_on_edge[1] =
float(ps->
winy * 0.5f) +
3399 (ps->
winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
3401 pixel_on_edge[2] = pixel_on_edge[2] / pixel_on_edge[3];
3406 ps, bucketFaceNodes, tri_index, pixel_on_edge))
3410 if (do_clip || do_3d_mapping) {
3426 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3431 else if (has_x_isect) {
3441 if (has_x_isect == 0 && has_isect) {
3495 rctf *r_bucket_bounds)
3514 const int thread_index,
3515 const int bucket_index,
3516 const rctf *clip_rect,
3517 const rctf *bucket_bounds)
3520 int tri_index, image_index = 0;
3521 ImBuf *ibuf =
nullptr;
3522 Image *tpage_last =
nullptr, *tpage;
3523 ImBuf *tmpibuf =
nullptr;
3555 if (tpage_last != tpage || tile_last !=
tile) {
3560 for (image_index = 0; image_index < ps->
image_tot; image_index++) {
3563 ibuf = projIma->
ibuf;
3605 float p1[2], p2[2], p3[2], p4[2];
3606 const float *
v, *v1, *
v2, *v3;
3625 p1[0] = bucket_bounds.
xmin;
3626 p1[1] = bucket_bounds.
ymin;
3627 p2[0] = bucket_bounds.
xmin;
3628 p2[1] = bucket_bounds.
ymax;
3629 p3[0] = bucket_bounds.
xmax;
3630 p3[1] = bucket_bounds.
ymax;
3631 p4[0] = bucket_bounds.
xmax;
3632 p4[1] = bucket_bounds.
ymin;
3652 const int3 &corner_tri,
3653 const int tri_index)
3656 float min[2],
max[2], *vCoSS;
3658 int bucketMin[2], bucketMax[2];
3659 int fidx, bucket_x, bucket_y;
3661 int has_x_isect = -1, has_isect = 0;
3675 for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
3677 for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
3679 int bucket_index = bucket_x + (bucket_y * ps->
buckets_x);
3685 has_x_isect = has_isect = 1;
3687 else if (has_x_isect) {
3695 if (has_x_isect == 0 && has_isect) {
3700#ifndef PROJ_DEBUG_NOSEAMBLEED
3713 float viewmat[4][4];
3714 float viewinv[4][4];
3722 if (symmetry_flag) {
3724 for (
i = 0;
i < 3;
i++) {
3725 if ((symmetry_flag >>
i) & 1) {
3765 memcpy(winmat,
array,
sizeof(winmat));
3766 array +=
sizeof(winmat) /
sizeof(
float);
3767 memcpy(viewmat,
array,
sizeof(viewmat));
3768 array +=
sizeof(viewmat) /
sizeof(
float);
3780 copy_m4_m4(viewinv, cam_ob_eval->object_to_world().ptr());
3826 float *projScreenCo;
3837 for (a = 0; a < ps->totvert_eval; a++, projScreenCo += 4) {
3838 mul_v3_m4v3(projScreenCo, ps->projectMat, ps->vert_positions_eval[a]);
3841 projScreenCo[0] = float(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0];
3842 projScreenCo[1] = float(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1];
3843 minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
3847 for (a = 0; a < ps->
totvert_eval; a++, projScreenCo += 4) {
3849 projScreenCo[3] = 1.0f;
3855 projScreenCo[0] =
float(ps->
winx * 0.5f) +
3856 (ps->
winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
3857 projScreenCo[1] =
float(ps->
winy * 0.5f) +
3858 (ps->
winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
3860 projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
3884#ifdef PROJ_DEBUG_WINCLIP
3885 CLAMP(ps->screenMin[0], float(-diameter), float(ps->winx + diameter));
3886 CLAMP(ps->screenMax[0], float(-diameter), float(ps->winx + diameter));
3888 CLAMP(ps->screenMin[1], float(-diameter), float(ps->winy + diameter));
3889 CLAMP(ps->screenMax[1], float(-diameter), float(ps->winy + diameter));
3891 UNUSED_VARS(diameter);
3895 ps->screenMin[0] = 0;
3896 ps->screenMax[0] = float(ps->winx);
3898 ps->screenMin[1] = 0;
3899 ps->screenMax[1] = float(ps->winy);
3910 float (*edges)[3] =
static_cast<float (*)[3]
>(
3926 if (counter[a] > 0) {
3941#ifndef PROJ_DEBUG_NOSEAMBLEED
3966 if (reset_threads) {
3987 float viewDirPersp[3];
4023#ifndef PROJ_DEBUG_NOSEAMBLEED
4026 const int3 &corner_tri,
4027 const int tri_index)
4073 const int totmat = ob->
totcol + 1;
4079 for (
int i = 0;
i < totmat - 1;
i++) {
4119 const float (*uv_map_clone_base)[2] =
nullptr;
4129 if (layer_num != -1) {
4130 uv_map_clone_base =
static_cast<const float (*)[2]
>(
4134 if (uv_map_clone_base ==
nullptr) {
4136 uv_map_clone_base =
static_cast<const float (*)[2]
>(
4141 memset(layer_clone, 0,
sizeof(*layer_clone));
4149 const int tri_index)
4190 memset(face_lookup, 0,
sizeof(*face_lookup));
4234 const int3 &corner_tri,
4254#ifdef PROJ_DEBUG_WINCLIP
4293 entry = entry->
next,
i++, projIma++)
4297 projIma->
ima = entry->
ima;
4298 projIma->
touch =
false;
4300 if (projIma->
ibuf ==
nullptr) {
4323 const float (*uv_map_base)[2],
4324 const bool is_multi_view)
4329 Image *tpage_last =
nullptr, *tpage;
4332 int tile_last = -1,
tile;
4333 int image_index = -1, tri_index;
4340 for (tri_index = 0; tri_index < ps->
corner_tris_eval.size(); tri_index++) {
4341 bool is_face_paintable;
4342 bool skip_tri =
false;
4349 if (slot ==
nullptr) {
4350 uv_map_base =
static_cast<const float (*)[2]
>(
4355 if (slot != slot_last) {
4360 uv_map_base =
static_cast<const float (*)[2]
>(
4367 if (slot->
ima !=
nullptr &&
4396#ifndef PROJ_DEBUG_NOSEAMBLEED
4406 if (is_face_paintable && tpage) {
4410 if (is_multi_view ==
false) {
4415#ifdef PROJ_DEBUG_WINCLIP
4425 if (prev_poly != tri_faces[tri_index]) {
4428 prev_poly = tri_faces[tri_index];
4429 for (
const int corner : poly) {
4439 int poly_tri = poly.
size() - 3;
4440 tri_index += poly_tri;
4453 if (tpage_last != tpage || tile_last !=
tile) {
4456 e =
e->next, image_index++)
4458 if (
e->ima == tpage &&
e->iuser.tile ==
tile) {
4468 iuser.
framenr = tpage->lastframe;
4485 if (image_index != -1) {
4505 const bool is_multi_view,
4506 const char symmetry_flag)
4510 const float (*uv_map_base)[2] =
nullptr;
4517 bool reset_threads =
false;
4543 if (layer_num != -1) {
4581 reset_threads =
true;
4590 "paint-bucketRect");
4592 "paint-bucketFaces");
4595#ifndef PROJ_DEBUG_NOSEAMBLEED
4607 ps, arena, &face_lookup, &layer_clone, uv_map_base, is_multi_view);
4621 (
float(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projCo[0] / projCo[3]);
4623 (
float(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projCo[1] / projCo[3]);
4634 for (a = 0, projIma = ps->
projImages; a < ps->image_tot; a++, projIma++) {
4675#ifndef PROJ_DEBUG_NOSEAMBLEED
4745 bool redraw =
false;
4747 for (a = 0, projIma = ps->
projImages; a < ps->image_tot; a++, projIma++) {
4748 if (projIma->
touch) {
4762 projIma->
touch =
false;
4773 float min_brush[2], max_brush[2];
4779 if (radius < 1.0f) {
4784 min_brush[0] = mval_f[0] - radius;
4785 min_brush[1] = mval_f[1] - radius;
4787 max_brush[0] = mval_f[0] + radius;
4788 max_brush[1] = mval_f[1] + radius;
4812 rctf *bucket_bounds,
4813 const float mval[2])
4822 const int bucket_y = bidx / ps->
buckets_x;
4823 const int bucket_x = bidx - (bucket_y * ps->
buckets_x);
4826 if (bucket_x >= ps->
bucketMin[0] && bucket_x < ps->bucketMax[0]) {
4833 *bucket_index = bidx;
4867 uchar clone_rgba[4];
4869 clone_rgba[0] = clone_pt[0];
4870 clone_rgba[1] = clone_pt[1];
4871 clone_rgba[2] = clone_pt[2];
4872 clone_rgba[3] =
uchar(clone_pt[3] *
mask);
4889 const float *clone_pt = ((
ProjPixelClone *)projPixel)->clonepx.f;
4892 float clone_rgba[4];
4954 float accum_tot = 0.0f;
4962 for (yk = 0; yk < kernel->
side; yk++) {
4963 for (xk = 0; xk < kernel->
side; xk++) {
4965 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
4970 float weight = kernel->
wdata[xk + yk * kernel->
side];
4973 accum_tot += weight;
4978 if (
LIKELY(accum_tot != 0)) {
5014 float accum_tot = 0;
5023 for (yk = 0; yk < kernel->
side; yk++) {
5024 for (xk = 0; xk < kernel->
side; xk++) {
5026 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
5031 float weight = kernel->
wdata[xk + yk * kernel->
side];
5034 accum_tot += weight;
5039 if (
LIKELY(accum_tot != 0)) {
5045 float rgba_pixel[4];
5055 float alpha = rgba_pixel[3];
5056 rgba[3] = rgba_pixel[3] =
mask;
5078 const float texrgb[3],
5103 if (dither > 0.0f) {
5123 const float texrgb[3],
5150 rgba_ub[0] = rgba_ub[1] = rgba_ub[2] = ps->
stencil_value * 255.0f;
5184 &rect_to_add, projPixel->
x_px, projPixel->
x_px + 1, projPixel->
y_px, projPixel->
y_px + 1);
5194 float rgb_straight[4];
5212 const int thread_index = ((
ProjectHandle *)ph_v)->thread_index;
5220 int last_index = -1;
5224 float dist_sq, dist;
5228 bool is_floatbuf =
false;
5233 float pos_ofs[2] = {0};
5239 const float brush_radius_sq = brush_radius * brush_radius;
5251 LinkNode *softenPixels_f =
nullptr;
5256 pos_ofs[0] =
pos[0] - lastpos[0];
5257 pos_ofs[1] =
pos[1] - lastpos[1];
5272 rctf clip_rect = bucket_bounds;
5285 for (node = ps->
bucketRect[bucket_index]; node; node = node->
next) {
5291 last_projIma = projImages + last_index;
5293 last_projIma->
touch =
true;
5303 float line_len_sq_inv, line_len;
5306 const float p[2] = {
5307 projPixel->
projCoSS[0] - lastpos[0],
5308 projPixel->
projCoSS[1] - lastpos[1],
5313 line_len_sq_inv = 1.0f / line_len;
5314 line_len =
sqrtf(line_len);
5318 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
5323 f =
len_v2(p) / line_len;
5328 color_f[3] *=
float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5363 float newColor_f[4];
5364 newColor_f[3] =
float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5429 for (node = ps->
bucketRect[bucket_index]; node; node = node->
next) {
5436 if (dist_sq <= brush_radius_sq) {
5437 dist =
sqrtf(dist_sq);
5441 if (falloff > 0.0f) {
5446 float custom_mask =
float(projPixel->
mask) * (1.0f / 65535.0f);
5452 CLAMP(texmask, 0.0f, 1.0f);
5453 custom_mask *= texmask;
5469 samplecos[2] = 0.0f;
5475 ps->
paint, brush, mtex, samplecos, texrgba, thread_index, pool);
5478 custom_mask *= texrgba[3];
5492 float max_mask = brush_alpha * custom_mask * falloff * 65535.0f;
5495 mask = mask_accum + max_mask;
5498 mask = mask_accum + (max_mask - mask_accum * falloff);
5506 mask = mask_short * (1.0f / 65535.0f);
5514 mask = brush_alpha * custom_mask * falloff;
5522 last_projIma = projImages + last_index;
5524 last_projIma->
touch =
true;
5530 *projPixel->
valid =
true;
5536 switch (brush_type) {
5596 for (node = smearPixels; node; node = node->
next) {
5604 for (node = smearPixels_f; node; node = node->
next) {
5616 for (node = softenPixels; node; node = node->
next) {
5624 for (node = softenPixels_f; node; node = node->
next) {
5640 bool touch_any =
false;
5661 bool float_dest =
false;
5662 bool uchar_dest =
false;
5707 memcpy(
handles[a].projImages[
i].partRedrawRect,
5734 handles[a].projImages[
i].partRedrawRect,
5751 if (tri_index != -1) {
5775 const float prev_pos[2],
5850 const float prev_pos[2],
5867 const int mval_i[2] = {int(
pos[0]), int(
pos[1])};
5974#ifndef PROJ_DEBUG_NOSEAMBLEED
6008 char symmetry_flag_views[BOUNDED_ARRAY_TYPE_SIZE<
decltype(ps_handle->
ps_views)>()] = {0};
6010 ps_handle = MEM_new<ProjStrokeHandle>(
"ProjStrokeHandle");
6011 ps_handle->
scene = scene;
6036 ProjPaintState *ps = MEM_new<ProjPaintState>(
"ProjectionPaintState");
6051 BLI_assert(index <= ps_handle->ps_views_tot);
6063 if (ps->
ob ==
nullptr) {
6106 MEM_delete(ps_handle);
6135 MEM_delete(ps_handle);
6154 MEM_delete(ps_handle);
6165 int orig_brush_size;
6185 if (image ==
nullptr) {
6206 if (view_data !=
nullptr &&
6221 if (scene.
camera ==
nullptr) {
6251 const float pos[2] = {0.0, 0.0};
6252 const float lastpos[2] = {0.0, 0.0};
6279 ot->name =
"Project Image";
6280 ot->idname =
"PAINT_OT_project_image";
6281 ot->description =
"Project an edited render from the active camera back onto the object";
6323 char err_out[256] =
"unknown";
6342 w = std::min(
w, maxsize);
6343 h = std::min(h, maxsize);
6348 View3D v3d_copy = blender::dna::shallow_copy(*v3d);
6400 depsgraph, v3d, rv3d,
true, &clip_start, &clip_end);
6415 ot->name =
"Image from View";
6416 ot->idname =
"PAINT_OT_image_from_view";
6417 ot->description =
"Make an image from biggest 3D view for reprojection";
6427 ot->srna,
"filepath",
nullptr,
FILE_MAX,
"File Path",
"Name of the file");
6435 ReportList *reports,
bool has_uvs,
bool has_mat,
bool has_tex,
bool has_stencil)
6439 "Missing%s%s%s%s detected!",
6440 !has_uvs ?
RPT_(
" UVs,") :
"",
6441 !has_mat ?
RPT_(
" Materials,") :
"",
6442 !has_tex ?
RPT_(
" Textures (or linked),") :
"",
6443 !has_stencil ?
RPT_(
" Stencil,") :
"");
6451 bool *r_has_stencil)
6455 bool has_mat =
true;
6456 bool has_tex =
true;
6457 bool has_stencil =
true;
6458 bool has_uvs =
true;
6475 for (
int i = 1;
i < ob.
totcol + 1;
i++) {
6505 if (layernum == 0) {
6513 if (imapaint.
stencil ==
nullptr) {
6514 has_stencil =
false;
6532 *r_has_uvs = has_uvs;
6535 *r_has_mat = has_mat;
6538 *r_has_tex = has_tex;
6540 if (r_has_stencil) {
6541 *r_has_stencil = has_stencil;
6544 return has_uvs && has_mat && has_tex && has_stencil;
6566 {0,
nullptr, 0,
nullptr,
nullptr},
6583 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6584 char imagename[
MAX_ID_NAME - 2] =
"Material Diffuse Color";
6587 bool use_float =
false;
6628 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6665 switch (layer_type) {
6671 bNode *in_node =
nullptr;
6673 ma->
nodetree->ensure_topology_cache();
6675 "ShaderNodeBsdfPrincipled");
6687 switch (in_sock->
type) {
6732 Image *ima =
nullptr;
6760 switch (slot_type) {
6764 new_node->
id = &ima->
id;
6781 ntree->ensure_topology_cache();
6784 bNode *out_node = new_node;
6786 if (in_node !=
nullptr) {
6803 out_node = nor_node;
6815 out_node = bump_node;
6820 "ShaderNodeOutputMaterial");
6823 if (in_node !=
nullptr) {
6833 if (in_sock !=
nullptr && link ==
nullptr) {
6891 const char *base_name = ma ? &ma->
id.
name[2] : &ob->
id.
name[2];
6935 switch (slot_type) {
6958#define IMA_DEF_NAME N_("Untitled")
6964 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6969 {0,
nullptr, 0,
nullptr,
nullptr},
6973 ot->name =
"Add Paint Slot";
6974 ot->description =
"Add a paint slot";
6975 ot->idname =
"PAINT_OT_add_texture_paint_slot";
6991 "Material Layer Type",
6992 "Material layer type of new paint slot");
6996 ot->srna,
"slot_type", slot_type_items, 0,
"Slot Type",
"Type of new paint slot");
7003 ot->srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
7008 prop =
RNA_def_int(
ot->srna,
"width", 1024, 1, INT_MAX,
"Width",
"Image width", 1, 16384);
7011 prop =
RNA_def_int(
ot->srna,
"height", 1024, 1, INT_MAX,
"Height",
"Image height", 1, 16384);
7014 RNA_def_boolean(
ot->srna,
"alpha",
true,
"Alpha",
"Create an image with an alpha channel");
7021 "Fill the image with a grid for UV map testing");
7027 "Create image with 32-bit floating-point bit depth");
7035 "Type of element that attribute is stored on");
7042 "Type of data stored in attribute");
7075 ot->name =
"Add Simple UVs";
7076 ot->description =
"Add cube map UVs on mesh";
7077 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)
float BKE_brush_alpha_get(const Paint *paint, const Brush *brush)
const MTex * BKE_brush_color_texture_get(const Brush *brush, eObjectMode object_mode)
float BKE_brush_sample_tex_3d(const Paint *paint, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
float BKE_brush_sample_masktex(const Paint *paint, Brush *br, const float point[2], int thread, ImagePool *pool)
std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Paint *paint, const Brush *brush)
void BKE_brush_size_set(Paint *paint, Brush *brush, int size)
float BKE_brush_curve_strength_clamped(const Brush *br, float p, float len)
int BKE_brush_size_get(const Paint *paint, const Brush *brush)
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)
#define IDP_array_float_get(prop)
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.
@ BKE_MAT_ASSIGN_USERPREF
void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const Object *ob)
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)
blender::ocio::ColorSpace ColorSpace
#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])
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[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])
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 size_t size_t BLI_snprintf_utf8(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)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_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.
#define IMAGEPAINT_MODE_IMAGE
@ 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_MATERIAL
@ PAINT_CANVAS_SOURCE_COLOR_ATTRIBUTE
@ PAINT_CANVAS_SOURCE_IMAGE
@ PAINT_CANVAS_SOURCE_MATERIAL
@ IMAGEPAINT_MISSING_MATERIAL
@ IMAGEPAINT_MISSING_STENCIL
#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, Main *bmain, 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)
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], const ColorSpace *colorspace)
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], const ColorSpace *colorspace)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
bool IMB_colormanagement_space_is_srgb(const ColorSpace *colorspace)
BLI_INLINE void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[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)
@ IMB_COLORMANAGE_IS_DATA
Read Guarded memory(de)allocation.
#define MEM_SIZE_OPTIMAL(size)
struct blender::bke::bNodeTreeType * ntreeType_Shader
const EnumPropertyItem * RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
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
float distance(VecOp< float, D >, VecOp< float, D >) RET
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)
void paint_brush_color_get(const Paint *paint, Brush *br, std::optional< blender::float3 > &initial_hsv_jitter, bool invert, float distance, float pressure, float r_color[3])
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void paint_brush_exit_tex(Brush *brush)
bool paint_use_opacity_masking(const Paint *paint, const 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_paint_prepare_all_faces(ProjPaintState *ps, MemArena *arena, const ProjPaintFaceLookup *face_lookup, ProjPaintLayerClone *layer_clone, const float(*uv_map_base)[2], const bool is_multi_view)
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 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)
int RNA_int_get(PointerRNA *ptr, const char *name)
std::string RNA_string_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
const ColorSpace * colorspace
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
PaintRuntimeHandle * runtime
const bool * hide_poly_orig
const int * index_mp_to_orig
const bool * select_poly_orig
ImagePaintPartialRedraw * partRedrawRect
volatile void ** undoRect
float paint_color_byte[3]
const ColorSpace * byte_colorspace
const TexPaintSlot * slot_last_clone
const float(* uv_map_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
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(* uv_map_stencil_eval)[2]
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 texture_paint_mode_opacity
const c_style_mat & ptr() const
blender::float3 average_stroke_accum
int average_stroke_counter
void use_property_decorate_set(bool is_sep)
uiLayout & column(bool align)
void use_property_split_set(bool value)
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, std::optional< std::string > message)
wmOperatorStatus WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *)