Advertisement
yaotungyu

list nconstraint components

Aug 16th, 2022 (edited)
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. selected = cmds.ls(sl=1)
  2.  
  3. custom_nconst_data = {}
  4. for nconst in selected:
  5.     custom_nconst_data[nconst] = []
  6.     for a in cmds.ls(nconst+'.componentIds[*]'):
  7.         for ncomp in cmds.listConnections(a):
  8.             indices = cmds.ls(ncomp+'.ci[*]')
  9.             nobj = cmds.listConnections(ncomp+'.objectId')
  10.             mesh = cmds.listConnections(nobj[0]+'.inputMesh')
  11.             vtx_list = [mesh[0]+'.vtx[{}]'.format(str(cmds.getAttr(i))) for i in indices]
  12.             if vtx_list==[]:
  13.                 custom_nconst_data[nconst].extend(mesh)
  14.             else:
  15.                 custom_nconst_data[nconst].extend(vtx_list)
  16.    
  17.             custom_nconst_data[nconst] += vtx_list
  18. print custom_nconst_data
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement