I am currently working on an import/export plugin for Blender. The problem I have is with UV mapping of textures. Lets say I have two objects using same material. This material has multiple textures. Also every object uses its own UV mapping for textures, so I need to create different UV mapping for every object sharing one material with multiple textures. I tried two ways, but each has some issues:
Creating UV layer for mesh, it works fine for materials with one texture - every objects is using its own UV mapping even when they are sharing single material. But when the material has multiple textures, then all textures for my mesh are using same UV map - which is definitely something I do not want - each texture has to have its own UV map. I can create multiple layers, but only one layer can be active at the time.
Creating UV mapping for every material texture. It works fine for materials used by single mesh - every texture of material has different UV mapping, which is fine. But when I have more meshes sharing single material, then all meshes are using same UV map - again, its something I do not want.
I also want to keep single material - do not want to duplicate it. Is there any way how to achieve this (like create multiple UV layers for every mesh, assign each layer to one texture and activate them all)?