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:
authorBastien Montagne <bastien@blender.org>2021-10-22 15:57:34 +0300
committerBastien Montagne <bastien@blender.org>2021-10-22 15:59:40 +0300
commit01e2a532f55ee2de3bfd1c0d97d063976546a036 (patch)
tree4f50c7fe7e8397a8ea3a6eb3a87e6e3a1706d2fb /source/blender/makesrna/intern/rna_palette.c
parent029cf23d71b3557e1a9cacc39bde59ec99263458 (diff)
Fix T92290: Linked Color Palette datablocks can not be used.
* Forbid editing linked palettes. * Make `color` RNA property of ColorPalette '`LIB_EXCEPTION`', so that the color buttons in the palette template remain active on linked data. NOTE: This incidently makes linked palettes' colors editable from RNA, not from UI though, so think this is OK for now.
Diffstat (limited to 'source/blender/makesrna/intern/rna_palette.c')
-rw-r--r--source/blender/makesrna/intern/rna_palette.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 67d6daf5a13..30604c7a3b8 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -37,12 +37,20 @@
# include "BKE_report.h"
static PaletteColor *rna_Palette_color_new(Palette *palette)
{
+ if (ID_IS_LINKED(palette) || ID_IS_OVERRIDE_LIBRARY(palette)) {
+ return NULL;
+ }
+
PaletteColor *color = BKE_palette_color_add(palette);
return color;
}
static void rna_Palette_color_remove(Palette *palette, ReportList *reports, PointerRNA *color_ptr)
{
+ if (ID_IS_LINKED(palette) || ID_IS_OVERRIDE_LIBRARY(palette)) {
+ return;
+ }
+
PaletteColor *color = color_ptr->data;
if (BLI_findindex(&palette->colors, color) == -1) {
@@ -58,6 +66,10 @@ static void rna_Palette_color_remove(Palette *palette, ReportList *reports, Poin
static void rna_Palette_color_clear(Palette *palette)
{
+ if (ID_IS_LINKED(palette) || ID_IS_OVERRIDE_LIBRARY(palette)) {
+ return;
+ }
+
BKE_palette_clear(palette);
}
@@ -141,6 +153,7 @@ static void rna_def_palettecolor(BlenderRNA *brna)
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_float_sdna(prop, NULL, "rgb");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Color", "");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);