Fix for assert when sampling color to non-existent palette
This commit is contained in:
@@ -104,6 +104,7 @@ void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag);
|
||||
void BKE_paint_set_overlay_override(enum eOverlayFlags flag);
|
||||
|
||||
/* palettes */
|
||||
void BKE_palette_init(struct Palette *palette);
|
||||
void BKE_palette_free(struct Palette *palette);
|
||||
struct Palette *BKE_palette_add(struct Main *bmain, const char *name);
|
||||
void BKE_palette_copy_data(
|
||||
|
||||
@@ -1373,6 +1373,9 @@ void BKE_libblock_init_empty(ID *id)
|
||||
/* Should not be needed - animation from lib pre-2.5 is broken anyway. */
|
||||
BLI_assert(0);
|
||||
break;
|
||||
case ID_PAL:
|
||||
BKE_palette_init((Palette *)id);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0); /* Should never reach this point... */
|
||||
}
|
||||
|
||||
@@ -398,10 +398,6 @@ void BKE_palette_clear(Palette *palette)
|
||||
Palette *BKE_palette_add(Main *bmain, const char *name)
|
||||
{
|
||||
Palette *palette = BKE_id_new(bmain, ID_PAL, name);
|
||||
|
||||
/* enable fake user by default */
|
||||
id_fake_user_set(&palette->id);
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
@@ -430,6 +426,12 @@ void BKE_palette_make_local(Main *bmain, Palette *palette, const bool lib_local)
|
||||
BKE_id_make_local_generic(bmain, &palette->id, true, lib_local);
|
||||
}
|
||||
|
||||
void BKE_palette_init(Palette *palette)
|
||||
{
|
||||
/* Enable fake user by default. */
|
||||
id_fake_user_set(&palette->id);
|
||||
}
|
||||
|
||||
/** Free (or release) any data used by this palette (does not free the palette itself). */
|
||||
void BKE_palette_free(Palette *palette)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user