示例#1
0
def find_blender():
    blender_fol = ''
    if utils.is_windows():
        blender_win_fol = 'Program Files\Blender Foundation\Blender'
        if op.isdir(op.join('C:\\', blender_win_fol)):
            blender_fol = op.join('C:\\', blender_win_fol)
        elif op.isdir(op.join('D:\\', blender_win_fol)):
            blender_fol = op.join('D:\\', blender_win_fol)
    elif utils.is_linux():
        output = utils.run_script("find ~/ -name 'blender' -type d")
        if not isinstance(output, str):
            output = output.decode(sys.getfilesystemencoding(), 'ignore')
        blender_fols = output.split('\n')
        blender_fols = [
            fol for fol in blender_fols
            if op.isfile(op.join(utils.get_parent_fol(fol), 'blender.svg'))
            or 'blender.app' in fol
        ]
        if len(blender_fols) == 1:
            blender_fol = utils.get_parent_fol(blender_fols[0])
    elif utils.is_osx():
        blender_fol = '/Applications/Blender/blender.app/Contents/MacOS'
        # output = utils.run_script("find ~/ -name 'blender' -type d")
        # if not isinstance(output, str):
        #     output = output.decode(sys.getfilesystemencoding(), 'ignore')
        # blender_fols = output.split('\n')
        # blender_fols = [fol for fol in blender_fols if 'blender.app' in fol]
        # if len(blender_fols) == 1:
        #     blender_fol = op.join(blender_fols[0], 'blender.app', 'Contents', 'MacOS', 'blender')
    return blender_fol
示例#2
0
文件: setup.py 项目: XujiahuaBNU/mmvt
def find_blender():
    blender_fol = ''
    if utils.is_windows():
        blender_win_fol = 'Program Files\Blender Foundation\Blender*'
        for drive in ['C', 'D']:
            if len(glob.glob(op.join('{}:\\'.format(drive),
                                     blender_win_fol))) > 0:
                blender_fol = select_file(
                    glob.glob(op.join('{}:\\'.format(drive), blender_win_fol)))
                break
    elif utils.is_linux():
        blender_fol = find_blender_in_linux('../', False)
        if blender_fol == '':
            blender_fol = find_blender_in_linux('../../')
        if blender_fol == '':
            blender_fol = find_blender_in_linux('~/')
    elif utils.is_osx():
        blender_fol = '/Applications/Blender/blender.app/Contents/MacOS'
        blender_fol = blender_fol if op.isdir(blender_fol) else ''
        # output = utils.run_script("find ~/ -name 'blender' -type d")
        # if not isinstance(output, str):
        #     output = output.decode(sys.getfilesystemencoding(), 'ignore')
        # blender_fols = output.split('\n')
        # blender_fols = [fol for fol in blender_fols if 'blender.app' in fol]
        # if len(blender_fols) == 1:
        #     blender_fol = op.join(blender_fols[0], 'blender.app', 'Contents', 'MacOS', 'blender')
    return blender_fol