Urho3D-Blender
Urho3D-Blender copied to clipboard
Suggestion for handling UV2
Instead of requiring a texture that points to the UV2 map for each mesh, why not directly look for the UV2 map?
Hello Enhex, because it is helpful when you export more than one object, you can decide which of them need a UV2 map and you can have a different UV2 map for each of them.
You can still achieve that with directly looking for the UV map since it's per mesh, right?
I think UV maps and objects are independents entities and textures link them together. Here is where the map is loaded: https://github.com/reattiva/Urho3D-Blender/blob/master/io_mesh_urho/decompose.py#L1489 if you have a different approach, can you share some code?
UV maps are part of a mesh and the texture slots are part of a material. Both aren't directly part of an object. I'm not sure if there's a specific requirement, but if UV2 is only relevant to the mesh then you only need to check if there's a UV map for it in the mesh.
Code-wise it should be just iterating over the meshes and checking if they have "_UV2" map. Similar to what you have now.
For example I plan to use UV2 for lightmaps, and since I don't want to write every possible combination of diffuse & lightmap material manually, I want to generate them on the fly. That means that UV2 doesn't have to be bound to a texture/material when exporting geometry. It only adds extra redundant work.
I need the code to find the UV map from the mesh. Anyway, I prefer to leave it as it is, UV map are "mainly" made to work with a texture so it makes sense to have one, it can always be an empty placeholder texture.