[Bf-blender-cvs] [7ff31e0270f] greasepencil-object: New Enable/Disable editing lines option

Antonio Vazquez noreply at git.blender.org
Wed Sep 20 12:05:11 CEST 2017


Commit: 7ff31e0270f732ab725eb4436d42664e5626b2bf
Author: Antonio Vazquez
Date:   Wed Sep 20 12:04:49 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7ff31e0270f732ab725eb4436d42664e5626b2bf

New Enable/Disable  editing lines option

Allows to disable the new editing lines. Now the option is in Display panel, but maybe need to be moved to new panel or reorganize.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 16f07686cf9..eafee115f51 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -144,7 +144,7 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         layout.separator()
 
         col = layout.column()
-        col.label("Edit Lines:") # TODO: Editline toggle here
+        col.prop(gpd, "show_edit_lines", text="Show Edit Lines")
         col.prop(gpd, "edit_line_color", text="")
         col.prop(gpd, "multiedit_line_only", text="Only Lines in MultiEdit")
 
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 8a91a232b92..8dbde20894f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -772,6 +772,7 @@ bGPdata *BKE_gpencil_data_addnew(const char name[])
 	 * since this is more useful...
 	 */
 	gpd->flag |= GP_DATA_VIEWALIGN;
+	gpd->flag |= GP_DATA_STROKE_SHOW_EDIT_LINES;
 	gpd->xray_mode = GP_XRAY_3DSPACE;
 	gpd->batch_cache_data = NULL;
 	gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
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 2da346c8592..b0ee0623ab0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -616,7 +616,7 @@ static void gpencil_add_editpoints_shgroup(GPENCIL_StorageList *stl, GpencilBatc
 			cache->batch_edlin[cache->cache_idx] = DRW_gpencil_get_edlin_geom(gps, ts->gp_sculpt.alpha, gpd->flag);
 		}
 		if (cache->batch_edlin[cache->cache_idx]) {
-			if ((obact) && (obact == ob)) {
+			if ((obact) && (obact == ob) && (gpd->flag & (GP_DATA_STROKE_SHOW_EDIT_LINES | GP_DATA_STROKE_MULTIEDIT_LINES))) {
 				DRW_shgroup_call_add(stl->g_data->shgrps_edit_line, cache->batch_edlin[cache->cache_idx], gpf->viewmatrix);
 			}
 		}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 03189fafac7..17decd4868a 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -413,6 +413,8 @@ typedef enum eGPdata_Flag {
 	GP_DATA_STROKE_MULTIEDIT = (1 << 16),
 	/* Only show edit lines */
 	GP_DATA_STROKE_MULTIEDIT_LINES = (1 << 17),
+	/* show edit lines */
+	GP_DATA_STROKE_SHOW_EDIT_LINES = (1 << 18),
 } eGPdata_Flag;
 
 /* Onion->flag */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index a703e528790..a2f3c8679fc 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1346,6 +1346,11 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "MultiEdit", "Edit strokes in several grease pencil Keyframes at same time");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+	prop = RNA_def_property(srna, "show_edit_lines", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_SHOW_EDIT_LINES);
+	RNA_def_property_ui_text(prop, "Edit Lines", "Show edit lines when edit strokes");
+	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
 	prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "line_color");
 	RNA_def_property_array(prop, 4);



More information about the Bf-blender-cvs mailing list