Tests: Alembic: Add coverage for point cloud attribute import validation
Adds coverage for recently added import of pointcloud attributes. See PR blender/blender!145946 Pull Request: https://projects.blender.org/blender/blender/pulls/147494
This commit is contained in:
committed by
Jesse Yurkovich
parent
fd3f8c1265
commit
780c6ad024
BIN
tests/files/alembic/compare/point_attributes.abc
(Stored with Git LFS)
Normal file
BIN
tests/files/alembic/compare/point_attributes.abc
(Stored with Git LFS)
Normal file
Binary file not shown.
39
tests/files/alembic/compare/reference/point_attributes.txt
Normal file
39
tests/files/alembic/compare/reference/point_attributes.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
==== Point Clouds: 1
|
||||
- PointCloud 'particles' points:5
|
||||
- attr 'emission' FLOAT_COLOR POINT
|
||||
- (3.261, 0.846, 0.097, 1.000)
|
||||
- (3.188, 0.827, 0.094, 1.000)
|
||||
- (3.660, 0.949, 0.108, 1.000)
|
||||
- (3.597, 0.933, 0.107, 1.000)
|
||||
- (3.205, 0.831, 0.095, 1.000)
|
||||
- attr 'normals' FLOAT_VECTOR POINT
|
||||
- (-0.467, 0.698, 0.544)
|
||||
- (-0.708, 0.276, -0.650)
|
||||
- (0.652, -0.041, -0.757)
|
||||
- (0.672, -0.274, 0.688)
|
||||
- (-0.705, -0.664, 0.249)
|
||||
- attr 'position' FLOAT_VECTOR POINT
|
||||
- (-2.168, 0.698, -0.916)
|
||||
- (1.324, 0.276, -2.865)
|
||||
- (3.020, -0.041, 1.284)
|
||||
- (-1.478, -0.274, 2.791)
|
||||
- (-1.483, -0.664, -1.957)
|
||||
- attr 'radius' FLOAT POINT
|
||||
- 0.577 0.577 0.577 0.577 0.577
|
||||
- attr 'temperature' FLOAT POINT
|
||||
- 0.400 0.400 0.400 0.400 0.400
|
||||
- attr 'uv' FLOAT2 POINT
|
||||
- (0.863, 0.746)
|
||||
- (0.118, 0.589)
|
||||
- (0.363, 0.487)
|
||||
- (0.627, 0.412)
|
||||
- (0.946, 0.269)
|
||||
|
||||
==== Objects: 1
|
||||
- Obj 'particles' POINTCLOUD data:'particles'
|
||||
- pos 0.000, 0.000, 0.000
|
||||
- rot 0.000, 0.000, 0.000 (XYZ)
|
||||
- scl 1.000, 1.000, 1.000
|
||||
- 1 modifiers
|
||||
- MESH_SEQUENCE_CACHE 'MeshSequenceCache'
|
||||
|
||||
@@ -1177,6 +1177,7 @@ if(WITH_ALEMBIC AND TEST_SRC_DIR_EXISTS)
|
||||
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_io_test.py
|
||||
--
|
||||
--testdir "${TEST_SRC_DIR}/alembic"
|
||||
--outdir "${TEST_OUT_DIR}/io_alembic"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import unittest
|
||||
|
||||
import bpy
|
||||
|
||||
sys.path.append(str(pathlib.Path(__file__).parent.absolute()))
|
||||
|
||||
args = None
|
||||
|
||||
|
||||
@@ -449,6 +451,40 @@ class OverrideLayersTest(AbstractAlembicTest):
|
||||
self.assertEqual(len(mesh.polygons), 6)
|
||||
|
||||
|
||||
class AlembicImportComparisonTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.testdir = args.testdir
|
||||
cls.output_dir = args.outdir
|
||||
|
||||
def test_import_alembic(self):
|
||||
comparisondir = self.testdir.joinpath("compare")
|
||||
input_files = sorted(pathlib.Path(comparisondir).glob("*.abc"))
|
||||
self.passed_tests = []
|
||||
self.failed_tests = []
|
||||
self.updated_tests = []
|
||||
|
||||
from modules import io_report
|
||||
report = io_report.Report("Alembic Import", self.output_dir, comparisondir, comparisondir.joinpath("reference"))
|
||||
io_report.Report.context_lines = 8
|
||||
|
||||
for input_file in input_files:
|
||||
input_file_path = pathlib.Path(input_file)
|
||||
|
||||
io_report.Report.side_to_print_single_line = 5
|
||||
io_report.Report.side_to_print_multi_line = 3
|
||||
|
||||
with self.subTest(input_file_path.stem):
|
||||
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "empty.blend"))
|
||||
ok = report.import_and_check(
|
||||
input_file, lambda filepath, params: bpy.ops.wm.alembic_import(
|
||||
filepath=str(input_file), **params))
|
||||
if not ok:
|
||||
self.fail(f"{input_file.stem} import result does not match expectations")
|
||||
|
||||
report.finish("io_alembic_import")
|
||||
|
||||
|
||||
def main():
|
||||
global args
|
||||
import argparse
|
||||
@@ -460,6 +496,7 @@ def main():
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--testdir', required=True, type=pathlib.Path)
|
||||
parser.add_argument('--outdir', required=True, type=pathlib.Path)
|
||||
args, remaining = parser.parse_known_args(argv)
|
||||
|
||||
unittest.main(argv=remaining)
|
||||
|
||||
Reference in New Issue
Block a user