diff --git a/node-graph/preprocessor/src/lib.rs b/node-graph/preprocessor/src/lib.rs index 0f9bf398..f17760e6 100644 --- a/node-graph/preprocessor/src/lib.rs +++ b/node-graph/preprocessor/src/lib.rs @@ -19,6 +19,13 @@ pub fn expand_network(network: &mut NodeNetwork, substitutions: &HashMap expand_network(node_network, substitutions), DocumentNodeImplementation::ProtoNode(proto_node_identifier) => { if let Some(new_node) = substitutions.get(proto_node_identifier) { + // Reconcile the document node's inputs with what the current node definition expects, + // since the saved document may have fewer or more inputs than the current version + while node.inputs.len() < new_node.inputs.len() { + node.inputs.push(new_node.inputs[node.inputs.len()].clone()); + } + node.inputs.truncate(new_node.inputs.len()); + node.implementation = new_node.implementation.clone(); } } @@ -59,6 +66,7 @@ pub fn generate_node_substitutions() -> HashMap = node_io_types .iter() + .take(input_count) .enumerate() .map(|(i, inputs)| { (