mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Add the auto-generated node catalog to the website's user manual (#3662)
* Generate the MVP node catalog in the manual (with some placeholders) * Implement nearly the rest of everything * Move to the tools directory and make it generate nicer default values * Add category descriptions * Organize file structure and improve type naming * Improve book table of contents code * Add collapsing chapter navigation to the book template * Add to build workflow * Clean up site structure
This commit is contained in:
@@ -21,7 +21,7 @@ pub fn detect_file_type(path: &Path) -> Result<FileType, String> {
|
||||
Some("svg") => Ok(FileType::Svg),
|
||||
Some("png") => Ok(FileType::Png),
|
||||
Some("jpg" | "jpeg") => Ok(FileType::Jpg),
|
||||
_ => Err(format!("Unsupported file extension. Supported formats: .svg, .png, .jpg")),
|
||||
_ => Err("Unsupported file extension. Supported formats: .svg, .png, .jpg".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ pub async fn export_document(
|
||||
output_path: PathBuf,
|
||||
file_type: FileType,
|
||||
scale: f64,
|
||||
width: Option<u32>,
|
||||
height: Option<u32>,
|
||||
(width, height): (Option<u32>, Option<u32>),
|
||||
transparent: bool,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
// Determine export format based on file type
|
||||
@@ -42,10 +41,12 @@ pub async fn export_document(
|
||||
};
|
||||
|
||||
// Create render config with export settings
|
||||
let mut render_config = RenderConfig::default();
|
||||
render_config.export_format = export_format;
|
||||
render_config.for_export = true;
|
||||
render_config.scale = scale;
|
||||
let mut render_config = RenderConfig {
|
||||
scale,
|
||||
export_format,
|
||||
for_export: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Set viewport dimensions if specified
|
||||
if let (Some(w), Some(h)) = (width, height) {
|
||||
|
||||
@@ -97,9 +97,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
Command::Compile { ref document, .. } => document,
|
||||
Command::Export { ref document, .. } => document,
|
||||
Command::ListNodeIdentifiers => {
|
||||
let mut ids: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect();
|
||||
ids.sort_by_key(|x| x.as_str().to_string());
|
||||
for id in ids {
|
||||
let mut nodes: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect();
|
||||
nodes.sort_by_key(|x| x.as_str().to_string());
|
||||
for id in nodes {
|
||||
println!("{}", id.as_str());
|
||||
}
|
||||
return Ok(());
|
||||
@@ -108,7 +108,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let document_string = std::fs::read_to_string(document_path).expect("Failed to read document");
|
||||
|
||||
log::info!("creating gpu context",);
|
||||
log::info!("Creating GPU context");
|
||||
let mut application_io = block_on(WasmApplicationIo::new_offscreen());
|
||||
|
||||
if let Command::Export { image: Some(ref image_path), .. } = app.command {
|
||||
@@ -164,7 +164,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
let executor = create_executor(proto_graph)?;
|
||||
|
||||
// Perform export
|
||||
export::export_document(&executor, wgpu_executor_ref, output, file_type, scale, width, height, transparent).await?;
|
||||
export::export_document(&executor, wgpu_executor_ref, output, file_type, scale, (width, height), transparent).await?;
|
||||
}
|
||||
_ => unreachable!("All other commands should be handled before this match statement is run"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user