문제

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')

도움이 되었습니까?

해결책

1.

for n in nodes:
    print n

2.

print len(nodes)

3.

print nodes[0]

4.

print nodes[-1]

Hope it will help you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top