Libquery: fix missing image pointers from Mesh's UV layers.

Not really happy with this, could lead to a **lot** of callback executions...
But libquery foreach looper must go over **all** ID pointers,
otherwise remapping & co is broken!

A possible fix for future would be to have 'image slots' defined at root of poly/facetex layers,
and just a (short) index in each face/poly item - would also save a reasonable amount of memory...
This commit is contained in:
Bastien Montagne 2016-07-08 17:28:28 +02:00
parent d1a4ae3f39
commit f34fc60aa4
1 changed files with 26 additions and 0 deletions

View File

@ -45,6 +45,7 @@
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_mask_types.h"
@ -492,6 +493,31 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
for (i = 0; i < mesh->totcol; i++) {
CALLBACK_INVOKE(mesh->mat[i], IDWALK_USER);
}
/* XXX Really not happy with this - probably texface should rather use some kind of
* 'texture slots' and just set indices in each poly/face item - would also save some memory.
* Maybe a nice TODO for blender2.8? */
if (mesh->mtface || mesh->mtpoly) {
for (i = 0; i < mesh->pdata.totlayer; i++) {
if (mesh->pdata.layers[i].type == CD_MTEXPOLY) {
MTexPoly *txface = (MTexPoly *)mesh->pdata.layers[i].data;
for (int j = 0; j < mesh->totpoly; j++, txface++) {
CALLBACK_INVOKE(txface->tpage, IDWALK_USER_ONE);
}
}
}
for (i = 0; i < mesh->fdata.totlayer; i++) {
if (mesh->fdata.layers[i].type == CD_MTFACE) {
MTFace *tface = (MTFace *)mesh->fdata.layers[i].data;
for (int j = 0; j < mesh->totface; j++, tface++) {
CALLBACK_INVOKE(tface->tpage, IDWALK_USER_ONE);
}
}
}
}
break;
}