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 <ideasman42@gmail.com>2009-11-30 04:13:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-30 04:13:46 +0300
commitdc1af66d8a971ce5855ba5ceae1052e001acfae6 (patch)
tree2397dacb44bc1b2bfc08b14dae4f5299cd973a3f /source/blender/editors/gpencil
parent3d1f2974899308b5a58d28493da6f9eab966564c (diff)
- grease pencil drawing on the surface of objects (only when enable face snap & projection, a bit hidden I know)
- retopo operator to convert grease pencil drawn topology into geometry, not in the convert menu yet since its not quite finished, use the operator search menu for retopo. will test this week and see what needs fixing.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c62
2 files changed, 45 insertions, 19 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index c2b9a1a4bb9..2f41d90b37c 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -531,7 +531,7 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
}
/* restore old active object */
- BASACT= base;
+ // BASACT= base; // removing since this is expected new objects are active.
}
/* --- */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 4229c66353c..dce49cc4845 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -151,6 +151,21 @@ static int gpencil_draw_poll (bContext *C)
return (gpencil_data_get_pointers(C, NULL) != NULL);
}
+static int gpencil_project_check(tGPsdata *p)
+{
+ bGPdata *gpd= p->gpd;
+
+ /* in 3d-space - pt->x/y/z are 3 side-by-side floats */
+ if( (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) &&
+ (p->scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE) &&
+ (p->scene->toolsettings->snap_flag & SCE_SNAP_PROJECT) )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
/* ******************************************* */
/* Calculations/Conversions */
@@ -211,24 +226,29 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[])
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
if (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) {
- const short mx=mval[0], my=mval[1];
- float rvec[3], dvec[3];
-
- /* 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
- * - investigate projection onto geometry (ala retopo)
- */
- gp_get_3d_reference(p, rvec);
-
- /* method taken from editview.c - mouse_cursor() */
- project_short_noclip(p->ar, rvec, mval);
- window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
- sub_v3_v3v3(out, rvec, dvec);
+ if(gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out))) {
+ /* pass */
+ }
+ else {
+ const short mx=mval[0], my=mval[1];
+ float rvec[3], dvec[3];
+
+ /* 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);
+
+ /* method taken from editview.c - mouse_cursor() */
+ project_short_noclip(p->ar, rvec, mval);
+ window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
+ sub_v3_v3v3(out, rvec, dvec);
+ }
}
/* 2d - on 'canvas' (assume that p->v2d is set) */
@@ -1114,6 +1134,12 @@ static void gpencil_draw_exit (bContext *C, wmOperator *op)
}
/* cleanup */
+ if(gpencil_project_check(p)) {
+ View3D *v3d= p->sa->spacedata.first;
+ view3d_operator_needs_opengl(C);
+ view_autodist_init(p->scene, p->ar, v3d);
+ }
+
gp_paint_cleanup(p);
gp_session_cleanup(p);