Skip to content

Commit 8853022

Browse files
committed
Mark preprocessed networks as generated
1 parent d4b539a commit 8853022

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

node-graph/graph-craft/src/document.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ pub struct NodeNetwork {
708708
serde(serialize_with = "graphene_core::vector::serialize_hashmap", deserialize_with = "graphene_core::vector::deserialize_hashmap")
709709
)]
710710
pub scope_injections: FxHashMap<String, (NodeId, Type)>,
711+
pub generated: bool,
711712
}
712713

713714
impl std::hash::Hash for NodeNetwork {
@@ -822,7 +823,9 @@ impl NodeNetwork {
822823
pub fn generate_node_paths(&mut self, prefix: &[NodeId]) {
823824
for (node_id, node) in &mut self.nodes {
824825
let mut new_path = prefix.to_vec();
825-
new_path.push(*node_id);
826+
if !self.generated {
827+
new_path.push(*node_id);
828+
}
826829
if let DocumentNodeImplementation::Network(network) = &mut node.implementation {
827830
network.generate_node_paths(new_path.as_slice());
828831
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, editor_api: Arc<WasmEdito
7474
},
7575
];
7676

77+
log::debug!("This is here so this gets noticed in code review");
7778
NodeNetwork {
7879
exports: vec![NodeInput::node(NodeId(1), 0)],
7980
nodes: nodes.into_iter().enumerate().map(|(id, node)| (NodeId(id as u64), node)).collect(),
8081
scope_injections: [("editor-api".to_string(), (NodeId(2), concrete!(&WasmEditorApi)))].into_iter().collect(),
82+
// TODO: check if it makes sense to set generated to true
83+
generated: false,
8184
}
8285
}

node-graph/preprocessor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
102102
.collect();
103103

104104
if generated_nodes == 0 {
105-
log::debug!("skipping {}", id);
106105
continue;
107106
}
108107

@@ -127,6 +126,7 @@ pub fn generate_node_substitutions() -> HashMap<String, DocumentNode> {
127126
}],
128127
nodes,
129128
scope_injections: Default::default(),
129+
generated: true,
130130
}),
131131
visible: true,
132132
skip_deduplication: false,

0 commit comments

Comments
 (0)