[Bf-blender-cvs] [f0a75671547] greasepencil-object: Cleanup: Replace by generic function

Antonio Vazquez noreply at git.blender.org
Thu Jul 13 11:33:31 CEST 2017


Commit: f0a7567154702cf431c8e3b8bbc862d7b569d4b0
Author: Antonio Vazquez
Date:   Thu Jul 13 10:59:37 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf0a7567154702cf431c8e3b8bbc862d7b569d4b0

Cleanup: Replace by generic function

Call generic default creation code

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

M	source/blender/editors/gpencil/gpencil_data.c

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

diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index e2b0bc42c79..c5d2e0c75f6 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -102,14 +102,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
 		id_us_min(&gpd->id);
 		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 
-		/* if not exist brushes, create a new set */
-		if (ts) {
-			if (BLI_listbase_is_empty(&ts->gp_brushes)) {
-				/* create new brushes */
-				BKE_gpencil_brush_init_presets(ts);
-			}
-		}
-
+		/* add default sets of colors and brushes */
+		ED_gpencil_add_defaults(C);
 	}
 	
 	/* notifiers */
@@ -199,13 +193,8 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
 	if (*gpd_ptr == NULL)
 		*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
 	
-	/* if not exist brushes, create a new set */
-	if (ts) {
-		if (BLI_listbase_is_empty(&ts->gp_brushes)) {
-			/* create new brushes */
-			BKE_gpencil_brush_init_presets(ts);
-		}
-	}
+	/* add default sets of colors and brushes */
+	ED_gpencil_add_defaults(C);
 
 	/* add new layer now */
 	BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);




More information about the Bf-blender-cvs mailing list