Thanks for your help, Campbell - some responses below. On Mon, Apr 23, 2012 at 10:42 AM, Campbell Barton <[email protected]> wrote: >> At the moment I'm assuming that a UV Map contains the link to a >> per-face image, but it also seems to contain a weird collection of 4 >> 'UV Selected' properties, that I can't figure out what on earth >> they're for. The names of UV Maps also seem to correlate with what's >> in the UI. > > I don't follow, which selected properties are these?
These: http://www.pasteall.org/pic/30646 >> * Poking in the python console, I see that mesh.uv_loop_layers has an >> 'active' property, that's not displayed in the UI in datablocks mode >> (why?). This seems to get me the active layer selected in the UI. > > Because it sync's with the uv_texture.active layer... eeh, this should > be documented too. > >> * UV Loop layers seem to contain the UV coordinates themselves (a uv >> pair for each per-face-vertex 'loop') inside 'data', but I can't see >> how to relate those to the UV Maps shown in the UI. When I iterate >> over the uv loop layers (eg. [l for l in mesh.uv_loop_layers] ) it >> gives me names like: bpy.data.meshes['Cube'].uv_loop_layer["UV >> coord"]. These names are not visible in the datablocks view, and do >> not seem to correspond to the names in the 'UV Maps' in the UI. > > Hope the example helps here. Not really, I'm afraid. I understand the indices of MeshUVLoop data are equivalent between mesh geo loops, vertex colour loops, etc. (good to this this documented for certain now, though!). The issue I'm having is retrieving UV Loop Layers by name, not just the active one. I'm talking about the layers themselves, not the loop items inside them. It's only the UV Map names that are exposed in the UI, and the MeshUVLoopLayer names don't correspond to those names in the UI. So far I'm going on the assumption that UV Maps and UV Loop Layers are ordered identically, so my code looks like: if name == "": uv_loop_layer = mesh.uv_loop_layers.active else: # assuming uv loop layers and uv textures share identical indices idx = [i for i, uvtex in enumerate(mesh.uv_textures) if uvtex.name == name][0] uv_loop_layer = mesh.uv_loop_layers[idx] This seems to work ok, but it would be good to have clarification that this is the right way to access UV Loop Layers by name. Perhaps it would be simpler if the UV Loops Layers just shared names with UV Maps? :) thanks very much, Matt _______________________________________________ Bf-python mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-python
