SHARE
TWEET

run.js

garlfin Nov 19th, 2019 (edited) 252 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var readline = require('readline');
  2. var fs = require('fs');
  3. var dir = './sc3d';
  4.  
  5. if (!fs.existsSync(dir)){
  6.     fs.mkdirSync(dir);
  7. }
  8.  
  9. var rl = readline.createInterface({
  10.   input: process.stdin,
  11.   output: process.stdout
  12. });
  13. console.log("Parser by BlaCoiso! Dumb script thing by idot garlfin.");
  14. console.log("Any errors that talk about git don't matter!");
  15. console.log("Before you comment you have an error, please check if the dae is there!");
  16.   console.log("Subscribe, like, and donate to my Patreon to support me!");
  17.   console.log("Share the video with friends, teach them how to do this too!");
  18.   console.log("As of now, you can only use _geo.scw. Don't use animation scw's!");
  19. rl.question("Enter the name of the scw (eg. sandy_geo.scw)\n", function(answer) {
  20.   // TODO: Log the answer in a database
  21.   console.log("Running as:", answer);
  22.  
  23. const SC3D = require("./SC3D");
  24. SC3D.importPath = "Change me to your sc3d path!";
  25. //Make sure to use \\ or / instead of \ in your path!
  26. const lib1 = SC3D.importLib(answer);
  27. const out = lib1.exportModel();
  28.  
  29.  
  30. var path = require('path');
  31. //Extract the filename:
  32. var withoutname = path.basename(answer,'.scw');
  33. var extension = ".dae";
  34. var filename = __dirname+"\\"+withoutname+extension;
  35.  
  36.  
  37. fs.writeFile(filename, out, (err) => {
  38.     // throws an error, you could also catch it here
  39.     if (err) throw err;
  40.  
  41.     // success case, the file was saved
  42.     console.log(answer+" saved as "+withoutname+".dae at "+__dirname+"\\");
  43. });
  44.   rl.close();
  45. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top