[Bf-blender-cvs] [54eb034c08d] greasepencil-object: Revert "Add new factor to define pixel scale due z-depth error"

Antonio Vazquez noreply at git.blender.org
Fri Aug 11 16:38:12 CEST 2017


Commit: 54eb034c08da4f0021a741bf8cba362ecd490a02
Author: Antonio Vazquez
Date:   Thu Aug 10 16:27:28 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB54eb034c08da4f0021a741bf8cba362ecd490a02

Revert "Add new factor to define pixel scale due z-depth error"

Produce unexpected errors in z-depth and need more review before apply.

This reverts commit 62677a73e1e4324ed0c6d6bedb683721232c3199.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenloader/intern/versioning_280.c
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/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
M	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
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 159fcffa9d6..df0be90df09 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -107,7 +107,6 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         layout.prop(ob, "empty_draw_size", text="Size")
 
         gpd = context.gpencil_data
-
         row = layout.row()
         row.prop(gpd, "xray_mode", text="Draw Mode")
         row = layout.row()
@@ -121,9 +120,6 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
             row = layout.row()
             row.prop(gpl, "show_points")
 
-        row = layout.row()
-        row.prop(gpd, "pixfactor", text="Pixel Factor")
-
 
 classes = (
     DATA_PT_gpencil,
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index efae314235c..8fb62d83e85 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -772,7 +772,6 @@ bGPdata *BKE_gpencil_data_addnew(const char name[])
 	gpd->flag |= GP_DATA_VIEWALIGN;
 	gpd->xray_mode = GP_XRAY_3DSPACE;
 	gpd->batch_cache_data = NULL;
-	gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
 	
 	return gpd;
 }
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index fec307896a8..5e225d1fe24 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -551,13 +551,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 				}
 			}
 		}
-		/* init pixel size factor */
-		if (!DNA_struct_elem_find(fd->filesdna, "bGPDdata", "int", "pixfactor")) {
-			for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
-				gpd->pixfactor = 40;
-			}
-		}
-
 
 
 	}
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 9e01ab829f4..d40a0a690f6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -332,11 +332,6 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENC
 	DRW_shgroup_uniform_float(grp, "pixsize", DRW_viewport_pixelsize_get(), 1);
 	DRW_shgroup_uniform_float(grp, "pixelsize", &U.pixelsize, 1);
 
-	/* avoid wrong values */
-	if ((gpd) && (gpd->pixfactor == 0)) {
-		gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
-	}
-
 	/* object scale and depth */
 	if ((ob) && (id > -1)) {
 		stl->shgroups[id].obj_scale = (ob->size[0] + ob->size[1] + ob->size[2]) / 3.0f;
@@ -353,21 +348,13 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENC
 			}
 		}
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
-		DRW_shgroup_uniform_int(grp, "pixfactor", &gpd->pixfactor, 1);
 	}
 	else {
 		stl->storage->obj_scale = 1.0f;
 		stl->storage->keep_size = 0;
-		stl->storage->pixfactor = GP_DEFAULT_PIX_FACTOR;
 		DRW_shgroup_uniform_float(grp, "objscale", &stl->storage->obj_scale, 1);
 		DRW_shgroup_uniform_int(grp, "keep_size", &stl->storage->keep_size, 1);
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->storage->color_type, 1);
-		if (gpd) {
-			DRW_shgroup_uniform_int(grp, "pixfactor", &gpd->pixfactor, 1);
-		}
-		else {
-			DRW_shgroup_uniform_int(grp, "pixfactor", &stl->storage->pixfactor, 1);
-		}
 	}
 
 	if (gpd) {
@@ -423,11 +410,6 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
 	DRW_shgroup_uniform_float(grp, "pixsize", DRW_viewport_pixelsize_get(), 1);
 	DRW_shgroup_uniform_float(grp, "pixelsize", &U.pixelsize, 1);
 
-	/* avoid wrong values */
-	if ((gpd) && (gpd->pixfactor == 0)) {
-		gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
-	}
-
 	/* object scale and depth */
 	if ((ob) && (id > -1)) {
 		stl->shgroups[id].obj_scale = (ob->size[0] + ob->size[1] + ob->size[2]) / 3.0f;
@@ -444,21 +426,14 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
 			}
 		}
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
-		DRW_shgroup_uniform_int(grp, "pixfactor", &gpd->pixfactor, 1);
+
 	}
 	else {
 		stl->storage->obj_scale = 1.0f;
 		stl->storage->keep_size = 0;
-		stl->storage->pixfactor = GP_DEFAULT_PIX_FACTOR;
 		DRW_shgroup_uniform_float(grp, "objscale", &stl->storage->obj_scale, 1);
 		DRW_shgroup_uniform_int(grp, "keep_size", &stl->storage->keep_size, 1);
 		DRW_shgroup_uniform_int(grp, "color_type", &stl->storage->color_type, 1);
-		if (gpd) {
-			DRW_shgroup_uniform_int(grp, "pixfactor", &gpd->pixfactor, 1);
-		}
-		else {
-			DRW_shgroup_uniform_int(grp, "pixfactor", &stl->storage->pixfactor, 1);
-		}
 	}
 
 	if (gpd) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 736f2fbb794..811730ea5e0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -152,8 +152,6 @@ static void GPENCIL_cache_init(void *vedata)
 
 	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
 	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
