Parcourir la source

UI: raise error when constant output not sent out

Joseph Brandenburg il y a 5 mois
Parent
commit
96cb760295
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      schema_solve.py

+ 7 - 1
schema_solve.py

@@ -372,6 +372,12 @@ class SchemaSolver:
     def handle_link_to_constant_output(self, frame_mantis_nodes, index, ui_link,  to_ui_node):
         to_node = self.schema_nodes[(*self.tree_path_names, to_ui_node.bl_idname)]
         expose_when = to_node.evaluate_input('Expose when N==')
+        # this will be None for nested Groups that have ordinary Group Input and Group Output nodes.
+        # and in that case we just do it no matter what
+        if expose_when is not None and expose_when > self.solve_length-1:
+            raise GraphError(f"The Schema has a constant output at index {expose_when}"
+                             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
@@ -387,7 +393,7 @@ class SchemaSolver:
                 from_socket_name = ui_link.from_socket.name
         # HACK here to force it to work with ordinary node groups, which don't seem to set this value correctly.
         if to_ui_node.bl_idname == "NodeGroupOutput":
-            expose_when = index # just set it directly since it is getting set to None somewhere (I should find out where tho)
+            expose_when = index # the expose-when value is None because the GroupOutput doesn't have the socket.
         # end HACK
         if index == expose_when:
             for outgoing in self.constant_out[ui_link.to_socket.name]: