diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-01 19:46:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-01 19:46:27 +0300 |
commit | 7cc72d5830c8440a2b05ef15f1eeba42c615fdc3 (patch) | |
tree | 7b9bf27bbc8760e5cfbf165ebea302a690603857 /source/blender/editors | |
parent | 11e529f4f77e6eae519f7b2b91055cf8b2d459ba (diff) |
grease pencil stroke depth option, rather then snapping to geometry you can draw over existing grease pencil lines. makes it easuer to draw 3D shapes with grease pencil.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_buttons.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 1 |
6 files changed, 41 insertions, 8 deletions
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 54dd43160a6..4f12f072e72 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -254,16 +254,18 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi } /* draw gpd drawing settings first ------------------------------------- */ - col= uiLayoutColumn(layout, 0); + col= uiLayoutColumn(layout, 1); /* label */ uiItemL(col, "Drawing Settings:", 0); /* 'stick to view' option */ //uiItemR(col, NULL, 0, &gpd_ptr, "draw_mode", 0); - row= uiLayoutRow(layout, 1); + row= uiLayoutRow(col, 1); uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "VIEW"); uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "CURSOR"); - uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "DEPTH"); + row= uiLayoutRow(col, 1); + uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "SURFACE"); + uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "STROKE"); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 905f8c482e9..d48ff411f10 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -155,7 +155,7 @@ static int gpencil_draw_poll (bContext *C) static int gpencil_project_check (tGPsdata *p) { bGPdata *gpd= p->gpd; - return ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) && (p->gpd->flag & GP_DATA_VIEWDEPTH)) ? 1:0; + return ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) && (p->gpd->flag & (GP_DATA_DEPTH_VIEW | GP_DATA_DEPTH_STROKE))) ? 1:0; } /* ******************************************* */ @@ -1165,7 +1165,7 @@ static void gpencil_draw_exit (bContext *C, wmOperator *op) /* need to restore the original projection settings before packing up */ view3d_operator_needs_opengl(C); - view_autodist_init(p->scene, p->ar, v3d); + view_autodist_init(p->scene, p->ar, v3d, (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1:0); } gp_paint_cleanup(p); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 2e439f8fdef..b087829d6b0 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -127,7 +127,7 @@ unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, short *mval, float mouse_worldloc[3]); /* only draw so view_autodist_simple can be called many times after */ -int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d); +int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); int view_autodist_simple(struct ARegion *ar, short *mval, float mouse_worldloc[3], float *force_depth); int view_autodist_depth(struct ARegion *ar, short *mval, float *depth); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 2cef7461e85..f251e54ead1 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1643,6 +1643,29 @@ void view3d_update_depths(ARegion *ar, View3D *v3d) } } +void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) +{ + RegionView3D *rv3d= ar->regiondata; + Scene *sce; + + setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ + setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ + + mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + invert_m4_m4(rv3d->persinv, rv3d->persmat); + invert_m4_m4(rv3d->viewinv, rv3d->viewmat); + + glClear(GL_DEPTH_BUFFER_BIT); + + wmLoadMatrix(rv3d->viewmat); + + v3d->zbuf= TRUE; + glEnable(GL_DEPTH_TEST); + + draw_gpencil_3dview_ext(scene, ar, 1); + return; +} + void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *)) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index bfd2ecb4939..87219b16dd2 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2265,12 +2265,19 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou return 1; } -int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d) //, float *autodist ) +int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist ) { RegionView3D *rv3d= ar->regiondata; /* Get Z Depths, needed for perspective, nice for ortho */ - draw_depth(scene, ar, v3d, NULL); + switch(mode) { + case 0: + draw_depth(scene, ar, v3d, NULL); + break; + case 1: + draw_depth_gpencil(scene, ar, v3d); + break; + } /* force updating */ if (rv3d->depths) { diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index a8e140dbca3..a5d4c61bc01 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -116,6 +116,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* view3d_draw.c */ void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void *)); +void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void view3d_clr_clipping(void); void view3d_set_clipping(RegionView3D *rv3d); void add_view3d_after(View3D *v3d, Base *base, int type, int flag); |