4.4 - For Loops

import maya.cmds as cmds
import maya.OpenMaya as om

sel = cmds.ls(sl=True)
children = cmds.listRelatives(sel, children = True)
frame = cmds.currentTime(query = True)

if sel:
    for child in children:
        attr = "{0}.ty".format(child) # attr is like pCube.ty
        if child.startswith("left"):
            cmds.setAttr(attr, frame)
        elif child.startswith("right"):
            cmds.setAttr(attr, -frame)
else:
    om.MGlobal.displayError("No objects selected")




阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/seamanj/article/details/49916141
个人分类: maya python python
上一篇4.5 - While Loops
下一篇4.2.2 - Logical and/or Operators
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