<!-- generated by scripts/buildClaudeChromeMarkdown.ts — do not edit by hand -->

# Previewer: Claude Chrome quickstart

> Inspect assets, list materials and textures, capture screenshots, frame the camera.

## Inspection primitives

These five methods cover the bulk of inspection work: list nodes, list shading data, grab a screenshot, fit the camera. Reach for `help()` for the full surface.

- `ls()` — List every node in the scene. Filter via `ls({ type: "mesh" })` for meshes only, or `{ selected: true }` for the current selection.
- `listMaterials()` — Return one slim Material descriptor per material on the loaded asset.
- `listTextures()` — Return one slim Texture descriptor per texture on the loaded asset.
- `viewport.captureScreenshot()` — Snapshot the viewport. Returns a Promise that resolves with a screenshot object containing the image Blob.
- `viewport.zoomToFit(meshIds, paddingFactor)` — Frame the camera on the given mesh ids. Pass `null` for "fit all"; padding `2.5` leaves comfortable margins.

## Top tasks

The most common Previewer workflows, each in one line. Pair any of these with `console.log(...)` to read the result back into your session.

1. **Load a file from a URL or path** — `io.openFile("/path/to/asset.glb")` — openFile accepts a string URL/path OR a File and fetches + imports it.
2. **Load an in-memory File** — `io.loadFile(file)` — Takes a browser File object only (picker / drag-drop). Does NOT accept a URL string or ArrayBuffer — use io.openFile(url) for a URL.
3. **Pick a file and import it** — `io.openFile()` — Opens a native file picker, then loads the chosen file.
4. **List every node in the scene** — `ls()` — Returns Node[]. Filter via `ls({ type: "mesh" })` for meshes only.
5. **List the loaded asset's materials** — `listMaterials()` — One descriptor per material: name, id, slim PBR fields.
6. **List the loaded asset's textures** — `listTextures()` — One descriptor per texture: name, id, mime type, slim metadata.
7. **Capture a viewport screenshot** — `viewport.captureScreenshot()` — Awaits the next frame, returns a screenshot with an image Blob.
8. **Frame the camera on everything** — `viewport.zoomToFit(null, 2.5)` — Padding factor 2.5 leaves comfortable margins. Pass an array of mesh ids to frame only those.
9. **Read the current selection** — `ls({ selected: true })` — Returns the currently-selected Node[]. Empty array when nothing is selected.
10. **Find an export method** — `io.help()` — Lists every io-namespace method with its one-line description. Pick one and call it directly.
11. **Find and run a Quick Action by name** — `actions.search("export")` — Returns ranked action descriptors. Pass the descriptor's `id` to `actions.run(id)` to invoke it.

## Report a bug

Found a defect or want a feature? Pre-fill the in-app report dialog with `await PreviewEditor.dev.dialogs.bugReport.open({ title, description })` (pass `reportType: "feature"` for a request), then the user reviews and clicks Send. Submission is always human-gated. See the report-a-bug doc for the full evidence-gathering flow.

## Deep references

- [Full API reference](/docs/scripting/api) — Every method with signature, parameters, and examples.
- [Full flat API index](/llms-full.md) — Every public scripting symbol in one scannable file — generated from the API manifest, never stale. Read once instead of re-fetching for discovery.
- [Recipe library (JSON)](/recipe-library.json) — Machine-readable corpus of curated recipes + worked examples, each tagged by intent (cad / mesh / previewer / math / io / scene). Filter by intent before authoring a multi-step build.
- [Previewer recipes](/docs/scripting/previewer) — Copy-pasteable round-trip examples.
- [Model Editor recipes](/docs/scripting/model-editor) — Copy-pasteable round-trip examples.
