Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-03-01 02:56:28 +0300
committerCampbell Barton <campbell@blender.org>2022-03-01 03:18:17 +0300
commiteb0f8317e231c4a02940d0269125a96a47e94c7e (patch)
tree03c67854c72c5a4507f22f8c2321c14b2629fccd /source/blender/editors/gpencil/annotate_paint.c
parentae6400cfb4cae798667eab903d9c463fdec31298 (diff)
Cleanup: ED_view3d_win_to_delta & ED_view3d_calc_zfac usage
- Rename ED_view3d_win_to_delta `mval` argument to `xy_delta` as it as it was misleading since this is an screen-space offset not a region relative cursor position (typical use of the name `mval`). Also rename the variable passed to this function which also used the term `mval` in many places. - Re-order the output argument of ED_view3d_win_to_delta last. use an r_ prefix for return arguments. - Document how the `zfac` argument is intended to be used. - Split ED_view3d_calc_zfac into two functions as the `r_flip` argument was only used in some special cases.
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index b40dda146dc..5ab4a663efe 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -326,8 +326,7 @@ static void annotation_stroke_convertcoords(tGPsdata *p,
}
else {
float mval_prj[2];
- float rvec[3], dvec[3];
- float zfac;
+ float rvec[3];
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
@@ -339,13 +338,14 @@ static void annotation_stroke_convertcoords(tGPsdata *p,
*/
annotation_get_3d_reference(p, rvec);
- zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
+ const float zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec);
if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
- float mval_f[2];
- sub_v2_v2v2(mval_f, mval_prj, mval);
- ED_view3d_win_to_delta(p->region, mval_f, dvec, zfac);
+ float dvec[3];
+ float xy_delta[2];
+ sub_v2_v2v2(xy_delta, mval_prj, mval);
+ ED_view3d_win_to_delta(p->region, xy_delta, zfac, dvec);
sub_v3_v3v3(out, rvec, dvec);
}
else {