Adding more than 8 UVMap

I am trying to upgrade a LW importer and I have come across a mesh that has more than 8 UVMaps, it has 766.

I know that if you use mesh in the normal mode you can only have 8 UVMaps.

If you want to have more than 8 you have to create a bmesh object and copy across the mesh data and operate on the bmesh equivalent.

This is the code I am implementing:

        bm = bmesh.new()
        bm.from_mesh(me)
        for i, uvmap_key in enumerate(allmaps):
            print(i, uvmap_key)
            bm.loops.layers.uv.new(uvmap_key)
        bm.to_mesh(me)
        bm.free()

The only problem is that when I try and add 766 UVmaps this way, (len(allmaps) == 766), each time it adds a UVMap it gets slower and slower and eventually taking seconds to add 1 UVMap, which I am see via the print statement to the screen.

Is this the correct way to add many many UVMaps or is there is an realistic upper limit on how many can be added even to a Bmesh?

I suspose it is a question of operation, but do the 8+ UVMaps even survive the path back into the ordinary mesh format at the end?

bm.to_mesh(me)

Does any one know of another importer handling this number of UVMaps successfully?

1 Like

OK so have been trying to answer my own question.

I opened up the UVMaps via BMesh to handle 16 instead of 8 UVMaps. Sure enough when it got converted back to the regular mesh, there were only 8 UVMaps addressable, the remaining maps returns None

mesh573-uvs <bpy_struct, MeshUVLoopLayer("mesh573-uvs")>
mesh109-uvs <bpy_struct, MeshUVLoopLayer("mesh109-uvs")>
mesh362-uvs <bpy_struct, MeshUVLoopLayer("mesh362-uvs")>
mesh126-uvs <bpy_struct, MeshUVLoopLayer("mesh126-uvs")>
mesh241-uvs <bpy_struct, MeshUVLoopLayer("mesh241-uvs")>
mesh695-uvs <bpy_struct, MeshUVLoopLayer("mesh695-uvs")>
mesh100-uvs <bpy_struct, MeshUVLoopLayer("mesh100-uvs")>
mesh769-uvs <bpy_struct, MeshUVLoopLayer("mesh769-uvs")>
mesh353-uvs None
mesh532-uvs None
mesh262-uvs None
mesh168-uvs None
mesh511-uvs None
mesh62-uvs None
mesh842-uvs None
mesh276-uvs None

Also this topic does seem to be covered a fair bit, i just wasn’t using the correct google words.

and

Does any one have a more contemporary insight into this problem or 8 is all you get and all you will get!