[Bf-blender-cvs] [44479daa2f2] greasepencil-object: UI: Reorganize Stroke style panel

Antonio Vazquez noreply at git.blender.org
Tue Aug 8 20:29:45 CEST 2017


Commit: 44479daa2f2304e5c4ca432dd5f6070a14f5c415
Author: Antonio Vazquez
Date:   Tue Aug 8 20:29:04 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB44479daa2f2304e5c4ca432dd5f6070a14f5c415

UI: Reorganize Stroke style panel

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_palette.c

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 5077cb43f44..ee440c347b3 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -1413,22 +1413,22 @@ class GreasePencilPaletteStrokePanel:
         col.enabled = not pcolor.lock
         col.prop(pcolor, "stroke_style", text="")
 
-        row = layout.row()
-        row.enabled = not pcolor.lock and (pcolor.use_texture is False or pcolor.use_pattern is True)
-        col = row.column(align=True)
-        col.prop(pcolor, "color", text="")
-        col.prop(pcolor, "alpha", slider=True)
+        if pcolor.stroke_style == 'TEXTURE':
+            row = layout.row()
+            row.enabled = not pcolor.lock
+            col = row.column(align=True)
+            col.template_ID(pcolor, "stroke_image", open="image.open")
+            col.prop(pcolor, "use_pattern", text="Use as Pattern")
 
-        row = layout.row(align=True)
-        row.enabled = not pcolor.lock
-        row.prop(pcolor, "use_texture", text="Texture")
+        if pcolor.stroke_style == 'SOLID' or pcolor.use_pattern is True:
+            row = layout.row()
+            col = row.column(align=True)
+            col.prop(pcolor, "color", text="")
+            col.prop(pcolor, "alpha", slider=True)
 
-        row = layout.row()
+        row = layout.row(align=True)
         row.enabled = not pcolor.lock
-        col = row.column(align=True)
-        col.enabled = pcolor.use_texture
-        col.template_ID(pcolor, "stroke_image", open="image.open")
-        col.prop(pcolor, "use_pattern", text="Use as Pattern")
+        row.prop(pcolor, "use_dot", text="Dots")
 
         # Options
         row = layout.row()
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 f590084f91c..8a598be0476 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -341,13 +341,11 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENC
 
 		stl->shgroups[id].stroke_style = palcolor->stroke_style;
 		stl->shgroups[id].color_type = GPENCIL_COLOR_SOLID;
-		if (palcolor->flag & PAC_COLOR_TEXTURE) {
+		if (palcolor->stroke_style == STROKE_STYLE_TEXTURE) {
+			stl->shgroups[id].color_type = GPENCIL_COLOR_TEXTURE;
 			if (palcolor->flag & PAC_COLOR_PATTERN) {
 				stl->shgroups[id].color_type = GPENCIL_COLOR_PATTERN;
 			}
-			else {
-				stl->shgroups[id].color_type = GPENCIL_COLOR_TEXTURE;
-			}
 		}
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
 	}
@@ -368,7 +366,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENC
 	}
 
 	/* image texture for pattern */
