[Bf-blender-cvs] [62526308ac8] greasepencil-object: Move Edit LInes and Multi Edit LInes switch at View level

Antonio Vazquez noreply at git.blender.org
Sat Jul 7 18:30:13 CEST 2018


Commit: 62526308ac836f8ea380416073ff9706a7fff33d
Author: Antonio Vazquez
Date:   Sat Jul 7 18:30:07 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB62526308ac836f8ea380416073ff9706a7fff33d

Move Edit LInes and Multi Edit LInes switch at View level

This overlay must be by view, not by object.

Also changed the name to "gpencil_*" to some grease pencil paper to keep name consistency.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_gpencil.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 9522807eada..14407afa8f2 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -360,8 +360,6 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         gpl = context.active_gpencil_layer
 
         layout.prop(gpd, "xray_mode", text="Depth Ordering")
-        layout.prop(gpd, "show_edit_lines", text="Show Edit Lines")
-        layout.prop(gpd, "show_multiedit_line_only", text="Display Only Edit Line In Multiframe")
         layout.prop(gpd, "edit_line_color", text="Edit Line Color")
         layout.prop(ob, "empty_draw_size", text="Marker Size")
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index f1381469e33..5a52be80116 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4329,8 +4329,8 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
         layout.prop(view, "use_gpencil_paper", text="Drawing Paper")
 
         if view.use_gpencil_paper:
-            layout.prop(view, "gp_paper_color", text="Color")
-            layout.prop(view, "gp_paper_opacity", text="Opacity")
+            layout.prop(view, "gpencil_paper_color", text="Color")
+            layout.prop(view, "gpencil_paper_opacity", text="Opacity")
 
             layout.prop(view, "use_gpencil_grid", text="Display Paper Grid")
             if view.use_gpencil_grid:
@@ -4339,7 +4339,8 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
         layout.prop(gpd, "use_onion_skinning", text="Onion Skin")
 
         if context.object.mode in {'GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
-            layout.prop(gpd, "show_edit_lines", text="Show Edit Lines")
+            layout.prop(view, "use_gpencil_edit_lines", text="Show Edit Lines")
+            layout.prop(view, "use_gpencil_multiedit_line_only", text="Only Edit Lines In Multiframe")
             layout.prop(tool_settings.gpencil_sculpt, "selection_alpha", text="Vertex Opacity", slider=True)
 
 
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 0fac8aa162f..424b5955486 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -458,7 +458,6 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
 	gpd->flag |= GP_DATA_VIEWALIGN;
 
 	/* GP object specific settings */
-	gpd->flag |= GP_DATA_STROKE_SHOW_EDIT_LINES;
 	ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
 
 	gpd->xray_mode = GP_XRAY_3DSPACE;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 6834e450303..651bbfcd97b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -651,7 +651,7 @@ static void gpencil_add_editpoints_shgroup(
 		if (cache->batch_edlin[cache->cache_idx]) {
 			if ((obact) && (obact == ob) &&
 				((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
-				(gpd->flag & GP_DATA_STROKE_SHOW_EDIT_LINES))
+				(v3d->flag3 & V3D_GP_SHOW_EDIT_LINES))
 			{
 				DRW_shgroup_call_add(
 				        stl->g_data->shgrps_edit_line,
@@ -741,6 +741,7 @@ static void gpencil_draw_strokes(
 	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	Scene *scene = draw_ctx->scene;
+	View3D *v3d = draw_ctx->v3d;
 	bGPDstroke *gps, *src_gps;
 	DRWShadingGroup *fillgrp;
 	DRWShadingGroup *strokegrp;
@@ -804,7 +805,7 @@ static void gpencil_draw_strokes(
 
 		if ((gpl->actframe->framenum == derived_gpf->framenum) ||
 		    (!is_multiedit) ||
-		    ((gpd->flag & GP_DATA_STROKE_MULTIEDIT_LINES) == 0))
+		    ((v3d->flag3 & V3D_GP_SHOW_MULTIEDIT_LINES) == 0))
 		{
 			int id = stl->storage->shgroup_id;
 			if (gps->totpoints > 0) {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 627d8191164..7035d8d7d81 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -491,18 +491,15 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot)
 /* toggle multi edit strokes support */
 static int gpencil_multiedit_toggle_exec(bContext *C, wmOperator *op)
 {
-	bGPdata *gpd = ED_gpencil_data_get_active(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	const bool lines = RNA_boolean_get(op->ptr, "lines");
 
-	if (gpd == NULL)
-		return OPERATOR_CANCELLED;
-
 	/* Just toggle value */
 	if (lines == 0) {
-		gpd->flag ^= GP_DATA_STROKE_SHOW_EDIT_LINES;
+		v3d->flag3 ^= V3D_GP_SHOW_EDIT_LINES;
 	}
 	else {
-		gpd->flag ^= GP_DATA_STROKE_MULTIEDIT_LINES;
+		v3d->flag3 ^= V3D_GP_SHOW_MULTIEDIT_LINES;
 	}
 
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 8cf27a145b8..731ba83d934 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -416,10 +416,6 @@ typedef enum eGPdata_Flag {
 
 	/* Allow edit several frames at the same time */
 	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;
 
 /* gpd->onion_flag */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 2ee5f7a640a..8ac2a619431 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -348,9 +348,11 @@ typedef struct View3D {
 #define V3D_SHOW_MODE_SHADE_OVERRIDE (1 << 15) /* XXX: DNA deprecated */
 
 /* View3d->flag3 (short) */
-#define V3D_SHOW_WORLD			(1 << 0)
-#define V3D_GP_SHOW_PAPER       (1 << 2) /* Activate paper to cover all viewport */
-#define V3D_GP_SHOW_GRID        (1 << 3) /* Activate paper grid */
+#define V3D_SHOW_WORLD			     (1 << 0)
+#define V3D_GP_SHOW_PAPER            (1 << 2) /* Activate paper to cover all viewport */
+#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)
 
 /* View3DShading->light */
 enum {
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 383cf9eafe0..e2dac94d9ad 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1247,11 +1247,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "MultiFrame", "Edit strokes from multiple grease pencil keyframes at the same time (keyframes must be selected to be included)");
 	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);
@@ -1260,11 +1255,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Edit Line Color", "Color for editing line");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
-	prop = RNA_def_property(srna, "show_multiedit_line_only", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT_LINES);
-	RNA_def_property_ui_text(prop, "Lines Only", "Show only edit lines for additional frames");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
 	/* onion skinning */
 	prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gstep");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 7eaa0038b32..bf4075e48ae 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3027,7 +3027,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 
 	/* Paper Color */
 	static float default_paper1[3] = { 1.0f, 1.0f, 1.0f };
-	prop = RNA_def_property(srna, "gp_paper_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "gpencil_paper_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "gpencil_paper_color");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -3036,13 +3036,23 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	/* Paper opacity factor */
-	prop = RNA_def_property(srna, "gp_paper_opacity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gpencil_paper_opacity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "gpencil_paper_color[3]");
 	RNA_def_property_range(prop, 0.0, 1.0f);
 	RNA_def_property_float_default(prop, 0.7f);
 	RNA_def_property_ui_text(prop, "Opacity", "Paper opacity");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
+	/* show edit lines */
+	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);
+
+	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_up

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list