Explorar o código

Fix: Schema failed to prepare MatricesFromCurve

this commit is a total HACK and I am ashamed
but it will be complicated to make a proper fix
Joseph Brandenburg hai 1 semana
pai
achega
c5b213186b
Modificáronse 2 ficheiros con 8 adicións e 5 borrados
  1. 7 1
      execution/readtree.py
  2. 1 4
      execution/schema_solve.py

+ 7 - 1
execution/readtree.py

@@ -309,7 +309,7 @@ schema_bl_idnames = [   "SchemaIndex",
                         "SchemaIncomingConnection",
                     ]
 
-from ..utilities.utilities import get_all_dependencies
+from ..utilities.utilities import get_all_dependencies, read_schema_type
 def get_schema_length_dependencies(node, all_nodes={}):
     """ Get a list of all dependencies for the given node's length or array properties.
         This function will also recursively search for dependencies in its sub-trees.
@@ -326,6 +326,11 @@ def get_schema_length_dependencies(node, all_nodes={}):
                 if inp.name in prepare_links_to:
                     deps.append(l.from_node)
                     deps.extend(get_all_dependencies(l.from_node))
+                # we also always need to prepare these inputs because they create links.
+                # HACK below until I can be less stupid and solve this the right way
+                if l.from_node.__class__.__name__ in 'UtilityMatricesFromCurve':
+                    deps.append(l.from_node)
+                    deps.extend(get_all_dependencies(l.from_node))
     def deps_filter(dep): # remove any nodes inside the schema
         if len(dep.signature) > len(node.signature):
             for i in range(len(node.signature)):
@@ -505,6 +510,7 @@ def parse_tree(base_tree, error_popups=False):
             continue
 
         if n.signature in all_schema.keys():
+            prOrange(n)
             for dep in n.hierarchy_dependencies:
                 if dep not in schema_solve_done and (dep in solve_only_these):
                     if dep.prepared:

+ 1 - 4
execution/schema_solve.py

@@ -7,7 +7,7 @@ from ..base_definitions import (SchemaUINode, custom_props_types, \
     MantisNodeGroup, SchemaGroup, replace_types, GraphError, links_sort_key)
 from ..utilities.node_common import setup_custom_props_from_np
 # a class that solves Schema nodes
-from bpy.types import NodeGroupInput, NodeGroupOutput
+from bpy.types import NodeGroupInput, NodeGroupOutput, NodeSocket
 
 from .readtree import execution_error_cleanup
 
@@ -63,7 +63,6 @@ class SchemaSolver:
         for inp in self.node.inputs.values():
             inp.links.sort(key=links_sort_key)
 
-        from bpy.types import NodeGroupInput, NodeGroupOutput
         for ui_node in self.tree.nodes:
             # Make the mantis nodes for the special interface types
             # we use the bl_idname because all schema nodes should be single-instance
@@ -400,7 +399,6 @@ class SchemaSolver:
                              f" but it terminates at index {self.solve_length-1}. "
                              f"The Schema must have a length of at least {expose_when+1}.")
         from_name = get_link_in_out(ui_link)[0]
-        from bpy.types import NodeSocket
         #use it directly if it is a mantis node; this happens when the previous node was a Schema
         if isinstance( ui_link.from_socket, NodeSocket): # normal
             from_node = frame_mantis_nodes[(*self.autogen_path_names, from_name+self.index_str) ]
@@ -439,7 +437,6 @@ class SchemaSolver:
     def handle_link_to_array_output(self, frame_mantis_nodes, index, ui_link, to_ui_node, from_ui_node):# if this duplicated code works, dedupe!
         to_node = self.schema_nodes[(*self.tree_path_names, to_ui_node.bl_idname)] # get it by [], we want a KeyError if this fails
         from_name = get_link_in_out(ui_link)[0]
-        from bpy.types import NodeSocket
         #use it directly if it is a mantis node; this happens when the previous node was a Schema
         if isinstance( ui_link.from_socket, NodeSocket): # normal
             from_node = frame_mantis_nodes[(*self.autogen_path_names, from_name+self.index_str) ]