[Bf-blender-cvs] [9d30adb7ebd] master: Cleanup: Rename function `gpencil_point_to_parent_space`
Antonio Vazquez
noreply at git.blender.org
Sun Oct 2 13:42:52 CEST 2022
Commit: 9d30adb7ebdca322e8fb15c91ef50b90dead085b
Author: Antonio Vazquez
Date: Sun Oct 2 13:38:25 2022 +0200
Branches: master
https://developer.blender.org/rB9d30adb7ebdca322e8fb15c91ef50b90dead085b
Cleanup: Rename function `gpencil_point_to_parent_space`
gpencil_point_to_parent_space -> gpencil_point_to_world_space
The old name was not clear because it looked it was moving into
the object space, but really is doing the opposite.
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/gpencil/gpencil_interpolate.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_sculpt_paint.c
M source/blender/editors/gpencil/gpencil_select.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/gpencil/gpencil_vertex_paint.c
M source/blender/editors/gpencil/gpencil_weight_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 2615f70a21a..9d101490283 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -5460,7 +5460,7 @@ static bool gpencil_test_lasso(bGPDstroke *gps,
const struct GP_SelectLassoUserData *data = user_data;
bGPDspoint pt2;
int x0, y0;
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0);
/* test if in lasso */
return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) &&
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index e288c6c4aca..03d4df61e14 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -429,7 +429,7 @@ static void gpencil_load_array_strokes(tGPDfill *tgpf)
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
bGPDspoint pt2;
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy_fl(
&tgpf->gsc, gps, &pt2, &stroke->points2d[i][0], &stroke->points2d[i][1]);
}
@@ -597,11 +597,11 @@ static void gpencil_cut_extensions(tGPDfill *tgpf)
/* First stroke. */
bGPDspoint *pt = &gps_a->points[0];
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy_fl(&tgpf->gsc, gps_a, &pt2, &a1xy[0], &a1xy[1]);
pt = &gps_a->points[1];
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy_fl(&tgpf->gsc, gps_a, &pt2, &a2xy[0], &a2xy[1]);
bGPDspoint *extreme_a = &gps_a->points[1];
@@ -624,11 +624,11 @@ static void gpencil_cut_extensions(tGPDfill *tgpf)
}
pt = &gps_b->points[0];
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy_fl(&tgpf->gsc, gps_b, &pt2, &b1xy[0], &b1xy[1]);
pt = &gps_b->points[1];
- gpencil_point_to_parent_space(pt, diff_mat, &pt2);
+ gpencil_point_to_world_space(pt, diff_mat, &pt2);
gpencil_point_to_xy_fl(&tgpf->gsc, gps_b, &pt2, &b2xy[0], &b2xy[1]);
bGPDspoint *extreme_b = &gps_b->points[1];
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 3b797e7e4c8..4847e3eabf3 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -276,15 +276,15 @@ void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc,
float *r_y);
/**
- * Convert point to parent space
+ * Convert point to world space
*
* \param pt: Original point
- * \param diff_mat: Matrix with the difference between original parent matrix
+ * \param diff_mat: Matrix with the transformation
* \param[out] r_pt: Pointer to new point after apply matrix
*/
-void gpencil_point_to_parent_space(const bGPDspoint *pt,
- const float diff_mat[4][4],
- bGPDspoint *r_pt);
+void gpencil_point_to_world_space(const bGPDspoint *pt,
+ const float diff_mat[4][4],
+ bGPDspoint *r_pt);
/**
* Change points position relative to parent object
*/
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index dc63acf5136..4cd2bebe4a7 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -167,20 +167,20 @@ static bool gpencil_stroke_need_flip(Depsgraph *depsgraph,
/* Line from start of strokes. */
pt = &gps_from->points[0];
- gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps);
+ gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps);
gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_start[0], &v_from_start[1]);
pt = &gps_to->points[0];
- gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps);
+ gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps);
gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_start[0], &v_to_start[1]);
/* Line from end of strokes. */
pt = &gps_from->points[gps_from->totpoints - 1];
- gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps);
+ gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps);
gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_end[0], &v_from_end[1]);
pt = &gps_to->points[gps_to->totpoints - 1];
- gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps);
+ gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps);
gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_end[0], &v_to_end[1]);
const bool isect_lines = (isect_seg_seg_v2(v_from_start, v_to_start, v_from_end, v_to_end) ==
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 9a067dc018f..80600abcf78 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1551,7 +1551,7 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
/* only process if it hasn't been masked out... */
if (!(p->flags & GP_PAINTFLAG_SELECTMASK) || (gps->points->flag & GP_SPOINT_SELECT)) {
bGPDspoint pt_temp;
- gpencil_point_to_parent_space(gps->points, p->diff_mat, &pt_temp);
+ gpencil_point_to_world_space(gps->points, p->diff_mat, &pt_temp);
gpencil_point_to_xy(&p->gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
/* Do bound-box check first. */
if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) {
@@ -1575,7 +1575,7 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
/* get points to work with */
pt1 = gps->points + i;
bGPDspoint npt;
- gpencil_point_to_parent_space(pt1, p->diff_mat, &npt);
+ gpencil_point_to_world_space(pt1, p->diff_mat, &npt);
gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]);
/* Do bound-box check first. */
@@ -1633,14 +1633,14 @@ static void gpencil_stroke_eraser_dostroke(tGPsdata *p,
}
bGPDspoint npt;
- gpencil_point_to_parent_space(pt1, p->diff_mat, &npt);
+ gpencil_point_to_world_space(pt1, p->diff_mat, &npt);
gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]);
- gpencil_point_to_parent_space(pt2, p->diff_mat, &npt);
+ gpencil_point_to_world_space(pt2, p->diff_mat, &npt);
gpencil_point_to_xy(&p->gsc, gps, &npt, &pc2[0], &pc2[1]);
if (pt0) {
- gpencil_point_to_parent_space(pt0, p->diff_mat, &npt);
+ gpencil_point_to_world_space(pt0, p->diff_mat, &npt);
gpencil_point_to_xy(&p->gsc, gps, &npt, &pc0[0], &pc0[1]);
}
else {
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 52e6200978c..c2e548397e3 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -1462,7 +1462,7 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
bGPDspoint pt_temp;
pt = &gps->points[0];
if ((is_masking && (pt->flag & GP_SPOINT_SELECT) != 0) || (!is_masking)) {
- gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp);
+ gpencil_point_to_world_space(gps->points, diff_mat, &pt_temp);
gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
@@ -1499,10 +1499,10 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
}
}
bGPDspoint npt;
- gpencil_point_to_parent_space(pt1, diff_mat, &npt);
+ gpencil_point_to_world_space(pt1, diff_mat, &npt);
gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]);
- gpencil_point_to_parent_space(pt2, diff_mat, &npt);
+ gpencil_point_to_world_space(pt2, diff_mat, &npt);
gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]);
/* Check that point segment of the bound-box of the selection stroke. */
@@ -1803,7 +1803,7 @@ static bool get_automasking_strokes_list(tGP_BrushEditData *gso)
bGPDspoint npt;
if (gps->totpoints == 1) {
- gpencil_point_to_parent_space(gps->points, bound_mat, &npt);
+ gpencil_point_to_world_space(gps->points, bound_mat, &npt);
gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]);
/* Only check if point is inside. */
@@ -1821,7 +1821,7 @@ static bool get_automasking_strokes_list(tGP_BrushEditData *gso)
pt2 = gps->points + i + 1;
/* Check first point. */
- gpencil_point_to_parent_space(pt1, bound_mat, &npt);
+ gpencil_point_to_world_space(pt1, bound_mat, &npt);
gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]);
if (len_v2v2_int(mval_i, pc1) <= radius) {
BLI_ghash_insert(gso->automasking_strokes, gps, gps);
@@ -1830,7 +1830,7 @@ static bool get_automasking_strokes_list(tGP_BrushEditData *gso)
}
/* Check second point. */
- gpencil_point_to_parent_space(pt2, bound_mat, &npt);
+ gpencil_point_to_world_space(pt2, bound_mat, &npt);
gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]);
if (len_v2v2_int(mval_i, pc2) <= radius) {
BLI_ghash_insert(gso->automasking_strokes, gps, gps);
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index 5c3724e6ea4..a8968111d93 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1497,7 +1497,7 @@ static b
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list