[Bf-blender-cvs] [df62778a552] greasepencil-object: Tweak behaviour of adding a new GP Palette (to match other parts of Blender)

Joshua Leung noreply at git.blender.org
Wed Oct 4 14:17:26 CEST 2017


Commit: df62778a5529009637fcb6b3db1c5d39dac338f6
Author: Joshua Leung
Date:   Thu Oct 5 00:20:23 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBdf62778a5529009637fcb6b3db1c5d39dac338f6

Tweak behaviour of adding a new GP Palette (to match other parts of Blender)

When creating a new Palette with an existing Palette assigned to a slot,
a copy of the old Palette will be created (i.e. the new copy will have all
the same colours), instead of creating a blank palette.

This makes it easier to create different versions of the same palette.

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

M	source/blender/editors/sculpt_paint/paint_ops.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index e41e77f0639..17d7198c757 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -226,12 +226,14 @@ static int palette_new_gpencil_exec(bContext *C, wmOperator *UNUSED(op))
 	/* add new palette for use with active paletteslot */
 	bGPDpaletteref *palslot = BKE_gpencil_paletteslot_get_active(gpd);
 	if (palslot && palslot->palette) {
-		/* we need to replace the existing palette with a new one */
-		Palette *palette = BKE_palette_add(bmain, "Palette");
+		/* Replace the existing palette with a copy of the original datablock
+		 * (as done in the rest of Blender)
+		 */
+		Palette *palette = BKE_palette_copy(bmain, palslot->palette);
 		BKE_gpencil_paletteslot_set_palette(gpd, palslot, palette);
 	}
 	else {
-		/* just create everything that doesn't exist already */
+		/* Just create everything that doesn't exist already */
 		palslot = BKE_gpencil_paletteslot_validate(bmain, gpd);
 	}



More information about the Bf-blender-cvs mailing list