Libex, a JSON exporter plugin for Blender ?

https://media.giphy.com/media/3p0eYCocfIix41cEuA/giphy.gif

Presentation

As part of a project for my work, I have to set up an API allowing the streaming of 3D models.
For this task the GLTF file format seemed ideal.
However, I need to load the 3D models into Unreal Engine in real time, including a morph target system.
The problem is that the only GLTF importer currently available does not meet some of my needs, and the code is quite difficult to understand without a solid knowledge of the GLTF format.

That’s why, due to lack of time, I wrote my own JSON file format.
The export is done with this Blender plugin (2.93). Afterwards I will also put the import code into Unreal on Github.

I named this plugin “Libex”, for “librairy exporter”.

Libex format

The format of the json file is for example the following:

{
        // Name of current file
	"name": "Cube", 
        // List of all included objects in file
	"childList": [ 
		{
			"name": "Cube",
			"position": [0.0000, 0.0000, 0.0000],
			"rotation": [0.0000, 0.0000, 0.0000],
			"scale": [1.0000, 1.0000, 1.0000],
			// Material is very basic for the moment because 
			// used materials are predefined in my Unreal scene
			"materialList": [
				{
					"name": "Material",
                                        // [r, g, b, a] of diffuse color 
					"diffuse": [0.8000, 0.8000, 0.8000, 1.0000]
				}
			],
			"keyList": [
				{
                                        // Name of current shape key
					"name": "Basis", 
                                        // Index of one vertex.
                                        // This vertex is used in Unreal to set the 
                                        // position of user input to modify key factor
					"anchorIndex": -1,
                                        // [x, y, z] list of vertex coordinate
					"vertexList": []
				}
			],
                        // [x, y] list of uv coordinate
			"uvList": [],
                        // [x, y, z] list of normal coordinate
			"normalList": [],
                        // ["materialIndex", "normalIndex", "v1", "uv1", "v2", "uv2", "v3", "uv3"] list,
			"faceList": []
		}
	],
        // Hierarchy of objects, each item is like [Object index, Object childs list[]]
	"hierarchy": [
		[0, []]
	]
}

Get started

To start using the template, you can download the Git repository directly and install plugin in Blender !

After that, you can see the plugin layout in N-Panel (panel open and closed with N key) at the right of 3D view.

Warning

This exporter will certainly evolve a lot in the coming weeks, as this is only the very first version !
So feel free to use and modify it, but at your own risk ❤

Contributing ?

I think it is always possible to progress in programming, so any help and advice to improve this exporter is welcome !

Issues : Found a problem when using this plugin ? Want to request a feature ? Open an issue !

License

Copyright MIT 2021 Misslin Quentin

GitHub

https://github.com/qmisslin/Libex