fix(assimp): pass -f<format> so non-extension targets work#557
Merged
C4illin merged 3 commits intoC4illin:mainfrom Apr 22, 2026
Merged
fix(assimp): pass -f<format> so non-extension targets work#557C4illin merged 3 commits intoC4illin:mainfrom
C4illin merged 3 commits intoC4illin:mainfrom
Conversation
The assimp converter invokes `assimp export <in> <out>` and relies on
assimp's extension-based format inference to pick the output format.
That works for targets whose id happens to match a real file extension
(glb, gltf, obj, stl, ply, etc.) but silently fails for every target
whose assimp id is not a conventional filename extension:
glb2, gltf2, objnomtl, stlb, plyb, fbxa, assbin, assxml, pbrt, assjson
Picking any of those in the UI aborts the job with:
assimp export: no output format specified and I failed to guess it
assimp_cmd's `-f<h>` flag overrides extension inference, and the values
in `properties.to.object` already correspond 1:1 to assimp's format ids
(verified against `assimp listexport`). Passing `-f${convertTo}` makes
every advertised target work without changing anything else.
Reproduction: upload any .stl, convert to glb2. Before: ENOENT on the
nonexistent output file. After: valid binary glTF 2.0.
Follow-up to the previous commit. With `-f<format>` now passed to assimp, every advertised target exports successfully — but seven of them still produce files with assimp's internal format id as the extension, which no third-party viewer recognises: glb2 → .glb2 (really binary glTF 2.0, should be .glb) gltf2 → .gltf2 (text glTF 2.0, should be .gltf) objnomtl → .objnomtl (OBJ without .mtl, should be .obj) stlb → .stlb (binary STL, should be .stl) plyb → .plyb (binary PLY, should be .ply) fbxa → .fbxa (ASCII FBX, should be .fbx) assjson → .assjson (JSON dump, should be .json) Map these in `normalizeOutputFiletype`, the same helper that already handles jpeg→jpg, latex→tex, markdown→md. The format id on `convertTo` is untouched, so `assimp -f<id>` still selects the correct encoding/variant — only the output filename changes. assbin, assxml, and pbrt are both the format id and the canonical extension, so they need no mapping.
dantebarbieri
added a commit
to dantebarbieri/homeserver
that referenced
this pull request
Apr 22, 2026
Smoke test on the fork's fix/assimp-explicit-output-format branch passed (STL → glb2 produces a valid `.glb` binary glTF 2.0 file). Upstream PR filed at C4illin/ConvertX#557 — once merged, the next `:latest` pull picks up the fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
My ConvertX on my HomeServer failed to convert an STL file I found into a GLB file using the GLB2 format in
assimp.tools/assimp_cmd/Export.cpp:54 seems to indicate we need to pass
-f<h>where<h>is the format. And it can't infer since the extension for formatglb2is.glb: code/Common/Exporter.cpp:188. That's in line with the spec: https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/Specification.adocBut if you just use
glb2with-fglb2, then the output from ConvertX is a.glb2file which must be renamed, so I altered thenormalizeOutputFiletypefunction to handle these filetypes in assimp.Shows this working in my self-hosted ConvertX instance.
Summary by cubic
Pass
-f<format>toassimp exportso non-extension format IDs (e.g.,glb2,stlb) export reliably, and write real file extensions so outputs open in viewers.Bug Fixes
assimp exportwith-f${convertTo}to bypass extension inference and fix failures for non-extension targets (glb2,gltf2,objnomtl,stlb,plyb,fbxa,assjson).glb2→.glb,gltf2→.gltf,objnomtl→.obj,stlb→.stl,plyb→.ply,fbxa→.fbx,assjson→.json.Refactors
assimp.ts(no behavior changes).Written for commit f7bbe71. Summary will update on new commits.