Re: Frozen Normalized UVs off camera projection?

Date : Tue, 03 Jun 2008 06:40:20 +0100
To : XSI(at)Softimage.COM
From : Julian Johnson <julian(at)exch.demon.co.uk>
Subject : Re: Frozen Normalized UVs off camera projection?
Sam Cuttriss wrote:
incase anyone cares, im sure this is flawed but, it worked:

aEnd0 = map(lambda x,y: x/(y+0.00001), aSrc[0], aSrc[2])

Sam, I'm not sure why your original was giving you the error you were getting but here's another approach which uses list comprehensions..


uvArray = Application.Selection(0).Elements.Array
l = zip(*[(x[0]/x[2],x[1]/x[2],x[2]) for x in zip(*uvArray)])
LogMessage(l)

It's not particularly readable so here it is expanded (with a map alternative commented out):

#select your texture definition

uvArray = Application.Selection(0).Elements.Array

#either a single listcomprehension which uses zip to pack the u,v and w
#into individual tuples
l = [(x[0]/x[2],x[1]/x[2],x[2]) for x in zip(*uvArray)]

#or use map in the same way
#l = map(lambda x: (x[0]/x[2],x[1]/x[2],x[2]), zip(*uvArray))

#then unpack the tuples back into a conventional Element Array style list..
l = zip(*l)

LogMessage(l)

Julian
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.