Browse Source

Fix: default value disabled for Matrix

(it is not yet implemented)
Joseph Brandenburg 3 weeks ago
parent
commit
b979cdd50f
1 changed files with 13 additions and 17 deletions
  1. 13 17
      utilities.py

+ 13 - 17
utilities.py

@@ -296,12 +296,6 @@ def relink_socket_map_add_socket(node, socket_collection, item,  in_out=None,):
     multi=False
     if in_out == 'INPUT' and read_schema_type(item) == 'Array':
         multi = True
-
-    # multi=False
-    # 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':
@@ -311,17 +305,19 @@ def relink_socket_map_add_socket(node, socket_collection, item,  in_out=None,):
         s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier,  use_multi_input=multi)
     if hasattr(s, 'default_value') and hasattr(s, 'is_valid_interface_type') and \
           s.is_valid_interface_type == True:
-        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 s.bl_idname not in ['MatrixSocket']: # no default value implemented
+            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 read_schema_type(item) == 'Array': s.display_shape = 'SQUARE_DOT'
     elif node.bl_idname in ['MantisSchemaGroup'] and read_schema_type(item) == 'Constant':
         s.display_shape='CIRCLE_DOT'