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:
authorAntony Riakiotakis <kalast@gmail.com>2014-09-18 13:16:31 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-09-18 13:16:31 +0400
commite6271d236752b8551d8d401ff6aff8e92efde18e (patch)
tree82e76b140c3d8c123ce469c0c2277fdea3c4e881 /source/blender/blenkernel/intern/paint.c
parent90f75b8ce034068f0f8192e32d4b9a6d9261393f (diff)
Palettes:
Avoid having an invalid active index if user deletes a color. Also attempt to set active color on clicking (Not working yet but fix coming soon)
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 4382d74f34e..296ca09a901 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -315,8 +315,14 @@ void BKE_paint_curve_set(Brush *br, PaintCurve *pc)
/* remove colour from palette. Must be certain color is inside the palette! */
void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
{
+ int num_items;
BLI_remlink(&palette->colors, color);
+
+ num_items = BLI_countlist(&palette->colors);
+
BLI_addhead(&palette->deleted, color);
+ if (palette->active_color == num_items && num_items > 0)
+ palette->active_color--;
}
void BKE_palette_cleanup(Palette *palette)