74 const bool use_select,
86 for (i = 0, pt = gps->
points; i < gps->totpoints; i++, pt++) {
104 bool changed =
false;
132 float min[3],
max[3], tot[3];
203 for (
int i = 0; i < 8; i++) {
214 const int index_next_pt,
215 const float *current,
225 float remaining_till_next = 0.0f;
226 float remaining_march = dist;
229 int next_point_index = index_next_pt;
232 if (!(next_point_index < gps->totpoints)) {
237 pt = &gps->
points[next_point_index];
239 remaining_till_next =
len_v3v3(point, step_start);
241 while (remaining_till_next < remaining_march) {
242 remaining_march -= remaining_till_next;
243 pt = &gps->
points[next_point_index];
247 if (!(next_point_index < gps->totpoints)) {
251 pt = &gps->
points[next_point_index];
253 remaining_till_next =
len_v3v3(point, step_start);
255 if (remaining_till_next < remaining_march) {
256 pt = &gps->
points[next_point_index];
260 memcpy(vert_color, gps->
points[next_point_index].
vert_color,
sizeof(
float[4]));
262 *index_from = next_point_index - 1;
263 *index_to = next_point_index;
264 *ratio_result = 1.0f;
269 float ratio = remaining_march / remaining_till_next;
280 *index_from = next_point_index - 1;
281 *index_to = next_point_index;
282 *ratio_result = ratio;
284 return next_point_index;
288 const int index_next_pt,
289 const float *current,
293 float remaining_till_next = 0.0f;
294 float remaining_march = dist;
297 int next_point_index = index_next_pt;
300 if (!(next_point_index < gps->totpoints)) {
305 pt = &gps->
points[next_point_index];
307 remaining_till_next =
len_v3v3(point, step_start);
309 while (remaining_till_next < remaining_march) {
310 remaining_march -= remaining_till_next;
311 pt = &gps->
points[next_point_index];
315 if (!(next_point_index < gps->totpoints)) {
319 pt = &gps->
points[next_point_index];
321 remaining_till_next =
len_v3v3(point, step_start);
323 if (remaining_till_next < remaining_march) {
324 pt = &gps->
points[next_point_index];
329 float ratio = remaining_march / remaining_till_next;
331 return next_point_index;
338 int next_point_index = 1;
346 gps, next_point_index, point, dist, point)) > -1) {
348 if (next_point_index == 0) {
365 for (i = 0; i <
count; i++) {
396 for (i = 0; i <
count; i++) {
401 for (ld = def_nr_list->
first; ld; ld = ld->
next) {
416 for (
int i = 0; i < vert->
totweight; i++) {
437 if (gps->
totpoints < 2 || dist < FLT_EPSILON) {
446 int result_totweight;
453 int next_point_index = 1;
455 float pressure, strength, ratio_result;
457 int index_from, index_to;
467 memcpy(new_pt[i].vert_color, pt[0].vert_color,
sizeof(
float[4]));
493 memcpy(new_pt[i].vert_color, vert_color,
sizeof(
float[4]));
503 if (next_point_index == 0) {
540 float threshold = (tip_length == 0 ? 0.001f : tip_length);
542 if (gps->
totpoints < 2 || dist < FLT_EPSILON) {
554 while (len1 < threshold && gps->totpoints > i) {
561 while (len2 < threshold && gps->totpoints >= i) {
563 len2 =
len_v3v3(&last_pt->x, &second_last->x);
567 float extend1 = (len1 + dist) / len1;
568 float extend2 = (len2 + dist) / len2;
570 float result1[3], result2[3];
592 const int new_count = index_to - index_from + 1;
598 if (new_count == 1) {
609 for (
int i = 0; i < new_count; i++) {
610 memcpy(&new_pt[i], &pt[i + index_from],
sizeof(
bGPDspoint));
615 for (
int i = 0; i < new_count; i++) {
616 dv = &gps->
dvert[i + index_from];
620 "gp_stroke_dverts_dw_trimmed");
621 for (
int j = 0; j < dv->
totweight; j++) {
649 const int before_index,
656 if (before_index >= gps->
totpoints || before_index == 0) {
660 const int new_count = gps->
totpoints - before_index;
661 const int old_count = before_index;
670 for (
int i = 0; i < new_count; i++) {
671 memcpy(&new_pt[i], &pt[i + before_index],
sizeof(
bGPDspoint));
676 "gp_stroke_dverts_remaining(MDeformVert)");
677 for (
int i = 0; i < new_count; i++) {
678 dv = &gps->
dvert[i + before_index];
682 "gp_stroke_dverts_dw_remaining(MDeformWeight)");
683 for (
int j = 0; j < dv->
totweight; j++) {
688 new_gps->
dvert = new_dv;
691 (*remaining_gps) = new_gps;
711 if (gps->
totpoints < 2 || dist < FLT_EPSILON) {
717 float len1, this_len1, cut_len1;
718 float len2, this_len2, cut_len2;
719 int index_start, index_end;
721 len1 = len2 = this_len1 = this_len2 = cut_len1 = cut_len2 = 0.0f;
724 while (len1 < dist && gps->totpoints > i - 1) {
727 cut_len1 = len1 - dist;
733 while (len2 < dist && gps->totpoints >= i) {
735 this_len2 =
len_v3v3(&second_last[1].
x, &second_last->x);
737 cut_len2 = len2 - dist;
742 if (len1 < dist || len2 < dist || index_end <= index_start) {
743 index_start = index_end = 0;
746 if ((index_end == index_start + 1) && (cut_len1 + cut_len2 > 1.0f)) {
747 index_start = index_end = 0;
758 float cut1 = cut_len1 / this_len1;
759 float cut2 = cut_len2 / this_len2;
761 float result1[3], result2[3];
781 float sco[3] = {0.0f};
802 const float average_fac = 1.0f / (
float)(
steps * 2 + 1);
812 for (step = 1; step <=
steps; step++) {
814 int before = i - step;
815 int after = i + step;
820 pt1 = &gps->
points[before];
821 pt2 = &gps->
points[after];
846 if ((gps->
totpoints <= 2) || (point_index < 1)) {
850 float inf = influence;
858 float max_strength = 0.0f;
860 const float average_fac = 1.0f / (
float)(
steps * 2 + 1);
864 total += ptb->
strength * average_fac;
868 for (step = 1; step <=
steps; step++) {
870 int before = point_index - step;
871 int after = point_index + step;
876 pt1 = &gps->
points[before];
877 pt2 = &gps->
points[after];
880 total += pt1->
strength * average_fac;
881 total += pt2->
strength * average_fac;
883 if (max_strength < pt1->strength) {
886 if (max_strength < pt2->strength) {
910 if ((gps->
totpoints <= 2) || (point_index < 1)) {
914 float inf = influence;
922 float max_pressure = 0.0f;
924 const float average_fac = 1.0f / (
float)(
steps * 2 + 1);
928 total += ptb->
pressure * average_fac;
932 for (step = 1; step <=
steps; step++) {
934 int before = point_index - step;
935 int after = point_index + step;
940 pt1 = &gps->
points[before];
941 pt2 = &gps->
points[after];
944 total += pt1->
pressure * average_fac;
945 total += pt2->
pressure * average_fac;
947 if (max_pressure < pt1->pressure) {
950 if (max_pressure < pt2->pressure) {
979 int before = point_index - 1;
980 int after = point_index + 1;
985 pta = &gps->
points[before];
986 ptc = &gps->
points[after];
993 if ((fac < 0.0f) || (fac > 1.0f)) {
1015 float (*points2d)[2],
1022 const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
1034 if (totpoints == 2) {
1054 const bGPDspoint *pt_last = &points[totpoints - 1];
1058 points2d[totpoints - 1][0] =
dot_v3v3(tmp, locx);
1059 points2d[totpoints - 1][1] =
dot_v3v3(tmp, locy);
1064 float *co_prev = (
float *)&points2d[totpoints - 1];
1067 for (
int i = 0; i < totpoints - 1; i++) {
1074 points2d[i][0] =
dot_v3v3(loc, locx);
1075 points2d[i][1] =
dot_v3v3(loc, locy);
1078 co_curr = (
float *)&points2d[i][0];
1079 cross += (co_curr[0] - co_prev[0]) * (co_curr[1] + co_prev[1]);
1080 co_prev = (
float *)&points2d[i][0];
1084 *r_direction = (
cross >= 0.0f) ? 1 : -1;
1102 float (*points2d)[2],
1110 const bGPDspoint *pt3 = &ref_points[(int)(ref_totpoints * 0.75)];
1122 if (totpoints == 2) {
1142 for (
int i = 0; i < totpoints; i++) {
1146 float vn[3] = {0.0f, 0.0f, 0.0f};
1160 else if (i == totpoints - 1) {
1174 points2d[i][0] =
dot_v3v3(loc, locx);
1175 points2d[i][1] =
dot_v3v3(loc, locy);
1179 *r_direction = (int)locy[2];
1185 const float minv[2],
1186 const float maxv[2],
1193 float center[2] = {0.5f, 0.5f};
1195 d[0] = maxv[0] - minv[0];
1196 d[1] = maxv[1] - minv[1];
1197 for (
int i = 0; i < gps->
totpoints; i++) {
1198 r_uv[i][0] = (points2d[i][0] - minv[0]) / d[0];
1199 r_uv[i][1] = (points2d[i][1] - minv[1]) / d[1];
1208 float x = r_uv[i][0] *
c - r_uv[i][1] * s;
1209 float y = r_uv[i][0] * s + r_uv[i][1] *
c;
1232 "GP Stroke temp triangulation");
1234 "GP Stroke temp 2d points");
1257 "GP Stroke triangulation");
1264 for (
int i = 0; i < gps->
totpoints; i++) {
1294 float totlen = 0.0f;
1296 for (
int i = 1; i < gps->
totpoints; i++) {
1355 float *last_pt = &gps->
points[0].
x;
1356 float total_length = 0.0f;
1357 for (
int i = 1; i < gps->
totpoints; i++) {
1360 total_length +=
len_v3v3(&pt->
x, last_pt);
1363 total_length +=
len_v2v2(&pt->
x, last_pt);
1367 return total_length;
1372 const int start_index,
1373 const int end_index,
1380 int index =
MAX2(start_index, 0) + 1;
1383 float *last_pt = &gps->
points[index - 1].
x;
1384 float total_length = 0.0f;
1385 for (
int i = index; i < last_index; i++) {
1388 total_length +=
len_v3v3(&pt->
x, last_pt);
1391 total_length +=
len_v2v2(&pt->
x, last_pt);
1395 return total_length;
1412 for (
int i = 0; i < gps->
totpoints - 2; i++) {
1416 for (
int j = start + 2; j < gps->
totpoints - 1; j++) {
1423 if (
len_v3(point) > 0.0f) {
1427 if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
1431 if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
1458 int newtot = end - start + 1;
1465 for (
int i = 0; i < newtot; i++) {
1466 int idx = start + i;
1471 dvert_src = &old_dvert[idx];
1474 if (dvert_src->
dw) {
1478 if (
ELEM(idx, start, end)) {
1509 float dist_tot = 0.0f;
1510 for (
int i = 0; i < gps->
totpoints - 1; i++) {
1512 pt2 = &gps->
points[i + 1];
1516 float dist_avg = dist_tot / (gps->
totpoints - 1);
1521 float dist_close =
len_v3v3(&pt1->
x, &pt2->
x);
1524 if (dist_close <= dist_avg) {
1530 int tot_newpoints =
MAX2(dist_close / dist_avg, 1);
1541 pt1 = &gps->
points[old_tot - 1];
1544 for (
int i = 1; i < tot_newpoints + 1; i++, pt++) {
1545 float step = (tot_newpoints > 1) ? ((
float)i / (
float)tot_newpoints) : 0.99f;
1547 if ((tot_newpoints > 1) && (i == tot_newpoints)) {
1562 float weight_1 = dw1 ? dw1->
weight : 0.0f;
1566 float weight_2 = dw2 ? dw2->
weight : 0.0f;
1571 if (dvert_final->
dw) {
1599 for (i = 0, pt = gps->
points; i < gps->totpoints; i++, pt++) {
1600 if (pt->
flag & tag) {
1635 for (i = 0, pt = gps->
points; i < gps->totpoints; i++, pt++) {
1636 if ((pt->
flag & tag) == 0) {
1661 gps->
points = new_points;
1662 gps->
dvert = new_dvert;
1687 const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
1721 char *marked =
NULL;
1727 marked =
MEM_callocN(totpoints,
"GP marked array");
1745 float max_dist =
epsilon / 10.0f;
1748 while (marked[le] == 0) {
1752 for (
int i = ls + 1; i < le; i++) {
1753 float point_on_line[3];
1757 point_on_line, &old_points[i].
x, &old_points[ls].
x, &old_points[le].
x);
1759 dist =
len_v3v3(point_on_line, &old_points[i].
x);
1761 if (dist > max_dist) {
1787 for (
int i = 0; i < totpoints; i++) {
1791 if ((marked[i]) || (i == 0) || (i == totpoints - 1)) {
1794 dvert_src = &old_dvert[i];
1797 if (dvert_src->
dw) {
1805 dvert_src = &old_dvert[i];
1854 for (
int i = 0; i < gps->
totpoints; i++) {
1858 if ((i == 0) || (i == gps->
totpoints - 1) || ((i % 2) > 0.0)) {
1861 dvert_src = &old_dvert[i];
1864 if (dvert_src->
dw) {
1872 dvert_src = &old_dvert[i];
1900 int totnewpoints, oldtotpoints;
1903 for (
int s = 0; s < level; s++) {
1919 for (
int i = oldtotpoints - 1; i > 0; i--) {
1933 dvert = &temp_dverts[i];
1934 dvert_final = &gps->
dvert[i2];
1936 dvert_final->
dw = dvert->
dw;
1942 for (
int i = 0; i < oldtotpoints - 1; i++) {
1958 dvert = &temp_dverts[i];
1959 dvert_next = &temp_dverts[i + 1];
1960 dvert_final = &gps->
dvert[i2];
1966 for (
int d = 0; d < dvert->
totweight; d++) {
1988 for (
int i = 0; i < gps->
totpoints - 2; i++) {
2020 const float threshold,
2021 const bool use_unselected)
2025 float tagged =
false;
2027 const float th_square = threshold * threshold;
2034 while ((i < gps->totpoints - 1) && (i + step < gps->totpoints)) {
2041 pt_next = &gps->
points[i + step];
2048 if (!use_unselected) {
2056 if (len_square <= th_square) {
2102 GpEdge *gp_edges,
int totedges,
GpEdge *gped_init,
const float threshold,
const bool reverse)
2105 float last_angle = 999999.0f;
2106 for (
int i = 0; i < totedges; i++) {
2107 GpEdge *gped = &gp_edges[i];
2108 if (gped->
flag != 0) {
2112 if (gped_init->
v1 != gped->
v2) {
2117 if (gped_init->
v2 != gped->
v1) {
2123 if ((
angle < threshold) && (
angle <= last_angle)) {
2140 GpEdge *gped_init = &gp_edges[init_idx];
2146 GpEdge *gped = &gp_edges[edge];
2147 stroke_array[idx] = edge;
2149 gped_init = &gp_edges[edge];
2178 int stroke_mat_index,
2180 const int thickness,
2182 const float matrix[4][4],
2183 const bool use_seams)
2199 for (
int i = 0; i < me->
totedge; i++) {
2201 gped = &gp_edges[i];
2222 bool pending =
true;
2228 memset(stroke, 0,
sizeof(
uint) * me->
totedge * 2);
2230 gped = &gp_edges[
e];
2232 if (gped->
flag != 0) {
2255 for (
int i = totbw - 1; i > 0; i--) {
2256 stroke[array_len] = stroke_bw[i];
2259 for (
int i = 0; i < totedges; i++) {
2260 stroke[array_len] = stroke_fw[i];
2266 gpf_stroke,
MAX2(stroke_mat_index, 0), array_len + 1, thickness * thickness,
false);
2271 gped = &gp_edges[
v];
2280 pt = &gps_stroke->
points[1];
2289 for (
int i = 1; i < array_len; i++) {
2291 gped = &gp_edges[
v];
2293 pt = &gps_stroke->
points[i + 1];
2316 const float color[4],
2317 const bool use_stroke,
2318 const bool use_fill,
2351 for (
int i = 0; i < ob->
totcol; i++) {
2397 const int thickness,
2399 const float matrix[4][4],
2400 const int frame_offset,
2401 const bool use_seams,
2402 const bool use_faces)
2415 int mpoly_len = me_eval->
totpoly;
2416 char element_name[200];
2423 const float default_colors[2][4] = {{0.0f, 0.0f, 0.0f, 1.0f}, {0.7f, 0.7f, 0.7f, 1.0f}};
2428 if (stroke_mat_index == -1) {
2430 bmain, ob_gp, element_name, default_colors[0],
true,
false, &stroke_mat_index);
2437 if (mpoly_len > 0) {
2441 if (gpl_fill ==
NULL) {
2447 for (i = 0, mp = mpoly; i < mpoly_len; i++, mp++) {
2453 ob_mesh->
id.
name + 2, (ma !=
NULL) ? ma->
id.
name + 2 :
"Fill", 64, element_name);
2455 if (mat_idx == -1) {
2471 for (
int j = 0; j < mp->
totloop; j++, ml++) {
2494 if (gpl_stroke ==
NULL) {
2501 ob_eval, gpd, gpf_stroke, stroke_mat_index,
angle, thickness, offset, matrix, use_seams);
2535 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2550 int total_points = 0;
2571 return total_points;
2595 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2626 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2642 const float mat[4][4])
2663 for (pt = gps->
points, i = 0; i < gps->totpoints; pt++, i++) {
2684 float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
2689 for (
int i = 0; i < gps->
totpoints; i++) {
2700 for (
int i = 0; i < gps->
totpoints / 2; i++) {
2716 point2 = &gps->
points[end];
2717 point->
x = point2->
x;
2718 point->
y = point2->
y;
2719 point->
z = point2->
z;
2727 point = &gps->
points[end];
2771 for (
int i = 0; i < totpoints; i++) {
2772 pt_final = &join_stroke->
points[i];
2773 if (i < gps_last->totpoints) {
2774 pt = &gps_last->
points[e1];
2778 pt = &gps_first->
points[e2];
2786 pt_final->
time = delta;
2803 for (
int i = 0; i < totpoints; i++) {
2804 dvert_dst = &join_stroke->
dvert[i];
2806 if (i < gps_last->totpoints) {
2807 if (gps_last->
dvert) {
2808 dvert_src = &gps_last->
dvert[e1];
2813 if (gps_first->
dvert) {
2814 dvert_src = &gps_first->
dvert[e2];
2819 if ((dvert_src) && (dvert_src->
dw)) {
2859 const bool flat_cap,
2863 "gp_point_islands");
2864 bool in_island =
false;
2865 int num_islands = 0;
2873 for (
int i = 0; i < gps->
totpoints; i++, pt++) {
2874 if (pt->
flag & tag_flags) {
2884 idx = num_islands - 1;
2892 idx = num_islands - 1;
2905 for (idx = 0; idx < num_islands; idx++) {
2913 if ((is_cyclic) && (gps_first ==
NULL)) {
2914 gps_first = new_stroke;
2924 "gp delete stroke fragment");
2925 memcpy(new_stroke->
points,
2933 "gp delete stroke fragment weight");
2934 memcpy(new_stroke->
dvert,
2940 for (
int i = 0; i < new_stroke->
totpoints; i++) {
2943 if (dvert_src->
dw) {
2964 pts = new_stroke->
points;
2965 for (j = 0; j < new_stroke->
totpoints; j++, pts++) {
2976 if ((limit > 0) && (new_stroke->
totpoints <= limit)) {
2992 if ((is_cyclic) && (gps_first !=
NULL) && (gps_first != new_stroke)) {
3027 if (prev_selected ==
true && selected ==
false) {
3031 if ((prev_selected ==
false && selected ==
true) || (selected ==
false && i == idx_last)) {
3033 idx_end = selected ? i - 1 : i;
3034 int island_length = idx_end - idx_start + 1;
3037 if (island_length == 1) {
3039 if (idx_start > 0 && idx_end < idx_last) {
3040 prev_selected = selected;
3045 prev_selected = selected;
3055 if (gps_first ==
NULL) {
3056 gps_first = new_stroke;
3077 gps_last = new_stroke;
3079 prev_selected = selected;
3083 if (is_cyclic && gps_first !=
NULL && gps_last !=
NULL && gps_first != gps_last) {
3117 const float delta[3],
3130 if (dvert !=
NULL) {
3138 newpoint->
x = point->
x * delta[0];
3139 newpoint->
y = point->
y * delta[1];
3140 newpoint->
z = point->
z * delta[2];
3144 newpoint->
time = point->
time + deltatime;
3150 if (dvert !=
NULL) {
3164 const bool leave_gaps,
3165 const bool fit_thickness)
3170 const float delta[3] = {1.0f, 1.0f, 1.0f};
3171 float deltatime = 0.0f;
3183 float start_a[3], start_b[3], end_a[3], end_b[3];
3198 bool flip_a =
false;
3199 bool flip_b =
false;
3200 float lowest = dist;
3203 if (dist < lowest) {
3210 if (dist < lowest) {
3217 if (dist < lowest) {
3234 deltatime = point.
time;
3239 point = gps_b->
points[0];
3243 const float ratio = (fit_thickness && gps_a->
thickness > 0.0f) ?
3248 for (i = 0, pt = gps_b->
points; i < gps_b->totpoints && pt; i++, pt++) {
3268 if (gpf_new ==
NULL) {
3272 if (gpf_new ==
NULL) {
3277 if (gps_new ==
NULL) {
3320 if (dvert !=
NULL) {
3364 const bool has_dverts = (gps->
dvert !=
NULL);
3371 for (
uint32_t i = 0; i < totpoints; ++i) {
3393 int num_points_needed = target_number - totpoints;
3396 while (num_points_needed > 0) {
3411 if (sp->
dw && sp_next->
dw) {
3430 num_points_needed--;
3477 if (temp->dw !=
NULL) {
3495 const float diff_mat[4][4])
3497 for (
int i = 0; i < gps->
totpoints; i++) {
3514 const float diff_mat[4][4])
3516 float inverse_diff_mat[4][4];
3519 for (
int i = 0; i < gps->
totpoints; i++) {
3563 int num_points = (int)(((1 << (subdivisions + 1)) - 1) * (
angle /
M_PI));
3564 if (num_points > 0) {
3565 float angle_incr =
angle / (
float)num_points;
3580 for (
int i = 0; i < num_points - 1; i++) {
3581 tmp_angle = (i + 1) * angle_incr;
3585 vec_p[2] = center_pt[2];
3595 last_point = new_point;
3598 return num_points - 1;
3609 int num_points = (1 << (subdivisions + 1)) + 1;
3613 float vec_center[2];
3620 float angle_incr =
M_PI / ((
float)num_points - 1);
3623 for (
int i = 1; i < num_points; i++) {
3624 float angle = i * angle_incr;
3629 vec_p[2] = center_pt[2];
3634 last_point = new_point;
3637 return num_points - 1;
3641 const float other_point[4],
3654 cap_nvec[1] = radius;
3657 cap_nvec[0] = -cap_vec[1];
3658 cap_nvec[1] = cap_vec[0];
3661 float cap_nvec_inv[2];
3664 float vec_perimeter[3];
3668 float vec_perimeter_inv[3];
3670 add_v2_v2(vec_perimeter_inv, cap_nvec_inv);
3683 return num_points + 2;
3695 int *r_num_perimeter_points)
3702 float defaultpixsize = 1000.0f / gpd->
pixfactor;
3707 int num_perimeter_points = 0;
3712 float first_radius = stroke_radius * first->
pressure;
3713 float last_radius = stroke_radius * last->
pressure;
3718 first_next = &gps->
points[1];
3728 float first_next_pt[3];
3729 float last_prev_pt[3];
3737 first_next_pt[0] += 1.0f;
3738 last_prev_pt[0] -= 1.0f;
3743 first_pt, first_next_pt, first_radius, perimeter_right_side, subdivisions, gps->
caps[0]);
3746 float curr_pt[3], next_pt[3], prev_pt[3];
3747 float vec_next[2], vec_prev[2];
3748 float nvec_next[2], nvec_prev[2];
3749 float nvec_next_pt[3], nvec_prev_pt[3];
3750 float vec_tangent[2];
3752 float vec_miter_left[2], vec_miter_right[2];
3753 float miter_left_pt[3], miter_right_pt[3];
3755 for (
int i = 1; i < gps->
totpoints - 1; i++) {
3759 float radius = stroke_radius * curr->
pressure;
3767 float prev_length =
len_v2(vec_prev);
3768 float next_length =
len_v2(vec_next);
3779 nvec_prev[0] = -vec_prev[1];
3780 nvec_prev[1] = vec_prev[0];
3782 nvec_next[0] = -vec_next[1];
3783 nvec_next[1] = vec_next[0];
3790 vec_miter_left[0] = -vec_tangent[1];
3791 vec_miter_left[1] = vec_tangent[0];
3794 float an1 =
dot_v2v2(vec_miter_left, nvec_prev);
3798 float miter_length = radius / an1;
3799 if (miter_length <= 0.0f) {
3800 miter_length = 0.01f;
3826 num_perimeter_points += 2;
3845 num_perimeter_points += 2;
3848 perimeter_left_side, normal_prev, normal_next, curr_pt, subdivisions,
true);
3850 if (miter_length < prev_length && miter_length < next_length) {
3852 add_v2_v2(miter_right_pt, vec_miter_right);
3862 num_perimeter_points++;
3880 num_perimeter_points += 2;
3883 perimeter_right_side, normal_prev, normal_next, curr_pt, subdivisions,
false);
3885 if (miter_length < prev_length && miter_length < next_length) {
3887 add_v2_v2(miter_left_pt, vec_miter_left);
3897 num_perimeter_points++;
3904 last_pt, last_prev_pt, last_radius, perimeter_right_side, subdivisions, gps->
caps[1]);
3909 perimeter_right_side);
3910 ListBase *perimeter_list = perimeter_left_side;
3918 if (
compare_v3v3(close_pt, &close_first->
x, FLT_EPSILON) ==
false) {
3921 num_perimeter_points++;
3928 *r_num_perimeter_points = num_perimeter_points;
3929 return perimeter_list;
3942 const int subdivisions,
3943 const float diff_mat[4][4])
3952 if (cyclic && (gps_temp->
totpoints > 1)) {
3966 int num_perimeter_points = 0;
3968 gpd, gpl, gps_temp, subdivisions, &num_perimeter_points);
3970 if (num_perimeter_points == 0) {
4001 return perimeter_stroke;
4013 for (
int i = 0; i < gps->
totpoints; i++) {
4029 for (
int i = 0; i < gps->
totpoints; i++) {
4031 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 bGPDstroke * BKE_gpencil_stroke_add(struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, const bool insert_at_head)
struct Material * BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index)
void BKE_gpencil_free_stroke_weights(struct bGPDstroke *gps)
void BKE_gpencil_free_point_weights(struct MDeformVert *dvert)
struct bGPDstroke * BKE_gpencil_stroke_add_existing_style(struct bGPDframe *gpf, struct bGPDstroke *existing, int mat_idx, int totpoints, short thickness)
struct bGPDcurve * BKE_gpencil_stroke_editcurve_new(const int tot_curve_points)
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
struct bGPDstroke * BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src, const bool dup_points, const bool dup_curve)
int BKE_gpencil_material_find_index_by_name_prefix(struct Object *ob, const char *name_prefix)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive)
void BKE_gpencil_frame_selected_hash(struct bGPdata *gpd, struct GHash *r_list)
void BKE_gpencil_stroke_update_geometry_from_editcurve(struct bGPDstroke *gps, const uint resolution, const 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)
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(struct Object *object)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_int_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
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 line_point_factor_v3(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])
void closest_to_line_segment_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])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
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)
void rotate_v2_v2fl(float r[2], const float p[2], const float angle)
MINLINE bool compare_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[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 normal_short_to_float_v3(float r[3], const short n[3])
MINLINE void mul_v2_fl(float r[2], float f)
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const 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])
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])
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 normalize_v2_length(float r[2], const float unit_scale)
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
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
MINLINE bool is_zero_v2(const float a[3]) 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 void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v2(float r[2])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void BLI_polyfill_calc(const float(*coords)[2], const unsigned int coords_tot, const int coords_sign, unsigned int(*r_tris)[3])
#define SNPRINTF(dst, format,...)
void BLI_str_replace_char(char *string, char src, char dst) ATTR_NONNULL()
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
#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 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 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 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 RGB to Bright Vector Camera CLAMP
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
bool closest(btVector3 &v)
const Depsgraph * depsgraph
void BKE_gpencil_stroke_flip(bGPDstroke *gps)
static tPerimeterPoint * new_perimeter_point(const float pt[3])
bool BKE_gpencil_stroke_stretch(bGPDstroke *gps, const float dist, const float tip_length)
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)
struct tSamplePoint tSamplePoint
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)
void BKE_gpencil_stroke_join(bGPDstroke *gps_a, bGPDstroke *gps_b, const bool leave_gaps, const bool fit_thickness)
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_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)
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 *ratio_result, int *index_from, int *index_to)
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)
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)
struct tSampleEdge tSampleEdge
bool BKE_gpencil_stroke_shrink(bGPDstroke *gps, const float dist)
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)
bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf)
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_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)
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])
static int gpencil_material_find_index_by_name(Object *ob, const char *name)
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)
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)
struct tPerimeterPoint tPerimeterPoint
void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4])
bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float influence)
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)
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_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)
static int stroke_march_count(const bGPDstroke *gps, const float dist)
void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
static tSampleEdge * new_sample_edge_from_sample_points(tSamplePoint *from, tSamplePoint *to)
float BKE_gpencil_stroke_segment_length(const struct bGPDstroke *gps, const int start_index, const int end_index, bool use_3d)
static int stroke_march_next_point_no_interp(const bGPDstroke *gps, const int index_next_pt, const float *current, const float dist, float *result)
int BKE_gpencil_stroke_point_count(bGPdata *gpd)
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])
struct tGPDeleteIsland tGPDeleteIsland
bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float influence)
bool BKE_gpencil_stroke_smooth_uv(bGPDstroke *gps, int point_index, float influence)
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)
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
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)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
struct MaterialGPencilStyle * gp_style
bGPDcurve_point * curve_points
struct bGPDspoint * pt_orig
bGPDspoint_Runtime runtime
struct bGPDcurve * editcurve
struct MDeformVert * dvert
int curve_edit_resolution
struct tPerimeterPoint * next
struct tPerimeterPoint * prev
struct MDeformWeight * dw
struct tSamplePoint * next
struct tSamplePoint * prev
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
__forceinline avxf cross(const avxf &a, const avxf &b)
__forceinline BoundBox intersect(const BoundBox &a, const BoundBox &b)