Fix T82785: Setting Image.alpha_mode clears generated image data
This commit is contained in:
parent
10e093b30d
commit
9509e18564
Notes:
blender-bot
2023-02-14 01:21:16 +01:00
Referenced by issue #82785, Image does not save properly when setting alpha_mode to "STRAIGHT"
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue