Commit: fdb2132d66ca1a18520c90677fb0f2fb5c6a2f69
Author: Antony Riakiotakis
Date:   Wed Mar 12 23:04:31 2014 +0200
https://developer.blender.org/rBfdb2132d66ca1a18520c90677fb0f2fb5c6a2f69

User request: Selecting a slot in the layer panel in projective texture
painting will set that texture in the image editor.

===================================================================

M       source/blender/makesrna/intern/rna_material.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 9b9c98f..457a58d 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -29,12 +29,16 @@
 
 #include "DNA_material_types.h"
 #include "DNA_texture_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
 
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
 #include "rna_internal.h"
 
+#include "ED_image.h"
+
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -177,6 +181,29 @@ static int 
rna_texture_paint_material(CollectionPropertyIterator *UNUSED(iter),
        return 1;
 }
 
+static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene 
*scene, PointerRNA *ptr)
+{
+       bScreen *sc;
+       Material *ma = ptr->id.data;
+       refresh_texpaint_image_cache(ma);
+
+       for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+               ScrArea *sa;
+               for (sa = sc->areabase.first; sa; sa = sa->next) {
+                       SpaceLink *sl;
+                       for (sl = sa->spacedata.first; sl; sl = sl->next) {
+                               if (sl->spacetype == SPACE_IMAGE) {
+                                               SpaceImage *sima = (SpaceImage 
*)sl;
+                                               ED_space_image_set(sima, scene, 
scene->obedit, ma->texpaintima);
+                               }
+                       }
+               }
+       }
+
+       DAG_id_tag_update(&ma->id, 0);
+       WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
+}
+
 static void rna_MaterialTexturePaint_mtex_begin(CollectionPropertyIterator 
*iter, PointerRNA *ptr)
 {
        Material *ma = (Material *)ptr->data;
@@ -2162,7 +2189,7 @@ void rna_def_mtex_texpaint(StructRNA *srna, const char 
*structname)
        RNA_def_property_int_sdna(prop, NULL, "texactpaint");
        RNA_def_property_range(prop, 0, MAX_MTEX - 1);
        RNA_def_property_ui_text(prop, "Active Paint Texture Index", "Index of 
active texture paint slot");
-       RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, 
"rna_Material_update");
+       RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, 
"rna_Material_active_paint_texture_index_update");
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to