diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-09 11:03:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-09 11:03:43 +0300 |
commit | ae91ca7217414038442487ec76f192fd1e5ac584 (patch) | |
tree | 00bf015e3c1e48235723ed1c73acfbfe9e7f1e2b /source/blender | |
parent | 521af99f59c2233eaf503e5a878997ccc9051362 (diff) |
OpenGL grease pencil render
Algorith: needed to add some functions since offscreen render doesn't have a context pointer
- draw_gpencil_3dview_ext
- gpencil_data_get_active_v3d
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 19 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/include/ED_gpencil.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 8 |
4 files changed, 29 insertions, 7 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 81ee2378717..dcd57efa926 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -744,22 +744,27 @@ void draw_gpencil_2dview (bContext *C, short onlyv2d) /* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly * Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes */ -void draw_gpencil_3dview (bContext *C, short only3d) +void draw_gpencil_3dview_ext (Scene *scene, ARegion *ar, short only3d) { - ARegion *ar= CTX_wm_region(C); - Scene *scene= CTX_data_scene(C); bGPdata *gpd; int dflag = 0; - + /* check that we have grease-pencil stuff to draw */ - gpd= gpencil_data_get_active(C); // XXX - if (gpd == NULL) return; - + gpd= gpencil_data_get_active_v3d(scene); // XXX + if(gpd == NULL) return; + /* draw it! */ if (only3d) dflag |= (GP_DRAWDATA_ONLY3D|GP_DRAWDATA_NOSTATUS); gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag); } +void draw_gpencil_3dview (bContext *C, short only3d) +{ + ARegion *ar= CTX_wm_region(C); + Scene *scene= CTX_data_scene(C); + draw_gpencil_3dview_ext(scene, ar, only3d); +} + /* draw grease-pencil sketches to opengl render window assuming that matrices are already set correctly */ // XXX porting note, ogl render will probably be a window with one 3d region void draw_gpencil_oglrender (bContext *C) diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 8cf1affa8c6..6b76c48e1bf 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -155,6 +155,13 @@ bGPdata *gpencil_data_get_active (bContext *C) return (gpd_ptr) ? *(gpd_ptr) : NULL; } +/* needed for offscreen rendering */ +bGPdata *gpencil_data_get_active_v3d (Scene *scene) +{ + bGPdata *gpd= scene->basact ? scene->basact->object->gpd : NULL; + return gpd ? gpd : scene->gpd; +} + /* ************************************************ */ /* Panel Operators */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index ff95f8ce6eb..31c8e93c683 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -59,6 +59,7 @@ typedef struct tGPspoint { struct bGPdata **gpencil_data_get_pointers(struct bContext *C, struct PointerRNA *ptr); struct bGPdata *gpencil_data_get_active(struct bContext *C); +struct bGPdata *gpencil_data_get_active_v3d(struct Scene *scene); /* for offscreen rendering */ /* ----------- Grease Pencil Operators ----------------- */ @@ -71,6 +72,7 @@ void ED_operatortypes_gpencil(void); void draw_gpencil_2dimage(struct bContext *C, struct ImBuf *ibuf); void draw_gpencil_2dview(struct bContext *C, short onlyv2d); void draw_gpencil_3dview(struct bContext *C, short only3d); +void draw_gpencil_3dview_ext(struct Scene *scene, struct ARegion *ar, short only3d); void draw_gpencil_oglrender(struct bContext *C); void gpencil_panel_standard(const struct bContext *C, struct Panel *pa); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 64ea574b011..247800c3077 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2009,6 +2009,14 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, glDisable(GL_DEPTH_TEST); } + /* draw grease-pencil stuff */ + draw_gpencil_3dview_ext(scene, ar, 1); + + ED_region_pixelspace(ar); + + /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ + draw_gpencil_3dview_ext(scene, ar, 0); + GPU_free_images(); /* restore size */ |