[Bf-python] Add UV coordinates by python: is possible?
Bill Baxter
baxter at cs.unc.edu
Mon Feb 2 04:00:20 CET 2004
Maybe you need to cast to float tuple. I you're trying to use a string
tuple.
like
f.uv.append(map(int, tuple(uvVertCoo)))
--bb
Manuel Bastioni wrote:
> I'm trying to write this code to read the UV from external file
> and assign to object . I't's very short, I paste it here:
>
> try:
> obj = Blender.Object.Get("Base")
> obj_mesh = obj.getData()
> obj_mesh.hasVertexUV(1)
> except:
> print "Base obj not in scene"
> return
>
> file = open(path+"base.uv")
> for f in obj_mesh.faces:
> uvData = file.readline()
> uvCoo = uvData.split(';')
> nverts = len(f.v)
> for i in range(nverts):
> uvVertCoo = uvCoo[i].split(',')
> f.uv.append(uvVertCoo)
> file.close()
> obj_mesh.update()
>
> The uv is stored in text line as
> x,y;x,y;x,y;x,y
>
> If I use the line
> f.uv.append(uvVertCoo)
>
> Blender print the error:
>
> SystemError: new style getargs format but argument is not a tuple
>
> If I modify the line above as
> f.uv.append(tuple(uvVertCoo))
>
> the error is:
>
> TypeError: bad argument type for built-in operation
>
> Is possible to add the UV in this way? If not, can be a good idea to
> implement it....
>
> Thanks,
>
> Manuel
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://www.blender.org/mailman/listinfo/bf-python
More information about the Bf-python
mailing list