problem saving modified UV data

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Posts: 7
Joined: Wed Feb 12, 2003 2:54 pm

problem saving modified UV data

Postby Jin » Fri Feb 21, 2003 2:26 pm

hi there!

I am trying to assign new UV coordinates to a face via python and have a problem: after writing my UV data nothing happens, blender does not see or recognize the changes I make. when rerunning the script the old values are there again.

here's a small piece of code:

import Blender

mesh = Blender.NMesh.GetRawFromObject('Plane')

face = mesh.faces[0]

# that prints me the original uv data as set manually in the UV editor
print face.uv

del face.uv[:]

# that seems to work - I get a [ ]
print face.uv

face.uv.append((0.0, 1.0))
face.uv.append((0.0, 0.0))
face.uv.append((1.0, 0.0))
face.uv.append((1.0, 1.0))

# that seems to work as well - face.uv has all the values above now
print face.uv

# do I need this?


well - after running the script nothing changes and when I run it one more time I see that it starts with old values - blender did not remember the changes I made.

I guess I am doing something wrong or missing something, but I was not able to figure out what; any help is appreciated :)



Posts: 7
Joined: Wed Feb 12, 2003 2:54 pm

never mind :)

Postby Jin » Fri Feb 21, 2003 3:37 pm

just figured it out! baaah, spent almost 4 hours yesterday :)

it works when using the Mesh module, it does not work with NMesh, that's all :)

Return to “Python”

Who is online

Users browsing this forum: No registered users and 0 guests