Prepare for supporting more operation systems
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
from threading import Thread, Lock
|
||||
import blf
|
||||
@@ -444,6 +445,24 @@ class BENCHMARK_PT_main(Panel):
|
||||
################################################################################
|
||||
# Operator
|
||||
|
||||
def blender_executable_get():
|
||||
benchmark_binary_dir = os.path.dirname(bpy.app.binary_path)
|
||||
system = platform.system()
|
||||
if system == "Linux":
|
||||
return os.path.join(benchmark_binary_dir, "blender", "blender")
|
||||
elif system == "Windows":
|
||||
return os.path.join(benchmark_binary_dir, "blender", "blender.exe")
|
||||
else:
|
||||
raise Exception("Needs implementation")
|
||||
|
||||
def scenes_dir_get():
|
||||
benchmark_binary_dir = os.path.dirname(bpy.app.binary_path)
|
||||
system = platform.system()
|
||||
if system == "Linux" or system == "Windows":
|
||||
return os.path.join(benchmark_binary_dir, "scenes")
|
||||
else:
|
||||
raise Exception("Needs implementation")
|
||||
|
||||
class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
"Run Blender benchmark"
|
||||
bl_label = "Run Benchmark"
|
||||
@@ -556,13 +575,11 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
self.setup_sink()
|
||||
wm = context.window_manager
|
||||
script_directory = os.path.dirname(os.path.realpath(__file__))
|
||||
benchmark_binary_dir = os.path.dirname(bpy.app.binary_path)
|
||||
benchmark_script_directory = os.path.dirname(script_directory)
|
||||
configure_script = os.path.join(
|
||||
benchmark_script_directory, "configure.py")
|
||||
ctx = benchmark_context.Context()
|
||||
# TODO(sergey): Update for MacOS and Windows.
|
||||
ctx.blender = os.path.join(benchmark_binary_dir, "blender", "blender")
|
||||
ctx.blender = blender_executable_get()
|
||||
ctx.configure_script = configure_script
|
||||
if self.run_type == 'QUICK':
|
||||
ctx.scenes = QUICK_SCENES
|
||||
@@ -570,7 +587,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
ctx.scenes = COMPLETE_SCENES
|
||||
for scene in ctx.scenes:
|
||||
global_scene_status[scene] = "N/A"
|
||||
ctx.scenes_dir = os.path.join(benchmark_binary_dir, "scenes")
|
||||
ctx.scenes_dir = scenes_dir_get()
|
||||
ctx.device_type = 'CPU'
|
||||
# Only applies for GPU, should match Cycles name
|
||||
ctx.device_name = ""
|
||||
|
Reference in New Issue
Block a user