maya_tools.py 文件源码

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

项目:gozbruh 作者: LumaPictures 项目源码 文件源码
def _get_gozid_mismatches(objs):
    """Return objects from `objs` whose gozbruhBrushID does not match their name

    Checks object history for instances of gozbruhBrushID,
    returns a list ofgozbruhBrushID/name conflicts

    gozbruhBrushID is created by ZBrush on export and is used to track
    name changes that can occur in maya

    this function compares object current name against the ID
    and returns a list of conflicts

    this list is handled by the gui to allow for dialog boxes
    """
    goz_list = []

    for obj in objs:
        has_attr = cmds.attributeQuery(
            'gozbruhBrushID', node=obj, exists=True)

        if has_attr:
            # check for 'rename'
            goz_id = cmds.getAttr(obj + '.gozbruhBrushID')
            if obj != goz_id:
                goz_list.append((obj, goz_id))
        else:
            # check for old ID in history
            for old_obj in cmds.listHistory(obj):
                has_attr = cmds.attributeQuery('gozbruhBrushID',
                                               node=old_obj,
                                               exists=True)
                if has_attr:
                    goz_id = cmds.getAttr(old_obj + '.gozbruhBrushID')
                    if obj != goz_id:
                        goz_list.append((obj, goz_id))

    # resulting mismatches to be handled
    return goz_list

#------------------------------------------------------------------------------
# Sending / Exporting
#------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号