|
|
@@ -271,21 +271,29 @@ def update_interface(interface, name, in_out, sock_type, parent_name):
|
|
|
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 hasattr(item, 'is_array'):
|
|
|
+ multi = item.is_array
|
|
|
if node.bl_idname in ['MantisSchemaGroup'] and item.parent and item.parent.name == 'Array':
|
|
|
multi = True if in_out == 'INPUT' else False
|
|
|
- # 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':
|
|
|
- from .versioning import socket_add_workaround_for_4_5_0_LTS
|
|
|
- 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)
|
|
|
+ # 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':
|
|
|
+ from .versioning import socket_add_workaround_for_4_5_0_LTS
|
|
|
+ s = socket_add_workaround_for_4_5_0_LTS(item, socket_collection, multi)
|
|
|
else:
|
|
|
- if bpy_version == (4, 5, 0) and item.bl_socket_idname == 'NodeSocketGeometry':
|
|
|
- from .versioning import socket_add_workaround_for_4_5_0_LTS
|
|
|
- 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)
|
|
|
+ s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier, use_multi_input=multi)
|
|
|
+ if hasattr(s, 'default_value'):
|
|
|
+ from bpy.types import bpy_prop_array
|
|
|
+ from mathutils import Vector
|
|
|
+ default_value = 'REPORT BUG ON GITLAB' # default to bug string
|
|
|
+ val_type = type(s.default_value) # why tf can't I match/case here?
|
|
|
+ if val_type is bool: default_value = item.default_bool
|
|
|
+ if val_type is int: default_value = item.default_int
|
|
|
+ if val_type is float: default_value = item.default_float
|
|
|
+ if val_type is Vector: default_value = item.default_float
|
|
|
+ if val_type is str: default_value = item.default_string
|
|
|
+ if val_type is bpy_prop_array: default_value = item.default_float
|
|
|
+ s.default_value = default_value
|
|
|
if item.parent.name == 'Array': s.display_shape = 'SQUARE_DOT'
|
|
|
elif item.parent.name == 'Constant': s.display_shape='CIRCLE_DOT'
|
|
|
return s
|