Cycles tests: pass Blender custom arguments from CYCLESTEST_ARGS.
This is useful for testing with different devices, split kernel, OSL, impact of integrator settings, etc.
This commit is contained in:
@@ -5,6 +5,7 @@ import argparse
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -52,38 +53,44 @@ def render_file(filepath):
|
|||||||
dirname = os.path.dirname(filepath)
|
dirname = os.path.dirname(filepath)
|
||||||
basedir = os.path.dirname(dirname)
|
basedir = os.path.dirname(dirname)
|
||||||
subject = os.path.basename(dirname)
|
subject = os.path.basename(dirname)
|
||||||
|
|
||||||
|
custom_args = os.getenv('CYCLESTEST_ARGS')
|
||||||
|
custom_args = shlex.split(custom_args) if custom_args else []
|
||||||
|
|
||||||
|
# OSL and GPU examples
|
||||||
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True"]
|
||||||
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.device = 'GPU'"]
|
||||||
|
|
||||||
if subject == 'opengl':
|
if subject == 'opengl':
|
||||||
command = (
|
command = [
|
||||||
BLENDER,
|
BLENDER,
|
||||||
"--window-geometry", "0", "0", "1", "1",
|
"--window-geometry", "0", "0", "1", "1",
|
||||||
"-noaudio",
|
"-noaudio",
|
||||||
"--factory-startup",
|
"--factory-startup",
|
||||||
"--enable-autoexec",
|
"--enable-autoexec",
|
||||||
filepath,
|
filepath,
|
||||||
"-E", "CYCLES",
|
"-E", "CYCLES"]
|
||||||
# Run with OSL enabled
|
command += custom_args
|
||||||
# "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
|
command += [
|
||||||
"-o", TEMP_FILE_MASK,
|
"-o", TEMP_FILE_MASK,
|
||||||
"-F", "PNG",
|
"-F", "PNG",
|
||||||
'--python', os.path.join(basedir,
|
'--python', os.path.join(basedir,
|
||||||
"util",
|
"util",
|
||||||
"render_opengl.py")
|
"render_opengl.py")]
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
command = (
|
command = [
|
||||||
BLENDER,
|
BLENDER,
|
||||||
"--background",
|
"--background",
|
||||||
"-noaudio",
|
"-noaudio",
|
||||||
"--factory-startup",
|
"--factory-startup",
|
||||||
"--enable-autoexec",
|
"--enable-autoexec",
|
||||||
filepath,
|
filepath,
|
||||||
"-E", "CYCLES",
|
"-E", "CYCLES"]
|
||||||
# Run with OSL enabled
|
command += custom_args
|
||||||
# "--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True",
|
command += [
|
||||||
"-o", TEMP_FILE_MASK,
|
"-o", TEMP_FILE_MASK,
|
||||||
"-F", "PNG",
|
"-F", "PNG",
|
||||||
"-f", "1",
|
"-f", "1"]
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(command)
|
output = subprocess.check_output(command)
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
|
Reference in New Issue
Block a user