https://github.com/socialtables/obj2json
Convert Wavefront .obj files to Three.js JSON format, using Blender
https://github.com/socialtables/obj2json
flock library product-3d renovation three-js
Last synced: 4 months ago
JSON representation
Convert Wavefront .obj files to Three.js JSON format, using Blender
- Host: GitHub
- URL: https://github.com/socialtables/obj2json
- Owner: socialtables
- Archived: true
- Created: 2015-09-25T19:47:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-06-29T21:15:41.000Z (almost 2 years ago)
- Last Synced: 2025-01-18T12:18:25.451Z (4 months ago)
- Topics: flock, library, product-3d, renovation, three-js
- Language: JavaScript
- Homepage:
- Size: 6.15 MB
- Stars: 7
- Watchers: 41
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# obj2json
[](https://circleci.com/gh/socialtables/obj2json)
Convert Wavefront .obj files to Three.js JSON format, using
[Blender](http://www.blender.org) and its Python API. Bundles the
[Three.js exporter](https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/)
along with a custom script to drive the import / export.Example:
```javascript
var path = require("path");
var obj2json = require("obj2json");
// NOTE: The module can detect standard install locations for Blender on Linux
// and OS X, but also accepts a `blenderPath` option to provide a non-standard path
var opts = {
inputFile: path.join(__dirname, "circle.obj"),
outputFile: path.join(__dirname, "circle2.json")
};
obj2json(opts, function(err, outputFilePath) {
if (err) {
console.error("ERROR:", err);
}
else {
console.log("Output file at:", outputFilePath);
}
});
```A promise-based interface is also available, based on Node 0.12+ native Promises:
```javascript
var path = require("path");
var obj2json = require("obj2json/as-promised");
var opts = {
inputFile: path.join(__dirname, "circle.obj"),
outputFile: path.join(__dirname, "circle2.json")
};
obj2json(opts)
.then(function(outputFilePath) {
console.log("Output file at:", outputFilePath);
})
.catch(function (err) {
console.error("ERROR:", err);
});
```