Closed malakhovks closed 6 years ago
@malakhovks honestly, I have no idea.
@malakhovks honestly, I have no idea.
Is there any way to directly access the THREE object of the three.js library with your component to initialize that function:
var gltfExporter = new THREE.GLTFExporter();
var options = {
trs: document.getElementById( 'option_trs' ).checked,
onlyVisible: document.getElementById( 'option_visible' ).checked,
truncateDrawRange: document.getElementById( 'option_drawrange' ).checked,
binary: document.getElementById( 'option_binary' ).checked,
forceIndices: document.getElementById( 'option_forceindices' ).checked,
forcePowerOfTwoTextures: document.getElementById( 'option_forcepot' ).checked
};
gltfExporter.parse( input, function ( result ) {
if ( result instanceof ArrayBuffer ) {
saveArrayBuffer( result, 'scene.glb' );
} else {
var output = JSON.stringify( result, null, 2 );
console.log( output );
saveString( output, 'scene.gltf' );
}
}, options );
}
@malakhovks you can access the ThreeJS scene
using myGraph.scene()
. Would that suffice?
@vasturiano I implemented a graph exporter to .gltf using GLTFExporter.js from three.js examples. It would be great if you add GLTFExporter.js to your unpkg.com cdn. And here is an example graph2gltf.html you can add to your list of examples.
@malakhovks you can already get the exporter from NPM
/unpkg.com
, as part of the three
package: https://unpkg.com/three/examples/js/exporters/GLTFExporter.js
@vasturiano Thanks! 👍
Hey @malakhovks how are you? I'm facing the same problem as you trying to export the 3d model generated for the graph. Do you have the example you mentioned before anywhere? I see the dropbox link is broken. Thank you! I'll keep trying to export the object anyway (:
@rafaelbecks , Hey! You can try it: graph-exporter-to-gltf.zip
Just run server firstly server-cors-python3.py
:
$ python3 server-cors-python3.py
And then you can serve page with random generated graph and click button to export it to .gltf
:
http://127.0.0.1:8000/graph2gltf.html
@malakhovks Thanks for your response. In the end, I was able to export the graph with GLTFExporter using the code you mentioned above. Thanks for sending the code with the python server, I'll take a look to it.
Hi there @malakhovks , I am trying to get the exporter file you added to work - but when i click download it doesnt save anywhere... any advice? I am running server first, then clicking button and getting this error - Uncaught TypeError: THREE.GLTFExporter is not a constructor
Hi there @malakhovks , I am trying to get the exporter file you added to work - but when i click download it doesnt save anywhere... any advice? I am running server first, then clicking button and getting this error - Uncaught TypeError: THREE.GLTFExporter is not a constructor
Hey @peestract , there is an issue with Cross-Origin Read Blocking (CORB) - a new browser security feature. I tried to export with graph-exporter-to-gltf.zip and in developer console I firstly get:
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://unpkg.com/browse/three@0.147.0/examples/js/exporters/GLTFExporter.js with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
and then Uncaught TypeError: THREE.GLTFExporter is not a constructor
cause it is not loaded.
I will try to solve this issue
Ah I see, thanks for having a look. @rafaelbecks you were able to execute export without the need for python server?
@malakhovks I got it to work by changing the script tag to a rawcdn - thanks for your work
Hello,
is there a way to implement a graph exporter to .obj or .gltf from three.js lib?
Best regards!