Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
Thanks, Struct.
That's very close to what I read online but not quite an answer to my question. Your answer assumes that I know I am on row 0 and I know how many rows there are. I won't. I want to loop.
my question is:
During a looping process how can I refer to the CURRENT row, column 1 and 2?
maybe its:
For EachActor in ActorList:
[EachActor].[0]SetParent([EachActor].[1])
I always go for less typing. The iterator can split your pairs for you.
for a, b in yourlist:
a.SetParent(b)
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
Note:
If you were starting with two separate lists to begin with, you can skip making the list of pairs. The built-in function "zip" will iterate over two or more lists, giving you parallel elements from each - kind of like a zipper bringing the teeth from the two sides together.
for p, c in zip(listOfParents, listOfChildren):
p.SetParent(c)
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
This is my first time using a two column array.
I think I’ve successfully built an array where the first column is one actor, and the second column is a related actor. Now I want to loop through the list and set the parent of the first actor to the second actor.
But I don’t know what the syntax would be to refer to the two columns of my list.
Something like this:
ActorList =[]
ActorList.append ([actor1,actor2])
…
For EachActor in ActorList:
actor1.SetParent(actor2) ----- of course that is not the right syntax, what would be?