mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 02:08:11 +08:00
Fix regression with migration code changed in node UI wire refactor (#2840)
Fixes
This commit is contained in:
@@ -97,6 +97,8 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
};
|
||||
}
|
||||
|
||||
let layer_input_connector = post_node_input_connector.clone();
|
||||
|
||||
// Sink post_node down to the end of the non layer chain that feeds into post_node, such that pre_node is the layer node at insert_index + 1, or None if insert_index is the last layer
|
||||
loop {
|
||||
let pre_node_output_connector = network_interface.upstream_output_connector(&post_node_input_connector, &[]);
|
||||
@@ -105,6 +107,11 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
Some(OutputConnector::Node { node_id: pre_node_id, .. }) if !network_interface.is_layer(&pre_node_id, &[]) => {
|
||||
// Update post_node_input_connector for the next iteration
|
||||
post_node_input_connector = InputConnector::node(pre_node_id, 0);
|
||||
// Insert directly under layer if moving to the end of a layer stack that ends with a non layer node that does not have an exposed primary input
|
||||
let primary_is_exposed = network_interface.input_from_connector(&post_node_input_connector, &[]).is_some_and(|input| input.is_exposed());
|
||||
if !primary_is_exposed {
|
||||
return layer_input_connector;
|
||||
}
|
||||
}
|
||||
_ => break, // Break if pre_node_output_connector is None or if pre_node_id is a layer
|
||||
}
|
||||
|
||||
@@ -4093,6 +4093,18 @@ impl NodeNetworkInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// When opening an old document to ensure the output names match the number of exports
|
||||
pub fn validate_output_names(&mut self, node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId]) {
|
||||
if let DocumentNodeImplementation::Network(network) = &node.implementation {
|
||||
let number_of_exports = network.exports.len();
|
||||
let Some(metadata) = self.node_metadata_mut(node_id, network_path) else {
|
||||
log::error!("Could not get metadata for node: {:?}", node_id);
|
||||
return;
|
||||
};
|
||||
metadata.persistent_metadata.output_names.resize(number_of_exports, "".to_string());
|
||||
}
|
||||
}
|
||||
|
||||
/// Keep metadata in sync with the new implementation if this is used by anything other than the upgrade scripts
|
||||
pub fn replace_reference_name(&mut self, node_id: &NodeId, network_path: &[NodeId], reference_name: String) {
|
||||
let Some(node_metadata) = self.node_metadata_mut(node_id, network_path) else {
|
||||
@@ -5639,7 +5651,6 @@ impl NodeNetworkInterface {
|
||||
self.unload_all_nodes_bounding_box(network_path);
|
||||
}
|
||||
|
||||
// TODO: Run the auto layout system to make space for the new nodes
|
||||
/// Disconnect the layers primary output and the input to the last non layer node feeding into it through primary flow, reconnects, then moves the layer to the new layer and stack index
|
||||
pub fn move_layer_to_stack(&mut self, layer: LayerNodeIdentifier, mut parent: LayerNodeIdentifier, mut insert_index: usize, network_path: &[NodeId]) {
|
||||
// Prevent moving an artboard anywhere but to the ROOT_PARENT child stack
|
||||
|
||||
Reference in New Issue
Block a user