Fix ##29803: cycles image texture node refresh issue with image editor.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 12 Jan 2012 21:10:30 +0000 (21:10 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 12 Jan 2012 21:10:30 +0000 (21:10 +0000)
source/blender/editors/space_image/space_image.c
source/blender/makesrna/intern/rna_nodetree.c

index 99c190c..4421ad8 100644 (file)
@@ -594,8 +594,13 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
                        /* new shading system, get image from material */
                        EditFace *efa= EM_get_actFace(em, sloppy);
 
-                       if(efa)
-                               ED_object_get_active_image(obedit, efa->mat_nr, &sima->image, NULL, NULL);
+                       if(efa) {
+                               Image *node_ima;
+                               ED_object_get_active_image(obedit, efa->mat_nr, &node_ima, NULL, NULL);
+
+                               if(node_ima)
+                                       sima->image= node_ima;
+                       }
                }
                else {
                        /* old shading system, we set texface */
index 2b59251..a04ddec 100644 (file)
@@ -369,6 +369,15 @@ static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
        node_update(bmain, scene, ntree, node);
 }
 
+static void rna_Node_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+       bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+       bNode *node= (bNode*)ptr->data;
+
+       node_update(bmain, scene, ntree, node);
+       WM_main_add_notifier(NC_IMAGE, NULL);
+}
+
 static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        bNodeTree *ntree= (bNodeTree*)ptr->id.data;
@@ -1268,7 +1277,7 @@ static void def_sh_tex_environment(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Image");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Image", "");
-       RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+       RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update");
 
        RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
        def_sh_tex(srna);
@@ -1293,7 +1302,7 @@ static void def_sh_tex_image(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Image");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Image", "");
-       RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+       RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update");
 
        RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
        def_sh_tex(srna);