You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There isn't an obvious way to import a 3D model directly from a data: URI. I tried using LoadModelFromUrlList with the data: URI, but it failed with No importable file found.
After some experimentation, I was able to create it by manually constructing a File object, although it wasn't pretty:
constdataUrl='data:model/stl;base64,...';constdataBlob=awaitfetch(dataUrl).then(res=>res.blob());constdataFile=newFile([dataBlob],'foo.stl');// must manually provide correct extensionviewer.LoadModelFromFileList([dataFile]);
Some brief digging through the code suggests that the filename's extension is used to determine whether or not a model format is supported. That approach is incompatible here because data: URIs do not have filenames.
Perhaps also of interest; URL fetch responses may offer a supported MIME type despite the URL's path having a different extension, or no extension at all. I imagine it'd be useful to support cases like that as well.
The text was updated successfully, but these errors were encountered:
There isn't an obvious way to import a 3D model directly from a
data:
URI. I tried usingLoadModelFromUrlList
with thedata:
URI, but it failed withNo importable file found
.After some experimentation, I was able to create it by manually constructing a
File
object, although it wasn't pretty:Some brief digging through the code suggests that the filename's extension is used to determine whether or not a model format is supported. That approach is incompatible here because
data:
URIs do not have filenames.Perhaps also of interest; URL fetch responses may offer a supported MIME type despite the URL's path having a different extension, or no extension at all. I imagine it'd be useful to support cases like that as well.
The text was updated successfully, but these errors were encountered: