Problems in Python

Hello,
I’m actually in working on an export from Blender (langage Python). But, I have a problem for the multi-UV. I apply 2 textures on an objet (with 2 differents UV) and I can’t find the two UV and the two textures in the API Python. I just can find the one who is select (in the menu mesh). Do you have an idea to get back the two UV and export the multi-UV ? Thanks a lot

Nibua

For the first problem, getting the uv coordinates of multiple uv layers, I did it like this. Get a list of the the names of the uv layers from the object’s mesh data. Loop through this list, set each of the uv layers as active and get the faces uv. Example for an object called “testob” with multiple uv layers:

import Blender

ob = Blender.Object.Get("testob")
me = ob.getData(mesh=True)

uvlayers = me.getUVLayerNames()

for uvlayer in uvlayers:
	me.activeUVLayer = uvlayer	
	print
	print uvlayer
	for f in me.faces:
		print f.uv

Output for my object which has two uv layers named “uvfirst” and “uvsecond”:

[uvfirst
([1.000000, 1.000000](vector), [0.000000, 1.000000](vector), [0.000000, 0.000000](vector), [0.999999, 0.000000](vector))

uvsecond
([1.500000, 0.500000](vector), [0.500000, 0.500000](vector), [0.500000, -0.500000](vector), [1.499999, -0.500000](vector))

I’ve just try that and I’ve find the two UV.
Thanks you so much !!!

You’re welcome, Nibua, glad I could help. :slight_smile: