fix: compositor working

This commit is contained in:
Fabian 2021-06-18 17:20:12 +02:00
parent 8c3e510231
commit c06febed45
3 changed files with 21 additions and 2 deletions

View File

@ -41,7 +41,7 @@ __all__ = [
'bl_node_group',
'bl_texture',
"bl_particle",
'bl_compositor'
# 'bl_compositor',
] # Order here defines execution order
if bpy.app.version[1] >= 91:

View File

@ -449,6 +449,13 @@ class BlScene(ReplicatedDatablock):
# FIXME: Find a better way after the replication big refacotoring
# Keep other user from deleting collection object by flushing their history
# Compositor
if data["use_nodes"]:
if datablock.node_tree is None:
datablock.use_nodes = True
load_node_tree(data['node_tree'], datablock.node_tree)
flush_history()
@staticmethod
@ -520,6 +527,11 @@ class BlScene(ReplicatedDatablock):
dumped_sequences[seq.name] = dump_sequence(seq)
data['sequences'] = dumped_sequences
# Compositor
if datablock.use_nodes:
data['node_tree'] = dump_node_tree(datablock.node_tree)
data['animation_data'] = dump_animation_data(datablock)
return data
@staticmethod
@ -553,6 +565,12 @@ class BlScene(ReplicatedDatablock):
Path(bpy.path.abspath(sequence.directory),
elem.filename))
# Compositor
if datablock.use_nodes:
deps.extend(get_node_tree_dependencies(datablock.node_tree))
deps.extend(resolve_animation_dependencies(datablock))
return deps
@staticmethod

View File

@ -132,6 +132,7 @@ def dump_node(node: bpy.types.Node) -> dict:
dump_io_needed = (node.type not in ['REROUTE', 'OUTPUT_MATERIAL'])
if dump_io_needed:
io_dumper = Dumper()
io_dumper.depth = 2
@ -341,7 +342,7 @@ def load_node_tree(node_tree_data: dict, target_node_tree: bpy.types.NodeTree) -
def get_node_tree_dependencies(node_tree: bpy.types.NodeTree) -> list:
def has_image(node): return (
node.type in ['TEX_IMAGE', 'TEX_ENVIRONMENT'] and node.image)
node.type in ['TEX_IMAGE', 'TEX_ENVIRONMENT','IMAGE','R_LAYER'] and node.image)
def has_node_group(node): return (
hasattr(node, 'node_tree') and node.node_tree)