openalea.plantconvert.gltf#
Internal functions to handle buffer on .gltf files.#
- openalea.plantconvert.gltf.buffer_tools.get_buffer(acsr: Accessor, g: GLTF2)[source]#
Get the buffer referenced by the accessor in a gltf asset.
Functions to read .gltf files.#
Functions to write .gltf files.#
- class openalea.plantconvert.gltf.writer.gltf_builder(g: MTG, features: list = None)[source]#
Bases:
objectClass used to build a gltf object from the mtg.
- The gltf object is implemented in pygltflib :
A Python library for reading, writing and handling GLTF files. link : sergkr/gltflib.
basic usage :
builder = gltf_builder(g, features = [“Length”, “Width”]) # you should initiate an instnace with your mtg g and a list of features to be written in the gltf object.
builder.build() #by calling this method, the build.gltf object will be created according to the mtg g.
#Finally, use the gltf’s method to output a gltf file Here we choose :
builder.gltf.save_json(“test.gltf”) #here we choose to output a simple json file. The meshes are written in an embedded (when we construct the gltf object). You can choose also to output in a more compact file type. Please refer to the pygltflib’s documentation
- Parameters:
g (mtg.MTG) – the mtg object
features (list or None) – a list of features to be written in the gltf object. Default is None.