Repository navigation
feat(demo): open a shared .3mf, .glb or .gltf in the viewer, then in AR (#3482) - #3510
Merged
Merged
Conversation
…AR (#3482) Reading 3MF in the SDK only pays off if a file can reach it. On Android a `.3mf` sitting in Downloads or arriving from a chat has nowhere to go: no installed app claims the type, so the chooser is empty and the format is a dead end on the very device it was generated on. The demo now declares `ACTION_VIEW` and `ACTION_SEND` filters for `.3mf`, `.glb` and `.gltf`, stages the incoming file and opens it in the model viewer under its own name; the dock's "View in AR" carries the same file into placement, sized from the bounds the viewer just measured. Android's file typing is unreliable, so the bytes decide. Measured on emulator-5554 (API 36): a `.3mf` sent through the share sheet arrives as `application/octet-stream` *and* with no queryable display name, so both metadata signals are blank and a metadata-only check refuses a file the SDK reads perfectly. `OpenedModelIntent` therefore sniffs the staged file — glTF magic, a glTF-JSON heuristic, and for a ZIP the SDK's own `ThreeMfLoader.isThreeMf`, so a `.docx` or a `.jar` is not claimed merely for opening with `PK` — and falls back to the declared name and MIME when the content says nothing. Three further things the platform forces: - The manifest needs three filter blocks, not one. A MIME-typed VIEW covers apps that know the type; a `pathPattern` block under `application/octet-stream` and `*/*` covers the ones that do not; SEND covers the share sheet. - `EXTRA_STREAM` is read from the ClipData first. A sender's `FLAG_GRANT_READ_URI_PERMISSION` only ever covers `getData()` and the ClipData, never a bare extra, so a share carrying both must be read from the clip or `openInputStream` returns null. - The typed `getParcelableExtra(name, Uri::class.java)` returns null for a `Uri` on Android 13+ (a real Uri is the hidden `Uri$HierarchicalUri` subclass), so the untyped reader stays as a documented fallback behind it. The file is copied into the app's cache rather than used in place: a `content://` grant is scoped to the launching intent and would expire across the viewer → AR navigation, and `ARPlacementDemo` places by location string. Only the current file is kept. Verified on emulator-5554: a three-colour 68-vertex rocket `.3mf` opens upright with its colours, titled `rocket.3mf`, and hands off to AR placement. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Sep 6, 2026
ThomasGorisse
added a commit
that referenced
this pull request
Sep 6, 2026
…3482) (#3514) #3510 stages an incoming file under the fixed name `opened-model`, deliberately: a display name comes from whichever app shared the file, so putting it on a path would mean sanitising untrusted text into a filesystem location, and there is never more than one opened model to hold. AR placement, though, receives only the `file://` location and derived its row label from that path's basename. So the user opened `rocket.3mf`, tapped View in AR, and was offered a model called `opened-model`. The viewer already hands placement one thing the location cannot carry — the real-world size it measured from the loaded bounds. The file's own name travels the same way now, in `DemoSettings.openedModelDisplayName`, with the basename left as the fallback. Co-authored-by: Claude Fable 5.1 <[email protected]>
ThomasGorisse
added a commit
that referenced
this pull request
Sep 6, 2026
…face (#3519) * docs(comms): say 3MF and the ChatGPT/Codex plugin on every public surface The SDK learned to read 3MF (#3483), the demo learned to receive one from the share sheet (#3510), and the repository became an OpenAI plugin (#3475). None of the surfaces a user or an AI actually reads had been told. - **Model Formats** — a new docs page states the whole matrix (glTF/GLB, USDZ, `.3mf` on Android with no new API), what the conversion does to units, axes, normals and colours, the two things the platform forces when receiving a shared file, and the formats still on the roadmap as issues rather than as promises. - **`llms.txt`** — the other half of the contract: the formats that do NOT load. A generator that is not told invents `loadStl`; it now names #3486/#3487/#3488/ #3491 instead. - **The skill** — merged with #3511's rule rather than duplicated: only the unit and axis facts, and the unsupported-format list, are new. - **The plugin** — README, CONTRIBUTING, the docs and the site now carry the two `codex plugin` commands that were actually exercised, and the manifest gains a 3MF starter prompt, a matching test case and keywords. - **Store listings** — rewritten against the shipped app. The Play copy led with a Dynamic Sky demo the Android app no longer has and never mentioned Open with; the ~50 screens now listed were resolved from `DemoRegistry`'s fragments and the iOS scene files. Three things measured while writing, and fixed: - `discord.gg/sceneview` returns `Unknown Invite` from Discord's API. It was on eight pages of the live site, including both landing-page CTAs. Replaced with the live invite the README already used. - The footer's "Twitter" link pointed at an unrelated personal account. Removed rather than guessed at — there is no SceneView account to point it to. - The MCP server ships 38 samples (`mcp/src/samples.ts`), not the 33 three surfaces claimed, and the README advertised two npm packages whose own deprecation notices call them archived scaffolding. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(changelog): name the fragment after its PR (#3519) Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3483, which taught the SDK to read 3MF. This is the half that lets a file
actually reach it.
Why
Ask ChatGPT for a 3D print from a drawing and it hands back a
.3mf. On Android that filelands in Downloads or in a chat thread and stops there: no installed app claims the type, so
the chooser is empty. The SDK reading the format changes nothing until something in the
chooser opens it.
The demo now declares
ACTION_VIEWandACTION_SENDfilters for.3mf,.glband.gltf. The file opens in the model viewer under its own name, and the dock's View in ARcarries it into placement at the size the viewer just measured.
The bytes decide, not the metadata
Measured on
emulator-5554(API 36): a.3mfsent through the share sheet arrives withapplication/octet-streamas its type and with no queryable display name at all. Bothmetadata signals blank — a name/MIME check refuses a file the SDK reads perfectly.
So
OpenedModelIntentstages the file first and sniffs it: glTF magic, a glTF-JSONheuristic, and for a ZIP the SDK's own
ThreeMfLoader.isThreeMf, so a.docxor a.jaris not claimed merely for opening with
PK. The declared name and MIME stay as the fallbackfor a file too large to sniff.
Three things the platform forces
pathPatternblock underapplication/octet-streamand*/*covers the many that do not;SEND covers the share sheet.
EXTRA_STREAM. A sender'sFLAG_GRANT_READ_URI_PERMISSIONonly evercovers
getData()and the ClipData, never a bare extra — read the extra of a share thatcarries both and
openInputStreamreturns null.getParcelableExtra(name, Uri::class.java)returns null for aUrionAndroid 13+ (a real
Uriis the hiddenUri$HierarchicalUrisubclass). Tried firstanyway, with the deprecated untyped reader documented behind it, so the day the platform
fixes it this code is already on the good path.
The incoming file is copied into the app's cache: a
content://grant is scoped to thelaunching intent and would expire across the viewer → AR navigation, and
ARPlacementDemoplaces by location string. Only the current file is kept.
Verified
ACTION_VIEWend to end onemulator-5554with a three-colour, 68-vertex, 114-trianglerocket
.3mf: it opens upright with its three colours, titledrocket.3mf, and the dock'sView in AR arms the opened file for placement.
13 Robolectric tests cover intent routing (deep links must not be treated as files), the
name/MIME rules, the content sniffing against a genuine ZIP-built 3MF, and a check that the
manifest's
pathPatternlist andSupportedExtensionscannot drift apart.Not verified: the
ACTION_SENDpath end to end —adbcannot reproduce a real sharesheet's ClipData grant, so that path is covered by unit tests and by the grant rule above,
not by a device run. The AR session itself does not start on this emulator ("could not start
an AR session"), so the handoff is verified up to the armed placement screen, not the
placement.
🤖 Generated with Claude Code