[Bf-blender-cvs] [7ded480dff5] greasepencil-object: Reset color name only if not valid for the palette

Antonio Vazquez noreply at git.blender.org
Fri Mar 16 10:51:49 CET 2018


Commit: 7ded480dff5a9908c427004eac026ce93de13de9
Author: Antonio Vazquez
Date:   Fri Mar 16 10:51:38 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7ded480dff5a9908c427004eac026ce93de13de9

Reset color name only if not valid for the palette

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

M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 19c13544daa..33cab129637 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -708,7 +708,12 @@ static void rna_BrushPalette_colorname_reset(Main *UNUSED(bmain), Scene *UNUSED(
 {
 	/* reset colorname */
 	Brush *brush = ptr->data;
-	brush->colorname[0] = '\0';
+	Palette *palette = brush->palette;
+	PaletteColor *palcolor = BKE_palette_color_getbyname(palette, brush->colorname);
+
+	if (palcolor == NULL) {
+		brush->colorname[0] = '\0';
+	}
 }
 
 /* check the current color is valid */



More information about the Bf-blender-cvs mailing list