Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Selection de la 2eme curve de la hierarchie de la currentSelection
- import maya.cmds as mc
- # Selection + check si crv ou cm
- def shape_selection():
- selection = mc.ls(selection=True)
- mc.select(d=True)
- shapeSelection = []
- if mc.nodeType(selection) == 'camera' or mc.nodeType(selection) == 'nurbsCurve' and len(selection) == 1:
- mc.select(selection, replace=True)
- elif mc.nodeType(selection) == 'transform' and len(selection) == 1:
- shapeSelection = mc.listRelatives(selection, shapes=True)
- if mc.nodeType(shapeSelection) == 'camera' or mc.nodeType(shapeSelection) == 'nurbsCurve':
- mc.select(shapeSelection, replace=True)
- else:
- mc.select(d=True)
- mc.error('Select one transform(crv or cm)')
- else:
- mc.select(d=True)
- mc.error('Select one transform(crv or cm)')
- # Selection du global
- def selection_global():
- shapes = mc.ls(selection = True)
- mc.select(d=True)
- parents = mc.ls(shapes, long=True)[0].split('|')[1:-1]
- crv = mc.listRelatives(parents[1], allDescendents=True, type='nurbsCurve')
- globalCrv = mc.listRelatives(crv[1], parent=True)
- mc.select(globalCrv, replace=True)
- shape_selection()
- selection_global()
Advertisement
Add Comment
Please, Sign In to add comment