2020-11-01 21:33:38 +01:00
|
|
|
#!/usr/bin/env python3
|
2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2015-2022 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2020-11-01 21:33:38 +01:00
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_arguments(filepath, output_filepath):
|
|
|
|
|
dirname = os.path.dirname(filepath)
|
|
|
|
|
basedir = os.path.dirname(dirname)
|
|
|
|
|
|
|
|
|
|
args = [
|
|
|
|
|
"--background",
|
|
|
|
|
"--factory-startup",
|
|
|
|
|
"--enable-autoexec",
|
|
|
|
|
"--debug-memory",
|
|
|
|
|
"--debug-exit-on-error",
|
|
|
|
|
filepath,
|
|
|
|
|
"-o", output_filepath,
|
|
|
|
|
"-f", "1",
|
|
|
|
|
"-F", "PNG"]
|
|
|
|
|
|
|
|
|
|
return args
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_argparse():
|
2024-12-10 14:52:34 +01:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
|
description="Run test script for each blend file in TESTDIR, comparing the render result with known output."
|
|
|
|
|
)
|
|
|
|
|
parser.add_argument("--blender", required=True)
|
|
|
|
|
parser.add_argument("--testdir", required=True)
|
|
|
|
|
parser.add_argument("--outdir", required=True)
|
|
|
|
|
parser.add_argument("--oiiotool", required=True)
|
2024-09-03 21:22:34 +10:00
|
|
|
parser.add_argument("--batch", default=False, action="store_true")
|
2020-11-01 21:33:38 +01:00
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
parser = create_argparse()
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
from modules import render_report
|
2024-12-10 14:52:34 +01:00
|
|
|
report = render_report.Report("Sequencer", args.outdir, args.oiiotool)
|
2020-11-01 21:33:38 +01:00
|
|
|
report.set_pixelated(True)
|
2024-09-03 21:22:34 +10:00
|
|
|
# Default error tolerances are quite large, lower them.
|
2024-11-18 12:27:50 +01:00
|
|
|
report.set_fail_threshold(2.0 / 255.0)
|
2024-02-02 16:28:51 +01:00
|
|
|
report.set_fail_percent(0.01)
|
2020-11-01 21:33:38 +01:00
|
|
|
report.set_reference_dir("reference")
|
|
|
|
|
|
2024-12-10 14:52:34 +01:00
|
|
|
ok = report.run(args.testdir, args.blender, get_arguments, batch=args.batch)
|
2020-11-01 21:33:38 +01:00
|
|
|
|
|
|
|
|
sys.exit(not ok)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|