Files
Graphite/node-graph/graph-craft/src/util.rs
Dennis Kobert 7a2144e31e Fix and reenable profiling CI action (#2632)
* Reenable profiling ci action

* Remove deprecated iai feature flag

* Remove unused import

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-18 20:31:15 +00:00

31 lines
1001 B
Rust

use crate::document::NodeNetwork;
use crate::graphene_compiler::Compiler;
use crate::proto::ProtoNetwork;
pub fn load_network(document_string: &str) -> NodeNetwork {
let document: serde_json::Value = serde_json::from_str(document_string).expect("Failed to parse document");
let document = (document["network_interface"]["network"].clone()).to_string();
serde_json::from_str::<NodeNetwork>(&document).expect("Failed to parse document")
}
pub fn compile(network: NodeNetwork) -> ProtoNetwork {
let compiler = Compiler {};
compiler.compile_single(network).unwrap()
}
pub fn load_from_name(name: &str) -> NodeNetwork {
let content = std::fs::read(format!("../../demo-artwork/{name}.graphite")).expect("failed to read file");
let content = std::str::from_utf8(&content).unwrap();
load_network(content)
}
pub static DEMO_ART: [&str; 7] = [
"changing-seasons",
"painted-dreams",
"red-dress",
"valley-of-spires",
"isometric-fountain",
"procedural-string-lights",
"parametric-dunescape",
];