[Bf-blender-cvs] [d0c9a62904b] soc-2020-greasepencil-curve: GPencil: Update defaults for curve resolution
Falk David
noreply at git.blender.org
Wed Jul 22 19:06:38 CEST 2020
Commit: d0c9a62904b8e31f66d0b9d7c1f2eec0e3688b50
Author: Falk David
Date: Wed Jul 22 17:33:29 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBd0c9a62904b8e31f66d0b9d7c1f2eec0e3688b50
GPencil: Update defaults for curve resolution
===================================================================
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenloader/intern/versioning_290.c
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 7932be4000f..8d73ad44071 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -536,6 +536,7 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
gpd->flag |= GP_DATA_VIEWALIGN;
/* always enable object onion skin switch */
gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
+
/* GP object specific settings */
ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
@@ -543,6 +544,8 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
gpd->editcurve_resolution = GP_DEFAULT_CURVE_RESOLUTION;
gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
+ /* use adaptive curve resolution by default */
+ gpd->flag |= GP_DATA_CURVE_ADAPTIVE_RESOLUTION;
gpd->zdepth_offset = 0.150f;
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 76d25d744fe..807a3505db6 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -307,13 +307,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Init grease pencil default curve resolution. */
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "int", "editcurve_resolution")) {
- for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+ LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
gpd->editcurve_resolution = GP_DEFAULT_CURVE_RESOLUTION;
+ gpd->flag |= GP_DATA_CURVE_ADAPTIVE_RESOLUTION;
}
}
/* Init grease pencil curve editing error threshold. */
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
- for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+ LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
}
}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index adac760f8fb..914f422b600 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -38,8 +38,8 @@ struct Curve;
#define GP_MATERIAL_BUFFER_LEN 256
-#define GP_DEFAULT_CURVE_RESOLUTION 16
-#define GP_DEFAULT_CURVE_ERROR 0.01f
+#define GP_DEFAULT_CURVE_RESOLUTION 32
+#define GP_DEFAULT_CURVE_ERROR 0.1f
/* ***************************************** */
/* GP Stroke Points */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index b75d290371c..962ea90aa29 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -2376,11 +2376,12 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_adaptive_curve_resolution", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_CURVE_ADAPTIVE_RESOLUTION);
+ RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop,
"Adaptive Resolution",
"Set the resolution of each editcurve segment dynamically depending on "
"the length of the segment. The resolution is the number of points "
- "generated per unit distance. ");
+ "generated per unit distance");
RNA_def_property_update(
prop, NC_GPENCIL | ND_DATA, "rna_GPencil_stroke_curve_resolution_update");
More information about the Bf-blender-cvs
mailing list