[Bf-blender-cvs] [0feed8bb239] greasepencil-object: First step to include Pixel Factor
Antonio Vazquez
noreply at git.blender.org
Sun Aug 13 13:04:03 CEST 2017
Commit: 0feed8bb2395b921d504feeb7d30dba3a8002409
Author: Antonio Vazquez
Date: Fri Aug 11 17:08:32 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0feed8bb2395b921d504feeb7d30dba3a8002409
First step to include Pixel Factor
This is equal to old commit but step by step to avoid z-depth error. Doing the commit more granulate allow to debug better the code.
===================================================================
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/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 df0be90df09..9c80af05fc1 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -120,6 +120,9 @@ 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 8fb62d83e85..143f5e33a69 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -772,7 +772,8 @@ 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 5e225d1fe24..4ad2e67453e 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -551,8 +551,12 @@ 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 = GP_DEFAULT_PIX_FACTOR;
+ }
+ }
}
{
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 909bd22014d..f5bb996ac8d 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -40,6 +40,7 @@ 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 {
@@ -332,13 +333,14 @@ typedef struct bGPdata {
short bfill_style; /* buffer style for filling areas (used to select shader type) */
short xray_mode; /* xray mode for strokes */
-
/* saved palettes */
ListBase palettes DNA_DEPRECATED;
/* drawing manager cache */
struct GHash *batch_cache_data;
char last_palette_name[66]; /* name of the last palette used */
char pad[6];
+ int pixfactor; /* factor to define pixel size conversion */
+ char pad1[4];
} bGPdata;
/* bGPdata->flag */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index be894125b0a..aaee530a4ab 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1253,6 +1253,12 @@ 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, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "pixfactor", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pixfactor");
+ RNA_def_property_range(prop, 30, 200);
+ RNA_def_property_ui_text(prop, "Pixel Factor", "Factor of conversion of pixel size (set bigger values for thinner lines)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
/* API Functions */
func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
RNA_def_function_ui_description(func, "Remove all the grease pencil data");
More information about the Bf-blender-cvs
mailing list