skinio.py 文件源码

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

项目:cmt 作者: chadmv 项目源码 文件源码
def export_skin(file_path=None, shapes=None):
    """Exports the skinClusters of the given shapes to disk in a pickled list of skinCluster data.

    :param file_path: Path to export the data.
    :param shapes: Optional list of dag nodes to export skins from.  All descendent nodes will be searched for
    skinClusters also.
    """
    if shapes is None:
        shapes = cmds.ls(sl=True) or []

    # If no shapes were selected, export all skins
    skins = get_skin_clusters(shapes) if shapes else cmds.ls(type='skinCluster')
    if not skins:
        raise RuntimeError('No skins to export.')

    if file_path is None:
        file_path = cmds.fileDialog2(dialogStyle=2, fileMode=0, fileFilter='Skin Files (*{0})'.format(EXTENSION))
        if file_path:
            file_path = file_path[0]
    if not file_path:
        return
    if not file_path.endswith(EXTENSION):
        file_path += EXTENSION

    all_data = []
    for skin in skins:
        skin = SkinCluster(skin)
        data = skin.gather_data()
        all_data.append(data)
        logging.info('Exporting skinCluster %s on %s (%d influences, %d vertices)',
                     skin.node, skin.shape, len(data['weights'].keys()), len(data['blendWeights']))
    fh = open(file_path, 'wb')
    json.dump(all_data, fh)
    fh.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号