Fix: toggling premultiply or color management not updating packed images.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 11 Jan 2012 13:18:24 +0000 (13:18 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 11 Jan 2012 13:18:24 +0000 (13:18 +0000)
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_scene.c

index 9e7f4a349e7c534ef4fcf3464aae2ba94a2c073b..7059c001283856cf28c05ba2401276344500ca92 100644 (file)
@@ -107,6 +107,15 @@ static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
        BKE_image_release_ibuf(ima, lock);
 }
 
+static void rna_Image_free_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+       Image *ima= ptr->id.data;
+       BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
+       WM_main_add_notifier(NC_IMAGE|NA_EDITED, &ima->id);
+       DAG_id_tag_update(&ima->id, 0);
+}
+
+
 static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Image *ima= ptr->id.data;
@@ -476,12 +485,12 @@ static void rna_def_image(BlenderRNA *brna)
        prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL);
        RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
-       RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");
+       RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_free_update");
        
        prop= RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_CM_PREDIVIDE);
        RNA_def_property_ui_text(prop, "Color Unpremultiply", "For premultiplied alpha images, do color space conversion on colors without alpha, to avoid fringing for images with light backgrounds");
-       RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");
+       RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_free_update");
 
        prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
index feb8d0cb549310fb58f8f37031c0b0e9cd70321d..84cf50a3755d33f892df94e4db32e3220ea5b65e 100644 (file)
@@ -999,7 +999,7 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSE
                                WM_main_add_notifier(NC_NODE|NA_EDITED, node);
                                
                                if (node->type == CMP_NODE_IMAGE)
-                                       BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_RELOAD);
+                                       BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_FREE);
                        }
                }
        }