mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-31 18:27:20 +00:00
Add automatic type conversion and the node graph preprocessor (#2478)
* Prototype document network level into node insertion * Implement Convert trait / node for places we can't use Into * Add isize/usize and i128/u128 implementations for Convert trait * Factor out substitutions into preprocessor crate * Simplify layer node further * Code review * Mark preprocessed networks as generated * Revert changes to layer node definition * Skip generated flag for serialization * Don't expand for tests * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
86da69e33f
commit
a40a760f27
15 changed files with 484 additions and 128 deletions
|
@ -683,6 +683,8 @@ pub struct NodeNetwork {
|
|||
#[serde(default)]
|
||||
#[serde(serialize_with = "graphene_core::vector::serialize_hashmap", deserialize_with = "graphene_core::vector::deserialize_hashmap")]
|
||||
pub scope_injections: FxHashMap<String, (NodeId, Type)>,
|
||||
#[serde(skip)]
|
||||
pub generated: bool,
|
||||
}
|
||||
|
||||
impl Hash for NodeNetwork {
|
||||
|
@ -797,7 +799,9 @@ impl NodeNetwork {
|
|||
pub fn generate_node_paths(&mut self, prefix: &[NodeId]) {
|
||||
for (node_id, node) in &mut self.nodes {
|
||||
let mut new_path = prefix.to_vec();
|
||||
new_path.push(*node_id);
|
||||
if !self.generated {
|
||||
new_path.push(*node_id);
|
||||
}
|
||||
if let DocumentNodeImplementation::Network(network) = &mut node.implementation {
|
||||
network.generate_node_paths(new_path.as_slice());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue