[Bf-blender-cvs] [b91ba21] GPencil_Editing_Stage3: GPencil: Don't draw onion skins during animation playback

Joshua Leung noreply at git.blender.org
Sun Aug 9 12:53:45 CEST 2015


Commit: b91ba21185791ccdcdf38e6ef227f039f2324abf
Author: Joshua Leung
Date:   Sat Aug 8 17:44:11 2015 +1200
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rBb91ba21185791ccdcdf38e6ef227f039f2324abf

GPencil: Don't draw onion skins during animation playback

* When playing back animations, onion skinning is temporarily disabled now
  so that the poses can be seen more clearly.

  - I've supposedly used the check which disables this for animation scrubbing,
    (I've tried both and checked the logic for each), but they don't seem to be
    working as advertised. So, for now, onionskins are still visible during scrubbing.

* Onion skinning is also disabled for rendering playblasts and for file previews/
  sequencer renders.

===================================================================

M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/include/ED_gpencil.h
M	source/blender/editors/space_view3d/view3d_draw.c

===================================================================

diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index b28c948..fd1db6e 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1172,6 +1172,7 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
 /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
 void ED_gpencil_draw_2dimage(const bContext *C)
 {
+	wmWindowManager *wm = CTX_wm_manager(C);
 	ScrArea *sa = CTX_wm_area(C);
 	ARegion *ar = CTX_wm_region(C);
 	Scene *scene = CTX_data_scene(C);
@@ -1224,6 +1225,13 @@ void ED_gpencil_draw_2dimage(const bContext *C)
 			break;
 	}
 	
+	if (ED_screen_animation_playing(wm)) {
+		/* don't show onionskins during animation playback/scrub (i.e. it obscures the poses)
+		 * OpenGL Renders (i.e. final output), or depth buffer (i.e. not real strokes)
+		 */
+		dflag |= GP_DRAWDATA_NO_ONIONS;
+	}
+	
 	
 	/* draw it! */
 	gp_draw_data_all(scene, gpd, offsx, offsy, sizex, sizey, CFRA, dflag, sa->spacetype);
@@ -1234,6 +1242,7 @@ void ED_gpencil_draw_2dimage(const bContext *C)
  * second time with onlyv2d=0 for screen-aligned strokes */
 void ED_gpencil_draw_view2d(const bContext *C, bool onlyv2d)
 {
+	wmWindowManager *wm = CTX_wm_manager(C);
 	ScrArea *sa = CTX_wm_area(C);
 	ARegion *ar = CTX_wm_region(C);
 	Scene *scene = CTX_data_scene(C);
@@ -1252,6 +1261,8 @@ void ED_gpencil_draw_view2d(const bContext *C, bool onlyv2d)
 	
 	/* draw it! */
 	if (onlyv2d) dflag |= (GP_DRAWDATA_ONLYV2D | GP_DRAWDATA_NOSTATUS);
+	if (ED_screen_animation_playing(wm)) dflag |= GP_DRAWDATA_NO_ONIONS;
+	
 	gp_draw_data_all(scene, gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag, sa->spacetype);
 	
 	/* draw status text (if in screen/pixel-space) */
@@ -1263,7 +1274,7 @@ void ED_gpencil_draw_view2d(const bContext *C, bool 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 ED_gpencil_draw_view3d(Scene *scene, View3D *v3d, ARegion *ar, bool only3d)
+void ED_gpencil_draw_view3d(wmWindowManager *wm, Scene *scene, View3D *v3d, ARegion *ar, bool only3d)
 {
 	bGPdata *gpd;
 	int dflag = 0;
@@ -1306,6 +1317,13 @@ void ED_gpencil_draw_view3d(Scene *scene, View3D *v3d, ARegion *ar, bool only3d)
 		dflag |= GP_DRAWDATA_NOSTATUS;
 	}
 	
+	if ((wm == NULL) || ED_screen_animation_playing(wm)) {
+		/* don't show onionskins during animation playback/scrub (i.e. it obscures the poses)
+		 * OpenGL Renders (i.e. final output), or depth buffer (i.e. not real strokes)
+		 */
+		dflag |= GP_DRAWDATA_NO_ONIONS;
+	}
+	
 	/* draw it! */
 	gp_draw_data_all(scene, gpd, offsx, offsy, winx, winy, CFRA, dflag, v3d->spacetype);
 	
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 448f2c8..adbc64c 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -42,6 +42,7 @@ struct bGPDlayer;
 struct bGPDframe;
 struct bGPDstroke;
 struct PointerRNA;
+struct wmWindowManager;
 struct wmKeyConfig;
 
 
@@ -100,7 +101,7 @@ void ED_gpencil_strokes_copybuf_free(void);
 
 void ED_gpencil_draw_2dimage(const struct bContext *C);
 void ED_gpencil_draw_view2d(const struct bContext *C, bool onlyv2d);
-void ED_gpencil_draw_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d);
+void ED_gpencil_draw_view3d(struct wmWindowManager *wm, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d);
 void ED_gpencil_draw_ex(struct Scene *scene, struct bGPdata *gpd, int winx, int winy,
                         const int cfra, const char spacetype);
 
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 0f4e05c..e45830e 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2358,7 +2358,7 @@ void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 	glEnable(GL_DEPTH_TEST);
 
 	if (v3d->flag2 & V3D_SHOW_GPENCIL) {
-		ED_gpencil_draw_view3d(scene, v3d, ar, true);
+		ED_gpencil_draw_view3d(NULL, scene, v3d, ar, true);
 	}
 	
 	v3d->zbuf = zbuf;
@@ -2865,9 +2865,11 @@ static void view3d_draw_objects(
 
 	/* must be before xray draw which clears the depth buffer */
 	if (v3d->flag2 & V3D_SHOW_GPENCIL) {
+		wmWindowManager *wm = (C != NULL) ? CTX_wm_manager(C) : NULL;
+		
 		/* must be before xray draw which clears the depth buffer */
 		if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-		ED_gpencil_draw_view3d(scene, v3d, ar, true);
+		ED_gpencil_draw_view3d(wm, scene, v3d, ar, true);
 		if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 	}
 
@@ -3239,7 +3241,7 @@ void ED_view3d_draw_offscreen(
 
 		if (v3d->flag2 & V3D_SHOW_GPENCIL) {
 			/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
-			ED_gpencil_draw_view3d(scene, v3d, ar, false);
+			ED_gpencil_draw_view3d(NULL, scene, v3d, ar, false);
 		}
 
 		/* freeing the images again here could be done after the operator runs, leaving for now */
@@ -3825,6 +3827,7 @@ static void view3d_main_area_draw_info(const bContext *C, Scene *scene,
                                        ARegion *ar, View3D *v3d,
                                        const char *grid_unit, bool render_border)
 {
+	wmWindowManager *wm = CTX_wm_manager(C);
 	RegionView3D *rv3d = ar->regiondata;
 	rcti rect;
 	
@@ -3848,7 +3851,7 @@ static void view3d_main_area_draw_info(const bContext *C, Scene *scene,
 
 	if (v3d->flag2 & V3D_SHOW_GPENCIL) {
 		/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
-		ED_gpencil_draw_view3d(scene, v3d, ar, false);
+		ED_gpencil_draw_view3d(wm, scene, v3d, ar, false);
 	}
 
 	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
@@ -3875,8 +3878,6 @@ static void view3d_main_area_draw_info(const bContext *C, Scene *scene,
 	}
 
 	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
-		wmWindowManager *wm = CTX_wm_manager(C);
-
 		if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_playing(wm)) {
 			ED_scene_draw_fps(scene, &rect);
 		}




More information about the Bf-blender-cvs mailing list