diff options
author | Martin Felke <martin.felke@googlemail.com> | 2017-12-20 12:30:39 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-12-20 12:55:02 +0300 |
commit | b1a036861ddd08c314587666a028a59bfb049e54 (patch) | |
tree | b27c5ff9cc3763f01b5646a62be68fcf81a8ef4d /source/blender/alembic/intern/abc_customdata.cc | |
parent | 94a3ee56c7a4d7e76daaed821988741296fb2c8f (diff) |
Fix T53572: Alembic imports UV maps incorrectly
Since in Alembic the loop order seems to be reversed when exporting and
importing, and this was the only place where it was not, I was thinking
to match this to the convention of reversing the loop order as well.
Reviewers: sybren, kevindietrich
Tags: #alembic
Differential Revision: https://developer.blender.org/D2968
Diffstat (limited to 'source/blender/alembic/intern/abc_customdata.cc')
-rw-r--r-- | source/blender/alembic/intern/abc_customdata.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc index d6e7a80d174..8b526616053 100644 --- a/source/blender/alembic/intern/abc_customdata.cc +++ b/source/blender/alembic/intern/abc_customdata.cc @@ -235,17 +235,19 @@ static void read_uvs(const CDStreamConfig &config, void *data, MPoly *mpolys = config.mpoly; MLoopUV *mloopuvs = static_cast<MLoopUV *>(data); - unsigned int uv_index, loop_index; + unsigned int uv_index, loop_index, rev_loop_index; for (int i = 0; i < config.totpoly; ++i) { MPoly &poly = mpolys[i]; + unsigned int rev_loop_offset = poly.loopstart + poly.totloop - 1; for (int f = 0; f < poly.totloop; ++f) { loop_index = poly.loopstart + f; + rev_loop_index = rev_loop_offset - f; uv_index = (*indices)[loop_index]; const Imath::V2f &uv = (*uvs)[uv_index]; - MLoopUV &loopuv = mloopuvs[loop_index]; + MLoopUV &loopuv = mloopuvs[rev_loop_index]; loopuv.uv[0] = uv[0]; loopuv.uv[1] = uv[1]; } |