diff --git a/utils/exporters/blender/addons/io_three/constants.py b/utils/exporters/blender/addons/io_three/constants.py index 77177250f70f3a..f7ec054b93f15d 100644 --- a/utils/exporters/blender/addons/io_three/constants.py +++ b/utils/exporters/blender/addons/io_three/constants.py @@ -220,6 +220,7 @@ SCALE = 'scale' UV = 'uv' +UV2 = 'uv2' ATTRIBUTES = 'attributes' NORMAL = 'normal' ITEM_SIZE = 'itemSize' diff --git a/utils/exporters/blender/addons/io_three/exporter/api/mesh.py b/utils/exporters/blender/addons/io_three/exporter/api/mesh.py index d7cc5d6c7fbc8e..4c780d342d6ca9 100644 --- a/utils/exporters/blender/addons/io_three/exporter/api/mesh.py +++ b/utils/exporters/blender/addons/io_three/exporter/api/mesh.py @@ -155,22 +155,19 @@ def buffer_position(mesh): @_mesh -def buffer_uv(mesh): +def buffer_uv(mesh, layer=0): """ :param mesh: + :param layer: (Default value = 0) :rtype: [] """ uvs_ = [] - if len(mesh.uv_layers) is 0: + if len(mesh.uv_layers) <= layer: return uvs_ - elif len(mesh.uv_layers) > 1: - # if memory serves me correctly buffer geometry - # only uses one UV layer - logger.warning("%s has more than 1 UV layer", mesh.name) - for uv_data in mesh.uv_layers[0].data: + for uv_data in mesh.uv_layers[layer].data: uv_tuple = (uv_data.uv[0], uv_data.uv[1]) uvs_.extend(uv_tuple) diff --git a/utils/exporters/blender/addons/io_three/exporter/geometry.py b/utils/exporters/blender/addons/io_three/exporter/geometry.py index 389bdf266c596e..bdc92463ed4cfb 100644 --- a/utils/exporters/blender/addons/io_three/exporter/geometry.py +++ b/utils/exporters/blender/addons/io_three/exporter/geometry.py @@ -389,9 +389,11 @@ def _parse_buffer_geometry(self): api.mesh.buffer_position, 3) uvs_tuple = (constants.UV, option_uvs, api.mesh.buffer_uv, 2) + uvs2_tuple = (constants.UV2, option_uvs, + lambda m: api.mesh.buffer_uv(m, layer=1), 2) normals_tuple = (constants.NORMAL, option_normals, api.mesh.buffer_normal, 3) - dispatch = (pos_tuple, uvs_tuple, normals_tuple) + dispatch = (pos_tuple, uvs_tuple, uvs2_tuple, normals_tuple) for key, option, func, size in dispatch: