1 thought on “Feature Request Bulk export .js to .obj

  1. The gist would be:

    const THREE = require('three');
    const fs = require('fs');
    
    require('three/examples/js/exporters/OBJExporter');
    
    const files = [ 'file1.js', 'file2.json' ];
    
    const loader = new THREE.ObjectLoader(); // or JSONLoader, depending on the format.
    const exporter = new THREE.OBJExporter();
    
    files.forEach( ( file ) => {
    
      loader.load( file, ( result ) => {
    
        var objContent = exporter.parse( result );
        fs.writeFile( file.replace(/\.js(on)?/, '.obj'), objContent );
    
      } );
    
    });

    ^whether it’s really quite that easy to use three.js in node.js, i’m not sure… might need to hotpatch global.XMLHttpRequest or something.

Comments are closed.