ソースを参照

Fix: wrap in Schema fails

this commit also makes sure the wrap is the same for both the array
input at index node and the array get node
Joseph Brandenburg 10 ヶ月 前
コミット
66c83799d4
2 ファイル変更4 行追加3 行削除
  1. 1 1
      misc_nodes.py
  2. 3 2
      schema_solve.py

+ 1 - 1
misc_nodes.py

@@ -1733,7 +1733,7 @@ class UtilityArrayGet(MantisNode):
             from .utilities import cap, wrap
             # we must assume that the array has sent the correct number of links
             if oob == 'WRAP':
-                index = index % len(self.inputs['Array'].links)-1
+                index = wrap(0, len(self.inputs['Array'].links), index)
             if oob == 'HOLD':
                 index = cap(index, len(self.inputs['Array'].links)-1)
             array_choose_relink(self, [index], "Array", "Output")

+ 3 - 2
schema_solve.py

@@ -301,10 +301,11 @@ class SchemaSolver:
         # that are left because this node is reused in each iteration of the schema
         assert(get_index is not None), f"Cannot get index in {from_node}"
         oob = from_node.evaluate_input("OoB Behaviour")
+        array_length = len(self.array_input_connections[ui_link.from_socket.identifier])-1
         if oob == 'WRAP':
-            get_index = wrap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier])-1, 0)
+            get_index = wrap(0, array_length+1, get_index)
         if oob == 'HOLD':
-            get_index = cap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier])-1)
+            get_index = cap(get_index, array_length)
         try:
             incoming = self.array_input_connections[ui_link.from_socket.identifier][get_index]
         except IndexError: