[Bf-blender-cvs] [27a7f4bf439] greasepencil-object: GPencil: Change materials defaults for 2D template

Antonio Vazquez noreply at git.blender.org
Sun Nov 3 11:26:44 CET 2019


Commit: 27a7f4bf439d212e1b9a5070598dbb023d12a98a
Author: Antonio Vazquez
Date:   Sun Nov 3 10:56:34 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB27a7f4bf439d212e1b9a5070598dbb023d12a98a

GPencil: Change materials defaults for 2D template

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

M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenloader/intern/versioning_defaults.c

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

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 08d32b44b0f..08cdf75b892 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -293,9 +293,9 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
   /* Create and link Black Dots material to brush.
    * This material is required because the brush uses the material to define how the stroke is
    * drawn. */
-  Material *ma = BLI_findstring(&bmain->materials, "Black Dots", offsetof(ID, name) + 2);
+  Material *ma = BLI_findstring(&bmain->materials, "Dots Stroke", offsetof(ID, name) + 2);
   if (ma == NULL) {
-    ma = BKE_material_add_gpencil(bmain, "Black Dots");
+    ma = BKE_material_add_gpencil(bmain, "Dots Stroke");
   }
   brush->gpencil_settings->material = ma;
   /* Pin the matterial to the brush. */
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 9fce89558b6..42bb91ea0f1 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -46,6 +46,7 @@
 #include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_material.h"
 #include "BKE_node.h"
 #include "BKE_paint.h"
 #include "BKE_screen.h"
@@ -526,6 +527,27 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
       BKE_id_delete(bmain, brush);
     }
 
+    /* Rename and fix materials. */
+    Material *ma = NULL;
+    rename_id_for_versioning(bmain, ID_MA, "Black", "Solid Stroke");
+    rename_id_for_versioning(bmain, ID_MA, "Red", "Boxes Stroke");
+    rename_id_for_versioning(bmain, ID_MA, "Grey", "Solid Fill");
+    rename_id_for_versioning(bmain, ID_MA, "Black Dots", "Dots Stroke");
+
+    /* Dots Stroke. */
+    ma = BLI_findstring(&bmain->materials, "Dots Stroke", offsetof(ID, name) + 2);
+    if (ma == NULL) {
+      ma = BKE_material_add_gpencil(bmain, "Dots Stroke");
+    }
+    ma->gp_style->mode = GP_STYLE_MODE_DOTS;
+
+    /* Boxes Stroke. */
+    ma = BLI_findstring(&bmain->materials, "Boxes Stroke", offsetof(ID, name) + 2);
+    if (ma == NULL) {
+      ma = BKE_material_add_gpencil(bmain, "Boxes Stroke");
+    }
+    ma->gp_style->mode = GP_STYLE_MODE_BOX;
+
     /* Reset all grease pencil brushes. */
     Scene *scene = bmain->scenes.first;
     BKE_brush_gpencil_presets(bmain, scene->toolsettings);



More information about the Bf-blender-cvs mailing list