scad-gltf 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -4
- package/bin/gen.js +1 -1
- package/editor/dist/assets/{OutputPass-B6MrFnGE.js → OutputPass-C3DZe46t.js} +2 -2
- package/editor/dist/assets/{index-CgVih1C4.js → index-D-FSzMhd.js} +76 -76
- package/editor/dist/assets/{index-B1KAb97r.css → index-D8In1wnN.css} +1 -1
- package/editor/dist/assets/{openscad-CdBCY4mx.wasm → openscad-DiJCzDqJ.wasm} +0 -0
- package/editor/dist/assets/preview-Br3_yFrj.js +1 -0
- package/editor/dist/assets/preview-Cx3FHqKG.css +1 -0
- package/editor/dist/assets/{prompt-ui-B9QCNLfJ.js → prompt-ui-BjZlMzjn.js} +1 -0
- package/editor/dist/content.js +1 -1
- package/editor/dist/index.html +7 -6
- package/editor/dist/preview.html +20 -15
- package/editor/dist/sw.js +1 -1
- package/package.json +1 -1
- package/src/cli-utils.js +2 -2
- package/src/ext/openscad.js +1 -1
- package/src/ext/openscad.wasm +0 -0
- package/src/project-prompts.js +65 -32
- package/src/prompt.js +1 -0
- package/editor/dist/assets/preview-A6M04CFK.css +0 -1
- package/editor/dist/assets/preview-BbUpKLF4.js +0 -1
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ The C++ source code for this custom OpenSCAD version is included directly in thi
|
|
|
24
24
|
- **AI Studio Extension:** Chrome extension to natively preview, prompt, take chat snapshots, open in Scadify, and locally save AI-generated 3D models directly inside Google AI Studio.
|
|
25
25
|
- **Godot 4, Rust Bevy & Web Integration:** Native Godot 4 importer addon and Rust Bevy compile-time `build.rs` integration.
|
|
26
26
|
- **Automated AI Generation:** Pass an OpenAI-compatible base URL (and optional API key) to the `scad-gltf gen` CLI tool to automatically spawn a local MCP server, query the LLM via standard endpoints, allow it to visually iterate, and output a ready-to-run game project or raw 3D asset script.
|
|
27
|
+
- **Project Runner:** Bundled `scad-gltf play` CLI utility to safely unpack, build, and launch generated game projects in isolated temporary environments.
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
@@ -251,7 +252,7 @@ When asking an LLM (like Gemini) to generate OpenSCAD code, the extension automa
|
|
|
251
252
|
|
|
252
253
|
---
|
|
253
254
|
|
|
254
|
-
## 🤖 Model Context Protocol (
|
|
255
|
+
## 🤖 Model Context Protocol Server (`scad-gltf mcp`)
|
|
255
256
|
|
|
256
257
|
This package includes a native [MCP Server](https://modelcontextprotocol.io/) (`scad-gltf mcp`) designed to give AI assistants **visual feedback** during the 3D modeling process.
|
|
257
258
|
|
|
@@ -294,15 +295,16 @@ The addon allows you to drag-and-drop `.scad` files directly into your Godot pro
|
|
|
294
295
|
|
|
295
296
|
---
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
## Automated AI Generation (`scad-gltf gen`)
|
|
298
299
|
|
|
299
300
|
By default, the `scad-gltf gen` utility copies a heavily engineered system prompt to your clipboard to paste into an LLM. However, if you provide a **Base URL** (and optional **API Key**), the CLI will fully automate this process. It will automatically spin up the `scad-gltf mcp` server in the background, connect it to your LLM, and allow the AI to _visually evaluate and fix_ its code in real-time before saving the final `generate_project.js` script to your disk.
|
|
300
301
|
|
|
301
302
|
**Supported Generation Types:**
|
|
302
303
|
|
|
303
|
-
- `
|
|
304
|
+
- `scad`: Generate a single raw `.scad` asset file.
|
|
304
305
|
- `godot`: Generate a fully packaged Godot 4 game project containing generated assets and GDScript logic.
|
|
305
306
|
- `bevy`: Generate a Rust Bevy game project.
|
|
307
|
+
- `wgpu`: Generate a Rust wgpu graphics project.
|
|
306
308
|
- `web`: Generate a Vite-based Web3D app (Three.js/Babylon).
|
|
307
309
|
|
|
308
310
|
**Option 1: Using OpenAI (GPT-4o)**
|
|
@@ -340,7 +342,20 @@ You can also pass credentials inline as a JSON string argument instead of modify
|
|
|
340
342
|
scad-gltf gen godot "A futuristic tank game" '{"openaiBaseUrl": "http://127.0.0.1:8080/v1", "openaiModel": "llama-3"}'
|
|
341
343
|
```
|
|
342
344
|
|
|
343
|
-
|
|
345
|
+
**Providing Existing SCAD Files (`scadFiles`)**
|
|
346
|
+
You can inject your own local `.scad` files into the AI's context using the `scadFiles` JSON option. The AI will embed them into the generated project or use them as a foundation.
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
scad-gltf gen godot "A game using the provided player model" '{"scadFiles": ["./player.scad"]}'
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
_Once the automated process completes for full game projects, you can test it instantly using the `play` command:_
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
scad-gltf play generate_godot_project.js
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
_Alternatively, to extract the final project permanently into your current directory, just run the script with Node:_
|
|
344
359
|
|
|
345
360
|
```bash
|
|
346
361
|
node generate_godot_project.js
|
|
@@ -348,6 +363,18 @@ node generate_godot_project.js
|
|
|
348
363
|
|
|
349
364
|
---
|
|
350
365
|
|
|
366
|
+
## Testing Generated Projects (`scad-gltf play`)
|
|
367
|
+
|
|
368
|
+
The `scad-gltf play` utility is designed to quickly test the single-file Node.js scripts produced by the `gen` command. Instead of cluttering your working directory, it unpacks the project into a temporary folder, automatically installs dependencies or builds the project (Godot, Rust Bevy, or Vite), and launches it. Once you close the application, the temporary folder is automatically cleaned up.
|
|
369
|
+
|
|
370
|
+
**Usage:**
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
scad-gltf play <path_to_generated_script.js>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
351
378
|
## Extended OpenSCAD Syntax
|
|
352
379
|
|
|
353
380
|
This custom fork introduces new syntax not found in standard OpenSCAD.
|
package/bin/gen.js
CHANGED
|
@@ -14,7 +14,7 @@ async function main() {
|
|
|
14
14
|
`Usage: scad-gltf gen <${VALID_TYPES.join("|")}> "<description>" [options_json]`,
|
|
15
15
|
);
|
|
16
16
|
console.error(
|
|
17
|
-
`Example: scad-gltf gen godot "A 3D physics simulation" '{"openaiModel": "gpt-4o"}'`,
|
|
17
|
+
`Example: scad-gltf gen godot "A 3D physics simulation" '{"openaiModel": "gpt-4o", "scadFiles": ["./player.scad"]}'`,
|
|
18
18
|
);
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|