diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-11-30 06:10:46 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-11-30 06:10:46 +0300 |
commit | 7fd2a2da6fe7c57aecfe615725f57156e1f37721 (patch) | |
tree | c40375d733955dd99da6d77b897cd10eaa9aa8fb /source/blender/editors/gpencil | |
parent | caa11aae048639e6569d22c11af256447c8eb395 (diff) |
* Grease Pencil drawing now works with Repeat Last operator. Stroke info is now saved when drawing strokes, but unfortunately, the post-draw settings tweaking doesn't work from the toolbar still (due to missing region context info)
* Added some update callbacks/flags for F-Curve properties, so changing the colour of an F-Curve updates in realtime.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index dce49cc4845..3f9e3e04411 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -151,11 +151,11 @@ static int gpencil_draw_poll (bContext *C) return (gpencil_data_get_pointers(C, NULL) != NULL); } -static int gpencil_project_check(tGPsdata *p) +/* check if projecting strokes into 3d-geometry in the 3D-View */ +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) ) @@ -227,12 +227,14 @@ 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) { if(gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out))) { - /* pass */ + /* projecting onto 3D-Geometry + * - nothing more needs to be done here, since view_autodist_simple() has already done it + */ } 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. @@ -241,9 +243,9 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[]) * - 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); @@ -1136,6 +1138,8 @@ static void gpencil_draw_exit (bContext *C, wmOperator *op) /* cleanup */ if(gpencil_project_check(p)) { View3D *v3d= p->sa->spacedata.first; + + /* need to restore the original projection settings before packing up */ view3d_operator_needs_opengl(C); view_autodist_init(p->scene, p->ar, v3d); } @@ -1206,8 +1210,8 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even { tGPsdata *p= op->customdata; ARegion *ar= p->ar; - //PointerRNA itemptr; - //float mousef[2]; + PointerRNA itemptr; + float mousef[2]; int tablet=0; /* convert from window-space to area-space mouse coordintes */ @@ -1242,7 +1246,6 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even return; } -#if 0 // NOTE: disabled for now, since creating this data is currently useless anyways (and slows things down) /* fill in stroke data (not actually used directly by gpencil_draw_apply) */ RNA_collection_add(op->ptr, "stroke", &itemptr); @@ -1250,7 +1253,6 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even mousef[1]= p->mval[1]; RNA_float_set_array(&itemptr, "mouse", mousef); RNA_float_set(&itemptr, "pressure", p->pressure); -#endif /* apply the current latest drawing point */ gpencil_draw_apply(C, op, p); @@ -1261,7 +1263,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even /* ------------------------------- */ -/* operator 'redo' (i.e. after changing some properties) */ +/* operator 'redo' (i.e. after changing some properties, but also for repeat last) */ static int gpencil_draw_exec (bContext *C, wmOperator *op) { tGPsdata *p = NULL; @@ -1462,6 +1464,5 @@ void GPENCIL_OT_draw (wmOperatorType *ot) /* settings for drawing */ RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements."); - // xxx the stuff below is used only for redo operator, but is not really working RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } |