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
What I'm trying to build is a .gltf exporter for a specific type of file, namely .root for the organization that I'm currently working.
You can find the repo over here 👉 link
Inside the file 👉 /LHCb_WebDisplay/src/app/gltf-exporter/gltf-exporter.component.ts
I've tried to import the GLTFExporter.js file with the following ways:
// just for GLTFExporterimport*asTHREEfrom'three'(<any>window).THREE = THREE;
import "three/examples/js/exporters/GLTFExporter";
/// on the method that I want to use it I implement the following
let options = {};
let exporter = new THREE.GLTFExporter();
exporter.parse(scene, (gltf) =>{console.log("Parsed scene!");}, options);
Error: export 'GLTFExporter' (imported as 'THREE') was not found in 'three'
Error: src/app/gltf-exporter/gltf-exporter.component.ts:106:30 - error TS2339: Property 'GLTFExporter' does not exist on type 'typeof
import("/LHCb_WebDisplay/node_modules/@types/three/index")'.
106 let exporter = new THREE.GLTFExporter();
Then I tried adding a script tag directly to the index.html file then I manually loaded the functions from the GLTFExporter.js to my component.ts based on this 👉 link
Even though with this method I didn't get compilation errors, I got runtime errors:
ERROR Error: Uncaught (in promise): ReferenceError: GLTFExporter is not defined
Then I tried the simpler way , which is similar to loading the GLTFLoader (which works by the way)
import*asTHREEfrom'three'import{GLTFExporter}from'three/examples/js/exporters/GLTFExporter'letexporter=newGLTFExporter();exporter.parse(scene,(gltf)=>{console.log("Parsed scene!");},{});/*** Which again did not work,* Even though doing the exactly same, but instead with GLTFLoader works...*/
The error: (runtime again in the console, compilation is successful)
ERROR Error: Uncaught (in promise): TypeError:
three_examples_js_exporters_GLTFExporter__WEBPACK_IMPORTED_MODULE_1__.GLTFExporter is not a constructor
Keep in mind that I also got the following in my angular.json file
inside the codebase move to: /src/app/gltf-exporter/gltf-exporter.component.ts
try any of the above mentioned ways of importing GLTFExporter.js
ctrl + shift + i 👉 check the console
Live
The repo lives live over here if that helps any further ( but it shouldn't ) 👉 link
Expected behavior
Have the GLTFExporter imported? 😥
I'm not sure if this is a bug or my idiotness ( forgive me if it's the latter ) but I would appreciate some help here!
Thank you for your valuable time.
P.S. Forgot to mention that I have succeeded into creating what I want into the following repository 👉 repo
i.e. exporting my "special" .root file that describes a 3D geometry to .gltf with the GLTFExporter.js but as it is only a standalone html file with messy script tags and code inside I would like to properly merge it and refactor the code to a proper form into my angular application.
Thank you once again.
Platform:
Device: [Desktop]
OS: [Windows, MacOS, Linux]
Browser: [Chrome, Firefox, Safari]
Three.js version: [127]
The text was updated successfully, but these errors were encountered:
Greetings,
Describing the bug
Thank you for this amazing library!
I got an angular project with the following information:
What I'm trying to build is a .gltf exporter for a specific type of file, namely .root for the organization that I'm currently working.
You can find the repo over here 👉 link
Inside the file 👉 /LHCb_WebDisplay/src/app/gltf-exporter/gltf-exporter.component.ts
I've tried to import the
GLTFExporter.js
file with the following ways:The above should work based on this 👉 link
But it's not!
The error:
script tag
directly to theindex.html
file then I manually loaded the functions from the GLTFExporter.js to my component.ts based on this 👉 linkEven though with this method I didn't get compilation errors, I got runtime errors:
GLTFLoader
(which works by the way)The error: (runtime again in the console, compilation is successful)
Keep in mind that I also got the following in my
angular.json
fileTo Reproduce
Steps to reproduce the behavior:
http://localhost:4200/
Live
The repo lives live over here if that helps any further ( but it shouldn't ) 👉 link
Expected behavior
Have the GLTFExporter imported? 😥
I'm not sure if this is a bug or my idiotness ( forgive me if it's the latter ) but I would appreciate some help here!
Thank you for your valuable time.
P.S. Forgot to mention that I have succeeded into creating what I want into the following repository 👉 repo
i.e. exporting my "special" .root file that describes a 3D geometry to .gltf with the GLTFExporter.js but as it is only a standalone
html
file with messy script tags and code inside I would like to properlymerge
it and refactor the code to a proper form into my angular application.Thank you once again.
Platform:
The text was updated successfully, but these errors were encountered: