Explorar el Código

fix: mantis node reuse in gen_mantis_nodes

this bug occured because the mantis_node was not set in the loop
causing the mantis_node references to use the previous iteration
which led to a mismatch between the mantis node and the ui node
and thus fill_parameters failed
Joseph Brandenburg hace 2 semanas
padre
commit
511da6a872
Se han modificado 1 ficheros con 7 adiciones y 5 borrados
  1. 7 5
      execution/readtree.py

+ 7 - 5
execution/readtree.py

@@ -82,6 +82,7 @@ def make_connections_to_ng_dummy(base_tree, tree_path_names, local_mantis_nodes,
 def gen_mantis_nodes(base_tree, current_tree, tree_path_names, mContext, all_mantis_nodes, local_mantis_nodes, dummy_nodes, group_nodes, schema_nodes, in_schema ):
     from ..internal_nodes import DummyNode
     for ui_node in current_tree.nodes:
+        mantis_node = None
         if ui_node.bl_idname in ["NodeFrame", "NodeReroute"]:
             continue # not a Mantis Node
         if ui_node.bl_idname in ["NodeGroupInput", "NodeGroupOutput"]:
@@ -116,11 +117,12 @@ def gen_mantis_nodes(base_tree, current_tree, tree_path_names, mContext, all_man
         else:
             mantis_node = None
             prRed(f"Can't make mantis_node for.. {ui_node.bl_idname}")
-        # this should be done at init
-        mantis_node.mContext = mContext
-        if mantis_node.signature[0] != 'MANTIS_AUTOGENERATED' and mantis_node.node_type not in {'SCHEMA', 'DUMMY', 'DUMMY_SCHEMA'}:
-            mantis_node.fill_parameters(ui_node)
-        mantis_node.is_schema_prototype = in_schema
+        if mantis_node is not None:
+            # this should be done at init
+            mantis_node.mContext = mContext
+            if mantis_node.signature[0] != 'MANTIS_AUTOGENERATED' and mantis_node.node_type not in {'SCHEMA', 'DUMMY', 'DUMMY_SCHEMA'}:
+                mantis_node.fill_parameters(ui_node)
+            mantis_node.is_schema_prototype = in_schema
 
 def data_from_tree(base_tree, tree_path, mContext, dummy_nodes, all_mantis_nodes, all_schema, in_schema):#
     # TODO: it should be relatively easy to make this use a while loop instead of recursion.