From eb29a01f4fb1bb444ef0f7cb1e0d91a6bce72fde Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Tue, 18 Nov 2025 10:23:59 +0100 Subject: [PATCH 1/4] Add proto node name printing --- node-graph/graphene-cli/src/main.rs | 2 +- node-graph/preprocessor/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/node-graph/graphene-cli/src/main.rs b/node-graph/graphene-cli/src/main.rs index 2d00ad3c3c..49e64ba1eb 100644 --- a/node-graph/graphene-cli/src/main.rs +++ b/node-graph/graphene-cli/src/main.rs @@ -81,7 +81,7 @@ async fn main() -> Result<(), Box> { let document_string = std::fs::read_to_string(document_path).expect("Failed to read document"); log::info!("creating gpu context",); - let mut application_io = block_on(WasmApplicationIo::new()); + let mut application_io = block_on(WasmApplicationIo::new_offscreen()); if let Command::Run { image: Some(ref image_path), .. } = app.command { application_io.resources.insert("null".to_string(), Arc::from(std::fs::read(image_path).expect("Failed to read image"))); diff --git a/node-graph/preprocessor/src/lib.rs b/node-graph/preprocessor/src/lib.rs index 185463401b..63c90b0845 100644 --- a/node-graph/preprocessor/src/lib.rs +++ b/node-graph/preprocessor/src/lib.rs @@ -34,6 +34,7 @@ pub fn generate_node_substitutions() -> HashMap Date: Wed, 19 Nov 2025 10:57:14 +0100 Subject: [PATCH 2/4] Add subcommand for printing proto node identifiers --- node-graph/graphene-cli/src/main.rs | 15 +++++++++++++-- node-graph/preprocessor/src/lib.rs | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/node-graph/graphene-cli/src/main.rs b/node-graph/graphene-cli/src/main.rs index 49e64ba1eb..d148f6c44e 100644 --- a/node-graph/graphene-cli/src/main.rs +++ b/node-graph/graphene-cli/src/main.rs @@ -6,8 +6,8 @@ use graph_craft::graphene_compiler::{Compiler, Executor}; use graph_craft::proto::ProtoNetwork; use graph_craft::util::load_network; use graph_craft::wasm_application_io::EditorPreferences; +use graphene_std::text::FontCache; use graphene_std::application_io::{ApplicationIo, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; -use graphene_std::text_nodes::FontCache; use graphene_std::wasm_application_io::{WasmApplicationIo, WasmEditorApi}; use interpreted_executor::dynamic_executor::DynamicExecutor; use interpreted_executor::util::wrap_network_in_scope; @@ -56,6 +56,7 @@ enum Command { #[clap(long, short = 'l')] run_loop: bool, }, + PrintNodeIdentifiers, } #[derive(Debug, Args)] @@ -76,6 +77,14 @@ async fn main() -> Result<(), Box> { let document_path = match app.command { Command::Compile { ref document, .. } => document, Command::Run { ref document, .. } => document, + Command::PrintNodeIdentifiers => { + let mut ids: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect(); + ids.sort_by_key(|x| x.name.clone()); + for id in ids { + println!("{}", id.name) + } + return Ok(()); + } }; let document_string = std::fs::read_to_string(document_path).expect("Failed to read document"); @@ -123,6 +132,7 @@ async fn main() -> Result<(), Box> { tokio::time::sleep(std::time::Duration::from_millis(16)).await; } } + _ => unreachable!("all other commands should be hadled before this match statement is run") } Ok(()) @@ -168,7 +178,8 @@ fn fix_nodes(network: &mut NodeNetwork) { // https://github.com/GraphiteEditor/Graphite/blob/d68f91ccca69e90e6d2df78d544d36cd1aaf348e/editor/src/messages/portfolio/portfolio_message_handler.rs#L535 // Since the CLI doesn't have the document node definitions, a less robust method of just patching the inputs is used. DocumentNodeImplementation::ProtoNode(proto_node_identifier) - if (proto_node_identifier.name.starts_with("core_types::ConstructLayerNode") || proto_node_identifier.name.starts_with("core_types::AddArtboardNode")) && node.inputs.len() < 3 => + if (proto_node_identifier.name.starts_with("graphene_core::ConstructLayerNode") || proto_node_identifier.name.starts_with("graphene_core::AddArtboardNode")) + && node.inputs.len() < 3 => { node.inputs.push(NodeInput::Reflection(DocumentNodeMetadata::DocumentNodePath)); } diff --git a/node-graph/preprocessor/src/lib.rs b/node-graph/preprocessor/src/lib.rs index 63c90b0845..185463401b 100644 --- a/node-graph/preprocessor/src/lib.rs +++ b/node-graph/preprocessor/src/lib.rs @@ -34,7 +34,6 @@ pub fn generate_node_substitutions() -> HashMap Date: Wed, 19 Nov 2025 11:22:21 +0100 Subject: [PATCH 3/4] Address review comments --- node-graph/graphene-cli/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node-graph/graphene-cli/src/main.rs b/node-graph/graphene-cli/src/main.rs index d148f6c44e..cf8698795b 100644 --- a/node-graph/graphene-cli/src/main.rs +++ b/node-graph/graphene-cli/src/main.rs @@ -56,7 +56,7 @@ enum Command { #[clap(long, short = 'l')] run_loop: bool, }, - PrintNodeIdentifiers, + ListNodeIdentifiers, } #[derive(Debug, Args)] @@ -77,7 +77,7 @@ async fn main() -> Result<(), Box> { let document_path = match app.command { Command::Compile { ref document, .. } => document, Command::Run { ref document, .. } => document, - Command::PrintNodeIdentifiers => { + Command::ListNodeIdentifiers => { let mut ids: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect(); ids.sort_by_key(|x| x.name.clone()); for id in ids { @@ -132,7 +132,7 @@ async fn main() -> Result<(), Box> { tokio::time::sleep(std::time::Duration::from_millis(16)).await; } } - _ => unreachable!("all other commands should be hadled before this match statement is run") + _ => unreachable!("All other commands should be handled before this match statement is run") } Ok(()) From a6342d931477d5c7daa97dbc13d0be1071f131e3 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Wed, 19 Nov 2025 11:24:49 +0100 Subject: [PATCH 4/4] Cargo fmt --- node-graph/graphene-cli/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-graph/graphene-cli/src/main.rs b/node-graph/graphene-cli/src/main.rs index cf8698795b..2539957093 100644 --- a/node-graph/graphene-cli/src/main.rs +++ b/node-graph/graphene-cli/src/main.rs @@ -6,8 +6,8 @@ use graph_craft::graphene_compiler::{Compiler, Executor}; use graph_craft::proto::ProtoNetwork; use graph_craft::util::load_network; use graph_craft::wasm_application_io::EditorPreferences; -use graphene_std::text::FontCache; use graphene_std::application_io::{ApplicationIo, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; +use graphene_std::text::FontCache; use graphene_std::wasm_application_io::{WasmApplicationIo, WasmEditorApi}; use interpreted_executor::dynamic_executor::DynamicExecutor; use interpreted_executor::util::wrap_network_in_scope; @@ -132,7 +132,7 @@ async fn main() -> Result<(), Box> { tokio::time::sleep(std::time::Duration::from_millis(16)).await; } } - _ => unreachable!("All other commands should be handled before this match statement is run") + _ => unreachable!("All other commands should be handled before this match statement is run"), } Ok(())