134#define PROJ_BUCKET_BRUSH_DIV 4
136#define PROJ_BUCKET_RECT_MIN 4
137#define PROJ_BUCKET_RECT_MAX 256
139#define PROJ_BOUNDBOX_DIV 8
140#define PROJ_BOUNDBOX_SQUARED (PROJ_BOUNDBOX_DIV * PROJ_BOUNDBOX_DIV)
145#define PROJ_DEBUG_WINCLIP 1
147#ifndef PROJ_DEBUG_NOSEAMBLEED
153# define PROJ_FACE_SEAM0 (1 << 0)
154# define PROJ_FACE_SEAM1 (1 << 1)
155# define PROJ_FACE_SEAM2 (1 << 2)
157# define PROJ_FACE_NOSEAM0 (1 << 4)
158# define PROJ_FACE_NOSEAM1 (1 << 5)
159# define PROJ_FACE_NOSEAM2 (1 << 6)
162# define PROJ_FACE_SEAM_INIT0 (1 << 8)
163# define PROJ_FACE_SEAM_INIT1 (1 << 9)
164# define PROJ_FACE_SEAM_INIT2 (1 << 10)
166# define PROJ_FACE_DEGENERATE (1 << 12)
169# define PROJ_FACE_WINDING_INIT 1
170# define PROJ_FACE_WINDING_CW 2
175# define PROJ_FACE_SCALE_SEAM 0.99f
178#define PROJ_SRC_VIEW 1
179#define PROJ_SRC_IMAGE_CAM 2
180#define PROJ_SRC_IMAGE_VIEW 3
181#define PROJ_SRC_VIEW_FILL 4
183#define PROJ_VIEW_DATA_ID "view_data"
185#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
187#define PROJ_BUCKET_NULL 0
188#define PROJ_BUCKET_INIT (1 << 0)
192#define PROJ_GEOM_TOLERANCE 0.00075f
193#define PROJ_PIXEL_TOLERANCE 0.01f
196#define PROJ_VERT_CULL 1
199#define TILE_PENDING POINTER_FROM_INT(-1)
361#ifndef PROJ_DEBUG_NOSEAMBLEED
401#define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src) \
402 MEMCPY_STRUCT_AFTER(ps_dst, ps_src, is_shared_user)
404#define PROJ_PAINT_STATE_SHARED_CLEAR(ps) MEMSET_STRUCT_AFTER(ps, 0, is_shared_user)
412#ifndef PROJ_DEBUG_NOSEAMBLEED
530#define PS_CORNER_TRI_AS_VERT_INDEX_3(ps, tri) \
531 ps->corner_verts_eval[tri[0]], ps->corner_verts_eval[tri[1]], ps->corner_verts_eval[tri[2]],
533#define PS_CORNER_TRI_AS_UV_3(uvlayer, face_i, tri) \
534 uvlayer[face_i][tri[0]], uvlayer[face_i][tri[1]], uvlayer[face_i][tri[2]],
536#define PS_CORNER_TRI_ASSIGN_UV_3(uv_tri, uvlayer, face_i, tri) \
538 (uv_tri)[0] = uvlayer[face_i][tri[0]]; \
539 (uv_tri)[1] = uvlayer[face_i][tri[1]]; \
540 (uv_tri)[2] = uvlayer[face_i][tri[2]]; \
557 return 1001 + 10 * ty + tx;
563 if (mat_nr >= 0 && mat_nr <= ps->ob->totcol) {
635 const float pt[2],
const float v1[3],
const float v2[3],
const float v3[3],
float w[3])
638 return (v1[2] *
w[0]) + (
v2[2] *
w[1]) + (v3[2] *
w[2]);
642 const float pt[2],
const float v1[4],
const float v2[4],
const float v3[4],
float w[3])
644 float wtot_inv, wtot;
654 w_tmp[0] =
w[0] * v1[3];
655 w_tmp[1] =
w[1] *
v2[3];
656 w_tmp[2] =
w[2] * v3[3];
658 wtot = w_tmp[0] + w_tmp[1] + w_tmp[2];
661 wtot_inv = 1.0f / wtot;
663 w_tmp[0] = w_tmp[0] * wtot_inv;
664 w_tmp[1] = w_tmp[1] * wtot_inv;
665 w_tmp[2] = w_tmp[2] * wtot_inv;
668 w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
672 return (v1[2] * w_tmp[0]) + (
v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
681 int best_tri_index = -1;
682 float z_depth_best =
FLT_MAX, z_depth;
685 if (bucket_index == -1) {
695 const float *vtri_ss[3] = {
709 if (z_depth < z_depth_best) {
710 best_tri_index = tri_index;
711 z_depth_best = z_depth;
718 return best_tri_index;
727 const float *tri_uv[3];
735 if (tri_index == -1) {
751 iuser.
tile = tile_number;
754 if (ibuf ==
nullptr) {
758 float x = uv[0] * ibuf->
x;
759 float y = uv[1] * ibuf->
y;
766 float4 col =
interp ? imbuf::interpolate_bilinear_wrap_fl(ibuf, x, y) :
767 imbuf::interpolate_nearest_wrap_fl(ibuf, x, y);
770 memcpy(rgba_fp, &
col,
sizeof(
col));
777 uchar4 col =
interp ? imbuf::interpolate_bilinear_wrap_byte(ibuf, x, y) :
778 imbuf::interpolate_nearest_wrap_byte(ibuf, x, y);
780 memcpy(rgba, &
col,
sizeof(
col));
806 if (v1[2] > pt[2] &&
v2[2] > pt[2] && v3[2] > pt[2]) {
817 if (v1[2] < pt[2] &&
v2[2] < pt[2] && v3[2] < pt[2]) {
840 const float v1_3d[3],
841 const float v2_3d[3],
842 const float v3_3d[3],
880 const float pixelScreenCo[4])
888 for (; bucketFace; bucketFace = bucketFace->
next) {
891 if (orig_face != tri_index) {
893 const float *vtri_ss[3] = {
901 const float *vtri_co[3] = {
913 if (isect_ret >= 1) {
926#define ISECT_TRUE_P1 2
927#define ISECT_TRUE_P2 3
928static int line_isect_y(
const float p1[2],
const float p2[2],
const float y_level,
float *x_isect)
933 if (y_level == p1[1]) {
938 if (y_level == p2[1]) {
944 y_diff =
fabsf(p1[1] - p2[1]);
946 if (y_diff < 0.000001f) {
947 *x_isect = (p1[0] + p2[0]) * 0.5f;
951 if (p1[1] > y_level && p2[1] < y_level) {
953 *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
956 if (p1[1] < y_level && p2[1] > y_level) {
958 *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
964static int line_isect_x(
const float p1[2],
const float p2[2],
const float x_level,
float *y_isect)
968 if (x_level == p1[0]) {
972 if (x_level == p2[0]) {
978 x_diff =
fabsf(p1[0] - p2[0]);
981 if (x_diff < 0.000001f) {
982 *y_isect = (p1[0] + p2[0]) * 0.5f;
986 if (p1[0] > x_level && p2[0] < x_level) {
988 *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
991 if (p1[0] < x_level && p2[0] > x_level) {
993 *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
1003#ifndef PROJ_DEBUG_NOSEAMBLEED
1004static bool cmp_uv(
const float vec2a[2],
const float vec2b[2])
1007 float xa =
fmodf(vec2a[0], 1.0f);
1008 float ya =
fmodf(vec2a[1], 1.0f);
1010 float xb =
fmodf(vec2b[0], 1.0f);
1011 float yb =
fmodf(vec2b[1], 1.0f);
1035#ifndef PROJ_DEBUG_NOSEAMBLEED
1042 float min_uv[2], max_uv[2];
1051 r_bounds_px->
xmin =
int(ibuf_x * min_uv[0]);
1052 r_bounds_px->
ymin =
int(ibuf_y * min_uv[1]);
1054 r_bounds_px->
xmax =
int(ibuf_x * max_uv[0]) + 1;
1055 r_bounds_px->
ymax =
int(ibuf_y * max_uv[1]) + 1;
1060 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1067 float (*uv)[2],
const int ibuf_x,
const int ibuf_y,
int tot,
rcti *r_bounds_px)
1070 float min_uv[2], max_uv[2];
1083 r_bounds_px->
xmin =
int(ibuf_x * min_uv[0]);
1084 r_bounds_px->
ymin =
int(ibuf_y * min_uv[1]);
1086 r_bounds_px->
xmax =
int(ibuf_x * max_uv[0]) + 1;
1087 r_bounds_px->
ymax =
int(ibuf_y * max_uv[1]) + 1;
1092 return (r_bounds_px->
xmin == r_bounds_px->
xmax || r_bounds_px->
ymin == r_bounds_px->
ymax) ?
1097#ifndef PROJ_DEBUG_NOSEAMBLEED
1105 float winding =
cross_tri_v2(tri_uv[0], tri_uv[1], tri_uv[2]);
1117 const int orig_face,
1118 const int orig_i1_fidx,
1119 const int orig_i2_fidx,
1125 const float *orig_tri_uv[3] = {
1132 int i1_fidx = -1, i2_fidx = -1;
1137 if (tri_index != orig_face) {
1151 if (i2_fidx != -1) {
1163 *other_face = tri_index;
1166 *orig_fidx = (i1_fidx < i2_fidx && (i2_fidx - i1_fidx == 1)) ? i1_fidx : i2_fidx;
1174 if ((orig_tpage == tpage) && (orig_tile ==
tile) &&
1175 cmp_uv(orig_tri_uv[orig_i1_fidx], tri_uv[i1_fidx]) &&
1176 cmp_uv(orig_tri_uv[orig_i2_fidx], tri_uv[i2_fidx]))
1208 while (seam->loop != loop_index) {
1218 if (seam->normal_cw) {
1220 if ((adjacent->
normal_cw != seam->normal_cw) &&
cmp_uv(adjacent->
uv, seam->uv)) {
1228 if ((adjacent->
normal_cw != seam->normal_cw) &&
cmp_uv(adjacent->
uv, seam->uv)) {
1244 const float PI_2 =
M_PI * 2.0f;
1246 float angle_rel, angle_no;
1248 if (seam->normal_cw) {
1249 angle[0] = adj->
angle;
1250 angle[1] = seam->angle;
1253 angle[0] = seam->angle;
1254 angle[1] = adj->
angle;
1257 angle_rel = angle[1] - angle[0];
1259 if (angle_rel < 0.0f) {
1265 angle_no = angle_rel + angle[0];
1267 if (angle_no >
M_PI) {
1271 r_no[0] =
cosf(angle_no);
1272 r_no[1] =
sinf(angle_no);
1281 float (*orig_uv)[2],
1294 ibuf_inv[0] = 1.0f /
float(ibuf_x);
1295 ibuf_inv[1] = 1.0f /
float(ibuf_y);
1297 for (fidx[0] = 0; fidx[0] < 3; fidx[0]++) {
1299 float(*seam_uvs)[2];
1306 loop_index = tri[fidx[0]];
1311 if (seam_uvs[0][0] !=
FLT_MAX) {
1315 fidx[1] = (fidx[0] == 2) ? 0 : fidx[0] + 1;
1320 for (
uint i = 0; i < 2; i++) {
1328 tri_ang = ang[i] -
M_PI_2;
1330 if (tri_ang > 0.0f) {
1338 len_fact =
cosf(tri_ang);
1339 len_fact =
UNLIKELY(len_fact < FLT_EPSILON) ?
FLT_MAX : (1.0f / len_fact);
1342 len_fact = std::min(len_fact, 10.0f);
1352 if ((ang[0] + ang[1]) <
M_PI) {
1357 orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1], isect_co);
1368 const int tri_index,
1376 const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
1381 vseam->
prev =
nullptr;
1382 vseam->
next =
nullptr;
1384 vseam->
tri = tri_index;
1385 vseam->
loop = tri[fidx[0]];
1387 sub_v2_v2v2(vec, tri_uv[fidx[1]], tri_uv[fidx[0]]);
1398 vseam[1] = vseam[0];
1403 for (
uint i = 0; i < 2; i++) {
1408 while (item && item->
angle < vseam[i].
angle) {
1424 const int tri_index,
1425 const uint vert_index,
1431 int other_face, other_fidx;
1433 int fidx[2] = {2, 0};
1449 if (
check_seam(ps, tri_index, fidx[0], fidx[1], &other_face, &other_fidx)) {
1453 if (other_face != -1) {
1466 if (other_face != -1) {
1476 }
while (fidx[0]--);
1479 char checked_verts = 0;
1486 for (
uint i = 0; i < 2; i++) {
1489 if ((checked_verts & (1 << fidx[i])) != 0) {
1501 checked_verts |= 1 << fidx[i];
1508 }
while (fidx[0]--);
1518 const float v1co[3],
1519 const float v2co[3],
1520 const float v3co[3],
1521 const float uv1co[2],
1522 const float uv2co[2],
1523 const float uv3co[2],
1524 float pixelScreenCo[4],
1534 const float v1co[4],
1535 const float v2co[4],
1536 const float v3co[4],
1537 const float uv1co[2],
1538 const float uv2co[2],
1539 const float uv3co[2],
1540 float pixelScreenCo[4],
1544 float wtot_inv, wtot;
1548 w_int[0] =
w[0] * v1co[3];
1549 w_int[1] =
w[1] * v2co[3];
1550 w_int[2] =
w[2] * v3co[3];
1552 wtot = w_int[0] + w_int[1] + w_int[2];
1555 wtot_inv = 1.0f / wtot;
1556 w_int[0] *= wtot_inv;
1557 w_int[1] *= wtot_inv;
1558 w_int[2] *= wtot_inv;
1562 w[0] =
w[1] =
w[2] = w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
1580 const float projmat_inv[4][4],
1581 const float view_pos[3],
1582 const float co_px[2],
1585 r_dir[0] = 2.0f * (co_px[0] / winx) - 1.0f;
1586 r_dir[1] = 2.0f * (co_px[1] / winy) - 1.0f;
1605 const float zero[3] = {0};
1606 float v1_proj[3], v2_proj[3];
1621 const float *tri_uv[3],
ImBuf *ibuf_other,
const float w[3],
uchar rgba_ub[4],
float rgba_f[4])
1628 float x = uv_other[0] * ibuf_other->
x - 0.5f;
1629 float y = uv_other[1] * ibuf_other->
y - 0.5f;
1632 float4 col = imbuf::interpolate_bilinear_wrap_fl(ibuf_other, x, y);
1634 memcpy(rgba_f, &
col,
sizeof(
col));
1637 uchar4 col = imbuf::interpolate_bilinear_wrap_byte(ibuf_other, x, y);
1638 memcpy(rgba_ub, &
col,
sizeof(
col));
1644 const int tri_index,
1668 mask = ((rgba_f[0] + rgba_f[1] + rgba_f[2]) * (1.0f / 3.0f)) * rgba_f[3];
1671 mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) * (1.0f / (255.0f * 3.0f))) *
1672 (rgba_ub[3] * (1.0f / 255.0f));
1679 mask = (1.0f -
mask);
1697 float ca1, ca2, ca3, ca_mask;
1702 ca_mask =
w[0] * ca1 +
w[1] * ca2 +
w[2] * ca3;
1704 CLAMP(ca_mask, 0.0f, 1.0f);
1713 float no[3], angle_cos;
1716 const float *no1, *no2, *no3;
1721 no[0] =
w[0] * no1[0] +
w[1] * no2[0] +
w[2] * no3[0];
1722 no[1] =
w[0] * no1[1] +
w[1] * no2[1] +
w[2] * no3[1];
1723 no[2] =
w[0] * no1[2] +
w[1] * no2[2] +
w[2] * no3[2];
1745 float viewDirPersp[3];
1746 const float *co1, *co2, *co3;
1752 viewDirPersp[0] = (ps->
viewPos[0] - (
w[0] * co1[0] +
w[1] * co2[0] +
w[2] * co3[0]));
1753 viewDirPersp[1] = (ps->
viewPos[1] - (
w[0] * co1[1] +
w[1] * co2[1] +
w[2] * co3[1]));
1754 viewDirPersp[2] = (ps->
viewPos[2] - (
w[0] * co1[2] +
w[1] * co2[2] +
w[2] * co3[2]));
1760 angle_cos =
dot_v3v3(viewDirPersp, no);
1765 angle_cos =
fabsf(angle_cos);
1768 if (angle_cos <= ps->normal_angle__cos) {
1772 if (angle_cos < ps->normal_angle_inner__cos) {
1796 bool generate_tile =
false;
1805 generate_tile =
true;
1812 if (generate_tile) {
1814 volatile void *undorect;
1864 const int tri_index,
1865 const float pixelScreenCo[4],
1866 const float world_spaceCo[3],
1871 int x_round, y_round;
1880 x_px =
mod_i(x_px, ibuf->
x);
1881 y_px =
mod_i(y_px, ibuf->
y);
1927 projPixel->
x_px = x_px;
1928 projPixel->
y_px = y_px;
1952 const float *other_tri_uv[3] = {
1960 other_tri_uv, ibuf_other,
w,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.f);
1980 other_tri_uv, ibuf_other,
w, ((
ProjPixelClone *)projPixel)->clonepx.ch,
nullptr);
2003 ps, co, ((
ProjPixelClone *)projPixel)->clonepx.f,
nullptr,
true))
2011 ps, co,
nullptr, ((
ProjPixelClone *)projPixel)->clonepx.ch,
true))
2020#ifdef PROJ_DEBUG_PAINT
2045 if (l1[1] < rect->
ymin || l1[1] > rect->
ymax) {
2049 if ((l1[0] < rect->
xmin && l2[0] < rect->
xmin) || (l1[0] > rect->
xmax && l2[0] > rect->
xmax)) {
2071 if (l1[0] < rect->
xmin || l1[0] > rect->
xmax) {
2076 if ((l1[1] < rect->
ymin && l2[1] < rect->
ymin) || (l1[1] > rect->
ymax && l2[1] > rect->
ymax)) {
2121 (isect <= cliprect->xmax))
2123 if (l1[1] < l2[1]) {
2125 l1_clip[1] = rect->
ymin;
2130 l2_clip[1] = rect->
ymin;
2140 (isect <= cliprect->xmax))
2142 if (l1[1] > l2[1]) {
2144 l1_clip[1] = rect->
ymax;
2149 l2_clip[1] = rect->
ymax;
2160 (isect <= cliprect->ymax))
2162 if (l1[0] < l2[0]) {
2163 l1_clip[0] = rect->
xmin;
2168 l2_clip[0] = rect->
xmin;
2179 (isect <= cliprect->ymax))
2181 if (l1[0] > l2[0]) {
2182 l1_clip[0] = rect->
xmax;
2187 l2_clip[0] = rect->
xmax;
2204#ifndef PROJ_DEBUG_NOSEAMBLEED
2206static void scale_tri(
float insetCos[3][3],
const float *origCos[3],
const float inset)
2209 cent[0] = (origCos[0][0] + origCos[1][0] + origCos[2][0]) * (1.0f / 3.0f);
2210 cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1]) * (1.0f / 3.0f);
2211 cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2]) * (1.0f / 3.0f);
2233 return x * x + y *
y;
2243 const float radius_squared,
2244 const rctf *bucket_bounds)
2258 if ((bucket_bounds->
xmin <= cent[0] && bucket_bounds->
xmax >= cent[0]) ||
2259 (bucket_bounds->
ymin <= cent[1] && bucket_bounds->
ymax >= cent[1]))
2265 if (cent[0] < bucket_bounds->
xmin) {
2267 if (cent[1] < bucket_bounds->
ymin) {
2274 if (cent[1] > bucket_bounds->
ymax) {
2281 else if (cent[0] > bucket_bounds->
xmax) {
2283 if (cent[1] < bucket_bounds->
ymin) {
2290 if (cent[1] > bucket_bounds->
ymax) {
2311 const float *v1coSS,
2312 const float *v2coSS,
2313 const float *v3coSS,
2317 float bucket_bounds_uv[4][2],
2324 uv[0] = bucket_bounds->
xmax;
2325 uv[1] = bucket_bounds->
ymin;
2330 uv[1] = bucket_bounds->
ymax;
2334 uv[0] = bucket_bounds->
xmin;
2340 uv[1] = bucket_bounds->
ymin;
2349 const float *v1coSS,
2350 const float *v2coSS,
2351 const float *v3coSS,
2355 float bucket_bounds_uv[4][2],
2362 uv[0] = bucket_bounds->
xmax;
2363 uv[1] = bucket_bounds->
ymin;
2368 uv[1] = bucket_bounds->
ymax;
2372 uv[0] = bucket_bounds->
xmin;
2378 uv[1] = bucket_bounds->
ymin;
2386static float angle_2d_clockwise(
const float p1[2],
const float p2[2],
const float p3[2])
2390 v1[0] = p1[0] - p2[0];
2391 v1[1] = p1[1] - p2[1];
2392 v2[0] = p3[0] - p2[0];
2393 v2[1] = p3[1] - p2[1];
2395 return -
atan2f(v1[0] *
v2[1] - v1[1] *
v2[0], v1[0] *
v2[0] + v1[1] *
v2[1]);
2400#define ISECT_2 (1 << 1)
2401#define ISECT_3 (1 << 2)
2402#define ISECT_4 (1 << 3)
2403#define ISECT_ALL3 ((1 << 3) - 1)
2404#define ISECT_ALL4 ((1 << 4) - 1)
2408 const float pt[2],
const float v1[2],
const float v2[2],
const float v3[2],
const float limit)
2420 return (((
float *)p1)[2] < ((
float *)p2)[2] ? 1 : -1);
2425 return (((
float *)p1)[2] < ((
float *)p2)[2] ? -1 : 1);
2438 float xlen = l2[0] - l1[0];
2439 float ylen = l2[1] - l1[1];
2443 if ((l1[0] - rect->
xmin) * (l2[0] - rect->
xmin) <= 0) {
2447 else if ((l1[0] - rect->
xmax) * (l2[0] - rect->
xmax) < 0) {
2454 if ((l1[1] - rect->
ymin) * (l2[1] - rect->
ymin) <= 0) {
2458 else if ((l1[1] - rect->
ymax) * (l2[1] - rect->
ymax) < 0) {
2468 tmp = (is_ortho) ? 1.0f : (l1[3] +
min * (l2[3] - l1[3]));
2470 uv[0] = (uv1[0] +
min / tmp * (uv2[0] - uv1[0]));
2471 uv[1] = (uv1[1] +
min / tmp * (uv2[1] - uv1[1]));
2477 const bool is_flip_object,
2478 const rctf *cliprect,
2479 const rctf *bucket_bounds,
2480 const float *v1coSS,
2481 const float *v2coSS,
2482 const float *v3coSS,
2486 float bucket_bounds_uv[8][2],
2490 int inside_bucket_flag = 0;
2491 int inside_face_flag = 0;
2493 bool collinear =
false;
2495 float bucket_bounds_ss[4][2];
2544 if (inside_bucket_flag &
ISECT_1) {
2552 bucket_bounds, v1coSS, v2coSS, uv1co, uv2co, bucket_bounds_uv[*tot], is_ortho))
2558 if (inside_bucket_flag &
ISECT_2) {
2566 bucket_bounds, v2coSS, v3coSS, uv2co, uv3co, bucket_bounds_uv[*tot], is_ortho))
2572 if (inside_bucket_flag &
ISECT_3) {
2580 bucket_bounds, v3coSS, v1coSS, uv3co, uv1co, bucket_bounds_uv[*tot], is_ortho))
2606 bucket_bounds_ss[0][0] = bucket_bounds->
xmax;
2607 bucket_bounds_ss[0][1] = bucket_bounds->
ymin;
2613 bucket_bounds_ss[1][0] = bucket_bounds->
xmax;
2614 bucket_bounds_ss[1][1] = bucket_bounds->
ymax;
2620 bucket_bounds_ss[2][0] = bucket_bounds->
xmin;
2621 bucket_bounds_ss[2][1] = bucket_bounds->
ymax;
2627 bucket_bounds_ss[3][0] = bucket_bounds->
xmin;
2628 bucket_bounds_ss[3][1] = bucket_bounds->
ymin;
2642 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2646 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2673 float isectVCosSS[8][3];
2674 float v1_clipSS[2], v2_clipSS[2];
2678 float cent[2] = {0.0f, 0.0f};
2684 if (inside_face_flag &
ISECT_1) {
2685 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]);
2688 if (inside_face_flag &
ISECT_2) {
2689 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]);
2692 if (inside_face_flag &
ISECT_3) {
2693 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]);
2696 if (inside_face_flag &
ISECT_4) {
2697 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]);
2701 if (inside_bucket_flag &
ISECT_1) {
2705 if (inside_bucket_flag &
ISECT_2) {
2709 if (inside_bucket_flag &
ISECT_3) {
2715 if (
line_clip_rect2f(cliprect, bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
2716 if ((inside_bucket_flag &
ISECT_1) == 0) {
2720 if ((inside_bucket_flag &
ISECT_2) == 0) {
2728 if (
line_clip_rect2f(cliprect, bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
2729 if ((inside_bucket_flag &
ISECT_2) == 0) {
2733 if ((inside_bucket_flag &
ISECT_3) == 0) {
2741 if (
line_clip_rect2f(cliprect, bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
2742 if ((inside_bucket_flag &
ISECT_3) == 0) {
2746 if ((inside_bucket_flag &
ISECT_1) == 0) {
2760 for (
int i = 0; i < (*tot); i++) {
2761 cent[0] += isectVCosSS[i][0];
2762 cent[1] += isectVCosSS[i][1];
2764 cent[0] = cent[0] /
float(*tot);
2765 cent[1] = cent[1] /
float(*tot);
2770 for (
int i = 0; i < (*tot); i++) {
2771 isectVCosSS[i][2] = angle_2d_clockwise(up, cent, isectVCosSS[i]);
2776 v1_clipSS[0] = cent[0];
2777 v1_clipSS[1] = cent[1] + 1.0f;
2779 for (
int i = 0; i < (*tot); i++) {
2780 v2_clipSS[0] = isectVCosSS[i][0] - cent[0];
2781 v2_clipSS[1] = isectVCosSS[i][1] - cent[1];
2782 isectVCosSS[i][2] =
atan2f(v1_clipSS[0] * v2_clipSS[1] - v1_clipSS[1] * v2_clipSS[0],
2783 v1_clipSS[0] * v2_clipSS[0] + v1_clipSS[1] * v2_clipSS[1]);
2790 qsort(isectVCosSS, *tot,
sizeof(
float[3]),
float_z_sort);
2794 while (doubles ==
true) {
2797 for (
int i = 0; i < (*tot); i++) {
2801 for (
int j = i; j < (*tot) - 1; j++) {
2802 isectVCosSS[j][0] = isectVCosSS[j + 1][0];
2803 isectVCosSS[j][1] = isectVCosSS[j + 1][1];
2820 for (
int i = 0; i < (*tot); i++) {
2826 for (
int i = 0; i < (*tot); i++) {
2833#ifdef PROJ_DEBUG_PRINT_CLIP
2838 float test_uv[4][2];
2842 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2846 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2848 printf(
"( [(%f,%f), (%f,%f), (%f,%f), (%f,%f)], ",
2858 printf(
" [(%f,%f), (%f,%f), (%f,%f)], ",
2867 for (
int i = 0; i < (*tot); i++) {
2868 printf(
"(%f, %f),", bucket_bounds_uv[i][0], bucket_bounds_uv[i][1]);
2932static bool IsectPoly2Df(
const float pt[2],
const float uv[][2],
const int tot)
2939 for (i = 1; i < tot; i++) {
2951 for (
int i = 1; i < tot; i++) {
2966 const int thread_index,
2967 const int bucket_index,
2968 const int tri_index,
2969 const int image_index,
2970 const rctf *clip_rect,
2971 const rctf *bucket_bounds,
3002 const float *v1coSS, *v2coSS, *v3coSS;
3005 const float *vCo[3];
3010 float *uv1co, *uv2co, *uv3co;
3011 float pixelScreenCo[4];
3019 float tri_uv_pxoffset[3][2];
3020 float xhalfpx, yhalfpx;
3021 const float ibuf_xf =
float(ibuf->
x), ibuf_yf =
float(ibuf->
y);
3024 int has_x_isect = 0, has_isect = 0;
3026 float uv_clip[8][2];
3028 const bool is_ortho = ps->
is_ortho;
3052 tri_uv_pxoffset[0][0] = tri_uv[0][0] - xhalfpx;
3053 tri_uv_pxoffset[0][1] = tri_uv[0][1] - yhalfpx;
3055 tri_uv_pxoffset[1][0] = tri_uv[1][0] - xhalfpx;
3056 tri_uv_pxoffset[1][1] = tri_uv[1][1] - yhalfpx;
3058 tri_uv_pxoffset[2][0] = tri_uv[2][0] - xhalfpx;
3059 tri_uv_pxoffset[2][1] = tri_uv[2][1] - yhalfpx;
3062 uv1co = tri_uv_pxoffset[0];
3063 uv2co = tri_uv_pxoffset[1];
3064 uv3co = tri_uv_pxoffset[2];
3088 if (uv_clip_tot > 6) {
3089 printf(
"this should never happen! %d\n", uv_clip_tot);
3095 project_paint_undo_tiles_init(
3101 for (y = bounds_px.
ymin; y < bounds_px.
ymax; y++) {
3104 uv[1] =
float(y) / ibuf_yf;
3107 for (x = bounds_px.
xmin; x < bounds_px.
xmax; x++) {
3110 uv[0] =
float(x) / ibuf_xf;
3114 if ((do_backfacecull ==
true &&
IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
3118 has_x_isect = has_isect = 1;
3122 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3126 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3131 if (do_clip || do_3d_mapping) {
3155 ps, arena, &tinf, x, y, mask, tri_index, pixelScreenCo, wco,
w),
3161 else if (has_x_isect) {
3171 if (has_x_isect == 0 && has_isect) {
3179#ifndef PROJ_DEBUG_NOSEAMBLEED
3198 printf(
"seams - %d %d %d %d\n",
3219 float insetCos[3][3];
3222 const float *vCoSS[3];
3226 float bucket_clip_edges[2][2];
3227 float edge_verts_inset_clip[2][3];
3232 float seam_subsection[4][2];
3236 float tri_puv[3][2];
3238 tri_puv[0][0] = tri_uv_pxoffset[0][0] * ibuf->
x;
3239 tri_puv[0][1] = tri_uv_pxoffset[0][1] * ibuf->
y;
3241 tri_puv[1][0] = tri_uv_pxoffset[1][0] * ibuf->
x;
3242 tri_puv[1][1] = tri_uv_pxoffset[1][1] * ibuf->
y;
3244 tri_puv[2][0] = tri_uv_pxoffset[2][0] * ibuf->
x;
3245 tri_puv[2][1] = tri_uv_pxoffset[2][1] * ibuf->
y;
3272 for (fidx1 = 0; fidx1 < 3; fidx1++) {
3274 fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
3276 if ((face_seam_flag & (1 << fidx1)) &&
3281 bucket_clip_edges[0],
3282 bucket_clip_edges[1]))
3296 ps, bucket_clip_edges[0], vCo[fidx1], vCo[fidx2]);
3298 ps, bucket_clip_edges[1], vCo[fidx1], vCo[fidx2]);
3302 seam_subsection[0], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac1);
3304 seam_subsection[1], tri_uv_pxoffset[fidx1], tri_uv_pxoffset[fidx2], fac2);
3306 interp_v2_v2v2(seam_subsection[2], seam_uvs[0], seam_uvs[1], fac2);
3307 interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1);
3311 interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
3312 interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
3318 for (y = bounds_px.
ymin; y < bounds_px.
ymax; y++) {
3321 uv[1] =
float(y) / ibuf_yf;
3324 for (x = bounds_px.
xmin; x < bounds_px.
xmax; x++) {
3329 uv[0] =
float(x) / ibuf_xf;
3357 float pixel_on_edge[4];
3362 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3366 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3372 pixel_on_edge, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
3375 pixel_on_edge[3] = 1.0f;
3378 pixel_on_edge[0] =
float(ps->
winx * 0.5f) +
3379 (ps->
winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
3380 pixel_on_edge[1] =
float(ps->
winy * 0.5f) +
3381 (ps->
winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
3383 pixel_on_edge[2] = pixel_on_edge[2] / pixel_on_edge[3];
3388 ps, bucketFaceNodes, tri_index, pixel_on_edge))
3392 if (do_clip || do_3d_mapping) {
3408 ps, arena, &tinf, x, y, mask, tri_index, pixelScreenCo, wco,
w),
3413 else if (has_x_isect) {
3423 if (has_x_isect == 0 && has_isect) {
3477 rctf *r_bucket_bounds)
3496 const int thread_index,
3497 const int bucket_index,
3498 const rctf *clip_rect,
3499 const rctf *bucket_bounds)
3502 int tri_index, image_index = 0;
3503 ImBuf *ibuf =
nullptr;
3504 Image *tpage_last =
nullptr, *tpage;
3505 ImBuf *tmpibuf =
nullptr;
3537 if (tpage_last != tpage || tile_last !=
tile) {
3542 for (image_index = 0; image_index < ps->
image_tot; image_index++) {
3545 ibuf = projIma->
ibuf;
3587 float p1[2], p2[2], p3[2], p4[2];
3588 const float *
v, *v1, *
v2, *v3;
3607 p1[0] = bucket_bounds.
xmin;
3608 p1[1] = bucket_bounds.
ymin;
3609 p2[0] = bucket_bounds.
xmin;
3610 p2[1] = bucket_bounds.
ymax;
3611 p3[0] = bucket_bounds.
xmax;
3612 p3[1] = bucket_bounds.
ymax;
3613 p4[0] = bucket_bounds.
xmax;
3614 p4[1] = bucket_bounds.
ymin;
3634 const int3 &corner_tri,
3635 const int tri_index)
3638 float min[2], max[2], *vCoSS;
3640 int bucketMin[2], bucketMax[2];
3641 int fidx, bucket_x, bucket_y;
3643 int has_x_isect = -1, has_isect = 0;
3657 for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
3659 for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
3661 int bucket_index = bucket_x + (bucket_y * ps->
buckets_x);
3667 has_x_isect = has_isect = 1;
3669 else if (has_x_isect) {
3677 if (has_x_isect == 0 && has_isect) {
3682#ifndef PROJ_DEBUG_NOSEAMBLEED
3695 float viewmat[4][4];
3696 float viewinv[4][4];
3704 if (symmetry_flag) {
3706 for (i = 0; i < 3; i++) {
3707 if ((symmetry_flag >> i) & 1) {
3747 memcpy(winmat,
array,
sizeof(winmat));
3748 array +=
sizeof(winmat) /
sizeof(
float);
3749 memcpy(viewmat,
array,
sizeof(viewmat));
3750 array +=
sizeof(viewmat) /
sizeof(
float);
3762 copy_m4_m4(viewinv, cam_ob_eval->object_to_world().ptr());
3808 float *projScreenCo;
3819 for (a = 0; a < ps->
totvert_eval; a++, projScreenCo += 4) {
3823 projScreenCo[0] =
float(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projScreenCo[0];
3824 projScreenCo[1] =
float(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projScreenCo[1];
3829 for (a = 0; a < ps->
totvert_eval; a++, projScreenCo += 4) {
3831 projScreenCo[3] = 1.0f;
3837 projScreenCo[0] =
float(ps->
winx * 0.5f) +
3838 (ps->
winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
3839 projScreenCo[1] =
float(ps->
winy * 0.5f) +
3840 (ps->
winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
3842 projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
3866#ifdef PROJ_DEBUG_WINCLIP
3891 int *counter = MEM_cnew_array<int>(ps->
totvert_eval,
"counter");
3892 float(*edges)[3] =
static_cast<float(*)[3]
>(
3894 ps->
cavities =
static_cast<float *
>(
3909 if (counter[a] > 0) {
3924#ifndef PROJ_DEBUG_NOSEAMBLEED
3950 if (reset_threads) {
3972 float viewDirPersp[3];
4008#ifndef PROJ_DEBUG_NOSEAMBLEED
4011 const int3 &corner_tri,
4012 const int tri_index)
4058 const int totmat = ob->
totcol + 1;
4064 for (
int i = 0; i < totmat - 1; i++) {
4104 const float(*mloopuv_clone_base)[2] =
nullptr;
4114 if (layer_num != -1) {
4115 mloopuv_clone_base =
static_cast<const float(*)[2]
>(
4119 if (mloopuv_clone_base ==
nullptr) {
4121 mloopuv_clone_base =
static_cast<const float(*)[2]
>(
4126 memset(layer_clone, 0,
sizeof(*layer_clone));
4134 const int tri_index)
4175 memset(face_lookup, 0,
sizeof(*face_lookup));
4219 const int3 &corner_tri,
4239#ifdef PROJ_DEBUG_WINCLIP
4278 entry = entry->
next, i++, projIma++)
4282 projIma->
ima = entry->
ima;
4283 projIma->
touch =
false;
4285 if (projIma->
ibuf ==
nullptr) {
4296 memset((
void *)projIma->
undoRect, 0, size);
4298 memset(projIma->
maskRect, 0, size);
4300 memset(projIma->
valid, 0, size);
4308 const float (*mloopuv_base)[2],
4309 const bool is_multi_view)
4314 Image *tpage_last =
nullptr, *tpage;
4317 int tile_last = -1,
tile;
4318 int image_index = -1, tri_index;
4326 bool is_face_paintable;
4327 bool skip_tri =
false;
4334 if (slot ==
nullptr) {
4335 mloopuv_base =
static_cast<const float(*)[2]
>(
4340 if (slot != slot_last) {
4345 mloopuv_base =
static_cast<const float(*)[2]
>(
4352 if (slot->
ima !=
nullptr &&
4381#ifndef PROJ_DEBUG_NOSEAMBLEED
4391 if (is_face_paintable && tpage) {
4395 if (is_multi_view ==
false) {
4400#ifdef PROJ_DEBUG_WINCLIP
4410 if (prev_poly != tri_faces[tri_index]) {
4413 prev_poly = tri_faces[tri_index];
4414 for (
const int corner : poly) {
4424 int poly_tri = poly.
size() - 3;
4425 tri_index += poly_tri;
4438 if (tpage_last != tpage || tile_last !=
tile) {
4441 e =
e->next, image_index++)
4443 if (
e->ima == tpage &&
e->iuser.tile ==
tile) {
4453 iuser.
framenr = tpage->lastframe;
4470 if (image_index != -1) {
4490 const bool is_multi_view,
4491 const char symmetry_flag)
4495 const float(*mloopuv_base)[2] =
nullptr;
4502 bool reset_threads =
false;
4528 if (layer_num != -1) {
4566 reset_threads =
true;
4578#ifndef PROJ_DEBUG_NOSEAMBLEED
4590 ps, arena, &face_lookup, &layer_clone, mloopuv_base, is_multi_view);
4604 (
float(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projCo[0] / projCo[3]);
4606 (
float(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projCo[1] / projCo[3]);
4657#ifndef PROJ_DEBUG_NOSEAMBLEED
4727 bool redraw =
false;
4730 if (projIma->
touch) {
4744 projIma->
touch =
false;
4755 float min_brush[2], max_brush[2];
4761 if (radius < 1.0f) {
4766 min_brush[0] = mval_f[0] - radius;
4767 min_brush[1] = mval_f[1] - radius;
4769 max_brush[0] = mval_f[0] + radius;
4770 max_brush[1] = mval_f[1] + radius;
4794 rctf *bucket_bounds,
4795 const float mval[2])
4804 const int bucket_y = bidx / ps->
buckets_x;
4805 const int bucket_x = bidx - (bucket_y * ps->
buckets_x);
4808 if (bucket_x >= ps->
bucketMin[0] && bucket_x < ps->bucketMax[0]) {
4815 *bucket_index = bidx;
4849 uchar clone_rgba[4];
4851 clone_rgba[0] = clone_pt[0];
4852 clone_rgba[1] = clone_pt[1];
4853 clone_rgba[2] = clone_pt[2];
4854 clone_rgba[3] =
uchar(clone_pt[3] * mask);
4871 const float *clone_pt = ((
ProjPixelClone *)projPixel)->clonepx.f;
4874 float clone_rgba[4];
4936 float accum_tot = 0.0f;
4944 for (yk = 0; yk < kernel->
side; yk++) {
4945 for (xk = 0; xk < kernel->
side; xk++) {
4947 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
4952 float weight = kernel->
wdata[xk + yk * kernel->
side];
4955 accum_tot += weight;
4960 if (
LIKELY(accum_tot != 0)) {
4961 mul_v4_fl(rgba, 1.0f /
float(accum_tot));
4996 float accum_tot = 0;
5005 for (yk = 0; yk < kernel->
side; yk++) {
5006 for (xk = 0; xk < kernel->
side; xk++) {
5008 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
5013 float weight = kernel->
wdata[xk + yk * kernel->
side];
5016 accum_tot += weight;
5021 if (
LIKELY(accum_tot != 0)) {
5024 mul_v4_fl(rgba, 1.0f /
float(accum_tot));
5027 float rgba_pixel[4];
5037 float alpha = rgba_pixel[3];
5038 rgba[3] = rgba_pixel[3] =
mask;
5060 const float texrgb[3],
5078 if (dither > 0.0f) {
5098 const float texrgb[3],
5125 rgba_ub[0] = rgba_ub[1] = rgba_ub[2] = ps->
stencil_value * 255.0f;
5159 &rect_to_add, projPixel->
x_px, projPixel->
x_px + 1, projPixel->
y_px, projPixel->
y_px + 1);
5169 float rgb_straight[4];
5171 rgb_straight[3] = pixel->origColor.f_pt[3];
5175 pixel->pixel.ch_pt[3] = pixel->origColor.ch_pt[3];
5187 const int thread_index = ((
ProjectHandle *)ph_v)->thread_index;
5195 int last_index = -1;
5199 float dist_sq, dist;
5203 bool is_floatbuf =
false;
5208 float pos_ofs[2] = {0};
5214 const float brush_radius_sq = brush_radius * brush_radius;
5226 LinkNode *softenPixels_f =
nullptr;
5231 pos_ofs[0] =
pos[0] - lastpos[0];
5232 pos_ofs[1] =
pos[1] - lastpos[1];
5247 rctf clip_rect = bucket_bounds;
5260 for (node = ps->
bucketRect[bucket_index];
node; node = node->next) {
5266 last_projIma = projImages + last_index;
5268 last_projIma->
touch =
true;
5278 float line_len_sq_inv, line_len;
5281 const float p[2] = {
5282 projPixel->
projCoSS[0] - lastpos[0],
5283 projPixel->
projCoSS[1] - lastpos[1],
5288 line_len_sq_inv = 1.0f / line_len;
5289 line_len =
sqrtf(line_len);
5293 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
5298 f =
len_v2(p) / line_len;
5303 color_f[3] *=
float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5332 float newColor_f[4];
5333 newColor_f[3] =
float(projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5342 float mask =
float(projPixel->
mask) * (1.0f / 65535.0f);
5343 projPixel->
newColor.
ch[3] = mask * 255 * brush_alpha;
5369 float mask =
float(projPixel->
mask) * (1.0f / 65535.0f);
5384 float mask =
float(projPixel->
mask) * (1.0f / 65535.0f);
5397 for (node = ps->
bucketRect[bucket_index];
node; node = node->next) {
5404 if (dist_sq <= brush_radius_sq) {
5405 dist =
sqrtf(dist_sq);
5409 if (falloff > 0.0f) {
5414 float custom_mask =
float(projPixel->
mask) * (1.0f / 65535.0f);
5420 CLAMP(texmask, 0.0f, 1.0f);
5421 custom_mask *= texmask;
5437 samplecos[2] = 0.0f;
5443 ps->
scene, brush, mtex, samplecos, texrgba, thread_index, pool);
5446 custom_mask *= texrgba[3];
5460 float max_mask = brush_alpha * custom_mask * falloff * 65535.0f;
5463 mask = mask_accum + max_mask;
5466 mask = mask_accum + (max_mask - mask_accum * falloff);
5469 mask =
min_ff(mask, 65535.0f);
5470 mask_short =
ushort(mask);
5474 mask = mask_short * (1.0f / 65535.0f);
5482 mask = brush_alpha * custom_mask * falloff;
5490 last_projIma = projImages + last_index;
5492 last_projIma->
touch =
true;
5498 *projPixel->
valid =
true;
5504 switch (brush_type) {
5545 ps, projPixel, texrgb, mask, ps->
dither, projPixel->
x_px, projPixel->
y_px);
5564 for (node = smearPixels;
node; node = node->
next) {
5565 projPixel =
static_cast<ProjPixel *
>(node->link);
5572 for (node = smearPixels_f;
node; node = node->
next) {
5573 projPixel =
static_cast<ProjPixel *
>(node->link);
5584 for (node = softenPixels;
node; node = node->
next) {
5585 projPixel =
static_cast<ProjPixel *
>(node->link);
5592 for (node = softenPixels_f;
node; node = node->
next) {
5593 projPixel =
static_cast<ProjPixel *
>(node->link);
5608 bool touch_any =
false;
5629 bool float_dest =
false;
5630 bool uchar_dest =
false;
5663 handles[a].thread_index = a;
5675 memcpy(handles[a].projImages[i].partRedrawRect,
5680 handles[a].pool = image_pool;
5702 handles[a].projImages[i].partRedrawRect,
5719 if (tri_index != -1) {
5743 const float prev_pos[2],
5794 const float prev_pos[2],
5810 float *cursor = scene->cursor.location;
5894 ps->
cavity_curve = settings->imapaint.paint.cavity_curve;
5917#ifndef PROJ_DEBUG_NOSEAMBLEED
5943 ps->
dither = settings->imapaint.dither;
5951 char symmetry_flag_views[BOUNDED_ARRAY_TYPE_SIZE<
decltype(ps_handle->
ps_views)>()] = {0};
5953 ps_handle = MEM_cnew<ProjStrokeHandle>(
"ProjStrokeHandle");
5974 ProjPaintState *ps = MEM_new<ProjPaintState>(
"ProjectionPaintState");
5989 BLI_assert(index <= ps_handle->ps_views_tot);
6001 if (ps->
ob ==
nullptr) {
6041 MEM_delete(ps_handle->
ps_views[i]);
6092 MEM_delete(ps_handle);
6103 int orig_brush_size;
6123 if (image ==
nullptr) {
6144 if (view_data !=
nullptr &&
6159 if (scene.camera ==
nullptr) {
6189 const float pos[2] = {0.0, 0.0};
6190 const float lastpos[2] = {0.0, 0.0};
6206 scene.toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
6217 ot->
name =
"Project Image";
6218 ot->
idname =
"PAINT_OT_project_image";
6219 ot->
description =
"Project an edited render from the active camera back onto the object";
6259 int h = settings->imapaint.screen_grab_size[1];
6261 char err_out[256] =
"unknown";
6289 View3D *v3d =
static_cast<View3D *
>(area->spacedata.first);
6290 View3D v3d_copy = blender::dna::shallow_copy(*v3d);
6340 depsgraph, v3d, rv3d,
true, &clip_start, &clip_end);
6355 ot->
name =
"Image from View";
6356 ot->
idname =
"PAINT_OT_image_from_view";
6357 ot->
description =
"Make an image from biggest 3D view for reprojection";
6367 ot->
srna,
"filepath",
nullptr,
FILE_MAX,
"File Path",
"Name of the file");
6375 ReportList *reports,
bool has_uvs,
bool has_mat,
bool has_tex,
bool has_stencil)
6379 "Missing%s%s%s%s detected!",
6380 !has_uvs ?
RPT_(
" UVs,") :
"",
6381 !has_mat ?
RPT_(
" Materials,") :
"",
6382 !has_tex ?
RPT_(
" Textures (or linked),") :
"",
6383 !has_stencil ?
RPT_(
" Stencil,") :
"");
6391 bool *r_has_stencil)
6395 bool has_mat =
true;
6396 bool has_tex =
true;
6397 bool has_stencil =
true;
6398 bool has_uvs =
true;
6415 for (
int i = 1; i < ob.
totcol + 1; i++) {
6445 if (layernum == 0) {
6453 if (imapaint.
stencil ==
nullptr) {
6454 has_stencil =
false;
6472 *r_has_uvs = has_uvs;
6475 *r_has_mat = has_mat;
6478 *r_has_tex = has_tex;
6480 if (r_has_stencil) {
6481 *r_has_stencil = has_stencil;
6484 return has_uvs && has_mat && has_tex && has_stencil;
6506 {0,
nullptr, 0,
nullptr,
nullptr},
6523 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6524 char imagename[
MAX_ID_NAME - 2] =
"Material Diffuse Color";
6527 bool use_float =
false;
6564 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6583 if (!mesh->default_color_attribute) {
6587 ed::sculpt_paint::object_active_color_fill(ob, color,
false);
6601 switch (layer_type) {
6607 bNode *in_node =
nullptr;
6609 ma->
nodetree->ensure_topology_cache();
6611 "ShaderNodeBsdfPrincipled");
6612 in_node = nodes.is_empty() ? nullptr : nodes.first();
6623 switch (in_sock->
type) {
6668 Image *ima =
nullptr;
6698 switch (slot_type) {
6702 new_node->
id = &ima->
id;
6719 ntree->ensure_topology_cache();
6722 bNode *out_node = new_node;
6724 if (in_node !=
nullptr) {
6741 out_node = nor_node;
6753 out_node = bump_node;
6758 "ShaderNodeOutputMaterial");
6759 in_node = output_nodes.
is_empty() ? nullptr : output_nodes.
first();
6761 if (in_node !=
nullptr) {
6771 if (in_sock !=
nullptr && link ==
nullptr) {
6828 const char *base_name = ma ? &ma->
id.
name[2] : &ob->
id.
name[2];
6871 switch (slot_type) {
6894#define IMA_DEF_NAME N_("Untitled")
6900 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6905 {0,
nullptr, 0,
nullptr,
nullptr},
6909 ot->
name =
"Add Paint Slot";
6911 ot->
idname =
"PAINT_OT_add_texture_paint_slot";
6927 "Material Layer Type",
6928 "Material layer type of new paint slot");
6932 ot->
srna,
"slot_type", slot_type_items, 0,
"Slot Type",
"Type of new paint slot");
6939 ot->
srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
6944 prop =
RNA_def_int(
ot->
srna,
"width", 1024, 1, INT_MAX,
"Width",
"Image width", 1, 16384);
6947 prop =
RNA_def_int(
ot->
srna,
"height", 1024, 1, INT_MAX,
"Height",
"Image height", 1, 16384);
6957 "Fill the image with a grid for UV map testing");
6963 "Create image with 32-bit floating-point bit depth");
6969 int(bke::AttrDomain::Point),
6971 "Type of element that attribute is stored on");
6978 "Type of data stored in attribute");
7011 ot->
name =
"Add Simple UVs";
7013 ot->
idname =
"PAINT_OT_add_simple_uvs";
void BKE_id_attributes_default_color_set(struct ID *id, const char *name)
void BKE_id_attributes_active_color_set(struct ID *id, const char *name)
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, const char *name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
int BKE_brush_size_get(const Scene *scene, const Brush *brush)
const MTex * BKE_brush_color_texture_get(const Brush *brush, const eObjectMode object_mode)
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)
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, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * IDP_GetPropertyTypeFromGroup(const IDProperty *prop, const char *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)
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)
ImagePool * BKE_image_pool_new(void)
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)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma, const struct Object *ob)
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
struct Material * BKE_material_add(struct Main *bmain, const char *name)
@ BKE_MAT_ASSIGN_USERPREF
Mesh * BKE_mesh_from_object(Object *ob)
#define BKE_MESH_TESSTRI_VINDEX_ORDER(_tri, _v)
#define SH_NODE_TEX_IMAGE
#define SH_NODE_NORMAL_MAP
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
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
#define LISTBASE_CIRCULAR_BACKWARD_END(type, lb, lb_iter, lb_init)
#define LISTBASE_CIRCULAR_FORWARD_BEGIN(type, lb, lb_iter, lb_init)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_BEGIN(type, lb, lb_iter, lb_init)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_FORWARD_END(type, lb, lb_iter, lb_init)
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, float s, float t)
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])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
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])
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
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)
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)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
#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
#define IMAGEPAINT_MODE_MATERIAL
@ IMAGEPAINT_PROJECT_LAYER_STENCIL_INV
@ IMAGEPAINT_PROJECT_BACKFACE
@ IMAGEPAINT_PROJECT_XRAY
@ IMAGEPAINT_PROJECT_LAYER_STENCIL
@ IMAGEPAINT_PROJECT_LAYER_CLONE
@ IMAGEPAINT_PROJECT_FLAT
@ 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_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *ntree)
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)
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_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, ViewDepths **r_depths)
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
void view3d_operator_needs_opengl(const bContext *C)
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)
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()
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
void imb_freerectImBuf(ImBuf *ibuf)
void imb_freerectfloatImBuf(ImBuf *ibuf)
void IMB_rect_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_blend_color_float(float dst[4], const float src1[4], const float src2[4], IMB_BlendMode mode)
void IMB_float_from_rect(ImBuf *ibuf)
Read Guarded memory(de)allocation.
#define MEM_SIZE_OPTIMAL(size)
struct blender::bke::bNodeTreeType * ntreeType_Shader
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
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)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
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
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 const T & first() const
constexpr int64_t size() const
constexpr bool is_empty() const
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
const Depsgraph * depsgraph
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void IMB_freeImBuf(ImBuf *)
ccl_global const KernelWorkTile * tile
void *(* MEM_mallocN)(size_t len, const char *str)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
#define unit_float_to_uchar_clamp(val)
#define unit_float_to_uchar_clamp_v3(v1, v2)
ccl_device_inline float2 interp(const float2 a, const float2 b, float t)
ccl_device_inline float4 mask(const int4 mask, const float4 a)
void node_set_active(bNodeTree *ntree, bNode *node)
bNode * node_add_static_node(const bContext *C, bNodeTree *ntree, int type)
void node_position_relative(bNode *from_node, const bNode *to_node, const bNodeSocket *from_sock, const bNodeSocket *to_sock)
bNodeLink * node_add_link(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
bNodeTree * node_tree_add_tree(Main *bmain, const char *name, const char *idname)
void node_position_propagate(bNode *node)
void node_tree_free_tree(bNodeTree *ntree)
bNodeSocket * node_find_socket(bNode *node, eNodeSocketInOut in_out, StringRef identifier)
Object * context_active_object(const bContext *C)
uchar4 interpolate_cubic_bspline_byte(const ImBuf *in, float u, float v)
float4 interpolate_cubic_bspline_fl(const ImBuf *in, float u, float v)
T clamp(const T &a, const T &min, const T &max)
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)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
bool paint_use_opacity_masking(Brush *brush)
void paint_brush_color_get(Scene *scene, const Paint *paint, Brush *br, bool color_correction, bool invert, float distance, float pressure, 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 int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *)
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 int add_simple_uvs_exec(bContext *C, wmOperator *)
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 int texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op)
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 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 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 int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
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[]
#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 int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
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)
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 do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, const float texrgb[3], float mask, float dither, float u, float v)
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 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 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
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
short screen_grab_size[2]
struct bNodeTree * nodetree
struct TexPaintSlot * texpaintslot
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
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
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* ui)(bContext *C, wmOperator *op)
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)
int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *)
int 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)