diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-24 21:21:22 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-24 21:21:22 +0400 |
commit | da4028d4a8265b7d4ba608729127604ea0f87a21 (patch) | |
tree | 275c79b31aaaf8c5dbf8a98e0a5ecf97b2483827 | |
parent | 623f3b3e3a69625add367b670108ed6477443d92 (diff) |
Fix #33953: blender crash after few steps with .exr image in compositor
Issue was caused by FILE multilayer ImBuf sharing buffers with render
result, and SEQUENCE multilayer ImBufs duplicating buffers. Which is
nice by it's own. But, changing image source wouldn't remove any loaded
image buffers, meaning if you've got loaded FILE multilayers they'll
likely became invalid.
That behavior of handling multilayers on changing source was done as
a fix for #24976, which is now actually not needed (removing check
for multilayer doesn't change behavior at all).
Just to be sure added check to RNA, so signal wouldn't be fired if
source wasn't actually changed form a menu.
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 14 |
2 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index c56091ead62..82b0d231869 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2205,9 +2205,20 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) } } +#if 0 /* force reload on first use, but not for multilayer, that makes nodes and buttons in ui drawing fail */ if (ima->type != IMA_TYPE_MULTILAYER) image_free_buffers(ima); +#else + /* image buffers for non-sequence multilayer will share buffers with RenderResult, + * however sequence multilayer will own buffers. Such logic makes switching from + * single multilayer file to sequence completely instable + * since changes in nodes seems this workaround isn't needed anymore, all sockets + * are nicely detecting anyway, but freeing buffers always here makes multilayer + * sequences behave stable + */ + image_free_buffers(ima); +#endif ima->ok = 1; if (iuser) diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 180a5a180fd..72e27ba9240 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -88,11 +88,15 @@ static int rna_Image_dirty_get(PointerRNA *ptr) return 0; } -static void rna_Image_source_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Image_source_set(PointerRNA *ptr, int value) { Image *ima = ptr->id.data; - BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE); - DAG_id_tag_update(&ima->id, 0); + + if (value != ima->source) { + ima->source = value; + BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE); + DAG_id_tag_update(&ima->id, 0); + } } static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -527,9 +531,9 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, image_source_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Image_source_itemf"); + RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf"); RNA_def_property_ui_text(prop, "Source", "Where the image comes from"); - RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_source_update"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_type_items); |