|
@@ -970,6 +970,7 @@ def handle_overlay_detect(node, socket_id, socket_idname, value) -> str:
|
|
|
root_items_tree = root_tree.interface.items_tree
|
|
root_items_tree = root_tree.interface.items_tree
|
|
|
# detect if it is in the root tree, if so, handle immediately
|
|
# detect if it is in the root tree, if so, handle immediately
|
|
|
out_value = value
|
|
out_value = value
|
|
|
|
|
+ # what this recieves is determined by its idname
|
|
|
socket_type = str
|
|
socket_type = str
|
|
|
match socket_idname:
|
|
match socket_idname:
|
|
|
case "IntSocket" | "UnsignedIntSocket":
|
|
case "IntSocket" | "UnsignedIntSocket":
|
|
@@ -981,14 +982,20 @@ def handle_overlay_detect(node, socket_id, socket_idname, value) -> str:
|
|
|
for key, interface_item in root_items_tree.items():
|
|
for key, interface_item in root_items_tree.items():
|
|
|
if interface_item.item_type != "SOCKET": continue
|
|
if interface_item.item_type != "SOCKET": continue
|
|
|
if interface_item.in_out != "INPUT": continue
|
|
if interface_item.in_out != "INPUT": continue
|
|
|
- # NOTE this will need to change if overlays extend to other data types
|
|
|
|
|
- if hasattr(interface_item, "default_string"):
|
|
|
|
|
- out_value = socket_type(out_value.replace("$"+key, interface_item.default_string))
|
|
|
|
|
- elif key == value: # TODO this is the wrong way to do this, replace this with parser later
|
|
|
|
|
- if hasattr(interface_item, "default_int"):
|
|
|
|
|
- out_value = socket_type(interface_item.default_int)
|
|
|
|
|
- elif hasattr(interface_item, "default_float"):
|
|
|
|
|
- out_value = socket_type(interface_item.default_float)
|
|
|
|
|
|
|
+ # then what the interface provides is determined by its idname in turn
|
|
|
|
|
+ # NOTE I'm not 100% sure checking the socket_type is the right thing to do here
|
|
|
|
|
+ match interface_item.bl_socket_idname:
|
|
|
|
|
+ case "IntSocket" | "BooleanSocket":
|
|
|
|
|
+ if socket_type in {int, float} and '$'+key == out_value:
|
|
|
|
|
+ # TODO this is the wrong way to do this, replace this with parser later
|
|
|
|
|
+ out_value = socket_type(interface_item.default_int)
|
|
|
|
|
+ case "FloatSocket":
|
|
|
|
|
+ if socket_type in {int, float} and '$'+key == out_value:
|
|
|
|
|
+ out_value = socket_type(interface_item.default_float)
|
|
|
|
|
+ case "StringSocket":
|
|
|
|
|
+ if socket_type == str:
|
|
|
|
|
+ out_value = socket_type(out_value.replace("$"+key, interface_item.default_string))
|
|
|
|
|
+
|
|
|
else: # since it is not root, we have to tag it.
|
|
else: # since it is not root, we have to tag it.
|
|
|
mContext.tagged_for_overlay.append((node.signature, socket_id))
|
|
mContext.tagged_for_overlay.append((node.signature, socket_id))
|
|
|
return out_value
|
|
return out_value
|