-	if ((palcolor) && (palcolor->flag & (PAC_COLOR_TEXTURE | PAC_COLOR_PATTERN))) {
+	if ((palcolor) && (palcolor->stroke_style == STROKE_STYLE_TEXTURE)) {
 		ImBuf *ibuf;
 		Image *image = palcolor->sima;
 		ImageUser iuser = { NULL };
@@ -421,13 +419,11 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
 
 		stl->shgroups[id].stroke_style = palcolor->stroke_style;
 		stl->shgroups[id].color_type = GPENCIL_COLOR_SOLID;
-		if (palcolor->flag & PAC_COLOR_TEXTURE) {
+		if (palcolor->stroke_style == STROKE_STYLE_TEXTURE) {
+			stl->shgroups[id].color_type = GPENCIL_COLOR_TEXTURE;
 			if (palcolor->flag & PAC_COLOR_PATTERN) {
 				stl->shgroups[id].color_type = GPENCIL_COLOR_PATTERN;
 			}
-			else {
-				stl->shgroups[id].color_type = GPENCIL_COLOR_TEXTURE;
-			}
 		}
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
 
@@ -449,7 +445,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
 	}
 
 	/* image texture */
-	if ((palcolor) && (palcolor->flag & (PAC_COLOR_TEXTURE | PAC_COLOR_PATTERN))) {
+	if ((palcolor) && (palcolor->stroke_style == STROKE_STYLE_TEXTURE)) {
 		ImBuf *ibuf;
 		Image *image = palcolor->sima;
 		ImageUser iuser = { NULL };
@@ -556,7 +552,7 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
 	CLAMP_MIN(sthickness, 1);
 	if (cache->is_dirty) {
 		gpencil_batch_cache_check_free_slots(ob, gpd);
-		if ((gps->totpoints > 1) && (gps->palcolor->stroke_style != STROKE_STYLE_VOLUMETRIC)) {
+		if ((gps->totpoints > 1) && ((gps->palcolor->flag & PAC_COLOR_DOT) == 0)) {
 			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_stroke_geom(gpf, gps, sthickness, ink);
 		}
 		else {
@@ -662,7 +658,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 		}
 #endif
 		int id = stl->storage->shgroup_id;
-		if ((gps->totpoints > 1) && (gps->palcolor->stroke_style != STROKE_STYLE_VOLUMETRIC)) {
+		if ((gps->totpoints > 1) && ((gps->palcolor->flag & PAC_COLOR_DOT) == 0)) {
 			if (gps->totpoints > 2) {
 				stl->shgroups[id].shgrps_fill = DRW_gpencil_shgroup_fill_create(e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh, gpd, gps->palcolor, id);
 			}
@@ -724,7 +720,7 @@ void DRW_gpencil_populate_buffer_strokes(void *vedata, ToolSettings *ts, bGPdata
 			/* if only one point, don't need to draw buffer because the user has no time to see it */
 			if (gpd->sbuffer_size > 1) {
 				/* use unit matrix because the buffer is in screen space and does not need conversion */
-				if (gpd->bstroke_style != STROKE_STYLE_VOLUMETRIC) {
+				if ((gpd->sflag & PAC_COLOR_DOT) == 0) {
 					stl->g_data->batch_buffer_stroke = DRW_gpencil_get_buffer_stroke_geom(gpd, stl->storage->unit_matrix, lthick);
 				}
 				else {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 9044549a702..811730ea5e0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -203,16 +203,12 @@ static void GPENCIL_cache_init(void *vedata)
 		PaletteColor *palcolor = BKE_palette_color_get_active(palette);
 		if (palcolor) {
 			stl->storage->stroke_style = palcolor->stroke_style;
-			if (palcolor->flag & PAC_COLOR_TEXTURE) {
+			stl->storage->color_type = GPENCIL_COLOR_SOLID;
+			if (palcolor->stroke_style == STROKE_STYLE_TEXTURE) {
+				stl->storage->color_type = GPENCIL_COLOR_TEXTURE;
 				if (palcolor->flag & PAC_COLOR_PATTERN) {
 					stl->storage->color_type = GPENCIL_COLOR_PATTERN;
 				}
-				else {
-					stl->storage->color_type = GPENCIL_COLOR_TEXTURE;
-				}
-			}
-			else {
-				stl->storage->color_type = GPENCIL_COLOR_SOLID;
 			}
 		}
 		else { 
@@ -223,7 +219,7 @@ static void GPENCIL_cache_init(void *vedata)
 		psl->drawing_pass = DRW_pass_create("Gpencil Drawing Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
 		stl->g_data->shgrps_drawing_fill = DRW_gpencil_shgroup_drawing_fill_create(psl->drawing_pass, e_data.gpencil_drawing_fill_sh);
 
-		if (stl->storage->stroke_style != STROKE_STYLE_VOLUMETRIC) {
+		if ((palcolor) && (palcolor->flag & PAC_COLOR_DOT) == 0) {
 			stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create(&e_data, vedata, psl->drawing_pass, e_data.gpencil_stroke_sh, NULL, NULL, palcolor, -1);
 		}
 		else {
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 5a0733048c0..64ed6153294 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1092,7 +1092,7 @@ static void gp_draw_strokes(
 					copy_v4_v4(ink, tcolor);
 				}
 			}
-			if (palcolor->stroke_style & STROKE_STYLE_VOLUMETRIC) {
+			if (palcolor->flag & PAC_COLOR_DOT) {
 				/* volumetric stroke drawing */
 				gp_draw_stroke_volumetric_3d(gps->points, gps->totpoints, sthickness, ink);
 			}
@@ -1156,7 +1156,7 @@ static void gp_draw_strokes(
 					copy_v4_v4(ink, tcolor);
 				}
 			}
-			if (palcolor->stroke_style & STROKE_STYLE_VOLUMETRIC) {
+			if (palcolor->flag & PAC_COLOR_DOT) {
 				/* blob/disk-based "volumetric" drawing */
 				gp_draw_stroke_volumetric_2d(gps->points, gps->totpoints, sthickness, dflag, gps->flag,
 				                             offsx, offsy, winx, winy, diff_mat, ink);
@@ -1537,7 +1537,7 @@ static void gp_draw_data_layers(
 			 * It should also be noted that sbuffer contains temporary point types
 			 * i.e. tGPspoints NOT bGPDspoints
 			 */
-			if (gpd->bstroke_style & STROKE_STYLE_VOLUMETRIC) {
+			if (gpd->sflag & PAC_COLOR_DOT) {
 				gp_draw_stroke_volumetric_buffer(gpd->sbuffer, gpd->sbuffer_size, lthick,
 				                                 dflag, gpd->scolor);
 			}
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 29f42153b27..43ca8a9ef7c 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -178,8 +178,8 @@ typedef enum ePaletteColor_Flag {
 	PAC_COLOR_TEX_MIX = (1 << 5),
 	/* Flip fill colors */
 	PAC_COLOR_FLIP_FILL = (1 << 6),
-	/* Stroke use Texture */
-	PAC_COLOR_TEXTURE = (1 << 7),
+	/* Stroke use Dots */
+	PAC_COLOR_DOT = (1 << 7),
 	/* Texture is a pattern */
 	PAC_COLOR_PATTERN = (1 << 8)
 } ePaletteColor_Flag;
@@ -380,7 +380,7 @@ typedef enum BlurKernelType {
 
 /* Grease Pencil Stroke styles */
 #define STROKE_STYLE_SOLID	0
-#define STROKE_STYLE_VOLUMETRIC	1
+#define STROKE_STYLE_TEXTURE 1
 
 /* Grease Pencil Fill styles */
 #define FILL_STYLE_SOLID	0
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 04544c2db1d..181542d1047 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -221,7 +221,7 @@ static void rna_def_palettecolor(BlenderRNA *brna)
 	/* stroke styles */
 	static EnumPropertyItem stroke_style_items[] = {
 		{ STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color" },
-		{ STROKE_STYLE_VOLUMETRIC, "VOLUMETRIC", 0, "Dot", "Draw strokes with dots" },
+		{ STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture" },
 		{ 0, NULL, 0, NULL, NULL }
 	};
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list