Support compositor node trees in Blender 5.0
Since Blender 5.0 these use a different DNA field. BAT now supports this too, and supports linked node trees as well. See blender/blender@bd61e69be5
This commit is contained in:
parent
4c429e9212
commit
16c208bc8e
@ -90,7 +90,14 @@ def _expand_generic_mtex(block: blendfile.BlendFileBlock):
|
||||
|
||||
|
||||
def _expand_generic_nodetree(block: blendfile.BlendFileBlock):
|
||||
assert block.dna_type.dna_type_id == b"bNodeTree"
|
||||
if block.dna_type.dna_type_id == b"ID":
|
||||
# This is a placeholder for a linked node tree.
|
||||
yield block
|
||||
return
|
||||
|
||||
assert (
|
||||
block.dna_type.dna_type_id == b"bNodeTree"
|
||||
), f"Expected bNodeTree, got {block.dna_type.dna_type_id.decode()})"
|
||||
|
||||
nodes = block.get_pointer((b"nodes", b"first"))
|
||||
|
||||
@ -145,7 +152,11 @@ def _expand_generic_idprops(block: blendfile.BlendFileBlock):
|
||||
|
||||
|
||||
def _expand_generic_nodetree_id(block: blendfile.BlendFileBlock):
|
||||
block_ntree = block.get_pointer(b"nodetree", None)
|
||||
if block.bfile.header.version >= 500 and block.bfile.file_subversion >= 4:
|
||||
# Introduced in Blender 5.0, commit bd61e69be5a7c96f1e5da1c86aafc17b839e049f
|
||||
block_ntree = block.get_pointer(b"compositing_node_group", None)
|
||||
else:
|
||||
block_ntree = block.get_pointer(b"nodetree", None)
|
||||
if block_ntree is not None:
|
||||
yield from _expand_generic_nodetree(block_ntree)
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -506,6 +506,26 @@ class DepsTest(AbstractTracerTest):
|
||||
},
|
||||
)
|
||||
|
||||
def test_compositor_nodes(self) -> None:
|
||||
"""Test compositor node trees.
|
||||
|
||||
Since Blender 5.0 these use a different DNA field, and can also be
|
||||
linked from other files.
|
||||
"""
|
||||
self.assert_deps(
|
||||
"compositor_nodes/compositor_nodes_blender500_workfile.blend",
|
||||
{
|
||||
b"LIcompositor_nodes_blender500_library.blend": Expect(
|
||||
type="Library",
|
||||
full_field="name[1024]",
|
||||
dirname_field=None,
|
||||
basename_field=None,
|
||||
asset_path=b"//compositor_nodes_blender500_library.blend",
|
||||
is_sequence=False,
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
def test_usage_abspath(self):
|
||||
deps = [
|
||||
dep
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user