MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / generate_node_paths

Method generate_node_paths

node-graph/graph-craft/src/document.rs:747–764  ·  view source on GitHub ↗

Populate the [`DocumentNode::path`], which stores the location of the document node to allow for matching the resulting proto nodes to the document node for the purposes of typing and finding monitor nodes.

(&mut self, prefix: &[NodeId])

Source from the content-addressed store, hash-verified

745
746 /// Populate the [`DocumentNode::path`], which stores the location of the document node to allow for matching the resulting proto nodes to the document node for the purposes of typing and finding monitor nodes.
747 pub fn generate_node_paths(&mut self, prefix: &[NodeId]) {
748 for (node_id, node) in &mut self.nodes {
749 let mut new_path = prefix.to_vec();
750 if !self.generated {
751 new_path.push(*node_id);
752 }
753 if let DocumentNodeImplementation::Network(network) = &mut node.implementation {
754 network.generate_node_paths(new_path.as_slice());
755 }
756 if node.original_location.path.is_some() {
757 log::warn!("Attempting to overwrite node path");
758 } else {
759 node.original_location.path = Some(new_path);
760 node.original_location.inputs_exposed = node.inputs.iter().map(|input| input.is_exposed()).collect();
761 node.original_location.dependants = (0..node.implementation.output_count()).map(|_| Vec::new()).collect();
762 }
763 }
764 }
765
766 pub fn populate_dependants(&mut self) {
767 let mut dep_changes = Vec::new();

Callers 1

compileMethod · 0.80

Calls 6

as_sliceMethod · 0.80
is_someMethod · 0.80
output_countMethod · 0.80
pushMethod · 0.45
iterMethod · 0.45
is_exposedMethod · 0.45

Tested by

no test coverage detected