Support UDIM images

This commit is contained in:
Sybren A. Stüvel
2022-02-18 16:12:41 +01:00
parent 4ebd535b5f
commit 843c34c3c0
12 changed files with 51 additions and 4 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.
+15
View File
@@ -366,6 +366,21 @@ class PackTest(AbstractPackTest):
self.assertEqual(b"SQ000210.png", seq[b"name"])
self.assertEqual(relpath, seq_strip[b"dir"])
def test_sequence_udim(self):
# UDIM tiles are special, because the filename itself has a <UDIM>
# marker in there and thus doesn't exist itself.
ppath = self.blendfiles / "udim"
infile = ppath / "v01_UDIM_BAT_debugging.blend"
with pack.Packer(infile, ppath, self.tpath) as packer:
packer.strategise()
packer.execute()
# The UDIM files should have been copied.
self.assertTrue((self.tpath / "cube_UDIM.color.1001.png").exists())
self.assertTrue((self.tpath / "cube_UDIM.color.1002.png").exists())
self.assertTrue((self.tpath / "cube_UDIM.color.1003.png").exists())
def test_noop(self):
ppath = self.blendfiles / "subdir"
infile = ppath / "doubly_linked_up.blend"
+13 -1
View File
@@ -62,7 +62,6 @@ class AssetHoldingBlocksTest(AbstractTracerTest):
self.assertEqual(965, len(self.bf.blocks))
self.assertEqual(4, blocks_seen)
class DepsTest(AbstractTracerTest):
@staticmethod
def field_name(field: dna.Field) -> typing.Optional[str]:
@@ -189,6 +188,19 @@ class DepsTest(AbstractTracerTest):
actual = list(dep.files())
self.assertEqual(actual, expected)
def test_seq_image_udim_sequence(self):
expects = {
b"IMcube_UDIM.color": Expect(
'Image',
'name[1024]',
None,
None,
b'//cube_UDIM.color.<UDIM>.png',
True,
),
}
self.assert_deps("udim/v01_UDIM_BAT_debugging.blend", expects)
def test_block_cf(self):
self.assert_deps(
"alembic-user.blend",
+8
View File
@@ -20,6 +20,14 @@ class ExpandFileSequenceTest(AbstractBlendFileTest):
actual = list(file_sequence.expand_sequence(path))
self.assertEqual(self.imgseq, actual)
def test_udim_sequence(self):
path = self.blendfiles / "udim/cube_UDIM.color.<UDIM>.png"
actual = list(file_sequence.expand_sequence(path))
imgseq = [
self.blendfiles / ("udim/cube_UDIM.color.%04d.png" % num) for num in range(1001, 1004)
]
self.assertEqual(imgseq, actual)
def test_nonexistent(self):
path = self.blendfiles / "nonexistant"
with self.assertRaises(file_sequence.DoesNotExist) as raises: