Home Projects Research Misc. Contact

Java .Blend

Demo and Examples


GPL v3


Holger Machens

This is a collection of examples to demonstrate the use of Java .Blend. The collection comprises a data model generated by Java .Blend for Blender v2.78.

Project Contents

  • gen: Generated data model to access data in Blender v2.78 files.
  • examples: Various examples and a demo application.
  • resources: Blender files and glsl shaders required by the demo application.

Data Model

The source code of the data model is located in folder gen. It was generated for Blender version 2.78 and all Blender files used in the examples are of version 2.78. Refer to Java .Blend to download or generate different versions of the data model.


Demo Application

Files: org/cakelab/blender/io/demo/*

The demo application is based on LWJGL, JOML and contains a thin object-oriented abstraction layer on top of it. The latter is not included in the source code version but in the binary version of the examples.

The source code of the demo application contains a simple and a complex demo.

  • The complex demo reads out a Blender scene with a single object. The object has a mesh with material and a texture.
  • The simple demo just visualises meshes of different Blender files without textures.

The most important part of the demo applications is found in the file examples/org/cakelab/blender/io/utils/ There you will find the source code to accesses the data in the Blender file using the generated data model.

Example: Converting .blend to JSON

File: org/cakelab/blender/io/input/

This example demonstrates how to implement a class which converts the whole Blender file into a JSON representation. The example makes use of the java reflection API to perform its task on top of the generated data model. This approach was just used to further demonstrate the use of the data model.

The conversion allows to easily visualise the content of a Blender file which helps in understanding the meaning of member variables of classes in the generated data model.

Example: Exchanging Data with Blender via Copybuffer

File: org/cakelab/blender/io/output/

Blender provides a clipboard functionality of its own kind. On CTRL+C Blender copies selected objects into a temporary .blend file which is stored in /tmp/copybuffer.blend (I guess it's %APPDATA%/.. on windows). Accordingly, on CTRL+V the content of this file is pasted in the currently selected scene.

The example code in demonstrates how to fill the copybuffer with a mesh (cube without texture or anything).

Example: Creating new Blocks

File: org/cakelab/blender/io/output/

The factory class of the generated data model (see utils package) provides several methods to create new blocks for structs, arrays and pointers. This example provides multiple examples to demonstrate the use of those methods.


This work is published under GPL v3.0.

This work includes a copy of LWJGL 3 which is licensed under "a BSD license".

This work includes a copy of JOML which is published under an "MIT license".