From 92119982cb2073829560c54991179359f1c1fca1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 12 Jul 2012 07:30:50 +0000 Subject: Fix #32082: face textures lost when linking scene from another file Issue was caused by missing expand for MTexPoly-s tpages. --- source/blender/blenloader/intern/readfile.c | 37 ++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 14860509d81..4a5eabc7615 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8519,7 +8519,6 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me) { CustomDataLayer *layer; - MTFace *mtf; TFace *tf; int a, i; @@ -8541,14 +8540,34 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me) } } - for (a = 0; a < me->fdata.totlayer; a++) { - layer = &me->fdata.layers[a]; - - if (layer->type == CD_MTFACE) { - mtf = (MTFace*)layer->data; - for (i = 0; i < me->totface; i++, mtf++) { - if (mtf->tpage) - expand_doit(fd, mainvar, mtf->tpage); + if (me->mface && !me->mpoly) { + MTFace *mtf; + + for (a = 0; a < me->fdata.totlayer; a++) { + layer = &me->fdata.layers[a]; + + if (layer->type == CD_MTFACE) { + mtf = (MTFace *) layer->data; + for (i = 0; i < me->totface; i++, mtf++) { + if (mtf->tpage) + expand_doit(fd, mainvar, mtf->tpage); + } + } + } + } + else { + MTexPoly *mtp; + + for (a = 0; a < me->pdata.totlayer; a++) { + layer = &me->pdata.layers[a]; + + if (layer->type == CD_MTEXPOLY) { + mtp = (MTexPoly *) layer->data; + + for (i = 0; i < me->totpoly; i++, mtp++) { + if (mtp->tpage) + expand_doit(fd, mainvar, mtp->tpage); + } } } } -- cgit v1.2.3