Fix T103242: Missing update on undo/redo for some image properties.
Issue comes from the fact that some of the image updates are handled outside of depsgraph context (through the signal system), and therefore completely ignored by the undo/redo code. Now that undo/redo tries to update as little data as possible, it needs to be aware of these changes. As a temporary workaround, until image update is fully handled through depsgraph, consider that IDs tagged with `ID_RECALC_SOURCE` should get their caches cleared on undo/redo, and tag some RNA property updates of Image/ColorSpace as such. Reviewed By: sergey Maniphest Tasks: T103242 Differential Revision: https://developer.blender.org/D16927
This commit is contained in:
parent
5c4d11d709
commit
fc9c39e320
Notes:
blender-bot
2023-02-14 02:22:13 +01:00
Referenced by issue #103242, Regression: Image Texture node: color space and alpha changes are ignored in undo/redo
|
@ -1604,7 +1604,7 @@ static void blo_cache_storage_entry_register(
|
|||
|
||||
/** Restore a cache data entry from old ID into new one, when reading some undo memfile. */
|
||||
static void blo_cache_storage_entry_restore_in_new(
|
||||
ID * /*id*/, const IDCacheKey *key, void **cache_p, uint flags, void *cache_storage_v)
|
||||
ID *id, const IDCacheKey *key, void **cache_p, uint flags, void *cache_storage_v)
|
||||
{
|
||||
BLOCacheStorage *cache_storage = static_cast<BLOCacheStorage *>(cache_storage_v);
|
||||
|
||||
|
@ -1618,6 +1618,15 @@ static void blo_cache_storage_entry_restore_in_new(
|
|||
return;
|
||||
}
|
||||
|
||||
/* Assume that when ID source is tagged as changed, its caches need to be cleared.
|
||||
* NOTE: This is mainly a work-around for some IDs, like Image, which use a non-depsgraph-handled
|
||||
* process for part of their updates.
|
||||
*/
|
||||
if (id->recalc & ID_RECALC_SOURCE) {
|
||||
*cache_p = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
BLOCacheStorageValue *storage_value = static_cast<BLOCacheStorageValue *>(
|
||||
BLI_ghash_lookup(cache_storage->cache_map, key));
|
||||
if (storage_value == nullptr) {
|
||||
|
|
|
@ -626,6 +626,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
|
|||
Image *ima = (Image *)id;
|
||||
|
||||
DEG_id_tag_update(&ima->id, 0);
|
||||
DEG_id_tag_update(&ima->id, ID_RECALC_SOURCE);
|
||||
|
||||
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), Poin
|
|||
Image *ima = (Image *)ptr->owner_id;
|
||||
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
|
||||
DEG_id_tag_update(&ima->id, 0);
|
||||
DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
|
||||
DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS | ID_RECALC_SOURCE);
|
||||
WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
|
||||
WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue