Maya type filter

Maya type filter

def is_mesh(obj):
    isMesh = False
    obj_str = str(obj)
    if cmds.objExists(obj_str):
        meshType = 'mesh'
        
        if cmds.nodeType(obj_str) == meshType:
            return True
        
        shapeNodes = cmds.listRelatives(obj_str, shapes=True)
        if shapeNodes:
            isMesh = True
            for shapeNode in shapeNodes:
                nodeType = cmds.nodeType(shapeNode)
                if nodeType != meshType:
                    isMesh = False
                    break
    return isMesh

 

def is_group(groupName):
    try:
        children = cmds.listRelatives(groupName, children=True)
        for child in children:
            if not cmds.ls(child, transforms = True):
                return False
        return True
    except:
        return False
posted @ 2021-05-19 15:56  ibingshan  阅读(86)  评论(0编辑  收藏  举报