Parameter node: Restrict initial type choice to avoid mismatch between type and default value before connecting the output

This commit is contained in:
Acly
2024-10-29 13:03:53 +01:00
parent 035c68c629
commit e2bd09d7e9
+5 -1
View File
@@ -106,7 +106,9 @@ function changeWidgets(node, type, connectedNode, connectedWidget) {
}
const options = connectedWidget.options
if (!parameterTypes[type].includes(node.widgets[1].value)) {
const parameterTypeHint = node.widgets[1].value
const notSpecialized = node.widgets[1].options.values.includes("auto")
if (notSpecialized || !parameterTypes[type].includes(parameterTypeHint)) {
node.widgets[1].value = defaultParameterType(type, connectedNode, connectedWidget)
node.widgets[1].options = {values: parameterTypes[type]}
}
@@ -153,6 +155,8 @@ function adaptWidgetsToConnection(node) {
} else if (!links || links.length === 0) {
node.outputs[0].type = "*"
node.widgets[1].value = "auto"
node.widgets[1].options = {values: ["auto"]}
}
}