npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

surfacecurve-blender

v0.2.6

Published

surfacecurve-blender is a Javascript module for parsing data from .blend Blender files

Downloads

14

Readme

surfacecurve-blender

surfacecurve-blender is a module for parsing data from .blend files saved by Blender. It makes it easier to load Blender data into the 3d model format or rendering library of your choice. The blend file format is described on the blender.org site.

The library parses the file from buffer, thus making it usable both in the browser or a NodeJS environment.

node examples/<filename>     # run an example script

node scripts/build.js        # build the distributable files and
                             # browser version of the library
node scripts/test.js         # run the unit tests
node scripts/benchmark.js    # run the benchmarks

Some of the above commands require that npm install --dev be run first.

The module is accessible in the browser via the global name surfacecurve.blender.

Usage

The parser is fairly low-level: its goal is to make traversing the Blender "SDNA" structures easier, not to convert the format to wholly new intermediate 3D format. It works by reading in the index of all types, structures, and blocks from the file and providing access methods for those blocks.

The client code still needs to direct the traversal of the blocks of interest. This is left to the client in order to (a) avoid loading what the client does not need, and (b) avoid enforcing use of some intermediate data structure for 3D points, normals, etc. that might require yet-another format conversion to get to the data format the client code needs.

The examples are the best way to understand the library:

Examples

In the module directory, run the examples:

$ node examples/example-01.js
$ node examples/example-02.js
etc.

The examples demonstrate how to extract data from the .blend file. For example, here's some of the partial output from example-01.js

Opening file:  data/unitCube-000.blend
File version:  257
Mesh at 0x2959559940 total vertices/faces/edges: 8/6/12
Object:
{ 
  ...
  mat: 4026607364,
  ...   
  totvert: 8,
  totedge: 12,
  totface: 6,
  ...
  loc: [ 5.960464477539063e-8, -1.1920928955078125e-7, 0 ],
  size: [ 1.0000004768371582, 1.0000004768371582, 1 ],
  rot: [ 0, 0, 0 ],
  texflag: 1,
  drawflag: 67,
  smoothresh: 30,
  ... }

The field names in the JSON represent the field names extracted from the Blender SDNA format. Therefore, using the format documentation you should be able to extract any and all data you need.

License

Licensed under the MIT license.

FAQ

How do I load a blender model for displaying on a web page?

I realize the convenient answer would be, "Call the function blender.renderModel('somefile.blend');" but that's not really the intent of this library...

This library provides an interface for getting data out of a .blend file in a structured manner. You'll need to use this library to traverse the blend file and build up the 3d model data structure used by the rendering library of your choice.