Fix crash in active_paint_texture_index callback

This commit is contained in:
Campbell Barton
2014-09-10 21:56:45 +10:00
parent 20d6b792a4
commit 64e955f522

View File

@@ -195,14 +195,17 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
nodeSetActive(ma->nodetree, node);
}
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->texpaintslot[ma->paint_active_slot].ima);
if (ma->texpaintslot) {
Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
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, image);
}
}
}
}