Frage

I would like to know a few things here. I'm collecting all the selected nodes using this code snippet below. What I'm now wondering is...

  1. How do I write a for-loop going through each node in the collection?
  2. How do i get the total number of nodes in the collection?
  3. How do I get the first node's position in the collection?
  4. How do I get the last node's position in the collection?

    nodes = cmds.ls(long = True, selection = True, type = 'dagNode')

War es hilfreich?

Lösung

1.

for n in nodes:
    print n

2.

print len(nodes)

3.

print nodes[0]

4.

print nodes[-1]

Hope it will help you.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top