[Bf-blender-cvs] [f855bb52fb8] greasepencil-object: Annotations: Properly initialise annotation datablocks
Joshua Leung
noreply at git.blender.org
Thu Jun 28 09:14:01 CEST 2018
Commit: f855bb52fb8464cbf30c0541f725d1cdc9ed9156
Author: Joshua Leung
Date: Thu Jun 28 13:26:23 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBf855bb52fb8464cbf30c0541f725d1cdc9ed9156
Annotations: Properly initialise annotation datablocks
===================================================================
M source/blender/blenkernel/intern/gpencil.c
M source/blender/editors/gpencil/annotate_paint.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6a12615c8c1..9ab1a9383f7 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -409,15 +409,23 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti
/* add to datablock */
BLI_addtail(&gpd->layers, gpl);
- /* set basic settings */
- copy_v4_v4(gpl->color, U.gpencil_new_layer_col);
- /* Since GPv2 thickness must be 0 */
- gpl->thickness = 0;
+ /* annotation vs GP Object behaviour is slightly different */
+ if (gpd->flag & GP_DATA_ANNOTATIONS) {
+ /* set default color of new strokes for this layer */
+ copy_v4_v4(gpl->color, U.gpencil_new_layer_col);
+ gpl->opacity = 1.0f;
- gpl->opacity = 1.0f;
+ /* set default thickness of new strokes for this layer */
+ gpl->thickness = 3;
- /* onion-skinning settings */
- gpl->onion_flag |= GP_LAYER_ONIONSKIN;
+ /* onion-skinning settings */
+ gpl->onion_flag |= GP_LAYER_ONIONSKIN;
+ }
+ else {
+ /* thickness parameter represents "thickness change", not absolute thickness */
+ gpl->thickness = 0;
+ gpl->opacity = 1.0f;
+ }
/* auto-name */
BLI_strncpy(gpl->info, name, sizeof(gpl->info));
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index f10d47b2594..98ba3afe9e7 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1206,8 +1206,10 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
}
else {
/* if no existing GPencil block exists, add one */
- if (*gpd_ptr == NULL)
- *gpd_ptr = BKE_gpencil_data_addnew(bmain, "GPencil");
+ if (*gpd_ptr == NULL) {
+ *gpd_ptr = BKE_gpencil_data_addnew(bmain, "Notes");
+ (*gpd_ptr)->flag |= GP_DATA_ANNOTATIONS;
+ }
p->gpd = *gpd_ptr;
}
More information about the Bf-blender-cvs
mailing list