Exemplo n.º 1
0
def main(args):
    # 1) Create links
    if utils.should_run(args, 'create_links'):
        links_created = create_links(args.links, args.gui)
        if not links_created:
            print('Not all the links were created! Make sure all the links are created before running MMVT.')

    # 2) Copy resources files
    if utils.should_run(args, 'copy_resources_files'):
        links_dir = utils.get_links_dir(args.links)
        mmvt_root_dir = utils.get_link_dir(links_dir, 'mmvt')
        resource_file_exist = copy_resources_files(mmvt_root_dir)
        if not resource_file_exist:
            print('Not all the resources files were copied to the MMVT folder.\n'.format(mmvt_root_dir) +
                  'Please copy them manually from the mmvt_code/resources folder')

    # 3) Install the addon in Blender (depends on resources and links)
    if utils.should_run(args, 'install_addon'):
        from src.mmvt_addon.scripts import install_addon
        install_addon.wrap_blender_call()

    # 4) Install dependencies from requirements.txt (created using pipreqs)
    if utils.should_run(args, 'install_reqs'):
        install_reqs()
        print('Finish!')
Exemplo n.º 2
0
def main(args):
    # 1) Install dependencies from requirements.txt (created using pipreqs)
    if utils.should_run(args, 'install_reqs'):
        install_reqs(args.only_verbose)

    # 2) Create links
    if utils.should_run(args, 'create_links'):
        links_created = create_links(args.links, args.gui,
                                     args.default_folders, args.only_verbose,
                                     args.links_file_name,
                                     args.overwrite_links)
        if not links_created:
            print(
                'Not all the links were created! Make sure all the links are created before running MMVT.'
            )

    # 2,5) Create fsaverage folder link
    if utils.should_run(args, 'create_fsaverage_link'):
        create_fsaverage_link(args.links)

    # 3) Copy resources files
    if utils.should_run(args, 'copy_resources_files'):
        links_dir = utils.get_links_dir(args.links)
        mmvt_root_dir = utils.get_link_dir(links_dir, 'mmvt')
        resource_file_exist = copy_resources_files(mmvt_root_dir,
                                                   args.only_verbose)
        if not resource_file_exist:
            input(
                'Not all the resources files were copied to the MMVT folder ({}).\n'
                .format(mmvt_root_dir) +
                'Please copy them manually from the mmvt_code/resources folder.\n'
                + 'Press any key to continue...')

    # 4) Install the addon in Blender (depends on resources and links)
    if utils.should_run(args, 'install_addon'):
        from src.mmvt_addon.scripts import install_addon
        install_addon.wrap_blender_call(args.only_verbose)

    # 5) Install python packages in Blender
    if utils.should_run(args, 'install_blender_reqs'):
        install_blender_reqs()

    if utils.should_run(args, 'send_email'):
        send_email()

    if 'create_links_csv' in args.function:
        create_empty_links_csv()

    if 'create_csv' in args.function:
        write_links_into_csv_file(get_all_links())

    if 'find_blender' in args.function:
        find_blender()

    print('Finish!')
Exemplo n.º 3
0
def main(args):
    # If python version is < 3.5, use Blender's python
    if sys.version_info[0] < 3 or sys.version_info[
            0] == 3 and sys.version_info[1] < 5:
        blender_fol = find_blender()
        blender_bin_fol, python_exe = get_blender_python_exe(blender_fol)
        blender_python_exe = op.join(blender_bin_fol, 'bin', python_exe)
        if not op.isfile(blender_python_exe):
            print('You must use python 3.5 or newer, or install first Blender')
        else:
            # rerun setup with Blender's python
            args.blender_fol = blender_fol
            call_args = utils.create_call_args(args)
            setup_cmd = '{} -m src.setup {}'.format(blender_python_exe,
                                                    call_args)
            utils.run_script(setup_cmd, print_only=False)
        return

    print(args)

    # 1) Install dependencies from requirements.txt (created using pipreqs)
    if utils.should_run(args, 'install_reqs'):
        install_reqs(args.upgrade_reqs_libs, args.only_verbose)

    # 2) Create links
    if utils.should_run(args, 'create_links'):
        links_created = create_links(args.links, args.gui,
                                     args.default_folders, args.only_verbose,
                                     args.links_file_name,
                                     args.overwrite_links)
        if not links_created:
            print(
                'Not all the links were created! Make sure all the links are created before running MMVT.'
            )

    # 2,5) Create fsaverage folder link
    if utils.should_run(args, 'create_fsaverage_link'):
        create_fsaverage_link(args.links)

    # 3) Copy resources files
    if utils.should_run(args, 'copy_resources_files'):
        links_dir = utils.get_links_dir(args.links)
        mmvt_root_dir = utils.get_link_dir(links_dir, 'mmvt')
        resource_file_exist = copy_resources_files(mmvt_root_dir,
                                                   args.overwrite,
                                                   args.only_verbose)
        if not resource_file_exist:
            input(
                'Not all the resources files were copied to the MMVT folder ({}).\n'
                .format(mmvt_root_dir) +
                'Please copy them manually from the mmvt_code/resources folder.\n'
                + 'Press any key to continue...')

    # 4) Install the addon in Blender (depends on resources and links)
    if utils.should_run(args, 'install_addon'):
        from src.mmvt_addon.scripts import install_addon
        install_addon.wrap_blender_call(args.only_verbose)

    # 5) Install python packages in Blender
    if utils.should_run(args, 'install_blender_reqs'):
        install_blender_reqs(args.blender_fol)

    if utils.should_run(args, 'send_email'):
        send_email()

    if 'create_links_csv' in args.function:
        create_empty_links_csv()

    if 'create_csv' in args.function:
        write_links_into_csv_file(get_all_links())

    if 'find_blender' in args.function:
        find_blender()

    if 'get_pip_update_cmd' in args.function:
        get_pip_update_cmd()

    if 'read_blender_link' in args.function:
        read_blender_link()