If you don’t actually need the lists for anything else:

for i in range(5):
    card = nuke.nodes.Card2()
    p3d = nuke.nodes.Project3D()
    card.setInput(0, p3d)

Or if you have to build your lists separately and before you hook them up (i.e. 
they’re coming from somewhere else):

for card, p3d in zip(cards, p3ds):
    card.setInput(0, p3d)

-Nathan



From: Joshua LaCross 
Sent: Wednesday, August 24, 2011 11:43 AM
To: [email protected] 
Subject: [Nuke-python] Double for loop question

Here is a much simpler version of my problem.

      Code:  

      cards = []
      p3ds = []


      for i in range(5):
          card = nuke.nodes.Card2()
          cards.append(card)
      for i in range(5):
          p3d = nuke.nodes.Project3D()
          p3ds.append(p3d)

      for c in cards:
          for p in p3ds:
              c.setInput(0,p)
     


What I'm trying to do is to get each card to connect to each Project3D but all 
the cards connect to a single Project3D. I'm not sure what I'm doing wrong.


--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to