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>2012-12-17 06:34:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-17 06:34:53 +0400
commitf9ec10688a634f446e5666eead66e865a1595b67 (patch)
tree4fa07e07dcb83e33c818c5d3e339a46be7b2a30d /source/blender/editors
parentbc0e1211de9765f0c1fc5196f3d72eff06cfb6d4 (diff)
fix [#33501] Grease pencil in OpenGL render
With the view3d 'Render Only' option, grease pencil wouldn't draw, but for OpenGL render it did. Since grease pencil can be very useful in opengl renders, enable grease pencil drawing with 'Render Only' option in the viewport, and add a checkbox in the grease pencil header not to draw (unchecking each layer is annoying and applies to all spaces).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c7
-rw-r--r--source/blender/editors/include/ED_gpencil.h1
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c1
-rw-r--r--source/blender/editors/space_clip/space_clip.c14
-rw-r--r--source/blender/editors/space_image/image_buttons.c1
-rw-r--r--source/blender/editors/space_image/space_image.c13
-rw-r--r--source/blender/editors/space_node/node_buttons.c1
-rw-r--r--source/blender/editors/space_node/node_draw.c18
-rw-r--r--source/blender/editors/space_node/space_node.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c13
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c5
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c30
15 files changed, 79 insertions, 40 deletions
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 8a3c996a481..0aa109a0aef 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -312,6 +312,13 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
}
}
+void gpencil_panel_standard_header(const bContext *C, Panel *pa)
+{
+ PointerRNA ptr;
+ RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &ptr);
+
+ uiItemR(pa->layout, &ptr, "show_grease_pencil", 0, "", ICON_NONE);
+}
/* Standard panel to be included wherever Grease Pencil is used... */
void gpencil_panel_standard(const bContext *C, Panel *pa)
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 5cc1ecade3e..29d4097521d 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -81,6 +81,7 @@ void draw_gpencil_2dimage(const struct bContext *C);
void draw_gpencil_view2d(const struct bContext *C, short onlyv2d);
void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
+void gpencil_panel_standard_header(const struct bContext *C, struct Panel *pa);
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
/* ----------- Grease-Pencil AnimEdit API ------------------ */
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 969b0e25928..2cb6d8c9234 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -78,6 +78,7 @@ void ED_clip_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel gpencil");
strcpy(pt->idname, "CLIP_PT_gpencil");
strcpy(pt->label, "Grease Pencil");
+ pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
pt->flag |= PNL_DEFAULT_CLOSED;
pt->poll = clip_grease_pencil_panel_poll;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 7befa490d41..dc7b6d77c9e 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -246,7 +246,7 @@ static SpaceLink *clip_new(const bContext *C)
sc = MEM_callocN(sizeof(SpaceClip), "initclip");
sc->spacetype = SPACE_CLIP;
sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_MANUAL_CALIBRATION |
- SC_SHOW_GRAPH_TRACKS | SC_SHOW_GRAPH_FRAMES;
+ SC_SHOW_GRAPH_TRACKS | SC_SHOW_GRAPH_FRAMES | SC_SHOW_GPENCIL;
sc->zoom = 1.0f;
sc->path_length = 20;
sc->scopes.track_preview_height = 120;
@@ -1151,14 +1151,18 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
}
- /* Grease Pencil */
- clip_draw_grease_pencil((bContext *)C, 1);
+ if (sc->flag & SC_SHOW_GPENCIL) {
+ /* Grease Pencil */
+ clip_draw_grease_pencil((bContext *)C, TRUE);
+ }
/* reset view matrix */
UI_view2d_view_restore(C);
- /* draw Grease Pencil - screen space only */
- clip_draw_grease_pencil((bContext *)C, 0);
+ if (sc->flag & SC_SHOW_GPENCIL) {
+ /* draw Grease Pencil - screen space only */
+ clip_draw_grease_pencil((bContext *)C, FALSE);
+ }
}
static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn)
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 0a3db59096a..d02186e59dd 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -858,6 +858,7 @@ void image_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype image panel gpencil");
strcpy(pt->idname, "IMAGE_PT_gpencil");
strcpy(pt->label, "Grease Pencil");
+ pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 5616c025407..b0e9f8bcf99 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -151,6 +151,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
simage->spacetype = SPACE_IMAGE;
simage->zoom = 1.0f;
simage->lock = TRUE;
+ simage->flag = SI_SHOW_GPENCIL;
simage->iuser.ok = TRUE;
simage->iuser.fie_ima = 2;
@@ -674,16 +675,20 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
- /* Grease Pencil too (in addition to UV's) */
- draw_image_grease_pencil((bContext *)C, 1);
+ if (sima->flag & SI_SHOW_GPENCIL) {
+ /* Grease Pencil too (in addition to UV's) */
+ draw_image_grease_pencil((bContext *)C, TRUE);
+ }
/* sample line */
draw_image_sample_line(sima);
UI_view2d_view_restore(C);
- /* draw Grease Pencil - screen space only */
- draw_image_grease_pencil((bContext *)C, 0);
+ if (sima->flag & SI_SHOW_GPENCIL) {
+ /* draw Grease Pencil - screen space only */
+ draw_image_grease_pencil((bContext *)C, FALSE);
+ }
if (mask) {
int width, height;
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index da077d93641..300328f5fd4 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -184,6 +184,7 @@ void node_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil");
strcpy(pt->idname, "NODE_PT_gpencil");
strcpy(pt->label, "Grease Pencil");
+ pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
pt->poll = active_nodetree_poll;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 704bc70fa01..e1d5e4200b8 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1172,16 +1172,22 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
- /* draw grease-pencil ('canvas' strokes) */
- if (snode->nodetree)
- draw_gpencil_view2d(C, 1);
+ if (snode->flag & SNODE_SHOW_GPENCIL) {
+ /* draw grease-pencil ('canvas' strokes) */
+ if (snode->nodetree) {
+ draw_gpencil_view2d(C, TRUE);
+ }
+ }
/* reset view matrix */
UI_view2d_view_restore(C);
- /* draw grease-pencil (screen strokes, and also paintbuffer) */
- if (snode->nodetree)
- draw_gpencil_view2d(C, 0);
+ if (snode->flag & SNODE_SHOW_GPENCIL) {
+ /* draw grease-pencil (screen strokes, and also paintbuffer) */
+ if (snode->nodetree) {
+ draw_gpencil_view2d(C, FALSE);
+ }
+ }
/* scrollers */
scrollers = UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index fe880a7592b..513f6b43e9a 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -119,6 +119,8 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
snode = MEM_callocN(sizeof(SpaceNode), "initnode");
snode->spacetype = SPACE_NODE;
+ snode->flag = SNODE_SHOW_GPENCIL;
+
/* backdrop */
snode->zoom = 1.0f;
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 7dbcabedccc..bd4bb0896ed 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -58,6 +58,7 @@ void sequencer_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
strcpy(pt->idname, "SEQUENCER_PT_gpencil");
strcpy(pt->label, N_("Grease Pencil"));
+ pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 1a84efa0b50..9cc6b3d07a2 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1125,8 +1125,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
setlinestyle(0);
}
- /* draw grease-pencil (image aligned) */
- draw_gpencil_2dimage(C);
+ if (sseq->flag & SEQ_SHOW_GPENCIL) {
+ /* draw grease-pencil (image aligned) */
+ draw_gpencil_2dimage(C);
+ }
if (!scope)
IMB_freeImBuf(ibuf);
@@ -1134,9 +1136,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* ortho at pixel level */
UI_view2d_view_restore(C);
- /* draw grease-pencil (screen aligned) */
- draw_gpencil_view2d(C, 0);
-
+ if (sseq->flag & SEQ_SHOW_GPENCIL) {
+ /* draw grease-pencil (screen aligned) */
+ draw_gpencil_view2d(C, 0);
+ }
/* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index e8d47016608..436b649f3b1 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -120,6 +120,8 @@ static SpaceLink *sequencer_new(const bContext *C)
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
+ sseq->flag = SEQ_SHOW_GPENCIL;
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
@@ -306,8 +308,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
}
}
-static SpaceLink *sequencer_duplicate(SpaceLink *sl)
-{
+static SpaceLink *sequencer_duplicate(SpaceLink *sl){
SpaceSeq *sseqn = MEM_dupallocN(sl);
/* clear or remove stuff from old */
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 9faefbd4c2b..325e502f620 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -261,14 +261,11 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->gridlines = 16;
v3d->gridsubdiv = 10;
v3d->drawtype = OB_SOLID;
+
+ v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
- v3d->gridflag |= V3D_SHOW_X;
- v3d->gridflag |= V3D_SHOW_Y;
- v3d->gridflag |= V3D_SHOW_FLOOR;
- v3d->gridflag &= ~V3D_SHOW_Z;
-
- v3d->flag |= V3D_SELECT_OUTLINE;
- v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
+ v3d->flag = V3D_SELECT_OUTLINE;
+ v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_GPENCIL;
v3d->lens = 35.0f;
v3d->near = 0.01f;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 2d981f92af2..6a095a8d2b1 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1260,6 +1260,7 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil");
strcpy(pt->idname, "VIEW3D_PT_gpencil");
strcpy(pt->label, "Grease Pencil");
+ pt->draw_header = gpencil_panel_standard_header;
pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 31bfd9f45e0..7fccff861ab 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2169,7 +2169,9 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf = TRUE;
glEnable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, 1);
+ if (v3d->flag2 & V3D_SHOW_GPENCIL) {
+ draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ }
v3d->zbuf = zbuf;
@@ -2649,9 +2651,11 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
}
/* must be before xray draw which clears the depth buffer */
- if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, 1);
- if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->flag2 & V3D_SHOW_GPENCIL) {
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ draw_gpencil_view3d(scene, v3d, ar, TRUE);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ }
/* transp and X-ray afterdraw stuff */
if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
@@ -2675,8 +2679,11 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
/* draw grease-pencil stuff */
ED_region_pixelspace(ar);
- /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d(scene, v3d, ar, 0);
+
+ if (v3d->flag2 & V3D_SHOW_GPENCIL) {
+ /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
+ draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ }
/* freeing the images again here could be done after the operator runs, leaving for now */
GPU_free_images_anim();
@@ -3109,10 +3116,10 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
// REEB_draw();
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* must be before xray draw which clears the depth buffer */
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- draw_gpencil_view3d(scene, v3d, ar, 1);
+ draw_gpencil_view3d(scene, v3d, ar, TRUE);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
@@ -3178,9 +3185,10 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
Object *ob;
- /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- // if (v3d->flag2 & V3D_DISPGP)
- draw_gpencil_view3d(scene, v3d, ar, 0);
+ if (v3d->flag2 & V3D_SHOW_GPENCIL) {
+ /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
+ draw_gpencil_view3d(scene, v3d, ar, FALSE);
+ }
drawcursor(scene, ar, v3d);