diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-28 10:24:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-28 10:27:25 +0300 |
commit | 9509e18564452c1f95a8967accbb1aeb6094d222 (patch) | |
tree | 138aa089c49c9770add84fba2331e6545ec63c70 /source/blender/makesrna/intern/rna_image.c | |
parent | 10e093b30d17149008a10df3f52d39744577f17b (diff) |
Fix T82785: Setting Image.alpha_mode clears generated image data
Diffstat (limited to 'source/blender/makesrna/intern/rna_image.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 1e84ded6cde..b3272f44826 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -128,6 +128,17 @@ static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), Poin WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id); } +static void rna_Image_alpha_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->owner_id; + /* When operating on a generated image, avoid re-generating when changing the alpha-mode + * as it doesn't impact generated images, causing them to reload pixel data, see T82785. */ + if (ima->source == IMA_SRC_GENERATED) { + return; + } + rna_Image_colormanage_update(bmain, scene, ptr); +} + static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima = (Image *)ptr->owner_id; @@ -1133,7 +1144,7 @@ static void rna_def_image(BlenderRNA *brna) "Alpha Mode", "Representation of alpha in the image file, to convert to and from " "when saving and loading the image"); - RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_alpha_mode_update"); prop = RNA_def_property(srna, "use_half_precision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_HIGH_BITDEPTH); |