Is UV offset possible with python?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

ningu
Posts: 9
Joined: Mon Nov 12, 2012 12:55 pm

Is UV offset possible with python?

Postby ningu » Wed Dec 26, 2012 11:37 am

Hi,

is there a way to access UV coordinates from a python script? I've been searching all over and haven't found how to do it.

I'd like to code a sript to animate UV offsets. Is that possible?

Any pointers will be very much appreciated.

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Dec 26, 2012 9:07 pm

there are plenty examples, have a look at the OBJ import script for instance. Has also been discussed several times here and at blenderartists.org
I'm sitting, waiting, wishing, building Blender in superstition...

ningu
Posts: 9
Joined: Mon Nov 12, 2012 12:55 pm

Postby ningu » Wed Dec 26, 2012 9:24 pm

Thank you very much. I'll take a look at this addon's code. I guess I didn't search in the right place :/

ningu
Posts: 9
Joined: Mon Nov 12, 2012 12:55 pm

Postby ningu » Wed Dec 26, 2012 9:46 pm

Found it.

bpy.data.materials['material_name'].texture_slots[0].offset

Thanks CoDEmanX

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Jan 02, 2013 8:46 pm

ah, i see. You may use an app handler for the frame_change_pre event to update the offsets:

http://www.blender.org/documentation/bl ... dlers.html
I'm sitting, waiting, wishing, building Blender in superstition...

ningu
Posts: 9
Joined: Mon Nov 12, 2012 12:55 pm

Postby ningu » Wed Jan 02, 2013 10:21 pm

Nice. Thanks.

Actually I found out that I could animate the offset without scripting, but there's an issue when playing it back on the 3dView. It doesn't refresh the texture offset.

So I might try coding something to see if it works that way.

Thanks a lot.


Return to “Python”

Who is online

Users browsing this forum: No registered users and 0 guests