[Bf-blender-cvs] [82a2bb27509] greasepencil-object: Enable Onion with Overlay button

Antonio Vazquez noreply at git.blender.org
Fri Jul 6 22:23:06 CEST 2018


Commit: 82a2bb275096448810555f92f4c3ee3ddd5d96ae
Author: Antonio Vazquez
Date:   Fri Jul 6 22:22:51 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB82a2bb275096448810555f92f4c3ee3ddd5d96ae

Enable Onion with Overlay button

The grease pencil onion skin need to set the cache as dirty to recalculate geometry, so a depsgraph recalc must be done when change Overlay switch.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index a03bdb26634..6834e450303 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1174,6 +1174,7 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
 	ToolSettings *ts = scene->toolsettings;
 	bGPDframe *derived_gpf = NULL;
 	bool no_onion = (bool)(gpd->flag & GP_DATA_STROKE_WEIGHTMODE);
+	bool overlay = (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0);
 
 	/* check if playing animation */
 	bool playing = (bool)stl->storage->playing;
@@ -1218,7 +1219,8 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
 		}
 
 		/* draw onion skins */
-		if ((gpd->flag & GP_DATA_SHOW_ONIONSKINS) && (!no_onion) &&
+		if ((gpd->flag & GP_DATA_SHOW_ONIONSKINS) &&
+			(!no_onion) && (overlay) &&
 			(gpl->onion_flag & GP_LAYER_ONIONSKIN) &&
 			((!playing) || (gpd->onion_flag & GP_ONION_GHOST_ALWAYS)))
 		{
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 01db1e445f9..6ba55aee362 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -476,6 +476,17 @@ static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scen
 	}
 }
 
+static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+{
+	/* need set all caches as dirty to recalculate onion skinning */
+	for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob->type == OB_GPENCIL) {
+			DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+		}
+	}
+	WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+}
+
 /* Space 3D View */
 static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
@@ -2544,7 +2555,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
 	RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like manipulators and outlines");
-	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, "show_floor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);



More information about the Bf-blender-cvs mailing list