Bläddra i källkod

check for more array types in tree execution

Joseph Brandenburg 6 månader sedan
förälder
incheckning
86b786474c
2 ändrade filer med 10 tillägg och 5 borttagningar
  1. 8 3
      base_definitions.py
  2. 2 2
      readtree.py

+ 8 - 3
base_definitions.py

@@ -584,8 +584,8 @@ SOCKETS_ADDED=[("DeformerMorphTargetDeform", 'INPUT', 'BooleanSocket', "Use Shap
 # replace names with bl_idnames for reading the tree and solving schemas.
 replace_types = ["NodeGroupInput", "NodeGroupOutput", "SchemaIncomingConnection",
                  "SchemaArrayInput", "SchemaArrayInputAll", "SchemaConstInput", "SchemaConstOutput",
-                 "SchemaIndex", "SchemaOutgoingConnection", "SchemaConstantOutput", "SchemaArrayOutput",
-                 "SchemaArrayInputGet",]
+                 "SchemaIndex", "SchemaOutgoingConnection", "SchemaArrayOutput","SchemaArrayInputGet",
+                ]
 
 # anything that gets properties added in the graph... this is a clumsy approach but I need to watch for this
 #   in schema generation and this is the easiest way to do it for now.
@@ -599,7 +599,10 @@ to_name_filter = [
                    "Deform Bones",
                  ]
 
-
+# nodes that must be solved as if they were Schema because they send arrays out.
+array_output_types = [
+    'UtilityArrayGet', 'UtilityKDChoosePoint', 'UtilityKDChooseXForm',
+]
 
 class MantisNode:
     """
@@ -838,6 +841,8 @@ class NodeLink:
         #     return wrapWhite(link_string)
     
     def die(self):
+        if "Choose" in "".join(self.from_node.signature[1:]):
+            prRed(f"End of life: {self}")
         self.is_alive = False
         self.to_node.inputs[self.to_socket].flush_links()
         self.from_node.outputs[self.from_socket].flush_links()

+ 2 - 2
readtree.py

@@ -305,7 +305,7 @@ def parse_tree(base_tree):
     
     start_time = time.time()
     roots, array_nodes = [], []
-    from .misc_nodes import UtilityArrayGet
+    from .base_definitions import array_output_types
     for mantis_node in all_mantis_nodes.values():
         if mantis_node.node_type in ["DUMMY"]: # clean up the groups
             if mantis_node.prototype.bl_idname in ("MantisNodeGroup", "NodeGroupOutput"):
@@ -315,7 +315,7 @@ def parse_tree(base_tree):
         init_dependencies(mantis_node); init_connections(mantis_node)
         check_and_add_root(mantis_node, roots, include_non_hierarchy=True)
         # Array nodes need a little special treatment, they're quasi-schemas
-        if isinstance(mantis_node, UtilityArrayGet):
+        if mantis_node.__class__.__name__ in array_output_types:
             array_nodes.append(mantis_node)
 
     from collections import deque