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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-03-19 22:07:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-03-19 22:08:38 +0300
commit81472aff2be5a8059e046436b4d1810659032716 (patch)
treefeb17572be55e29d82af3c67eca7f76a6f605623 /source
parenteee538f0d262a430cc622bfe17eef7dba9b251c7 (diff)
Remove deleted list for palette colors
was used because of UI memory access only.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/intern/paint.c21
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c3
-rw-r--r--source/blender/makesdna/DNA_brush_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_palette.c2
7 files changed, 9 insertions, 27 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 58c0b495062..9076eada312 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -102,9 +102,7 @@ void BKE_palette_free(struct Palette *palette);
struct Palette *BKE_palette_add(struct Main *bmain, const char *name);
struct PaletteColor *BKE_palette_color_add(struct Palette *palette);
bool BKE_palette_is_empty(const struct Palette *palette);
-void BKE_palette_color_remove_ex(struct Palette *palette, struct PaletteColor *color, bool use_free);
void BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *color);
-void BKE_palette_cleanup(struct Palette *palette);
void BKE_palette_clear(struct Palette *palette);
/* paint curves */
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 2082066d395..c3c88389e11 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -314,7 +314,7 @@ 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_ex(Palette *palette, PaletteColor *color, bool use_free)
+void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
{
if (BLI_listbase_count_ex(&palette->colors, palette->active_color) == palette->active_color) {
palette->active_color--;
@@ -326,32 +326,15 @@ void BKE_palette_color_remove_ex(Palette *palette, PaletteColor *color, bool use
palette->active_color = 0;
}
- if (use_free) {
- MEM_freeN(color);
- }
- else {
- BLI_addhead(&palette->deleted, color);
- }
-}
-
-void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
-{
- BKE_palette_color_remove_ex(palette, color, false);
+ MEM_freeN(color);
}
void BKE_palette_clear(Palette *palette)
{
BLI_freelistN(&palette->colors);
- BLI_freelistN(&palette->deleted);
palette->active_color = 0;
}
-void BKE_palette_cleanup(Palette *palette)
-{
- BLI_freelistN(&palette->deleted);
-}
-
-
Palette *BKE_palette_add(Main *bmain, const char *name)
{
Palette *palette;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6b4d45a85dc..639ee646a67 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1950,7 +1950,6 @@ static void direct_link_palette(FileData *fd, Palette *palette)
{
/* palette itself has been read */
link_list(fd, &palette->colors);
- BLI_listbase_clear(&palette->deleted);
}
static void lib_link_paint_curve(FileData *UNUSED(fd), Main *main)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a6ff5bb3ad3..71b7b95208b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4494,6 +4494,12 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co
BKE_palette_color_remove(palette, color);
button_activate_state(C, but, BUTTON_STATE_EXIT);
+
+ /* this is risky. it works OK for now,
+ * but if it gives trouble we should delay execution */
+ but->rnapoin = PointerRNA_NULL;
+ but->rnaprop = NULL;
+
return WM_UI_HANDLER_BREAK;
}
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b3c31a1a644..7db734ee919 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2398,9 +2398,6 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
palette = cptr.data;
- /* first delete any pending colors */
- BKE_palette_cleanup(palette);
-
color = palette->colors.first;
col = uiLayoutColumn(layout, true);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 89c8316002b..dd66acf2781 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -151,7 +151,6 @@ typedef struct Palette
/* pointer to individual colours */
ListBase colors;
- ListBase deleted;
int active_color;
int pad;
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 7405df967a0..8cbb57fde2c 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -55,7 +55,7 @@ static void rna_Palette_color_remove(Palette *palette, ReportList *reports, Poin
return;
}
- BKE_palette_color_remove_ex(palette, color, true);
+ BKE_palette_color_remove(palette, color);
RNA_POINTER_INVALIDATE(color_ptr);
}