[Bf-blender-cvs] [a9664fa6662] blender2.8: GP: Fix unreported surface missing strokes
Antonioya
noreply at git.blender.org
Thu Aug 30 16:43:06 CEST 2018
Commit: a9664fa6662d5ca03c8bc4f43398d4ffe2a65f35
Author: Antonioya
Date: Thu Aug 30 16:42:03 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa9664fa6662d5ca03c8bc4f43398d4ffe2a65f35
GP: Fix unreported surface missing strokes
When drawing in surface mode if the stroke z-depth was not valid, the stroke was created, but it was not visible because location was something illogical.
Now, if the z-depth cannot be calculated, the stroke is calculated as it was done in other modes.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 9822f4a1029..db698afcc1a 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -383,34 +383,38 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
+
+ /* if no valid zdepth, use default mode drawing. */
+ if (*depth <= 1.0f) {
+ return;
+ }
}
- else {
- float mval_prj[2];
- float rvec[3], dvec[3];
- float mval_f[2];
- copy_v2fl_v2i(mval_f, mval);
- float zfac;
-
- /* Current method just converts each point in screen-coordinates to
- * 3D-coordinates using the 3D-cursor as reference. In general, this
- * works OK, but it could of course be improved.
- *
- * TODO:
- * - investigate using nearest point(s) on a previous stroke as
- * reference point instead or as offset, for easier stroke matching
- */
- gp_get_3d_reference(p, rvec);
- zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
+ float mval_prj[2];
+ float rvec[3], dvec[3];
+ float mval_f[2];
+ copy_v2fl_v2i(mval_f, mval);
+ float zfac;
- if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
- sub_v2_v2v2(mval_f, mval_prj, mval_f);
- ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
- sub_v3_v3v3(out, rvec, dvec);
- }
- else {
- zero_v3(out);
- }
+ /* Current method just converts each point in screen-coordinates to
+ * 3D-coordinates using the 3D-cursor as reference. In general, this
+ * works OK, but it could of course be improved.
+ *
+ * TODO:
+ * - investigate using nearest point(s) on a previous stroke as
+ * reference point instead or as offset, for easier stroke matching
+ */
+
+ gp_get_3d_reference(p, rvec);
+ zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
+
+ if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ sub_v2_v2v2(mval_f, mval_prj, mval_f);
+ ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
+ sub_v3_v3v3(out, rvec, dvec);
+ }
+ else {
+ zero_v3(out);
}
}
}
More information about the Bf-blender-cvs
mailing list