58 const bool use_select,
131 ob->
runtime.
bb = MEM_cnew<BoundBox>(
"GPencil boundbox");
166 if (!
ELEM(ob_orig,
nullptr, ob)) {
168 ob_orig->
runtime.
bb = MEM_cnew<BoundBox>(
"GPencil boundbox");
170 for (
int i = 0; i < 8; i++) {
185 const int index_next_pt,
186 const float *current,
199 float remaining_till_next = 0.0f;
200 float remaining_march = dist;
203 int next_point_index = index_next_pt;
206 if (next_point_index == gps->
totpoints) {
207 next_point_index = 0;
211 pt = &gps->
points[next_point_index];
215 while (remaining_till_next < remaining_march && next_point_index) {
216 remaining_march -= remaining_till_next;
217 pt = &gps->
points[next_point_index];
219 pt = &gps->
points[next_point_index];
223 memcpy(vert_color, gps->
points[next_point_index].
vert_color,
sizeof(
float[4]));
225 *index_from = next_point_index == 0 ? (gps->
totpoints - 1) : (next_point_index - 1);
226 *index_to = next_point_index;
227 *ratio_result = 1.0f;
229 return next_point_index == 0 ? gps->
totpoints : next_point_index;
234 if (!(next_point_index < gps->totpoints)) {
236 next_point_index = 0;
240 remaining_till_next = 0;
244 pt = &gps->
points[next_point_index];
248 if (remaining_till_next < remaining_march) {
249 pt = &gps->
points[next_point_index];
253 memcpy(vert_color, gps->
points[next_point_index].
vert_color,
sizeof(
float[4]));
255 *index_from = next_point_index == 0 ? (gps->
totpoints - 1) : (next_point_index - 1);
256 *index_to = next_point_index;
257 *ratio_result = 1.0f;
262 *index_from = next_point_index == 0 ? (gps->
totpoints - 1) : (next_point_index - 1);
263 *index_to = next_point_index;
265 float ratio = remaining_march / remaining_till_next;
267 *ratio_result = ratio;
270 float vratio = d1 / (d1 + d2);
285 return next_point_index == 0 ? gps->
totpoints : next_point_index;
289 const int index_next_pt,
290 const float *current,
292 const float sharp_threshold,
295 float remaining_till_next = 0.0f;
296 float remaining_march = dist;
299 int next_point_index = index_next_pt;
302 if (next_point_index == gps->
totpoints) {
303 next_point_index = 0;
307 pt = &gps->
points[next_point_index];
311 while (remaining_till_next < remaining_march && next_point_index) {
312 remaining_march -= remaining_till_next;
313 pt = &gps->
points[next_point_index];
314 if (next_point_index < gps->totpoints - 1 &&
316 &gps->
points[next_point_index].
x,
317 &gps->
points[next_point_index + 1].
x) < sharp_threshold) {
321 return next_point_index == 0 ? gps->
totpoints : next_point_index;
326 if (!(next_point_index < gps->totpoints)) {
328 next_point_index = 0;
332 remaining_till_next = 0;
336 pt = &gps->
points[next_point_index];
340 if (remaining_till_next < remaining_march) {
341 pt = &gps->
points[next_point_index];
347 float ratio = remaining_march / remaining_till_next;
349 return next_point_index == 0 ? gps->
totpoints : next_point_index;
356 int next_point_index = 1;
364 for (
int i = 0; i < gps->
totpoints; i++) {
369 gps, next_point_index,
point, dist, sharp_threshold,
point)) > -1) {
371 if (next_point_index == 0) {
388 for (i = 0; i <
count; i++) {
402 ld = MEM_cnew<LinkData>(
"def_nr_item");
419 for (i = 0; i <
count; i++) {
440 for (
int i = 0; i < vert->
totweight; i++) {
451 const float sharp_threshold)
459 if (gps->
totpoints < 2 || dist < FLT_EPSILON) {
470 "gp_stroke_points_sampled");
473 int result_totweight;
475 if (gps->
dvert !=
nullptr) {
480 int next_point_index = 1;
482 float pressure, strength, ratio_result;
483 float uv_fac, uv_rot, uv_fill[2];
485 int index_from, index_to;
501 copy_v4_v4(new_pt[i].vert_color, pt[0].vert_color);
526 if (
is_cyclic && next_point_index == 0) {
533 new_pt[i].
uv_fac = uv_fac;
534 new_pt[i].
uv_rot = uv_rot;
537 memcpy(new_pt[i].vert_color, vert_color,
sizeof(
float[4]));
547 if (next_point_index == 0) {
583 const int count_before,
584 const int count_after)
590 if (!count_before && !count_after) {
594 const int new_count = count_before + count_after + gps->
totpoints;
598 for (
int i = 0; i < count_before; i++) {
599 new_pts[i] = blender::dna::shallow_copy(pts[0]);
601 memcpy(
static_cast<void *
>(&new_pts[count_before]), pts,
sizeof(
bGPDspoint) * gps->
totpoints);
602 for (
int i = new_count - count_after; i < new_count; i++) {
603 new_pts[i] = blender::dna::shallow_copy(pts[gps->
totpoints - 1]);
609 for (
int i = 0; i < new_count; i++) {
632 const float overshoot_fac,
634 const bool follow_curvature,
635 const int extra_point_count,
636 const float segment_influence,
637 const float max_angle,
638 const bool invert_curvature)
646 float used_percent_length = overshoot_fac;
647 CLAMP(used_percent_length, 1e-4f, 1.0f);
648 if (!
isfinite(used_percent_length)) {
652 used_percent_length = 0.1f;
655 if (gps->
totpoints <= 1 || dist < FLT_EPSILON || extra_point_count <= 0) {
660 if (!follow_curvature || gps->
totpoints <= 2) {
663 float overshoot_point_param = used_percent_length * (gps->
totpoints - 1);
667 int index1 =
floor(overshoot_point_param);
668 int index2 =
ceil(overshoot_point_param);
672 fmodf(overshoot_point_param, 1.0f));
682 int index2 = gps->
totpoints - 1 -
ceil(overshoot_point_param);
686 fmodf(overshoot_point_param, 1.0f));
700 const int first_old_index = do_start ? extra_point_count : 0;
701 const int last_old_index = gps->
totpoints - 1 + first_old_index;
702 const int orig_totpoints = gps->
totpoints;
707 const float overshoot_parameter = used_percent_length * (orig_totpoints - 2);
708 int overshoot_pointcount =
ceil(overshoot_parameter);
709 CLAMP(overshoot_pointcount, 1, orig_totpoints - 2);
712 float no[3], vec1[3], vec2[3], total_angle[3];
713 for (
int k = 0; k < 2; k++) {
714 if ((k == 0 && !do_start) || (k == 1 && !do_end)) {
718 const int start_i = k == 0 ? first_old_index :
720 const int dir_i = 1 - k * 2;
725 float overshoot_length = 0.0f;
729 for (
int i = start_i; j < overshoot_pointcount; i += dir_i, j++) {
731 float fac = fmin(overshoot_parameter - j, 1.0f);
740 const float added_len = (segment_length +
len) * 0.5f * fac;
741 overshoot_length += added_len;
742 segment_length =
len;
744 if (
angle > max_angle) {
751 angle *=
powf(added_len, segment_influence);
758 if (
UNLIKELY(overshoot_length == 0.0f)) {
767 float curvature =
normalize_v3(total_angle) / overshoot_length;
769 curvature /=
powf(overshoot_length /
fminf(overshoot_parameter, (
float)j), segment_influence);
770 if (invert_curvature) {
771 curvature = -curvature;
773 const float angle_step = curvature * dist / extra_point_count;
774 float step_length = dist / extra_point_count;
775 if (
fabsf(angle_step) > FLT_EPSILON) {
777 step_length *=
sin(angle_step * 0.5f) / (angle_step * 0.5f);
793 fmaxf(0.0f, 1.0f -
fabs(segment_influence)) *
794 (curvature * prev_length - angle_step) / 2.0f);
798 for (
int i = start_i - dir_i, j = 0; j < extra_point_count; i -= dir_i, j++) {
817 const int new_count = index_to - index_from + 1;
823 if (new_count == 1) {
830 gps->
dvert =
nullptr;
836 memcpy(
static_cast<void *
>(new_pt), &pt[index_from],
sizeof(
bGPDspoint) * new_count);
840 "gp_stroke_dverts_trimmed");
841 for (
int i = 0; i < new_count; i++) {
842 dv = &gps->
dvert[i + index_from];
846 "gp_stroke_dverts_dw_trimmed");
847 for (
int j = 0; j < dv->
totweight; j++) {
873 const int before_index,
880 if (before_index >= gps->
totpoints || before_index == 0) {
884 const int new_count = gps->
totpoints - before_index;
885 const int old_count = before_index;
893 memcpy(
static_cast<void *
>(new_pt), &pt[before_index],
sizeof(
bGPDspoint) * new_count);
897 "gp_stroke_dverts_remaining(MDeformVert)");
898 for (
int i = 0; i < new_count; i++) {
899 dv = &gps->
dvert[i + before_index];
903 "gp_stroke_dverts_dw_remaining(MDeformWeight)");
904 for (
int j = 0; j < dv->
totweight; j++) {
909 new_gps->
dvert = new_dv;
912 (*remaining_gps) = new_gps;
938 second_last = &pt[1];
939 if (
len_v3v3(&second_last->x, &pt->
x) < dist) {
951 float len1, cut_len1;
952 float len2, cut_len2;
953 len1 = len2 = cut_len1 = cut_len2 = 0.0f;
960 while (len1 < dist && gps->totpoints > i + 1) {
963 cut_len1 = len1 - dist;
973 while (len2 < dist && gps->totpoints >= i) {
977 cut_len2 = len2 - dist;
984 if (index_end <= index_start) {
985 index_start = index_end = 0;
988 if ((index_end == index_start + 1) && (cut_len1 + cut_len2 < 0)) {
989 index_start = index_end = 0;
1011 const bool smooth_caps,
1012 const bool keep_shape,
1016 if (gps->
totpoints <= 2 || iterations <= 0) {
1061 float sco[3] = {0.0f, 0.0f, 0.0f};
1063 const int n_half = keep_shape ? (iterations * iterations) / 8 + iterations :
1064 (iterations * iterations) / 4 + 2 * iterations + 12;
1065 double w = keep_shape ? 2.0 : 1.0;
1066 double w2 = keep_shape ?
1067 (1.0 /
M_SQRT3) *
exp((2 * iterations * iterations) / (
double)(n_half * 3)) :
1069 double total_w = 0.0;
1070 for (
int step = iterations; step > 0; step--) {
1073 float w_before = (
float)(
w - w2);
1074 float w_after = (
float)(
w - w2);
1101 total_w += w_before;
1104 w *= (n_half + step) / (
double)(n_half + 1 - step);
1105 w2 *= (n_half * 3 + step) / (
double)(n_half * 3 + 1 - step);
1131 if (gps->
totpoints <= 2 || iterations <= 0) {
1139 float strength = 0.0f;
1140 const int n_half = (iterations * iterations) / 4 + iterations;
1142 double total_w = 0.0;
1143 for (
int step = iterations; step > 0; step--) {
1146 float w_before = (
float)
w;
1147 float w_after = (
float)
w;
1162 total_w += w_before;
1165 w *= (n_half + step) / (
double)(n_half + 1 - step);
1171 strength /= total_w;
1189 if (gps->
totpoints <= 2 || iterations <= 0) {
1197 float pressure = 0.0f;
1198 const int n_half = (iterations * iterations) / 4 + iterations;
1200 double total_w = 0.0;
1201 for (
int step = iterations; step > 0; step--) {
1204 float w_before = (
float)
w;
1205 float w_after = (
float)
w;
1220 total_w += w_before;
1223 w *= (n_half + step) / (
double)(n_half + 1 - step);
1229 pressure /= total_w;
1250 if (gps->
totpoints <= 2 || iterations <= 0) {
1266 float uv_rot = 0.0f;
1267 float uv_fac = 0.0f;
1268 const int n_half = iterations * iterations + iterations;
1270 double total_w = 0.0;
1271 for (
int step = iterations; step > 0; step--) {
1274 float w_before = (
float)
w;
1275 float w_after = (
float)
w;
1298 total_w += w_before;
1301 w *= (n_half + step) / (
double)(n_half + 1 - step);
1318 const float influence,
1319 const int iterations,
1320 const bool smooth_position,
1321 const bool smooth_strength,
1322 const bool smooth_thickness,
1323 const bool smooth_uv,
1324 const bool keep_shape,
1325 const float *weights)
1327 if (influence <= 0 || iterations <= 0) {
1332 bGPDstroke gps_old = blender::dna::shallow_copy(*gps);
1336 for (
int i = 0; i < gps->
totpoints; i++) {
1337 float val = influence;
1338 if (weights !=
nullptr) {
1349 if (smooth_position) {
1352 if (smooth_strength) {
1355 if (smooth_thickness) {
1369 float (*points2d)[2],
1376 const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
1388 if (totpoints == 2) {
1408 const bGPDspoint *pt_last = &points[totpoints - 1];
1412 points2d[totpoints - 1][0] =
dot_v3v3(tmp, locx);
1413 points2d[totpoints - 1][1] =
dot_v3v3(tmp, locy);
1418 float *co_prev = (
float *)&points2d[totpoints - 1];
1421 for (
int i = 0; i < totpoints - 1; i++) {
1428 points2d[i][0] =
dot_v3v3(loc, locx);
1429 points2d[i][1] =
dot_v3v3(loc, locy);
1432 co_curr = (
float *)&points2d[i][0];
1433 cross += (co_curr[0] - co_prev[0]) * (co_curr[1] + co_prev[1]);
1434 co_prev = (
float *)&points2d[i][0];
1438 *r_direction = (
cross >= 0.0f) ? 1 : -1;
1445 float (*points2d)[2],
1453 const bGPDspoint *pt3 = &ref_points[(int)(ref_totpoints * 0.75)];
1465 if (totpoints == 2) {
1485 for (
int i = 0; i < totpoints; i++) {
1489 float vn[3] = {0.0f, 0.0f, 0.0f};
1503 else if (i == totpoints - 1) {
1517 points2d[i][0] =
dot_v3v3(loc, locx);
1518 points2d[i][1] =
dot_v3v3(loc, locy);
1522 *r_direction = (int)locy[2];
1528 const float minv[2],
1529 const float maxv[2],
1536 float center[2] = {0.5f, 0.5f};
1538 d[0] = maxv[0] - minv[0];
1539 d[1] = maxv[1] - minv[1];
1540 for (
int i = 0; i < gps->
totpoints; i++) {
1541 r_uv[i][0] = (points2d[i][0] - minv[0]) / d[0];
1542 r_uv[i][1] = (points2d[i][1] - minv[1]) / d[1];
1551 float x = r_uv[i][0] *
c - r_uv[i][1] * s;
1552 float y = r_uv[i][0] * s + r_uv[i][1] *
c;
1577 "GP Stroke temp triangulation");
1579 "GP Stroke temp 2d points");
1581 "GP Stroke temp 2d uv data");
1603 "GP Stroke triangulation");
1610 for (
int i = 0; i < gps->
totpoints; i++) {
1631 if (gps ==
nullptr || gps->
totpoints == 0) {
1636 float totlen = 0.0f;
1638 for (
int i = 1; i < gps->
totpoints; i++) {
1646 if (gps ==
nullptr) {
1686 float *last_pt = &gps->
points[0].
x;
1687 float total_length = 0.0f;
1688 for (
int i = 1; i < gps->
totpoints; i++) {
1691 total_length +=
len_v3v3(&pt->
x, last_pt);
1694 total_length +=
len_v2v2(&pt->
x, last_pt);
1698 return total_length;
1702 const int start_index,
1703 const int end_index,
1710 int index =
MAX2(start_index, 0) + 1;
1713 float *last_pt = &gps->
points[index - 1].
x;
1714 float total_length = 0.0f;
1715 for (
int i = index; i < last_index; i++) {
1718 total_length +=
len_v3v3(&pt->
x, last_pt);
1721 total_length +=
len_v2v2(&pt->
x, last_pt);
1725 return total_length;
1738 for (
int i = 0; i < gps->
totpoints - 2; i++) {
1742 for (
int j = start + 2; j < gps->
totpoints - 1; j++) {
1753 if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
1757 if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
1779 if (gps->
dvert !=
nullptr) {
1784 int newtot = end - start + 1;
1787 if (gps->
dvert !=
nullptr) {
1791 for (
int i = 0; i < newtot; i++) {
1792 int idx = start + i;
1795 *pt_new = blender::dna::shallow_copy(*pt_src);
1796 if (gps->
dvert !=
nullptr) {
1797 dvert_src = &old_dvert[idx];
1800 if (dvert_src->
dw) {
1804 if (
ELEM(idx, start, end)) {
1831 float dist_tot = 0.0f;
1832 for (
int i = 0; i < gps->
totpoints - 1; i++) {
1834 pt2 = &gps->
points[i + 1];
1838 float dist_avg = dist_tot / (gps->
totpoints - 1);
1843 float dist_close =
len_v3v3(&pt1->
x, &pt2->
x);
1846 if (dist_close <= dist_avg) {
1852 int tot_newpoints =
MAX2(dist_close / dist_avg, 1);
1858 if (gps->
dvert !=
nullptr) {
1863 pt1 = &gps->
points[old_tot - 1];
1866 for (
int i = 1; i < tot_newpoints + 1; i++, pt++) {
1867 float step = (tot_newpoints > 1) ? ((
float)i / (
float)tot_newpoints) : 0.99f;
1869 if ((tot_newpoints > 1) && (i == tot_newpoints)) {
1885 if (gps->
dvert !=
nullptr) {
1888 float weight_1 = dw1 ? dw1->
weight : 0.0f;
1892 float weight_2 = dw2 ? dw2->
weight : 0.0f;
1897 if (dvert_final->
dw) {
1924 for (i = 0, pt = gps->
points; i < gps->totpoints; i++, pt++) {
1925 if (pt->
flag & tag) {
1949 "new gp stroke points copy");
1955 if (gps->
dvert !=
nullptr) {
1957 "new gp stroke weights copy");
1961 (gps->
dvert !=
nullptr) ? dvert = gps->
dvert :
nullptr;
1962 for (i = 0, pt = gps->
points; i < gps->totpoints; i++, pt++) {
1963 if ((pt->
flag & tag) == 0) {
1964 *npt = blender::dna::shallow_copy(*pt);
1967 if (gps->
dvert !=
nullptr) {
1973 if (gps->
dvert !=
nullptr) {
1988 gps->
points = new_points;
1989 gps->
dvert = new_dvert;
2015 const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
2043 char *marked =
nullptr;
2049 marked = (
char *)
MEM_callocN(totpoints,
"GP marked array");
2067 float max_dist =
epsilon / 10.0f;
2070 while (marked[le] == 0) {
2074 for (
int i = ls + 1; i < le; i++) {
2075 float point_on_line[3];
2079 point_on_line, &old_points[i].
x, &old_points[ls].
x, &old_points[le].
x);
2081 dist =
len_v3v3(point_on_line, &old_points[i].
x);
2083 if (dist > max_dist) {
2104 if (gps->
dvert !=
nullptr) {
2109 for (
int i = 0; i < totpoints; i++) {
2113 if ((marked[i]) || (i == 0) || (i == totpoints - 1)) {
2114 *pt = blender::dna::shallow_copy(*pt_src);
2115 if (gps->
dvert !=
nullptr) {
2116 dvert_src = &old_dvert[i];
2119 if (dvert_src->
dw) {
2126 if (gps->
dvert !=
nullptr) {
2127 dvert_src = &old_dvert[i];
2154 if (gps->
dvert !=
nullptr) {
2166 if (gps->
dvert !=
nullptr) {
2171 for (
int i = 0; i < gps->
totpoints; i++) {
2175 if ((i == 0) || (i == gps->
totpoints - 1) || ((i % 2) > 0.0)) {
2176 *pt = blender::dna::shallow_copy(*pt_src);
2177 if (gps->
dvert !=
nullptr) {
2178 dvert_src = &old_dvert[i];
2181 if (dvert_src->
dw) {
2188 if (gps->
dvert !=
nullptr) {
2189 dvert_src = &old_dvert[i];
2210 int totnewpoints, oldtotpoints;
2214 for (
int s = 0; s < level; s++) {
2220 temp_points = gps->
points;
2226 if (gps->
dvert !=
nullptr) {
2227 temp_dverts = gps->
dvert;
2232 for (
int i = 0; i < oldtotpoints; i++) {
2248 if (gps->
dvert !=
nullptr) {
2249 dvert = &temp_dverts[i];
2250 dvert_final = &gps->
dvert[i * 2];
2252 dvert_final->
dw = dvert->
dw;
2256 for (
int i = cyclic ? 0 : 1, j = cyclic ? oldtotpoints - 1 : 0; i < oldtotpoints; j = i, i++) {
2274 if (gps->
dvert !=
nullptr) {
2275 dvert = &temp_dverts[j];
2276 dvert_next = &temp_dverts[i];
2277 dvert_final = &gps->
dvert[j * 2 + 1];
2283 for (
int d = 0; d < dvert->
totweight; d++) {
2301 for (
int i = cyclic ? 0 : 2, j = cyclic ? gps->
totpoints - 2 : 0; i < gps->totpoints - 2;
2328 const bool use_unselected)
2332 float tagged =
false;
2341 while ((i < gps->totpoints - 1) && (i + step < gps->totpoints)) {
2348 pt_next = &gps->
points[i + step];
2355 if (!use_unselected) {
2363 if (len_square <= th_square) {
2412 float last_angle = 999999.0f;
2413 for (
int i = 0; i < totedges; i++) {
2414 GpEdge *gped = &gp_edges[i];
2415 if (gped->
flag != 0) {
2419 if (gped_init->
v1 != gped->
v2) {
2424 if (gped_init->
v2 != gped->
v1) {
2447 GpEdge *gped_init = &gp_edges[init_idx];
2453 GpEdge *gped = &gp_edges[edge];
2454 stroke_array[idx] = edge;
2456 gped_init = &gp_edges[edge];
2485 int stroke_mat_index,
2487 const int thickness,
2489 const float matrix[4][4],
2490 const bool use_seams,
2491 const bool use_vgroups)
2508 for (
int i = 0; i < me->
totedge; i++) {
2510 gped = &gp_edges[i];
2531 bool pending =
true;
2534 gped = &gp_edges[
e];
2536 if (gped->
flag != 0) {
2559 for (
int i = totbw - 1; i > 0; i--) {
2560 stroke[array_len] = stroke_bw[i];
2563 for (
int i = 0; i < totedges; i++) {
2564 stroke[array_len] = stroke_fw[i];
2570 gpf_stroke,
MAX2(stroke_mat_index, 0), array_len + 1, thickness * thickness,
false);
2574 if (use_vgroups && me_dvert) {
2576 "gp_stroke_dverts");
2581 for (
int i = 0; i < array_len + 1; i++) {
2582 int vertex_index = i == 0 ? gp_edges[stroke[0]].
v1 : gp_edges[stroke[i - 1]].
v2;
2596 if (use_vgroups && me_dvert) {
2601 "gp_stroke_dverts_dw");
2602 for (
int j = 0; j < dv->
totweight; j++) {
2623 const float color[4],
2624 const bool use_stroke,
2625 const bool use_fill,
2658 for (
int i = 0; i < ob->
totcol; i++) {
2688 const int thickness,
2690 const float matrix[4][4],
2691 const int frame_offset,
2692 const bool use_seams,
2693 const bool use_faces,
2694 const bool use_vgroups)
2707 int mpoly_len = me_eval->
totpoly;
2708 char element_name[200];
2719 const float default_colors[2][4] = {{0.0f, 0.0f, 0.0f, 1.0f}, {0.7f, 0.7f, 0.7f, 1.0f}};
2724 if (stroke_mat_index == -1) {
2727 bmain, ob_gp, element_name, default_colors[0],
true,
false, &stroke_mat_index);
2731 if (use_faces && mpoly_len > 0) {
2736 if (gpl_fill ==
nullptr) {
2742 for (i = 0; i < mpoly_len; i++) {
2743 const MPoly *mp = &mpoly[i];
2749 ob_mesh->
id.
name + 2, (ma !=
nullptr) ? ma->
id.
name + 2 :
"Fill", 64, element_name);
2751 if (mat_idx == -1) {
2753 if (ma !=
nullptr) {
2768 if (use_vgroups && me_dvert) {
2774 for (
int j = 0; j < mp->
totloop; j++) {
2785 if (use_vgroups && me_dvert) {
2790 "gp_fill_dverts_dw");
2791 for (
int k = 0; k < dv->
totweight; k++) {
2811 if (gpl_stroke ==
nullptr) {
2836 if (gpd ==
nullptr) {
2855 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2869 int total_points = 0;
2871 if (gpd ==
nullptr) {
2890 return total_points;
2895 if (gpd ==
nullptr) {
2913 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2925 if (gpd ==
nullptr) {
2943 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2958 const float mat[4][4])
2960 if (gpd ==
nullptr) {
2979 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2996 float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
3001 for (
int i = 0; i < gps->
totpoints; i++) {
3048 for (
int i = 0; i < totpoints; i++) {
3049 pt_final = &join_stroke->
points[i];
3050 if (i < gps_last->totpoints) {
3051 pt = &gps_last->
points[e1];
3055 pt = &gps_first->
points[e2];
3063 pt_final->
time = delta;
3072 if ((gps_first->
dvert !=
nullptr) || (gps_last->
dvert !=
nullptr)) {
3080 for (
int i = 0; i < totpoints; i++) {
3081 dvert_dst = &join_stroke->
dvert[i];
3082 dvert_src =
nullptr;
3083 if (i < gps_last->totpoints) {
3084 if (gps_last->
dvert) {
3085 dvert_src = &gps_last->
dvert[e1];
3090 if (gps_first->
dvert) {
3091 dvert_src = &gps_first->
dvert[e2];
3096 if ((dvert_src) && (dvert_src->
dw)) {
3122 const bool flat_cap,
3137 bool in_island =
false;
3138 int num_islands = 0;
3146 for (
int i = 0; i < gps->
totpoints; i++, pt++) {
3147 if (pt->
flag & tag_flags) {
3157 idx = num_islands - 1;
3165 idx = num_islands - 1;
3178 for (idx = 0; idx < num_islands; idx++) {
3186 if ((
is_cyclic) && (gps_first ==
nullptr)) {
3187 gps_first = new_stroke;
3197 "gp delete stroke fragment");
3198 memcpy(
static_cast<void *
>(new_stroke->
points),
3203 if (gps->
dvert !=
nullptr) {
3206 "gp delete stroke fragment weight");
3207 memcpy(new_stroke->
dvert,
3213 for (
int i = 0; i < new_stroke->
totpoints; i++) {
3216 if (dvert_src->
dw) {
3237 pts = new_stroke->
points;
3238 for (j = 0; j < new_stroke->
totpoints; j++, pts++) {
3249 if ((limit > 0) && (new_stroke->
totpoints <= limit)) {
3250 if (gps_first == new_stroke) {
3251 gps_first =
nullptr;
3268 if ((
is_cyclic) && (gps_first !=
nullptr) && (gps_first != new_stroke)) {
3290 if (gpc ==
nullptr) {
3303 if (prev_selected ==
true && selected ==
false) {
3307 if ((prev_selected ==
false && selected ==
true) || (selected ==
false && i == idx_last)) {
3309 idx_end = selected ? i - 1 : i;
3310 int island_length = idx_end - idx_start + 1;
3313 if (island_length == 1) {
3315 if (idx_start > 0 && idx_end < idx_last) {
3316 prev_selected = selected;
3321 prev_selected = selected;
3327 new_stroke->
points =
nullptr;
3331 if (gps_first ==
nullptr) {
3332 gps_first = new_stroke;
3353 gps_last = new_stroke;
3355 prev_selected = selected;
3359 if (
is_cyclic && gps_first !=
nullptr && gps_last !=
nullptr && gps_first != gps_last) {
3393 const float delta[3],
3401 if (gps->
dvert !=
nullptr) {
3407 if (dvert !=
nullptr) {
3416 newpoint->
x =
point->x * delta[0];
3417 newpoint->
y =
point->y * delta[1];
3418 newpoint->
z =
point->z * delta[2];
3425 if (gps->
dvert !=
nullptr) {
3428 if (dvert !=
nullptr) {
3434 newdvert->
dw =
nullptr;
3441 const bool leave_gaps,
3442 const bool fit_thickness,
3448 const float delta[3] = {1.0f, 1.0f, 1.0f};
3449 float deltatime = 0.0f;
3452 if (
ELEM(
nullptr, gps_a, gps_b)) {
3461 float start_a[3], start_b[3], end_a[3], end_b[3];
3476 bool flip_a =
false;
3477 bool flip_b =
false;
3478 float lowest = dist;
3481 if (dist < lowest) {
3488 if (dist < lowest) {
3495 if (dist < lowest) {
3517 point = blender::dna::shallow_copy(gps_b->
points[0]);
3523 const float ratio = (fit_thickness && gps_a->
thickness > 0.0f) ?
3528 const int totpoints_a = gps_a->
totpoints;
3529 for (i = 0, pt = gps_b->
points; i < gps_b->totpoints && pt; i++, pt++) {
3536 const int sample_points = 8;
3538 int start =
MAX2(0, totpoints_a - sample_points);
3539 int end =
MIN2(gps_a->
totpoints - 1, start + (sample_points * 2));
3540 const int len = (end - start);
3541 float step = 1.0f / ((
len / 2) + 1);
3544 float avg_pressure = 0.0f;
3545 for (i = start; i < end; i++) {
3549 avg_pressure = avg_pressure /
len;
3553 for (i = start; i < end; i++) {
3561 ratio = ratio - step - step;
3580 if (gpf_new ==
nullptr) {
3584 if (gpf_new ==
nullptr) {
3589 if (gps_new ==
nullptr) {
3630 tSamplePoint *new_pt = MEM_cnew<tSamplePoint>(__func__);
3636 if (dvert !=
nullptr) {
3671 const bool has_dverts = (gps->
dvert !=
nullptr);
3674 ListBase points = {
nullptr,
nullptr};
3678 for (
uint32_t i = 0; i < totpoints; ++i) {
3700 int num_points_needed = target_number - totpoints;
3703 while (num_points_needed > 0) {
3709 tSamplePoint *new_sp = MEM_cnew<tSamplePoint>(__func__);
3718 if (sp->
dw && sp_next->
dw) {
3738 num_points_needed--;
3785 if (temp->dw !=
nullptr) {
3797 const float diff_mat[4][4])
3799 for (
int i = 0; i < gps->
totpoints; i++) {
3810 const float diff_mat[4][4])
3812 float inverse_diff_mat[4][4];
3815 for (
int i = 0; i < gps->
totpoints; i++) {
3862 int num_points = (int)(((1 << (subdivisions + 1)) - 1) * (
angle /
M_PI));
3863 if (num_points > 0) {
3864 float angle_incr =
angle / (
float)num_points;
3879 for (
int i = 0; i < num_points - 1; i++) {
3880 tmp_angle = (i + 1) * angle_incr;
3884 vec_p[2] = center_pt[2];
3894 last_point = new_point;
3897 return num_points - 1;
3908 int num_points = (1 << (subdivisions + 1)) + 1;
3912 float vec_center[2];
3919 float angle_incr =
M_PI / ((
float)num_points - 1);
3922 for (
int i = 1; i < num_points; i++) {
3923 float angle = i * angle_incr;
3928 vec_p[2] = center_pt[2];
3933 last_point = new_point;
3936 return num_points - 1;
3940 const float other_point[4],
3953 cap_nvec[1] = radius;
3956 cap_nvec[0] = -cap_vec[1];
3957 cap_nvec[1] = cap_vec[0];
3960 float cap_nvec_inv[2];
3963 float vec_perimeter[3];
3967 float vec_perimeter_inv[3];
3969 add_v2_v2(vec_perimeter_inv, cap_nvec_inv);
3982 return num_points + 2;
3994 int *r_num_perimeter_points)
4001 float defaultpixsize = 1000.0f / gpd->
pixfactor;
4004 ListBase *perimeter_right_side = MEM_cnew<ListBase>(__func__);
4005 ListBase *perimeter_left_side = MEM_cnew<ListBase>(__func__);
4006 int num_perimeter_points = 0;
4011 float first_radius = stroke_radius * first->
pressure;
4012 float last_radius = stroke_radius * last->
pressure;
4017 first_next = &gps->
points[1];
4027 float first_next_pt[3];
4028 float last_prev_pt[3];
4036 first_next_pt[0] += 1.0f;
4037 last_prev_pt[0] -= 1.0f;
4042 first_pt, first_next_pt, first_radius, perimeter_right_side, subdivisions, gps->
caps[0]);
4045 float curr_pt[3], next_pt[3], prev_pt[3];
4046 float vec_next[2], vec_prev[2];
4047 float nvec_next[2], nvec_prev[2];
4048 float nvec_next_pt[3], nvec_prev_pt[3];
4049 float vec_tangent[2];
4051 float vec_miter_left[2], vec_miter_right[2];
4052 float miter_left_pt[3], miter_right_pt[3];
4054 for (
int i = 1; i < gps->
totpoints - 1; i++) {
4058 float radius = stroke_radius * curr->
pressure;
4066 float prev_length =
len_v2(vec_prev);
4067 float next_length =
len_v2(vec_next);
4078 nvec_prev[0] = -vec_prev[1];
4079 nvec_prev[1] = vec_prev[0];
4081 nvec_next[0] = -vec_next[1];
4082 nvec_next[1] = vec_next[0];
4089 vec_miter_left[0] = -vec_tangent[1];
4090 vec_miter_left[1] = vec_tangent[0];
4093 float an1 =
dot_v2v2(vec_miter_left, nvec_prev);
4097 float miter_length = radius / an1;
4098 if (miter_length <= 0.0f) {
4099 miter_length = 0.01f;
4125 num_perimeter_points += 2;
4144 num_perimeter_points += 2;
4147 perimeter_left_side, normal_prev, normal_next, curr_pt, subdivisions,
true);
4149 if (miter_length < prev_length && miter_length < next_length) {
4151 add_v2_v2(miter_right_pt, vec_miter_right);
4161 num_perimeter_points++;
4179 num_perimeter_points += 2;
4182 perimeter_right_side, normal_prev, normal_next, curr_pt, subdivisions,
false);
4184 if (miter_length < prev_length && miter_length < next_length) {
4186 add_v2_v2(miter_left_pt, vec_miter_left);
4196 num_perimeter_points++;
4203 last_pt, last_prev_pt, last_radius, perimeter_right_side, subdivisions, gps->
caps[1]);
4208 perimeter_right_side);
4209 ListBase *perimeter_list = perimeter_left_side;
4217 if (
compare_v3v3(close_pt, &close_first->
x, FLT_EPSILON) ==
false) {
4220 num_perimeter_points++;
4227 *r_num_perimeter_points = num_perimeter_points;
4228 return perimeter_list;
4235 const int subdivisions,
4236 const float diff_mat[4][4])
4243 gps_temp->
prev = gps_temp->
next =
nullptr;
4246 gps_temp->
dvert =
nullptr;
4252 if (cyclic && (gps_temp->
totpoints > 1)) {
4266 int num_perimeter_points = 0;
4268 gpd, gpl, gps_temp, subdivisions, &num_perimeter_points);
4270 if (num_perimeter_points == 0) {
4301 return perimeter_stroke;
4312 for (
int i = 0; i < gps->
totpoints; i++) {
4327 for (
int i = 0; i < gps->
totpoints; i++) {
4329 if (pt->
pressure != first_pressure) {
typedef float(TangentPoint)[2]
void BKE_gpencil_stroke_select_index_set(struct bGPdata *gpd, struct bGPDstroke *gps)
struct bGPDframe * BKE_gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe)
struct Material * BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index)
struct bGPDstroke * BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src, bool dup_points, bool dup_curve)
void BKE_gpencil_free_stroke_weights(struct bGPDstroke *gps)
void BKE_gpencil_free_point_weights(struct MDeformVert *dvert)
struct bGPDcurve * BKE_gpencil_stroke_editcurve_new(int tot_curve_points)
struct bGPDstroke * BKE_gpencil_stroke_add_existing_style(struct bGPDframe *gpf, struct bGPDstroke *existing, int mat_idx, int totpoints, short thickness)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
struct bGPDstroke * BKE_gpencil_stroke_add(struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, bool insert_at_head)
struct bGPDstroke * BKE_gpencil_stroke_new(int mat_idx, int totpoints, short thickness)
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
struct bGPDframe * BKE_gpencil_layer_frame_find(struct bGPDlayer *gpl, int cframe)
void BKE_gpencil_free_stroke(struct bGPDstroke *gps)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
#define GPENCIL_STRENGTH_MIN
int BKE_gpencil_material_find_index_by_name_prefix(struct Object *ob, const char *name_prefix)
void BKE_gpencil_frame_selected_hash(struct bGPdata *gpd, struct GHash *r_list)
void BKE_gpencil_stroke_update_geometry_from_editcurve(struct bGPDstroke *gps, uint resolution, bool is_adaptive)
void BKE_gpencil_editcurve_recalculate_handles(struct bGPDstroke *gps)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
struct Mesh * BKE_object_get_evaluated_mesh(const struct Object *object)
Generic array manipulation API.
#define BLI_array_reverse(arr, arr_len)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_int_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BLI_INLINE float BLI_hash_int_01(unsigned int k)
BLI_INLINE unsigned int BLI_hash_int_2d(unsigned int kx, unsigned int ky)
A min-heap / priority queue ADT.
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
void(* HeapFreeFP)(void *ptr)
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
Heap * BLI_heap_new(void) ATTR_WARN_UNUSED_RESULT
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void void void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void void void void void void BLI_listbase_reverse(struct ListBase *lb) ATTR_NONNULL(1)
MINLINE float interpf(float a, float b, float t)
int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float r_i1[3], float r_i2[3])
float closest_to_line_segment_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
float mat4_to_scale(const float M[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void mul_qt_v3(const float q[4], float r[3])
void quat_to_mat3(float mat[3][3], const float q[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE bool compare_v3v3(const float a[3], const float b[3], float limit) ATTR_WARN_UNUSED_RESULT
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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 negate_v2(float r[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v2_v2(float r[2], const float a[2])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_length(float r[3], float unit_scale)
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 dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
void rotate_v2_v2fl(float r[2], const float p[2], float angle)
MINLINE bool is_zero_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE float normalize_v2_length(float r[2], float unit_scale)
float angle_v3v3v3(const float a[3], const float b[3], const float c[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v2(float r[2])
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
void BLI_str_replace_char(char *str, char src, char dst) ATTR_NONNULL()
#define SNPRINTF(dst, format,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define INIT_MINMAX(min, max)
#define ARRAY_SET_ITEMS(...)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
typedef double(DMatrix)[4][4]
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
struct ID * DEG_get_original_id(struct ID *id)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_COPY_ON_WRITE
@ GP_CURVE_NEEDS_STROKE_UPDATE
@ GP_STROKE_NEEDS_CURVE_UPDATE
@ GP_DATA_CURVE_ADAPTIVE_RESOLUTION
#define GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)
@ GP_MATERIAL_STROKE_SHOW
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint vn
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
#define MEM_reallocN(vmemh, len)
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input 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 a color
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
__forceinline BoundBox intersect(const BoundBox &a, const BoundBox &b)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
bool closest(btVector3 &v)
const Depsgraph * depsgraph
static bool is_cyclic(const Nurb *nu)
void BKE_gpencil_stroke_flip(bGPDstroke *gps)
static tPerimeterPoint * new_perimeter_point(const float pt[3])
static int stroke_march_count(const bGPDstroke *gps, const float dist, const float sharp_threshold)
float BKE_gpencil_stroke_average_pressure_get(bGPDstroke *gps)
static void gpencil_stroke_join_islands(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last)
void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points, int ref_totpoints, const bGPDspoint *points, int totpoints, float(*points2d)[2], const float scale, int *r_direction)
static void gpencil_calc_stroke_fill_uv(const float(*points2d)[2], bGPDstroke *gps, const float minv[2], const float maxv[2], float(*r_uv)[2])
bGPDstroke * BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags, const bool select, const bool flat_cap, const int limit)
void BKE_gpencil_stroke_merge_distance(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, const float threshold, const bool use_unselected)
void BKE_gpencil_stroke_copy_to_keyframes(bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, const bool tail)
float BKE_gpencil_stroke_length(const bGPDstroke *gps, bool use_3d)
static int generate_semi_circle_from_point_to_point(ListBase *list, tPerimeterPoint *from, tPerimeterPoint *to, int subdivisions)
static void make_element_name(const char *obname, const char *name, const int maxlen, char *r_name)
bool BKE_gpencil_convert_mesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob_gp, Object *ob_mesh, const float angle, const int thickness, const float offset, const float matrix[4][4], const int frame_offset, const bool use_seams, const bool use_faces, const bool use_vgroups)
bool BKE_gpencil_stroke_is_pressure_constant(bGPDstroke *gps)
void BKE_gpencil_stroke_subdivide(bGPdata *gpd, bGPDstroke *gps, int level, int type)
void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3])
bool BKE_gpencil_stroke_sample(bGPdata *gpd, bGPDstroke *gps, const float dist, const bool select, const float sharp_threshold)
static Material * gpencil_add_material(Main *bmain, Object *ob_gp, const char *name, const float color[4], const bool use_stroke, const bool use_fill, int *r_idx)
bGPDstroke * BKE_gpencil_stroke_perimeter_from_view(struct RegionView3D *rv3d, bGPdata *gpd, const bGPDlayer *gpl, bGPDstroke *gps, const int subdivisions, const float diff_mat[4][4])
bool BKE_gpencil_stroke_split(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, const int before_index, bGPDstroke **remaining_gps)
bool BKE_gpencil_stroke_trim(bGPdata *gpd, bGPDstroke *gps)
void BKE_gpencil_point_coords_get(bGPdata *gpd, GPencilPointCoordinates *elem_data)
bool BKE_gpencil_stroke_minmax(const bGPDstroke *gps, const bool use_select, float r_min[3], float r_max[3])
static int generate_arc_from_point_to_point(ListBase *list, tPerimeterPoint *from, tPerimeterPoint *to, float center_pt[3], int subdivisions, bool clockwise)
void BKE_gpencil_stroke_smooth(bGPDstroke *gps, const float influence, const int iterations, const bool smooth_position, const bool smooth_strength, const bool smooth_thickness, const bool smooth_uv, const bool keep_shape, const float *weights)
static void boundbox_gpencil(Object *ob)
void BKE_gpencil_point_coords_apply_with_mat4(bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4])
bool BKE_gpencil_data_minmax(const bGPdata *gpd, float r_min[3], float r_max[3])
static int generate_perimeter_cap(const float point[4], const float other_point[4], float radius, ListBase *list, int subdivisions, short cap_type)
bool BKE_gpencil_stroke_shrink(bGPDstroke *gps, const float dist, const short mode)
static MDeformVert * stroke_defvert_new_count(int count, int totweight, ListBase *def_nr_list)
static int gpencil_next_edge(GpEdge *gp_edges, int totedges, GpEdge *gped_init, const float threshold, const bool reverse)
void BKE_gpencil_stroke_from_view_space(RegionView3D *rv3d, bGPDstroke *gps, const float diff_mat[4][4])
bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float influence, int iterations, bGPDstroke *r_gps)
static int gpencil_material_find_index_by_name(Object *ob, const char *name)
bool BKE_gpencil_stroke_stretch(bGPDstroke *gps, const float dist, const float overshoot_fac, const short mode, const bool follow_curvature, const int extra_point_count, const float segment_influence, const float max_angle, const bool invert_curvature)
bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float influence, int iterations, bGPDstroke *r_gps)
static int gpencil_walk_edge(GHash *v_table, GpEdge *gp_edges, int totedges, uint *stroke_array, int init_idx, const float angle, const bool reverse)
static int stroke_march_next_point_no_interp(const bGPDstroke *gps, const int index_next_pt, const float *current, const float dist, const float sharp_threshold, float *result)
void BKE_gpencil_stroke_simplify_fixed(bGPdata *gpd, bGPDstroke *gps)
void BKE_gpencil_dissolve_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, const short tag)
void BKE_gpencil_curve_delete_tagged_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, bGPDcurve *gpc, int tag_flags)
bool BKE_gpencil_stroke_trim_points(bGPDstroke *gps, const int index_from, const int index_to)
void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4])
void BKE_gpencil_stroke_set_random_color(bGPDstroke *gps)
void BKE_gpencil_stroke_geometry_update(bGPdata *gpd, bGPDstroke *gps)
static tSamplePoint * new_sample_point_from_gp_point(const bGPDspoint *pt, const MDeformVert *dvert)
bool BKE_gpencil_stroke_smooth_uv(struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps)
static ListBase * gpencil_stroke_perimeter_ex(const bGPdata *gpd, const bGPDlayer *gpl, const bGPDstroke *gps, int subdivisions, int *r_num_perimeter_points)
void BKE_gpencil_stroke_simplify_adaptive(bGPdata *gpd, bGPDstroke *gps, float epsilon)
void BKE_gpencil_stroke_join(bGPDstroke *gps_a, bGPDstroke *gps_b, const bool leave_gaps, const bool fit_thickness, const bool smooth)
void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
static void gpencil_stroke_copy_point(bGPDstroke *gps, MDeformVert *dvert, bGPDspoint *point, const float delta[3], float pressure, float strength, float deltatime)
void BKE_gpencil_stroke_uv_update(bGPDstroke *gps)
void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
static int stroke_march_next_point(const bGPDstroke *gps, const int index_next_pt, const float *current, const float dist, float *result, float *pressure, float *strength, float *vert_color, float *uv_fac, float *uv_fill, float *uv_rot, float *ratio_result, int *index_from, int *index_to)
static tSampleEdge * new_sample_edge_from_sample_points(tSamplePoint *from, tSamplePoint *to)
int BKE_gpencil_stroke_point_count(const bGPdata *gpd)
float BKE_gpencil_stroke_segment_length(const struct bGPDstroke *gps, const int start_index, const int end_index, bool use_3d)
bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps, int point_index, float influence, int iterations, const bool smooth_caps, const bool keep_shape, bGPDstroke *r_gps)
void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
void BKE_gpencil_stroke_to_view_space(RegionView3D *rv3d, bGPDstroke *gps, const float diff_mat[4][4])
static void gpencil_generate_edgeloops(Object *ob, bGPdata *gpd, bGPDframe *gpf_stroke, int stroke_mat_index, const float angle, const int thickness, const float offset, const float matrix[4][4], const bool use_seams, const bool use_vgroups)
void BKE_gpencil_stroke_boundingbox_calc(bGPDstroke *gps)
bool BKE_gpencil_stroke_close(bGPDstroke *gps)
BoundBox * BKE_gpencil_boundbox_get(Object *ob)
void BKE_gpencil_point_coords_apply(bGPdata *gpd, const GPencilPointCoordinates *elem_data)
static bool BKE_gpencil_stroke_extra_points(bGPDstroke *gps, const int count_before, const int count_after)
void BKE_gpencil_stroke_uniform_subdivide(bGPdata *gpd, bGPDstroke *gps, const uint32_t target_number, const bool select)
static void stroke_interpolate_deform_weights(bGPDstroke *gps, int index_from, int index_to, float ratio, MDeformVert *vert)
static void stroke_defvert_create_nr_list(MDeformVert *dv_list, int count, ListBase *result, int *totweight)
IconTextureDrawCall normal
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 exp(float3 v)
ccl_device_inline float3 ceil(const float3 &a)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
SymEdge< T > * prev(const SymEdge< T > *se)
static MEdge new_edge(const int v1, const int v2)
bool is_adaptive(CpuPatchTable *patch_table)
vec_base< float, 3 > float3
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
smooth(Type::FLOAT, "mask_weight")
struct MaterialGPencilStyle * gp_style
struct MDeformVert * dvert
ListBase vertex_group_names
int vertex_group_active_index
bGPDcurve_point * curve_points
struct bGPDspoint * pt_orig
bGPDspoint_Runtime runtime
struct bGPDcurve * editcurve
struct MDeformVert * dvert
ListBase vertex_group_names
int curve_edit_resolution
int vertex_group_active_index
struct tPerimeterPoint * next
struct tPerimeterPoint * prev
struct MDeformWeight * dw
struct tSamplePoint * next
struct tSamplePoint * prev