[Bf-blender-cvs] [82afe5c324e] greasepencil-object: New Main switch at view level for Onion Skin

Antonio Vazquez noreply at git.blender.org
Sat Jul 7 19:17:35 CEST 2018


Commit: 82afe5c324e795eb2dfba25f62b0bb7442a42569
Author: Antonio Vazquez
Date:   Sat Jul 7 19:17:27 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB82afe5c324e795eb2dfba25f62b0bb7442a42569

New Main switch at view level for Onion Skin

The switch is on top of GP datablock onion switch and allows to show/hide all datablocks in the view.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 5a52be80116..34e05f60459 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4336,7 +4336,7 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
             if view.use_gpencil_grid:
                 layout.prop(view, "gpencil_grid_size", text="")
 
-        layout.prop(gpd, "use_onion_skinning", text="Onion Skin")
+        layout.prop(view, "use_gpencil_onion_skin", text="Onion Skin")
 
         if context.object.mode in {'GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
             layout.prop(view, "use_gpencil_edit_lines", text="Show Edit Lines")
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 651bbfcd97b..dd7ebb36af7 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1174,7 +1174,7 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
 	int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph);
 	ToolSettings *ts = scene->toolsettings;
 	bGPDframe *derived_gpf = NULL;
-	bool no_onion = (bool)(gpd->flag & GP_DATA_STROKE_WEIGHTMODE);
+	bool no_onion = (bool)(gpd->flag & GP_DATA_STROKE_WEIGHTMODE) || ((v3d->flag3 & V3D_GP_SHOW_ONION_SKIN) == 0);
 	bool overlay = (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0);
 
 	/* check if playing animation */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 8ac2a619431..18fb31f1019 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -353,6 +353,7 @@ typedef struct View3D {
 #define V3D_GP_SHOW_GRID             (1 << 3) /* Activate paper grid */
 #define V3D_GP_SHOW_EDIT_LINES       (1 << 4)
 #define V3D_GP_SHOW_MULTIEDIT_LINES  (1 << 5)
+#define V3D_GP_SHOW_ONION_SKIN       (1 << 6) /* main switch at view level */
 
 /* View3DShading->light */
 enum {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index bf4075e48ae..8b93ce40fb1 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3047,12 +3047,18 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "use_gpencil_edit_lines", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_GP_SHOW_EDIT_LINES);
 	RNA_def_property_ui_text(prop, "Edit Lines", "Show edit lines when edit strokes");
-	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
 
 	prop = RNA_def_property(srna, "use_gpencil_multiedit_line_only", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_GP_SHOW_MULTIEDIT_LINES);
 	RNA_def_property_ui_text(prop, "Lines Only", "Show only edit lines for additional frames");
-	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+	/* main grease pencil onion switch */
+	prop = RNA_def_property(srna, "use_gpencil_onion_skin", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_GP_SHOW_ONION_SKIN);
+	RNA_def_property_ui_text(prop, "Onion Skins", "Show ghosts of the frames before and after the current frame");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
 
 	/* Stereo Settings */
 	prop = RNA_def_property(srna, "stereo_3d_eye", PROP_ENUM, PROP_NONE);



More information about the Bf-blender-cvs mailing list