Fix T49534: 2.78 Wrong texture scaling in material viewport

Seems to be a bug in original implementation of a830280: code was always
using tangent space instead of UV map because it had the same name. Now
prefer UVMap over tangent because this is how Cycles works. At least it's
closer to.

Not sure it the save+reload issue is still relevant after this fix, that
needs to be double-checked.

Thanks @dfelinto for looking into the report and simplifying the case.

Should be included into 2.78a.
This commit is contained in:
Sergey Sharybin 2016-10-13 18:31:53 +02:00
parent fd9aa06440
commit 3fb0c1b8e7
1 changed files with 4 additions and 4 deletions

View File

@ -3675,15 +3675,15 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
* We do it based on the specified name.
*/
if (gattribs->layer[b].name[0]) {
layer = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, gattribs->layer[b].name);
type = CD_TANGENT;
layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name);
type = CD_MTFACE;
if (layer == -1) {
layer = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, gattribs->layer[b].name);
type = CD_MCOL;
}
if (layer == -1) {
layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name);
type = CD_MTFACE;
layer = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, gattribs->layer[b].name);
type = CD_TANGENT;
}
if (layer == -1) {
continue;