commands.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:config 作者: mindbender-studio 项目源码 文件源码
def connect_matching_attributes(source, target):
    """Connect matching attributes from source to target

    Arguments:
        source (str): Absolute path to node from which to connect
        target (str): Target node

    Example:
        >>> # Select two matching nodes
        >>> source = cmds.createNode("transform", name="source")
        >>> target = cmds.createNode("transform", name="target")
        >>> cmds.select([source, target], replace=True)
        >>> source, target = cmds.ls(selection=True)
        >>> connect_matching_attributes(source, target)

    """

    dsts = cmds.listAttr(target, keyable=True)
    for src in cmds.listAttr(source, keyable=True):
        if src not in dsts:
            continue

        try:
            src = "." + src
            cmds.connectAttr(source + src,
                             target + src,
                             force=True)
        except RuntimeError as e:
            cmds.warning("Could not connect %s: %s" % (src, e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号