mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-06 08:13:40 -10:00
* Free executor nodes once no output reaches them, and let an export keep its output instead of blocking the runtime * Answer an export on a channel of its own, so the viewport's answers stay in order * Render a copy's SVG as an export of the copied layers' own network * Record in the executor which paths' types changed, to be taken with take_type_changes * Prepare every network in the node graph executor, and send the runtime the thumbnail sources instead of the previews and layers
55 lines
1.5 KiB
Rust
55 lines
1.5 KiB
Rust
// Auto-trait checks for the registry's node types walk deep into wgpu types, beyond the default limit of 128
|
|
#![recursion_limit = "256"]
|
|
|
|
pub mod dynamic_executor;
|
|
pub mod layer_paths;
|
|
pub mod node_registry;
|
|
pub mod util;
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use core_types::*;
|
|
|
|
#[test]
|
|
fn double_number() {
|
|
use graph_craft::document::*;
|
|
use graph_craft::*;
|
|
|
|
let network = NodeNetwork {
|
|
exports: vec![NodeInput::node(NodeId(1), 0)],
|
|
nodes: [
|
|
// Simple passthrough node taking a number as input from outside the graph
|
|
(
|
|
NodeId(0),
|
|
DocumentNode {
|
|
inputs: vec![],
|
|
call_argument: concrete!(u32),
|
|
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("core_types::value::ClonedNode")),
|
|
..Default::default()
|
|
},
|
|
),
|
|
// An add node adding the result of the passthrough node to its self
|
|
(
|
|
NodeId(1),
|
|
DocumentNode {
|
|
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::node(NodeId(0), 0)],
|
|
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::math_nodes::add::IDENTIFIER),
|
|
..Default::default()
|
|
},
|
|
),
|
|
]
|
|
.into_iter()
|
|
.collect(),
|
|
..Default::default()
|
|
};
|
|
|
|
use crate::dynamic_executor::DynamicExecutor;
|
|
use graph_craft::graphene_compiler::Compiler;
|
|
|
|
let compiler = Compiler {};
|
|
let protograph = compiler.compile_single(network).expect("Graph should be generated").network;
|
|
|
|
let _exec = DynamicExecutor::default().insert(protograph).map(|_e| panic!("The network should not type check ")).unwrap_err();
|
|
}
|
|
}
|