elif arg['status'] == 'success':
                print(arg['message'])


    # Use binary mode IO in Python 3+
    if not stand_alone:
        if hasattr(sys.stdin, 'detach'): sys.stdin = sys.stdin.detach()
        if hasattr(sys.stdout, 'detach'): sys.stdout = sys.stdout.detach()

    if stand_alone:
        if args.scene_file:
            f = open(args.scene_file, 'r')
            scene_desc = json.load(f)
            f.close()
        else:
            output_error("Specify scene file", output_function)
            exit(1)
    else:
        scene_desc = pickle.load(sys.stdin)
    pstd = PSTD(args.multi_threaded, args.write_plot, args.write_array, scene_desc, output_function)
    out = sys.__stdout__
    if args.file:
        print("Writing to %s"%args.file)
        out = open(args.file,'w')
        out.write("openPSTD --- %s\n"%datetime.now().strftime('%d-%m-%y %H:%M'))
        out.write("Profile output\n"
                  "Scene file %s\n"
                  "Parallel: %s\n"
                  "Plotting: %s\n"
                  "Writing arrays: %s\n\n"%(args.scene_file,args.multi_threaded,args.write_plot,args.write_array))
    time_start = time.time()
Exemple #2
0
                print("\n%s\n"%("-"*20))
            elif arg['status'] == 'running':
                sys.stdout.write("\r%d"%(arg['frame']+1))
                sys.stdout.flush()
            elif arg['status'] == 'success':
                print(arg['message'])


    # Use binary mode IO in Python 3+
    if not stand_alone:
        if hasattr(sys.stdin, 'detach'): sys.stdin = sys.stdin.detach()
        if hasattr(sys.stdout, 'detach'): sys.stdout = sys.stdout.detach()

    if stand_alone:
        if args.scene_file:
            f = open(args.scene_file, 'r')
            scene_desc = json.load(f)
            f.close()
            os.chdir(os.path.dirname(os.path.abspath(args.scene_file)))
        else:
            output_error("Specify scene file", output_to_console)
            exit(1)
    else:
        scene_desc = pickle.load(sys.stdin)

    pstd = PSTD(args.multi_threaded, args.gpu_accelerated, args.write_plot, args.write_array, scene_desc, output_to_console)
    pstd.run()
    # Exit to prevent the Blender interpreter from processing
    # the subsequent command line arguments.

    exit()