diff options
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 23 |
2 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index e7500392c81..8ccdb8a3223 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1340,8 +1340,11 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) if (use_nodes || ma->use_nodes) { bNode *node, *active_node; - if (!(ma->nodetree)) + if (!(ma->nodetree)) { + ma->paint_active_slot = 0; + ma->paint_clone_slot = 0; return; + } for (node = ma->nodetree->nodes.first; node; node = node->next) { if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index f596f330534..f0176bcd04d 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1391,20 +1391,21 @@ void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op) if (!ma->texpaintslot) { proj_paint_add_slot(C, ma, NULL); - 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[0].ima); + if (ma->texpaintslot) { + 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[0].ima); + } } } } - } - + } } } } |