-	Object *ob = NULL;
-	bGPdata *gpd = NULL;
 
 	if (!stl->g_data) {
 		/* Alloc transient pointers */
@@ -201,10 +199,6 @@ static void GPENCIL_cache_init(void *vedata)
 		stl->g_data->shgrps_edit_line = DRW_gpencil_shgroup_edit_volumetric_create(psl->edit_pass, e_data.gpencil_line_sh);
 		/* drawing buffer pass */
 		const DRWContextState *draw_ctx = DRW_context_state_get();
-		ob = draw_ctx->obact;
-		if (ob) {
-			gpd = ob->gpd;
-		}
 		Palette *palette = BKE_palette_get_active_from_context(draw_ctx->evil_C);
 		PaletteColor *palcolor = BKE_palette_color_get_active(palette);
 		if (palcolor) {
@@ -226,10 +220,10 @@ static void GPENCIL_cache_init(void *vedata)
 		stl->g_data->shgrps_drawing_fill = DRW_gpencil_shgroup_drawing_fill_create(psl->drawing_pass, e_data.gpencil_drawing_fill_sh);
 
 		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, gpd, palcolor, -1);
+			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 {
-			stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create(&e_data, vedata, psl->drawing_pass, e_data.gpencil_point_sh, NULL, gpd, palcolor, -1);
+			stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create(&e_data, vedata, psl->drawing_pass, e_data.gpencil_point_sh, NULL, NULL, palcolor, -1);
 		}
 
 		/* we need a full screen pass to combine the result of zdepth */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index ea8e7db7e20..99de3296045 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -95,7 +95,6 @@ typedef struct GPENCIL_Storage {
 	int keep_size;
 	float obj_scale;
 	float blur1[2], blur2[2];
-	int pixfactor;
 } GPENCIL_Storage;
 
 typedef struct GPENCIL_StorageList {
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
index 9783a2cb1e8..244aecdd154 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
@@ -3,9 +3,7 @@ uniform mat4 ProjectionMatrix;
 
 uniform float pixsize;   /* rv3d->pixsize */
 uniform float pixelsize; /* U.pixelsize */
-uniform int pixfactor;
 uniform int keep_size;    
-
 uniform float objscale;
 
 in vec3 pos;
@@ -17,7 +15,7 @@ out float finalThickness;
 
 #define TRUE 1
 
-float defaultpixsize = pixsize * pixelsize * pixfactor;
+float defaultpixsize = pixsize * pixelsize * 40.0;
 
 void main()
 {
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
index 854d23911d7..205d5a02c7e 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
@@ -3,9 +3,7 @@ uniform mat4 ProjectionMatrix;
 
 uniform float pixsize;   /* rv3d->pixsize */
 uniform float pixelsize; /* U.pixelsize */
-uniform int pixfactor;
 uniform int keep_size;    
-
 uniform float objscale;
 
 in vec3 pos;
@@ -17,8 +15,7 @@ out float finalThickness;
 
 #define TRUE 1
 
-
-float defaultpixsize = pixsize * pixelsize * pixfactor;
+float defaultpixsize = pixsize * pixelsize * 40.0;
 
 void main(void)
 {
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index ae84ff20107..909bd22014d 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -40,7 +40,6 @@ struct GHash;
 
 /* TODO: add size as userprefs parameter */
 #define GP_OBGPENCIL_DEFAULT_SIZE  0.2f 
-#define GP_DEFAULT_PIX_FACTOR 40
 
 /* information of vertex group weight */
 typedef struct bGPDweight {
@@ -333,8 +332,6 @@ typedef struct bGPdata {
 	short bfill_style;          /* buffer style for filling areas (used to select shader type) */
 
 	short xray_mode;            /* xray mode for strokes */
-	int pixfactor;              /* factor to define pixel size conversion */
-	char pad1[4];
 
 	/* saved palettes */
 	ListBase palettes DNA_DEPRECATED;
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index aaee530a4ab..be894125b0a 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1253,12 +1253,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Keep thickness", "Show stroke with same thickness when viewport zoom change");
 	RNA_def_property_update(prop, 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list