Archive for novembre, 2011

novembre 15, 2011

Blender Real-time Exporter (simple version)

Sometimes, working with tools like Processing or Grasshopper I’ve felt the lack of maneuverability of blender meshes modeling. I therefore decided to develop a small script for export my mesh refreshing it in real-time. This will make it possible to read information from different software programs interactively with the ability to store files prefix.vertices and prefix.faces, containing respectively the vertices and faces of the mesh.
Is also possible to simultaneously export multiple objects with the ability to apply the modifiers before exporting. The export deals only with the mesh, so there are not applied the transformations like translation / rotation / scale of the object.

Following is a brief description of the syntax adopted for export .vertices file:

n_vertices
vertex_01_x vertex_01_y vertex_01_z
vertex_02_x vertex_02_y vertex_02_z
vertex_03_x vertex_03_y vertex_03_z
vertex_04_x vertex_04_y vertex_04_z
vertex_05_x vertex_05_y vertex_05_z
...

and .faces file:

n_faces
face_01_vertex_01_ID face_01_vertex_02_ID face_01_vertex_03_ID face_01_vertex_04_ID
face_02_vertex_01_ID face_02_vertex_02_ID face_02_vertex_03_ID face_02_vertex_04_ID
face_03_vertex_01_ID face_03_vertex_02_ID face_03_vertex_03_ID face_03_vertex_04_ID
face_04_vertex_01_ID face_04_vertex_02_ID face_04_vertex_03_ID face_04_vertex_04_ID
...

In the future, the intention would be to expand export opportunities allowing you to export files with different formats and reporting information about the vertex-colors.

Installation of Blender Real-time Exporter:
Download realtime_mesh_exporter.py and open it with blender text editor, press Alt-P for run the script and in Object Data menu it will appear the new panel: Real-time Mesh Exporter.

You can also try the exporter with my simple Processing sketch BlenderToProcessing.pde. I don’t use libraries like toxiclibs or hemesh, but only Processing function beginShape(). So with particular quad faces it gives some errors of visualization.

Happy Blending

[UPDATE]

Here is an updated versione of the script to blender 2.69:

simple_realtime_mesh_exporter_v269.py

Annunci