From 1cad0a627e882cf0c5a98d1b482327e59f65a87a Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 15 May 2020 16:43:50 +0200 Subject: GPencil: Fix unreported missing Sculpt/Vertex/Weight paint brushes This error was introduced wit the change in commit https://developer.blender.org/rB6a850f3cc840 As the brushes were not created, all modes except Edit were broken. Now, the brushes and palette are not created when load the file in versioning code, but when the mode is enabled. Also, if the brush already exist, the parameters are not reset as it was done in the versioning code in order to keep user settings. The same logic is used for the default palette. --- source/blender/blenkernel/intern/gpencil.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenkernel/intern/gpencil.c') diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 041ef0503b9..04d3c32f599 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1748,7 +1748,18 @@ void BKE_gpencil_palette_ensure(Main *bmain, Scene *scene) GpPaint *gp_paint = ts->gp_paint; Paint *paint = &gp_paint->paint; + if (paint->palette != NULL) { + return; + } + paint->palette = BLI_findstring(&bmain->palettes, "Palette", offsetof(ID, name) + 2); + /* Try with first palette. */ + if (bmain->palettes.first != NULL) { + paint->palette = bmain->palettes.first; + ts->gp_vertexpaint->paint.palette = paint->palette; + return; + } + if (paint->palette == NULL) { paint->palette = BKE_palette_add(bmain, "Palette"); ts->gp_vertexpaint->paint.palette = paint->palette; -- cgit v1.2.3