Преглед на файлове

rename Constant Output index select socket

Joseph Brandenburg преди 5 месеца
родител
ревизия
7b910b3cb2
променени са 5 файла, в които са добавени 10 реда и са изтрити 9 реда
  1. 2 1
      base_definitions.py
  2. 1 1
      misc_nodes.py
  3. 3 3
      schema_containers.py
  4. 1 1
      schema_definitions.py
  5. 3 3
      schema_solve.py

+ 2 - 1
base_definitions.py

@@ -603,7 +603,8 @@ SOCKETS_REMOVED=[("UtilityDriverVariable", "Transform Channel"),
                  ("LinkDrivenParameter", "Enable")]
                   # Node Class           #Prior bl_idname  # prior name # new bl_idname #       new name,          # Multi
 SOCKETS_RENAMED=[ ("LinkDrivenParameter", "DriverSocket",   "Driver",     "FloatSocket",        "Value",              False),
-                  ("DeformerHook",        "IntSocket",      "Index",      "UnsignedIntSocket",  "Point Index",  False)]
+                  ("DeformerHook",        "IntSocket",      "Index",      "UnsignedIntSocket",  "Point Index",        False),
+                  ("SchemaConstOutput",   "IntSocket",      "Expose when N==",      "UnsignedIntSocket",  "Expose at Index", False)]
 
                 # NODE CLASS NAME             IN_OUT    SOCKET TYPE     SOCKET NAME     INDEX   MULTI     DEFAULT
 SOCKETS_ADDED=[("DeformerMorphTargetDeform", 'INPUT', 'BooleanSocket', "Use Shape Key", 1,      False,    False),

+ 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)
+                index = index % len(self.inputs['Array'].links)-1
             if oob == 'HOLD':
                 index = cap(index, len(self.inputs['Array'].links)-1)
             array_choose_relink(self, [index], "Array", "Output")

+ 3 - 3
schema_containers.py

@@ -103,7 +103,7 @@ class SchemaConstOutput(SchemaNode):
     def __init__(self, signature, base_tree, parent_schema_node=None):
         super().__init__(signature, base_tree)
         inputs = [
-            "Expose when N==",
+            "Expose at Index",
         ]
         self.inputs.init_sockets(inputs)
         if parent_schema_node:
@@ -114,9 +114,9 @@ class SchemaConstOutput(SchemaNode):
             for item in parent_tree.interface.items_tree:
                 if item.item_type == 'PANEL': continue
                 if item.in_out == 'OUTPUT':
-                    sockets.init_sockets([item.name, "Expose when N==",])
+                    sockets.init_sockets([item.name, "Expose at Index",])
             self.init_parameters()
-            self.parameters['Expose when N=="']=1
+            self.parameters['Expose at Index"']=1
 
         else:
             schema_init_sockets(self, is_input=True, in_out='OUTPUT', category='Constant')

+ 1 - 1
schema_definitions.py

@@ -205,7 +205,7 @@ class SchemaConstOutput(Node, SchemaUINode):
             return
         input_map = socket_maps[0]
         self.inputs.clear()
-        s = self.inputs.new('IntSocket', "Expose when N==")
+        s = self.inputs.new('UnsignedIntSocket', "Expose at Index")
         for item in self.id_data.interface.items_tree:
             if item.item_type == 'PANEL': continue
             if item.parent and item.in_out == 'OUTPUT' and item.parent.name == 'Constant':

+ 3 - 3
schema_solve.py

@@ -302,9 +302,9 @@ class SchemaSolver:
         assert(get_index is not None), f"Cannot get index in {from_node}"
         oob = from_node.evaluate_input("OoB Behaviour")
         if oob == 'WRAP':
-            get_index = wrap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier]), 0)
+            get_index = wrap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier])-1, 0)
         if oob == 'HOLD':
-            get_index = cap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier]))
+            get_index = cap(get_index, len(self.array_input_connections[ui_link.from_socket.identifier])-1)
         try:
             incoming = self.array_input_connections[ui_link.from_socket.identifier][get_index]
         except IndexError:
@@ -371,7 +371,7 @@ 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==')
+        expose_when = to_node.evaluate_input('Expose at Index')
         if 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}. "