Support .blend files saved with large bhead

This is mostly the same as blender/blender!140195. The header parsing code has
been updated to be able to read old and new .blend file headers.

There is a new test file which is the same as the existing `basic_file.blend`,
but saved with the new header format. A new unit test has been added to check
that this file is read correctly as well.

Pull Request: https://projects.blender.org/blender/blender-asset-tracer/pulls/92893
This commit is contained in:
Jacques Lucke
2025-06-13 12:25:51 +02:00
committed by Jacques Lucke
parent eb69ca5632
commit f1ee7980b2
4 changed files with 156 additions and 53 deletions
Binary file not shown.
+18
View File
@@ -13,6 +13,7 @@ class BlendFileBlockTest(AbstractBlendFileTest):
def test_loading(self):
self.assertFalse(self.bf.is_compressed)
self.assertEqual(0, self.bf.header.file_format_version)
def test_some_properties(self):
ob = self.bf.code_index[b"OB"][0]
@@ -154,6 +155,23 @@ class BlendFileBlockTest(AbstractBlendFileTest):
self.assertEqual("OBümlaut", ob.id_name.decode())
class BlendFileLargeBhead8Test(AbstractBlendFileTest):
def setUp(self):
self.bf = blendfile.BlendFile(self.blendfiles / "basic_file_large_bhead8.blend")
def test_loading(self):
self.assertFalse(self.bf.is_compressed)
self.assertEqual(1, self.bf.header.file_format_version)
def test_some_properties(self):
ob = self.bf.code_index[b"OB"][0]
self.assertEqual("Object", ob.dna_type_name)
# Try high level operation to read the object location.
loc = ob.get(b"loc")
self.assertEqual([2.0, 3.0, 5.0], loc)
class PointerTest(AbstractBlendFileTest):
def setUp(self):
self.bf = blendfile.BlendFile(self.blendfiles / "with_sequencer.blend")