[Bf-blender-cvs] [04210761799] greasepencil-object: Simplify: new option to remove fill lines

Antonio Vazquez noreply at git.blender.org
Sun Sep 10 17:21:29 CEST 2017


Commit: 042107617999a7c7ce319c3cee856e85e560d666
Author: Antonio Vazquez
Date:   Sun Sep 10 16:55:48 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB042107617999a7c7ce319c3cee856e85e560d666

Simplify: new option to remove fill lines

For filling areas, sometimes is good to have a way to hide the external line of the stroke that makes the fill when select simplify.

Fixed the error of render flag because the storage field was too small, so a new field has been added for simplify only.

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

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.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_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 204388f6271..0e3fe3c900f 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -466,6 +466,7 @@ class SCENE_PT_gp_simplify(SceneButtonsPanel, Panel):
         col.prop(ts, "gpencil_simplify_view_fill", text="Fill")
         col.prop(ts, "gpencil_simplify_view_modifier", text="Modifiers")
         col.prop(ts, "gpencil_simplify_view_vfx", text="VFX")
+        col.prop(ts, "gpencil_simplify_remove_lines", text="Remove Fill Lines")
 
         col = split.column()
         # TODO: keep disable while render workflow is defined
@@ -475,6 +476,7 @@ class SCENE_PT_gp_simplify(SceneButtonsPanel, Panel):
         col.prop(ts, "gpencil_simplify_render_modifier", text="Modifiers")
         col.prop(ts, "gpencil_simplify_render_vfx", text="VFX")
 
+
 class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
     _context_path = "scene"
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index ccb224bab3b..f6d0287a423 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -691,6 +691,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 	bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
 	bool playing = (bool)stl->storage->playing;
 
+
 	/* get parent matrix and save as static data */
 	ED_gpencil_parent_location(ob, gpd, gpl, viewmatrix);
 	copy_m4_m4(derived_gpf->viewmatrix, viewmatrix);
@@ -725,6 +726,15 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 		if (stl->storage->shgroup_id >= GPENCIL_MAX_SHGROUPS) {
 			continue;
 		}
+		/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is enabled */
+		if ((GP_SIMPLIFY_FILL(ts, playing)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE)) {
+			if ((gps->palcolor->fill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || 
+				(gps->palcolor->fill_style > FILL_STYLE_SOLID)) 
+			{
+				continue;
+			}
+		}
+
 #if 0   /* if we use the reallocate the shading group is doing weird thing, so disable while find a solution 
 		   and allocate the max size on cache_init */
 		   /* realloc memory */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2158a186c7b..3d28034929f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -235,8 +235,8 @@ static void GPENCIL_cache_init(void *vedata)
 			else {
 				/* if animation was active and simplify on play was enabled, cache is dirty */
 				if ((oldsts == 1) && (stl->storage->playing == 0) && 
-					(ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY) && 
-					(ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY)) 
+					(ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY) && 
+					(ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY)) 
 				{
 					BKE_gpencil_batch_cache_alldirty();
 				}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 04728d9d4da..2d1c53542cd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -43,11 +43,11 @@ struct GPENCIL_StorageList;
 #define GPENCIL_COLOR_TEXTURE 1
 #define GPENCIL_COLOR_PATTERN 2
 
-#define GP_SIMPLIFY(ts) ((ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY))
-#define GP_SIMPLIFY_ONPLAY(playing) ((playing == true) && (ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY)) || ((ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY) == 0)
-#define GP_SIMPLIFY_FILL(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL))) 
-#define GP_SIMPLIFY_MODIF(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF))) 
-#define GP_SIMPLIFY_VFX(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_flags & GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX)))
+#define GP_SIMPLIFY(ts) ((ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY))
+#define GP_SIMPLIFY_ONPLAY(playing) ((playing == true) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY)) || ((ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY) == 0)
+#define GP_SIMPLIFY_FILL(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL))) 
+#define GP_SIMPLIFY_MODIF(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF))) 
+#define GP_SIMPLIFY_VFX(ts, playing) (GP_SIMPLIFY_ONPLAY(playing) && ((GP_SIMPLIFY(ts)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX)))
 
  /* *********** OBJECTS CACHE *********** */
 typedef struct GPencilVFXSwirl {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index ff499f34865..f7b6926dfc3 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1516,10 +1516,13 @@ typedef struct ToolSettings {
 	char gpencil_v2d_align; /*                          : General 2D Editor */
 	char gpencil_seq_align; /*                          : Sequencer Preview */
 	char gpencil_ima_align; /*                          : Image Editor */
-	
+
+	short gpencil_simplify; /* simplify flags for grease pencil */
+	char pad6[6];
+
 	/* Grease Pencil Sculpt */
 	struct GP_BrushEdit_Settings gp_sculpt;
-	
+
 	/* Grease Pencil Interpolation Tool(s) */
 	struct GP_Interpolate_Settings gp_interpolate;
 	
@@ -2244,23 +2247,29 @@ typedef enum eGPencil_Flags {
 	GP_TOOL_FLAG_RETAIN_LAST            = (1 << 1),
 	/* Add the strokes below all strokes in the layer */
 	GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2),
+} eGPencil_Flags;
+
+/* toolsettings->gpencil_simplify */
+typedef enum eGPencil_SimplifyFlags {
 	/* Simplify */
-	GP_TOOL_FLAG_SIMPLIFY = (1 << 3),
+	GP_TOOL_FLAG_SIMPLIFY = (1 << 0),
 	/* Simplify on play */
-	GP_TOOL_FLAG_SIMPLIFY_ON_PLAY = (1 << 4),
+	GP_TOOL_FLAG_SIMPLIFY_ON_PLAY = (1 << 1),
 	/* Simplify fill on viewport */
-	GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL = (1 << 5),
+	GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL = (1 << 2),
 	/* Simplify modifier on viewport */
-	GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF = (1 << 6),
+	GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF = (1 << 3),
 	/* Simplify vfx modifier on viewport */
-	GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX = (1 << 7),
+	GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX = (1 << 4),
 	/* Simplify fill on render */
-	GP_TOOL_FLAG_SIMPLIFY_RENDER_FILL = (1 << 8),
+	GP_TOOL_FLAG_SIMPLIFY_RENDER_FILL = (1 << 5),
 	/* Simplify modifier on render */
-	GP_TOOL_FLAG_SIMPLIFY_RENDER_MODIF = (1 << 9),
+	GP_TOOL_FLAG_SIMPLIFY_RENDER_MODIF = (1 << 6),
 	/* Simplify vfx modifier on render */
-	GP_TOOL_FLAG_SIMPLIFY_RENDER_VFX = (1 << 10),
-} eGPencil_Flags;
+	GP_TOOL_FLAG_SIMPLIFY_RENDER_VFX = (1 << 7),
+	/* Remove fill external line */
+	GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE = (1 << 8),
+} eGPencil_SimplifyFlags;
 
 /* toolsettings->gpencil_src */
 typedef enum eGPencil_Source_3D {
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 6ffb0f1e559..c440a78ff92 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3871,42 +3871,47 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 
 	/* Grease Pencil - Simplify Options */
 	prop = RNA_def_property(srna, "gpencil_simplify", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SIMPLIFY);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY);
 	RNA_def_property_ui_text(prop, "Simplify", "Simplify Grease Pencil Drawing");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
 	prop = RNA_def_property(srna, "gpencil_simplify_onplay", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SIMPLIFY_ON_PLAY);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_ON_PLAY);
 	RNA_def_property_ui_text(prop, "On Play", "Simplify Grease Pencil only when play animation");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
 	prop = RNA_def_property(srna, "gpencil_simplify_view_fill", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL);
 	RNA_def_property_ui_text(prop, "Fill", "Do not fill strokes on viewport");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+	prop = RNA_def_property(srna, "gpencil_simplify_remove_lines", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE);
+	RNA_def_property_ui_text(prop, "Remove Lines", "Remove External Lines of Filling Strokes");
+	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
 	prop = RNA_def_property(srna, "gpencil_simplify_view_modifier", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF);
 	RNA_def_property_ui_text(prop, "Fill", "Do not apply modifiers on viewport");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
 	prop = RNA_def_property(srna, "gpencil_simplify_view_vfx", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_VIEW_VFX);
 	RNA_def_property_ui_text(prop, 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list