项目作者: socialtables

项目描述 :
Convert Wavefront .obj files to Three.js JSON format, using Blender
高级语言: JavaScript
项目地址: git://github.com/socialtables/obj2json.git
创建时间: 2015-09-25T19:47:13Z
项目社区:https://github.com/socialtables/obj2json

开源协议:

下载


obj2json

Circle CI

Convert Wavefront .obj files to Three.js JSON format, using
Blender and its Python API. Bundles the
Three.js exporter
along with a custom script to drive the import / export.

Example:

  1. var path = require("path");
  2. var obj2json = require("obj2json");
  3. // NOTE: The module can detect standard install locations for Blender on Linux
  4. // and OS X, but also accepts a `blenderPath` option to provide a non-standard path
  5. var opts = {
  6. inputFile: path.join(__dirname, "circle.obj"),
  7. outputFile: path.join(__dirname, "circle2.json")
  8. };
  9. obj2json(opts, function(err, outputFilePath) {
  10. if (err) {
  11. console.error("ERROR:", err);
  12. }
  13. else {
  14. console.log("Output file at:", outputFilePath);
  15. }
  16. });

A promise-based interface is also available, based on Node 0.12+ native Promises:

  1. var path = require("path");
  2. var obj2json = require("obj2json/as-promised");
  3. var opts = {
  4. inputFile: path.join(__dirname, "circle.obj"),
  5. outputFile: path.join(__dirname, "circle2.json")
  6. };
  7. obj2json(opts)
  8. .then(function(outputFilePath) {
  9. console.log("Output file at:", outputFilePath);
  10. })
  11. .catch(function (err) {
  12. console.error("ERROR:", err);
  13. });