|
|
@@ -392,42 +392,35 @@ def node_group_update(node, force = False):
|
|
|
|
|
|
reorder_me_input = []; input_index = 0
|
|
|
reorder_me_output = []; output_index = 0
|
|
|
+
|
|
|
+ def update_group_sockets(interface_item, is_input):
|
|
|
+ socket_map = socket_map_in if is_input else socket_map_out
|
|
|
+ socket_collection = node.inputs if is_input else node.outputs
|
|
|
+ counter = input_index if is_input else output_index
|
|
|
+ reorder_collection = reorder_me_input if is_input else reorder_me_output
|
|
|
+ if socket_map:
|
|
|
+ if item.identifier in socket_map.keys():
|
|
|
+ socket = relink_socket_map_add_socket(node, socket_collection, item)
|
|
|
+ do_relink(node, socket, socket_map, item.in_out)
|
|
|
+ else:
|
|
|
+ for has_socket in socket_collection:
|
|
|
+ if has_socket.bl_idname == item.socket_type and \
|
|
|
+ has_socket.name == item.name:
|
|
|
+ reorder_collection.append((has_socket, counter))
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ socket = relink_socket_map_add_socket(node, socket_collection, item)
|
|
|
+ else:
|
|
|
+ socket = relink_socket_map_add_socket(node, socket_collection, item)
|
|
|
+ counter += 1
|
|
|
+
|
|
|
for item in node.node_tree.interface.items_tree:
|
|
|
if item.item_type != "SOCKET": continue
|
|
|
if (item.in_out == 'INPUT' and update_input):
|
|
|
- if socket_map_in:
|
|
|
- if item.identifier in socket_map_in.keys():
|
|
|
- socket = relink_socket_map_add_socket(node, node.inputs, item)
|
|
|
- do_relink(node, socket, socket_map_in)
|
|
|
- else:
|
|
|
- for has_socket in node.inputs:
|
|
|
- if has_socket.bl_idname == item.socket_type and \
|
|
|
- has_socket.name == item.name:
|
|
|
- reorder_me_input.append((has_socket, input_index))
|
|
|
- break
|
|
|
- else:
|
|
|
- socket = relink_socket_map_add_socket(node, node.inputs, item)
|
|
|
- else:
|
|
|
- socket = relink_socket_map_add_socket(node, node.inputs, item)
|
|
|
- input_index += 1
|
|
|
-
|
|
|
+ update_group_sockets(item, True)
|
|
|
if (item.in_out == 'OUTPUT' and update_output):
|
|
|
- if socket_map_out:
|
|
|
- if item.identifier in socket_map_out.keys():
|
|
|
- socket = relink_socket_map_add_socket(node, node.outputs, item)
|
|
|
- do_relink(node, socket, socket_map_out)
|
|
|
- else:
|
|
|
- for has_socket in node.outputs:
|
|
|
- if has_socket.bl_idname == item.socket_type and \
|
|
|
- has_socket.name == item.name:
|
|
|
- reorder_me_output.append((has_socket, output_index))
|
|
|
- break
|
|
|
- else:
|
|
|
- socket = relink_socket_map_add_socket(node, node.outputs, item)
|
|
|
- else:
|
|
|
- socket = relink_socket_map_add_socket(node, node.outputs, item)
|
|
|
- output_index += 1
|
|
|
-
|
|
|
+ update_group_sockets(item, False)
|
|
|
+
|
|
|
both_reorders = zip([reorder_me_input, reorder_me_output], [node.inputs, node.outputs])
|
|
|
for reorder_task, collection in both_reorders:
|
|
|
for socket, position in reorder_task:
|
|
|
@@ -435,7 +428,10 @@ def node_group_update(node, force = False):
|
|
|
if s.identifier == socket.identifier: break
|
|
|
else:
|
|
|
prRed(f"WARN: could not reorder socket {socket.name}")
|
|
|
- collection.move(i, position)
|
|
|
+ to_index = position
|
|
|
+ if (not socket.is_output) and node.bl_idname == "MantisSchemaGroup":
|
|
|
+ to_index+=1
|
|
|
+ collection.move(i, to_index)
|
|
|
|
|
|
# at this point there is no wildcard socket
|
|
|
if socket_map_in and '__extend__' in socket_map_in.keys():
|