|
|
@@ -215,14 +215,38 @@ def update_interface(interface, name, in_out, sock_type, parent_name):
|
|
|
else:
|
|
|
raise RuntimeError(wrapRed("Cannot add interface item to tree without specifying type."))
|
|
|
|
|
|
+
|
|
|
+def socket_add_workaround_for_4_5_0_LTS(item, socket_collection, multi):
|
|
|
+ import json
|
|
|
+ tree = item.id_data
|
|
|
+ interface_helper = json.loads(tree.interface_helper)
|
|
|
+ socket_info = interface_helper.get(item.identifier)
|
|
|
+ if not socket_info: raise RuntimeError(f"There has been an error adding the socket {item.name}")
|
|
|
+ s = socket_collection.new(
|
|
|
+ type=socket_info['bl_socket_idname'],
|
|
|
+ name=socket_info['name'],
|
|
|
+ identifier=item.identifier,
|
|
|
+ use_multi_input=multi, )
|
|
|
+ return s
|
|
|
+
|
|
|
+# D.node_groups['Rigging Nodes'].interface.new_socket('beans', description='the b word', socket_type='NodeSocketGeometry')
|
|
|
#UGLY BAD REFACTOR
|
|
|
def relink_socket_map_add_socket(node, socket_collection, item, in_out=None,):
|
|
|
+ from bpy.app import version as bpy_version
|
|
|
if not in_out: in_out=item.in_out
|
|
|
if node.bl_idname in ['MantisSchemaGroup'] and item.parent and item.parent.name == 'Array':
|
|
|
multi = True if in_out == 'INPUT' else False
|
|
|
- s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier, use_multi_input=multi)
|
|
|
+ # have to work around a bug in 4.5.0 that prevents me from declaring custom socket types
|
|
|
+ # I have arbitrarily chosen to use the NodeSocketGeometry type to signal that this one is affected.
|
|
|
+ if bpy_version == (4, 5, 0) and item.bl_socket_idname == 'NodeSocketGeometry':
|
|
|
+ s = socket_add_workaround_for_4_5_0_LTS(item, socket_collection, multi)
|
|
|
+ else:
|
|
|
+ s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier, use_multi_input=multi)
|
|
|
else:
|
|
|
- s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier)
|
|
|
+ if bpy_version == (4, 5, 0) and item.bl_socket_idname == 'NodeSocketGeometry':
|
|
|
+ s = socket_add_workaround_for_4_5_0_LTS(item, socket_collection, multi=False,)
|
|
|
+ else:
|
|
|
+ s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier)
|
|
|
if item.parent.name == 'Array': s.display_shape = 'SQUARE_DOT'
|
|
|
elif item.parent.name == 'Constant': s.display_shape='CIRCLE_DOT'
|
|
|
return s
|