diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-08 18:28:28 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-08 19:11:20 +0300 |
commit | f34fc60aa4b8682c3e3b13907dad4407a1f91b2a (patch) | |
tree | 77155ab259cbbaae32ccec39e69fe04cac5dfc30 /source | |
parent | d1a4ae3f395a6dbb6487c5885d2327129d9b4532 (diff) |
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...
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library_query.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index d068a394089..fbf4575e1e3 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -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; } |