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 14:07:17 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-09-18 14:07:17 +0400
commitb247e19ff10c74c756ec94b3d4f910383190f172 (patch)
tree703c16f7c890aae6a67543bf412c51a386e79eb5 /source/blender/blenkernel/intern/paint.c
parente6271d236752b8551d8d401ff6aff8e92efde18e (diff)
Palettes
* Remove some duplication in deletion code * Fix crash when restoring file from last saved state.
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 296ca09a901..6a3062f10ae 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -315,14 +315,13 @@ 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--;
+ if (color) {
+ if ((color == palette->colors.last) && (palette->colors.last != palette->colors.first))
+ palette->active_color--;
+
+ BLI_remlink(&palette->colors, color);
+ BLI_addhead(&palette->deleted, color);
+ }
}
void BKE_palette_cleanup(Palette *palette)
@@ -356,19 +355,6 @@ PaletteColor *BKE_palette_color_add(Palette *palette)
return color;
}
-void BKE_palette_color_delete(struct Palette *palette)
-{
- PaletteColor *color = BLI_findlink(&palette->colors, palette->active_color);
-
- if (color) {
- if ((color == palette->colors.last) && (palette->colors.last != palette->colors.first))
- palette->active_color--;
-
- BLI_remlink(&palette->colors, color);
- BLI_addhead(&palette->deleted, color);
- }
-}
-
bool BKE_palette_is_empty(const struct Palette *palette)
{