diff --git a/Cargo.lock b/Cargo.lock index f2fdfa6..fdeb993 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,9 +937,18 @@ dependencies = [ ] [[package]] -name = "craft-mcmat" +name = "craft-materialx" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc" +dependencies = [ + "craft-xml", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-mcmat" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=7a7a18cb40ac4cd5fca29c0dc224ac5178d40a89#7a7a18cb40ac4cd5fca29c0dc224ac5178d40a89" dependencies = [ "craft-zip", "serde", @@ -990,6 +999,16 @@ dependencies = [ "encoding_rs", ] +[[package]] +name = "craft-platform" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc" +dependencies = [ + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "craft-quit" version = "0.1.0" @@ -1112,7 +1131,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc" +source = "git+https://github.com/storytold/craft-libs?rev=7a7a18cb40ac4cd5fca29c0dc224ac5178d40a89#7a7a18cb40ac4cd5fca29c0dc224ac5178d40a89" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2823,6 +2842,7 @@ dependencies = [ "schemars", "serde", "serde_json", + "tempfile", "thiserror 2.0.21", "tokio", ] @@ -2834,6 +2854,7 @@ dependencies = [ "materialcraft-automation", "materialcraft-engine", "serde_json", + "tempfile", "tokio", "winresource", ] @@ -2851,6 +2872,7 @@ dependencies = [ name = "materialcraft-engine" version = "0.4.1" dependencies = [ + "craft-materialx", "craft-texture", "image", "materialcraft-core", @@ -2858,9 +2880,11 @@ dependencies = [ "materialcraft-formats", "materialcraft-geom", "materialcraft-nodes", + "rustix 1.1.6", "serde", "serde_json", "sha2", + "tempfile", "thiserror 2.0.21", ] @@ -2942,6 +2966,7 @@ dependencies = [ "craft-atomic", "craft-dialogs", "craft-keymap", + "craft-platform", "craft-quit", "craft-ui", "craft-update", @@ -2951,7 +2976,6 @@ dependencies = [ "egui-phosphor", "egui_kittest", "image", - "js-sys", "log", "materialcraft-engine", "materialcraft-render", @@ -2961,7 +2985,6 @@ dependencies = [ "sha2", "sys-locale", "tempfile", - "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "zip 2.6.1", diff --git a/Cargo.toml b/Cargo.toml index e971cdd..c5c26f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,14 +83,17 @@ flate2 = { version = "1", default-features = false, features = ["rust_backend"] cap-std = "4" getrandom = "0.3" # Shared Craft egui components from storytold/craft-libs -# MIT OR Apache-2.0; all shared dependencies use one reviewed revision +# MIT OR Apache-2.0 egui_kittest = "0.37" -craft-mcmat = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" } +craft-materialx = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" } +# MCMAT v3 uses its merged archive revision and the matching ZIP crate +craft-mcmat = { git = "https://github.com/storytold/craft-libs", rev = "7a7a18cb40ac4cd5fca29c0dc224ac5178d40a89" } craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["serde"] } # Keyboard bindings (chords, dispatch and display text): storytold/craft-libs, MIT OR Apache-2.0 craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["egui"] } # Native dialogs that do not block the event loop: storytold/craft-libs, MIT OR Apache-2.0 craft-dialogs = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" } +craft-platform = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" } # The platform quit and the macOS Quit menu item: storytold/craft-libs, MIT OR Apache-2.0 craft-quit = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["egui"] } craft-menu = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" } diff --git a/README.md b/README.md index a2155a8..fd9a762 100644 --- a/README.md +++ b/README.md @@ -145,11 +145,12 @@ cargo run --release -p materialcraft # desktop app cargo run --release -p materialcraft -- package.sbs # open an SBS package cargo run --release -p materialcraft -- --control 7878 # + JSON control channel cargo run --release -p materialcraft-cli -- mcp # MCP server (stdio) -cargo run --release -p materialcraft-cli -- new wood wood.sbs -cargo run --release -p materialcraft-cli -- render wood.sbs wood.png --scene sphere --full --hq -cargo run --release -p materialcraft-cli -- export wood.sbs textures --format png --depth 16 +cargo run --release -p materialcraft-cli -- new pbr surface.sbs --name Surface +cargo run --release -p materialcraft-cli -- render surface.sbs surface.png --scene sphere --full --hq +cargo run --release -p materialcraft-cli -- export surface.sbs textures --format png --depth 16 cargo run --release -p materialcraft-cli -- export my.sbs out --set wear=0.7 # with a graph input "wear" set first -cargo run --release -p materialcraft-cli -- run my.sbs file.exportMaterial '{"path": "my.mcmat", "size": 2048}' # for TextureCraft +cargo run --release -p materialcraft-cli -- publish surface.sbs surface.mcmat --graph Surface +cargo run --release -p materialcraft-cli -- export surface.mcmat build/surface --profile materialx --size 512 cd apps/materialcraft-web && trunk serve # web build cargo xtask ci # fmt, clippy, tests, layering, wasm ``` diff --git a/apps/materialcraft-cli/Cargo.toml b/apps/materialcraft-cli/Cargo.toml index c46ca73..025c1c4 100644 --- a/apps/materialcraft-cli/Cargo.toml +++ b/apps/materialcraft-cli/Cargo.toml @@ -17,3 +17,6 @@ tokio = { workspace = true } [build-dependencies] winresource = "0.1" + +[dev-dependencies] +tempfile = "3" diff --git a/apps/materialcraft-cli/src/main.rs b/apps/materialcraft-cli/src/main.rs index fa7a15e..621a2fa 100644 --- a/apps/materialcraft-cli/src/main.rs +++ b/apps/materialcraft-cli/src/main.rs @@ -13,8 +13,10 @@ materialcraft-cli: headless MaterialCraft USAGE: materialcraft-cli --version - materialcraft-cli info - Graphs, nodes, outputs and cook results, as JSON. + materialcraft-cli info + JSON graph inspection, or the published interface of a .mcmat. + materialcraft-cli publish --graph + Publish the selected material graph with its reachable source dependencies. materialcraft-cli commands [--filter ] List the engine commands (id, label, params). materialcraft-cli nodes [--filter ] [--category ] @@ -25,11 +27,16 @@ USAGE: Run [{\"id\", \"params\"}, ...] or {\"open\": , \"steps\": [...], \"save\": }. materialcraft-cli new