[Bf-blender-cvs] [dcbe481] GPencil_Editing_Stage3: GP Sculpt: More WIP work to try and get this randomise brush working

Joshua Leung noreply at git.blender.org
Thu Jul 23 03:20:27 CEST 2015


Commit: dcbe481cfd2a0a886f58b7c56a29287199146711
Author: Joshua Leung
Date:   Thu Jul 23 01:33:21 2015 +1200
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rBdcbe481cfd2a0a886f58b7c56a29287199146711

GP Sculpt: More WIP work to try and get this randomise brush working

So it turns out that the screenspace-to-3d math is a lot more convoluted now
than would be initially obvious. The brush is now behaving a lot better now
in that it somewhat does what is expected. The results aren't really what we
really want yet, so some more experimentation is still needed.

===================================================================

M	source/blender/editors/gpencil/gpencil_brush.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 3f47f39..f9b556e 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -605,7 +605,23 @@ static bool gp_brush_randomise_apply(tGP_BrushEditData *gso, bGPDstroke *gps, in
 			float *rvec = ED_view3d_cursor3d_get(gso->scene, v3d);
 			float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
 			
-			ED_view3d_win_to_delta(gso->ar, nco, &pt->x, zfac);
+			float sco[2] = {(float)co[0], (float)co[1]};
+			float dvec[3], out[3];
+			
+			float *mval_f = nco;
+			float mval_prj[2];
+			
+			if (ED_view3d_project_float_global(gso->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(gso->ar, mval_f, dvec, zfac);
+				sub_v3_v3v3(out, rvec, dvec);
+			}
+			else {
+				zero_v3(out);
+			}
+			
+			printf("  out vs pt = (%f, %f, %f)  -> (%f, %f, %f)\n", out[0], out[1], out[2], pt->x, pt->y, pt->z);
+			copy_v3_v3(&pt->x, out);
 		}
 		else {
 			/* ERROR */




More information about the Bf-blender-cvs mailing list