[Bf-blender-cvs] [64c96f15] GPencil_Editing_Stage3: GP Sculpt: Assorted tweaks to investigate problems with Twist brush

Joshua Leung noreply at git.blender.org
Mon Sep 28 15:36:50 CEST 2015


Commit: 64c96f15fe71e3cac814b83d17d66a74c7c3a146
Author: Joshua Leung
Date:   Tue Sep 29 01:52:59 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB64c96f15fe71e3cac814b83d17d66a74c7c3a146

GP Sculpt: Assorted tweaks to investigate problems with Twist brush

* Some of the problems stem from inaccuracies/noise introduced by the 2D -> 3D
  conversion that takes place. For some reason, some verts randomly get offsets
  when reprojecting everything.

* Twist brush strength isn't 1.0 degree anymore

* It still doesn't work well though :(

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index ddbd26e..02f5c91 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -580,11 +580,10 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso, bGPDstroke *gps, int i,
 	float angle, inf;
 	
 	/* Angle to rotate by */
-	// FIXME: falloffs for this brush don't work that great
-	//inf = gp_brush_influence_calc(gso, radius, co);
-	//angle = DEG2RADF(1.0f) * inf; // XXX: base value needs work
+	inf = gp_brush_influence_calc(gso, radius, co);
+	angle = DEG2RADF(1.0f) * inf;
 	
-	angle = DEG2RAD(1.0f);
+	//angle = DEG2RAD(1.0f);
 	
 	if (gp_brush_invert_check(gso)) {
 		/* invert angle that we rotate by */
@@ -613,6 +612,7 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso, bGPDstroke *gps, int i,
 	if (gps->flag & GP_STROKE_3DSPACE) {
 		/* 3D: Project to 3D space */
 		if (gso->sa->spacetype == SPACE_VIEW3D) {
+			// XXX: this conversion process sometimes introduces noise to the data -> some parts don't seem to move at all, while others get random offsets
 			gp_point_xy_to_3d(&gso->gsc, gso->scene, nco, &pt->x);
 		}
 		else {
@@ -1163,7 +1163,8 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
 	float mouse[2];
 	int tablet = 0;
 	
-	VECCOPY2D(mouse, event->mval);
+	mouse[0] = event->mval[0] + 1;
+	mouse[1] = event->mval[1] + 1;
 	
 	/* fill in stroke */
 	RNA_collection_add(op->ptr, "stroke", &itemptr);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 735bc3f..32c4a6d 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -383,6 +383,7 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, Scene *scene, const float screen
 	View3D *v3d = gsc->sa->spacedata.first;
 	RegionView3D *rv3d = gsc->ar->regiondata;
 	float *rvec = ED_view3d_cursor3d_get(scene, v3d);
+	float ref[3] = {rvec[0], rvec[1], rvec[2]};
 	float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
 	
 	float mval_f[2], mval_prj[2];
@@ -390,7 +391,7 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, Scene *scene, const float screen
 	
 	copy_v2_v2(mval_f, screen_co);
 	
-	if (ED_view3d_project_float_global(gsc->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+	if (ED_view3d_project_float_global(gsc->ar, ref, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
 		sub_v2_v2v2(mval_f, mval_prj, mval_f);
 		ED_view3d_win_to_delta(gsc->ar, mval_f, dvec, zfac);
 		sub_v3_v3v3(r_out, rvec, dvec);




More information about the Bf-blender-cvs mailing list