Skip to content

Instantly share code, notes, and snippets.

@chrislatorres
Created February 25, 2021 18:48
Show Gist options
  • Save chrislatorres/547e7873f592723418ed4fcd5ba2e460 to your computer and use it in GitHub Desktop.
Save chrislatorres/547e7873f592723418ed4fcd5ba2e460 to your computer and use it in GitHub Desktop.
javascript:(function()%7Bs%3Ddocument.createElement('script')%3B%0As.setAttribute('type'%2C 'module')%3B%0As.innerHTML %3D %60import %7BGLTFExporter%7D from 'https%3A%2F%2Frawcdn.githack.com%2Fmrdoob%2Fthree.js%2Fcf04fca253477f40e04488229cfcaf0f280e448b%2Fexamples%2Fjsm%2Fexporters%2FGLTFExporter.js'%3B%0Aif (!window.mesh.parent) %7B%0A alert('No window.mesh.parent')%3B%0A%7D else %7B%0A const exporter %3D new GLTFExporter()%3B%0A const scene %3D window.mesh.parent%3B%0A exporter.parse( scene%2C function ( gltf ) %7B%0A const blob %3D new Blob( %5B gltf %5D%2C %7B type%3A 'application%2Foctet-stream' %7D )%3B%0A const link %3D document.createElement( 'a' )%3B%0A link.style.display %3D 'none'%3B%0A document.body.appendChild( link )%3B%0A link.href %3D URL.createObjectURL( blob )%3B%0A link.download %3D 'scene.glb'%3B%0A link.click()%3B%0A %7D%2C %7B%0A binary%3A true%0A %7D )%3B%0A%7D%0A%60%3B%0Adocument.body.appendChild(s)%3B%7D)()%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment