[Bf-blender-cvs] [dac044d03cf] greasepencil-object: Add Simplify Blend Layers option

Antonioya noreply at git.blender.org
Sun Nov 25 17:23:16 CET 2018


Commit: dac044d03cf501a581ba936260a9421f8a009ffe
Author: Antonioya
Date:   Sun Nov 25 17:23:03 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdac044d03cf501a581ba936260a9421f8a009ffe

Add Simplify Blend Layers option

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

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 026b306b49e..8952229b323 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -650,6 +650,7 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel):
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
+        layout.use_property_decorate = False
 
         rd = context.scene.render
 
@@ -659,8 +660,8 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel):
         col.prop(rd, "simplify_gpencil_onplay", text="Playback Only")
         col.prop(rd, "simplify_gpencil_view_modifier", text="Modifiers")
         col.prop(rd, "simplify_gpencil_shader_fx", text="ShaderFX")
+        col.prop(rd, "simplify_gpencil_blend", text="Blend Layers")
 
-        col = layout.column(align=True)
         col.prop(rd, "simplify_gpencil_view_fill")
         sub = col.column()
         sub.active = rd.simplify_gpencil_view_fill
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 4b449c53411..363774adeba 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -803,21 +803,26 @@ static void gpencil_draw_strokes(
 				}
 			}
 
-			/* fill */
-			if ((gp_style->flag & GP_STYLE_FILL_SHOW) &&
-			    (!stl->storage->simplify_fill))
+			/* hide any blend layer */
+			if ((!stl->storage->simplify_blend) ||
+				(gpl->blend_mode == eGplBlendMode_Normal))
 			{
-				gpencil_add_fill_vertexdata(
-				        cache, ob, gpl, derived_gpf, gps,
-				        opacity, tintcolor, false, custonion);
-			}
-			/* stroke */
-			if ((gp_style->flag & GP_STYLE_STROKE_SHOW) &&
-			    (gp_style->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH))
-			{
-				gpencil_add_stroke_vertexdata(
-				        cache, ob, gpl, derived_gpf, gps,
-				        opacity, tintcolor, false, custonion);
+				/* fill */
+				if ((gp_style->flag & GP_STYLE_FILL_SHOW) &&
+					(!stl->storage->simplify_fill))
+				{
+					gpencil_add_fill_vertexdata(
+						cache, ob, gpl, derived_gpf, gps,
+						opacity, tintcolor, false, custonion);
+				}
+				/* stroke */
+				if ((gp_style->flag & GP_STYLE_STROKE_SHOW) &&
+					(gp_style->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH))
+				{
+					gpencil_add_stroke_vertexdata(
+						cache, ob, gpl, derived_gpf, gps,
+						opacity, tintcolor, false, custonion);
+				}
 			}
 		}
 
@@ -1283,6 +1288,7 @@ static void DRW_gpencil_shgroups_create(
 	for (int i = 0; i < cache->grp_used; i++) {
 		elm = &cache->grp_cache[i];
 		array_elm = &cache_ob->shgrp_array[idx];
+
 		/* save last group when change */
 		if (gpl_prev == NULL) {
 			gpl_prev = elm->gpl;
@@ -1518,8 +1524,9 @@ void DRW_gpencil_populate_datablock(
 	/* draw normal strokes */
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		/* don't draw layer if hidden */
-		if (gpl->flag & GP_LAYER_HIDE)
+		if (gpl->flag & GP_LAYER_HIDE) {
 			continue;
+		}
 
 		/* filter view layer to gp layers in the same view layer (for compo) */
 		if ((stl->storage->is_render) && (gpl->viewlayername[0] != '\0')) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 8451002f029..aa770c3e9fd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -378,6 +378,7 @@ void GPENCIL_cache_init(void *vedata)
 		stl->storage->simplify_fill = GP_SIMPLIFY_FILL(scene, stl->storage->is_playing);
 		stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(scene, stl->storage->is_playing);
 		stl->storage->simplify_fx = GP_SIMPLIFY_FX(scene, stl->storage->is_playing);
+		stl->storage->simplify_blend = GP_SIMPLIFY_BLEND(scene, stl->storage->is_playing);
 
 		/* save pixsize */
 		stl->storage->pixsize = DRW_viewport_pixelsize_get();
@@ -778,8 +779,7 @@ void GPENCIL_draw_scene(void *ved)
 					for (int e = 0; e < cache_ob->tot_layers; e++) {
 						array_elm = &cache_ob->shgrp_array[e];
 
-						if ((array_elm->mode == eGplBlendMode_Normal) && (!use_blend))
-						{
+						if ((array_elm->mode == eGplBlendMode_Normal) && (!use_blend)) {
 							if (init_shgrp == NULL) {
 								init_shgrp = array_elm->init_shgrp;
 							}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index ddbd6dd38e1..dc3870c1aae 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -54,6 +54,7 @@ struct RenderLayer;
 #define GP_SIMPLIFY_FILL(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL)))
 #define GP_SIMPLIFY_MODIF(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
 #define GP_SIMPLIFY_FX(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX)))
+#define GP_SIMPLIFY_BLEND(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND)))
 
 #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera))
 
@@ -145,6 +146,7 @@ typedef struct GPENCIL_Storage {
 	bool simplify_fill;
 	bool simplify_modif;
 	bool simplify_fx;
+	bool simplify_blend;
 
 	/* Render Matrices and data */
 	float persmat[4][4], persinv[4][4];
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 92a1d6309ea..f51c285cce1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2140,7 +2140,9 @@ typedef enum eGPencil_SimplifyFlags {
 	/* Remove fill external line */
 	SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4),
 	/* Simplify Shader FX */
-	SIMPLIFY_GPENCIL_FX               = (1 << 5)
+	SIMPLIFY_GPENCIL_FX               = (1 << 5),
+	/* Simplify layer blending */
+	SIMPLIFY_GPENCIL_BLEND            = (1 << 6),
 } eGPencil_SimplifyFlags;
 
 /* ToolSettings.gpencil_*_align - Stroke Placement mode flags */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index eeb48b67d28..d1fef1b9a2f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -5344,6 +5344,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Simplify Shaders", "Do not apply shader fx");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+	prop = RNA_def_property(srna, "simplify_gpencil_blend", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_BLEND);
+	RNA_def_property_ui_text(prop, "Blend Layers", "Do not display blend layers");
+	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
 	/* persistent data */
 	prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);



More information about the Bf-blender-cvs mailing list