Bug on Wiki - Python Tuples

General questions and troubleshooting SOFTIMAGE©
Post Reply
Gith
Posts: 26
Joined: 08 Jun 2009, 21:11
Location: Poland

Bug on Wiki - Python Tuples

Post by Gith » 16 Sep 2010, 20:03

There is a bug in the code of "How to convert a tuple into a list (python)"

In "Test3" function the conversion iteration should be without "-1" sign:

looks like that:
uvw_list = [1-uvw_tuple[j] for i in range(len(uvw_tuple[0])) for j in range(len(uvw_tuple)) ]

should be:
uvw_list = [uvw_tuple[j] for i in range(len(uvw_tuple[0])) for j in range(len(uvw_tuple)) ]

We've lost a couple of hours on that in the studio, as we were working on custom geometry exporter.. and the only thing that was broken were UVs.
I thought i'll post this so someone can fix it :)

Cheers!
v/

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Bug on Wiki - Python Tuples

Post by Hirazi Blue » 17 Sep 2010, 20:51

I think you are mistaken (but I could be just as easily be mistaken too :D )
Test3 claims to "turn a uvw tuple into a list, invert and set back".
What you propose wouldn't invert it, merely convert it to a list.
And by invert the author of the WIKI page obviously means:
for every x get me 1-x , which it does...
;)
Stay safe, sane & healthy!

Gith
Posts: 26
Joined: 08 Jun 2009, 21:11
Location: Poland

Re: Bug on Wiki - Python Tuples

Post by Gith » 17 Sep 2010, 23:17

Strange, because it should return the proper UVs list rather than it's inversion... I dont get the point of it.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Bug on Wiki - Python Tuples

Post by Hirazi Blue » 18 Sep 2010, 10:09

Yes, the point of inverting the list eludes me too, but that's what the example sets out to show,
so the code of this example can't be considered wrong... ;)
Stay safe, sane & healthy!

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests