Cleanup: Remove unused geonode tree lookup if load_nodes node_tree was None

refactor
Jonas Holzman 2025-03-24 16:07:31 +01:00
parent 0ab4ffc098
commit fc34669af7
1 changed files with 2 additions and 12 deletions

View File

@ -28,11 +28,6 @@ def get_dumper(bl_object: bpy.types.bpy_struct) -> type[Dumper]:
# Fallback to base Dumper if no matches are found # Fallback to base Dumper if no matches are found
return Dumper return Dumper
def get_current_node_tree(data):
if data.get("_new", {}).get("type") == "GeometryNodeTree":
return bpy.context.object.modifiers.active.node_group
def dump_nodes(nodes: list[bpy.types.Node]): def dump_nodes(nodes: list[bpy.types.Node]):
"""Generic Recursive Dump, convert any object into a dict""" """Generic Recursive Dump, convert any object into a dict"""
Dumper.pointers.clear() # TODO: Bad global Dumper.pointers.clear() # TODO: Bad global
@ -48,14 +43,9 @@ def dump_node(node: bpy.types.Node):
return dumper.dump(node) # TODO: Break the recursivity, clear things up return dumper.dump(node) # TODO: Break the recursivity, clear things up
def load_nodes(data, node_tree=None): def load_nodes(data, node_tree):
"""Generic Load to create an object from a dict""" """Load/Dump nodes into a specific node tree"""
Dumper.pointers.clear() Dumper.pointers.clear()
# print(Dumper.pointers)
if node_tree is None:
node_tree = get_current_node_tree(data)
dumper = get_dumper(node_tree) dumper = get_dumper(node_tree)
dumper.load(data, node_tree) dumper.load(data, node_tree)