Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c11
1 files changed, 11 insertions, 0 deletions
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;