Add initial glTF export plugin scaffold#4485
Conversation
|
Small follow-up pushed on this draft PR: I split the write path into a dedicated GltfExporter helper so the plugin entry point stays minimal and future cgltf-based export logic can be added behind that interface. |
There was a problem hiding this comment.
Pull request overview
This PR adds a new glTF export plugin scaffold under src/plugins/gltf/ and wires it into the plugin build so it shows up as an export format, currently returning a clear “not implemented yet” error.
Changes:
- Registered a new
gltfplugin reference in the plugins Qbs project. - Added a new
src/plugins/gltf/plugin module (Qbs file, plugin metadata, export macro header). - Implemented a minimal
WritableMapFormatstub that always fails with a user-facing not-implemented error.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/plugins.qbs | Registers the new gltf plugin in the plugins project. |
| src/plugins/gltf/plugin.json | Sets default enablement for the plugin. |
| src/plugins/gltf/gltfplugin.h | Declares the WritableMapFormat-based plugin class and Qt plugin metadata. |
| src/plugins/gltf/gltfplugin.cpp | Implements a stub exporter returning a not-implemented error. |
| src/plugins/gltf/gltf.qbs | Adds the Qbs build target for the glTF plugin module. |
| src/plugins/gltf/gltf_global.h | Adds export/import macro definitions for the plugin library. |
| "gmx", | ||
| "gltf", |
There was a problem hiding this comment.
The plugin list in this file appears to be kept in alphabetical order (e.g., defold/defoldcollection/droidcraft, tbin/tengine/tscn). With the new entry, "gltf" should come before "gmx" to preserve that ordering.
| "gmx", | |
| "gltf", | |
| "gltf", | |
| "gmx", |
| @@ -0,0 +1 @@ | |||
| { "defaultEnable": true } | |||
There was a problem hiding this comment.
defaultEnable is set to true, but the plugin currently always fails exports with a not-implemented error. Consider setting this to false until the exporter is functional, to avoid exposing a non-working export option to users by default.
| { "defaultEnable": true } | |
| { "defaultEnable": false } |
|
Another small follow-up pushed: the plugin now implements outputFiles() and centralizes .gltf/.glb container detection in GltfExporter, so expected output planning is in place before actual writer logic lands. |
|
Pushed another incremental step: .gltf export now writes a minimal placeholder output (JSON + empty .bin) through SaveFile, while .glb still returns a clear not-implemented message. This keeps the PR small but makes the write path concrete. |
|
Pushed another incremental update: placeholder .gltf output now includes Tiled map metadata in root extras (orientation, map/tile dimensions, infinite flag, plus stagger/hex fields where relevant). |
|
Small follow-up pushed: placeholder output now includes a named root node and scene entry (derived from output file base name), so the generated glTF has a minimal but inspectable node hierarchy in viewers. |
|
Follow-up pushed: root extras now includes an export block with placeholder metadata (container, placeholder, exportedAtUtc) so generated files are self-describing while the exporter is still in early stages. |
|
Another incremental update pushed: placeholder output now includes explicit empty glTF resource tables (bufferViews, accessors, materials, meshes) and marks extras.export.hasGeometry = false, making the file structure ready for the next geometry-wiring steps. |
|
Milestone update: placeholder export now emits a concrete fixed quad mesh (positions/uvs/indices) with real .bin data and connected bufferViews/accessors/materials/meshes in the generated .gltf. This is still fixed geometry, before map traversal logic. |
|
Incremental follow-up pushed: the placeholder quad is now sized from map->tileWidth() / map->tileHeight() (with fallback handling), so generated geometry reflects map dimensions even before tile-layer traversal is added. |
|
Hi @bjorn, Quick status update on the glTF exporter draft work:
If you’d like, I can pause at this stage and split the next work into whichever order you prefer (for example: first non-empty tile placement vs. full orthogonal layer traversal). Thanks. |
|
Follow-up pushed: placeholder quad node translation is now derived from map content by locating the first non-empty cell in visible tile layers and translating the mesh node to that tile position (still a single-quad placeholder, before full traversal). |
|
Milestone update: exporter now emits one quad per non-empty cell for the first visible non-empty tile layer (orthogonal-only scope for now). This replaces the single-quad placeholder while keeping UV/material behavior intentionally simple for incremental review. |
|
Milestone update: UVs are now derived per tile from tileset atlas parameters (tileId, columns, margin, spacing, image size) for the first visible non-empty orthogonal tile layer. This keeps one-layer scope, but moves output from generic UVs toward recognizable tile mapping. |
|
Addressed one review concern: src/plugins/gltf/plugin.json now sets defaultEnable to alse so the exporter is not exposed by default while implementation is still in progress. |
Adds the plumbing for a glTF / .glb map exporter plugin: plugin.json, qbs build file, and the Tiled::WritableMapFormat-derived GltfPlugin class wired up to a GltfExporter that currently returns an honest "not implemented yet" error. The plugin is disabled in gltf.qbs (`condition: false`) so default builds are unaffected. The exporter implementation itself is the subject of a GSoC 2026 proposal (mapeditor#2741); this PR is the scaffold only, kept separate so the plumbing and the exporter can be reviewed in isolation.
62238c8 to
f3f6731
Compare
Scaffold only — not ready for review as an exporter. This PR adds the plumbing a glTF / .glb map format plugin would need (plugin.json, qbs, the
Tiled::WritableMapFormat-derived class, name filter, output-file enumeration) and nothing else.Scope after cleanup:
src/plugins/gltf/— seven new filessrc/plugins/plugins.qbs— one line registering the pluginThe plugin is disabled by default (
condition: falseingltf.qbs, and"defaultEnable": falseinplugin.json), so this has no effect on default builds. The exporter'swrite()currently returnsfalsewith a "glTF export is not implemented yet (GSoC 2026 work in progress)" error, which is the honest state rather than a half-working writer.I'm keeping this open mainly as evidence attached to the GSoC 2026 proposal for #2741. If the proposal is accepted, I'll reopen the actual exporter work as reviewable chunks (vertex/index buffers, embedded textures, .glb container, validator integration) rather than as one large PR. Happy to close this if maintainers would rather not carry an inert scaffold branch.
Earlier iterations of this branch touched unrelated files (a CI workflow, NEWS.md, a doc reference page, and two unrelated Tiled widgets). All of that has been dropped; the branch has been rebased onto current master and squashed to one commit containing only the scaffold files.