Will exportScene() method used to Save GLB file #4010
Unanswered
bakkiyaraj-manokaran
asked this question in
Q&A
Replies: 1 comment
-
That's outside of our control - we can only return the GLB to you as a Blob. The browser's download functionality will, I believe, only put things into your downloads folder. If you send the Blob to a server running Node.js, then you can use its file system API to do what you want. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using model-viewer to show and apply a GLB file (3D file), and applying a colour to one of a GLB material, and to save the modified GLB file into the project folder, upon clicking on export button ,
Using the below code:
let options = {
binary: true,
trs: true,
onlyVisible: true,
maxTextureSize: Infinity,
forcePowerOfTwoTextures: false,
includeCustomExtensions: false,
embedImages: true,
};
const glTF = await modelViewer.exportScene(options);
,
and to save the GLB file inside the project repo or any specific path inside project folder.
Is it possible that modelViewer.exportScene(options) method will export and save the GLB file into a particular directory.
I am using react js for Front end , Here is my code:
<model-viewer
id="helmet"
// loading="eager"
camera-controls
touch-action="pan-y"
disable-tap
ar
// auto-rotate
ar-modes="webxr scene-viewer"
scale="0.001 0.001 0.001"
src={garmentDataInModelViewer?.content?.s3_path}
shadow-intensity="1"
alt="A 3D model of a shishkebab"
>
async function exportGLB() {
const modelViewer = document.getElementById("helmet");
let options = {
binary: true,
trs: true,
onlyVisible: true,
maxTextureSize: Infinity,
forcePowerOfTwoTextures: false,
includeCustomExtensions: false,
embedImages: true,
};
const glTF = await modelViewer.exportScene(options);
const file = new File([glTF], "chair.glb");
const link = document.createElement("a");
link.download = file.name;
link.href = URL.createObjectURL(file);
link.click();
}
///Export button to make a call to modelviewer.exportScene(), method
<Button
variant="contained"
sx={{ height: 35, borderRadius: 0, width: "100px", mb: 3 }}
onClick={() => exportGLB()}
// disableRipple
>
Export
I expect when clicking on export button, i want to see the GLB file stored in any specific folder with updated Changes.
Beta Was this translation helpful? Give feedback.
All reactions