mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Use more specific node input indexing when displaying invalid input errors (#3415)
* Reduce displayed invalid inputs * Correct error offset for convert node * Apply suggestions from code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -2048,7 +2048,7 @@ impl<'a> ParameterWidgetsInfo<'a> {
|
||||
let (name, description) = context.network_interface.displayed_input_name_and_description(&node_id, index, context.selection_network_path);
|
||||
let input_type = context
|
||||
.network_interface
|
||||
.input_type(&InputConnector::node(node_id, index), context.selection_network_path)
|
||||
.input_type_not_invalid(&InputConnector::node(node_id, index), context.selection_network_path)
|
||||
.displayed_type();
|
||||
let document_node = context.network_interface.document_node(&node_id, context.selection_network_path);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
|
||||
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{DocumentNodeImplementation, InlineRust, NodeInput};
|
||||
use graph_craft::proto::GraphErrors;
|
||||
use graph_craft::proto::{GraphErrorType, GraphErrors};
|
||||
use graph_craft::{Type, concrete};
|
||||
use graphene_std::uuid::NodeId;
|
||||
use interpreted_executor::dynamic_executor::{NodeTypes, ResolvedDocumentNodeTypesDelta};
|
||||
@@ -129,7 +129,14 @@ impl NodeNetworkInterface {
|
||||
InputConnector::Export(_) => false,
|
||||
})
|
||||
}
|
||||
DocumentNodeImplementation::ProtoNode(_) => self.resolved_types.node_graph_errors.iter().any(|error| error.node_path == node_path),
|
||||
DocumentNodeImplementation::ProtoNode(_) => self.resolved_types.node_graph_errors.iter().any(|error| {
|
||||
error.node_path == node_path
|
||||
&& match &error.error {
|
||||
GraphErrorType::InvalidImplementations { error_inputs, .. } => error_inputs.iter().any(|solution| solution.iter().any(|(index, _)| index == input_index)),
|
||||
_ => true,
|
||||
}
|
||||
}),
|
||||
|
||||
DocumentNodeImplementation::Extract => false,
|
||||
}
|
||||
}
|
||||
@@ -137,7 +144,7 @@ impl NodeNetworkInterface {
|
||||
}
|
||||
}
|
||||
|
||||
fn input_type_not_invalid(&mut self, input_connector: &InputConnector, network_path: &[NodeId]) -> TypeSource {
|
||||
pub fn input_type_not_invalid(&mut self, input_connector: &InputConnector, network_path: &[NodeId]) -> TypeSource {
|
||||
let Some(input) = self.input_from_connector(input_connector, network_path) else {
|
||||
return TypeSource::Error("Could not get input from connector");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user