three-stdlib icon indicating copy to clipboard operation
three-stdlib copied to clipboard

fix: GLTFExporter update

Open mysterybear opened this issue 2 years ago • 4 comments

Why

GLTFExporter stopped working

What

Copied some code across from three/jsm/examples

Checklist

  • [ ] Ready to be merged

mysterybear avatar Jul 13 '22 12:07 mysterybear

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
three-stdlib ✅ Ready (Inspect) Visit Preview Jul 22, 2022 at 0:45AM (UTC)

vercel[bot] avatar Jul 13 '22 12:07 vercel[bot]

Hi, I've written two comments: i) non-null assertion I wrote seems bad; ii) "if no context then throw error" might not be how you like to handle this. Let me know your preferred way to handle these cases and I can change the code!

Also, IIRC this is tested by running the storybook. There isn't a story for GLTFExporter yet. I just tried to start writing one, the Storybook setup isn't easy to understand though, it's not like I can just write some react. What I would think to do is to put a button or a click handler on a mesh, so you click the button or the mesh to export the GLTF. It's not immediately clear to me how to do this, if you could let me know or point me to some prior docs that would help with this then I can!

mysterybear avatar Jul 13 '22 12:07 mysterybear

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 861a62fee41f0400e9343494934bad4e3465e298:

Sandbox Source
three-stdlib-ssr Configuration

codesandbox-ci[bot] avatar Jul 22 '22 12:07 codesandbox-ci[bot]

Thanks for that @CodyJasonBennett, I tested the package that was built for CSB with yarn add https://pkg.csb.dev/pmndrs/three-stdlib/commit/861a62fe/three-stdlib. It doesn't error or make any interesting noise in the console but it doesn't export the GLTF successfully as the exporter from examples/jsm does.

This is what it's supposed to look like:

image

This is what it looks like: image

I'm pretty clueless about this code tbh, I just tried copying across stuff from the diff between when this was last updated and it doesn't seem to have worked unfortunately. Any suggestions?

mysterybear avatar Jul 25 '22 09:07 mysterybear

I just ran into the same issue. The working example linked from the three docs (https://threejs.org/examples/#misc_exporter_gltf) imports from "addons". Why not copy the code the from there?

import {GLTFExporter} from "three/addons/exporters/GLTFExporter.js";

Ctrlmonster avatar Jan 19 '23 21:01 Ctrlmonster

Continuing in #241.

CodyJasonBennett avatar May 26 '23 19:05 CodyJasonBennett