Skip to content

Commit 975b54d

Browse files
committed
Hide EditorApi and add a comment describing unresolved Import node input types
1 parent 93429ab commit 975b54d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

editor/src/messages/portfolio/document/graph_operation/utility_types.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,11 @@ impl<'a> ModifyInputsContext<'a> {
876876
can_reconnect = false
877877
}
878878

879+
// Do not reconnect to EditorApi network input in the document network.
880+
if network_path.is_empty() && reconnect_to_input.as_ref().is_some_and(|reconnect| matches!(reconnect, NodeInput::Network { .. })) {
881+
can_reconnect = false
882+
}
883+
879884
// Only reconnect if the output index for the node to be deleted is 0
880885
if can_reconnect && reconnect_to_input.is_some() {
881886
// None means to use reconnect_to_input, which can be safely unwrapped

editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,17 @@ impl NodeGraphMessageHandler {
11441144
(node_input, frontend_graph_input)
11451145
});
11461146

1147-
let primary_input = inputs.next().filter(|(input, _)| input.is_exposed()).map(|(_, input_type)| input_type);
1147+
let primary_input = inputs
1148+
.next()
1149+
.filter(|(input, _)| {
1150+
// Don't show EditorApi input to nodes like "Text" in the document network
1151+
if document_network == network && matches!(input, NodeInput::Network { .. }) {
1152+
false
1153+
} else {
1154+
input.is_exposed()
1155+
}
1156+
})
1157+
.map(|(_, input_type)| input_type);
11481158
let exposed_inputs = inputs
11491159
.filter(|(input, _)| input.is_exposed() && !(matches!(input, NodeInput::Network { .. }) && document_network == network))
11501160
.map(|(_, input_type)| input_type)
@@ -1356,6 +1366,7 @@ impl NodeGraphMessageHandler {
13561366
let mut import_node_outputs = Vec::new();
13571367
for (index, definition_name) in import_names.into_iter().enumerate() {
13581368
let (connected, connected_index) = connected_node_to_output_lookup.get(&(network.imports_metadata.0, index)).unwrap_or(&(Vec::new(), Vec::new())).clone();
1369+
// TODO: Non exposed inputs are not added to the inputs_source_map, fix `pub fn document_node_types(&self) -> ResolvedDocumentNodeTypes`
13591370
let input_type = self.resolved_types.inputs.get(&Source { node: self.network.clone(), index }).cloned();
13601371

13611372
let frontend_data_type = if let Some(input_type) = input_type.clone() {

node-graph/interpreted-executor/src/dynamic_executor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ impl DynamicExecutor {
8585

8686
pub fn document_node_types(&self) -> ResolvedDocumentNodeTypes {
8787
let mut resolved_document_node_types = ResolvedDocumentNodeTypes::default();
88+
// TODO: Non exposed inputs are not added to the inputs_source_map, so they are not included in the resolved_document_node_types. The type is still available in the typing_context. This only affects the UI only import node.
8889
for (source, &(protonode_id, protonode_index)) in self.tree.inputs_source_map() {
8990
let Some(node_io) = self.typing_context.type_of(protonode_id) else { continue };
9091
let Some(ty) = [&node_io.input].into_iter().chain(&node_io.parameters).nth(protonode_index) else {
@@ -206,7 +207,7 @@ impl BorrowTree {
206207
ConstructionArgs::Value(value) => {
207208
let upcasted = UpcastNode::new(value.to_owned());
208209
let node = Box::new(upcasted) as TypeErasedBox<'_>;
209-
let node = NodeContainer::new(node);
210+
let node: std::rc::Rc<NodeContainer> = NodeContainer::new(node);
210211
self.store_node(node, id);
211212
}
212213
ConstructionArgs::Inline(_) => unimplemented!("Inline nodes are not supported yet"),

0 commit comments

Comments
 (0)