diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-09-18 13:16:31 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-09-18 13:16:31 +0400 |
commit | e6271d236752b8551d8d401ff6aff8e92efde18e (patch) | |
tree | 82e76b140c3d8c123ce469c0c2277fdea3c4e881 /source/blender/blenkernel/intern/paint.c | |
parent | 90f75b8ce034068f0f8192e32d4b9a6d9261393f (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.c | 6 |
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) |