pygltflib


Namepygltflib JSON
Version 1.16.5 PyPI version JSON
download
home_pagehttps://gitlab.com/dodgyville/pygltflib
SummaryPython library for reading, writing and managing 3D objects in the Khronos Group gltf and gltf2 formats.
upload_time2025-07-24 06:35:38
maintainerNone
docs_urlNone
authorLuke Miller
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pygltflib

This is a library for reading, writing and handling GLTF v2 files. It works for Python3.6 and above.

It supports the entire specification, including materials and animations. Main features are:
* GLB and GLTF support
* Buffer data conversion
* Extensions
* All attributes are type-hinted

# Table of Contents

* [Quickstart](#quickstart)
  * [Install](#install)
  * [How do I...](#how-do-i)
    * [Create an empty GLTF2 object?](#create-an-empty-gltf2-object)
    * [Add a scene?](#add-a-scene)
    * [Load a file?](#load-a-file)
    * [Load a binary GLB file?](#load-a-binary-glb-file)
    * [Load a binary file with an unusual extension?](#load-a-binary-file-with-an-unusual-extension)
    * [Load a B3DM file?](#load-a-b3dm-file)
    * [Access the first node (the objects comprising the scene) of a scene?](#access-the-first-node-the-objects-comprising-the-scene-of-a-scene)
    * [Create a mesh?](#create-a-mesh)
    * [Convert buffers to GLB binary buffers?](#convert-buffers-to-glb-binary-buffers)
    * [Convert buffer to data uri (embedded) buffer?](#convert-buffer-to-data-uri-embedded-buffer)
    * [Convert buffers to binary file (external) buffers?](#convert-buffers-to-binary-file-external-buffers)
    * [Convert a glb to a gltf file?](#convert-a-glb-to-a-gltf-file)
    * [Access an extension?](#access-an-extension)
    * [Add a custom attribute to Attributes?](#add-a-custom-attribute-to-attributes)
    * [Remove a bufferView?](#remove-a-bufferview)
    * [Validate a gltf object?](#validate-a-gltf-object)
    * [Convert texture images inside a GLTF file to their own PNG files?](#convert-texture-images-inside-a-gltf-file-to-their-own-png-files)
    * [Convert texture images from a GLTF file to their own PNG files using custom file names?](#convert-texture-images-from-a-gltf-file-to-their-own-png-files-using-custom-file-names)
    * [Specify a path to my images when converting to files?](#specify-a-path-to-my-images-when-converting-to-files)
    * [Export images from the GLTF file to any location (ie outside the GLTF file)?](#export-images-from-the-GLTF-file-to-any-location-ie-outside-the-GLTF-file)
    * [Import PNG files as textures into a GLTF?](#import-png-files-as-textures-into-a-gltf)
* [About](#about)
  * [Contributors](#contributors)
  * [Thanks](#thanks)
  * [Changelog](#changelog)
  * [Installing](#installing)
  * [Source](#source)
* [More Detailed Usage](#more-detailed-usage)
  * [A simple mesh](#a-simple-mesh)
  * [Reading vertex data from a primitive and/or getting bounding sphere](#reading-vertex-data-from-a-primitive-andor-getting-bounding-sphere)
  * [Create a mesh, convert to bytes, convert back to mesh](#create-a-mesh-convert-to-bytes-convert-back-to-mesh)
  * [Loading and saving](#loading-and-saving)
  * [Converting files](#converting-files)
  * [Converting buffers](#converting-buffers)
  * [Converting texture images](#converting-texture-images)
* [Extensions](#extensions)
  * [EXT_structural_metadata](#ext_structural_metadata)
* [Running the tests](#running-the-tests)

## Quickstart

### Install

```
pip install pygltflib
```


### How do I...


#### Create an empty GLTF2 object?

```python
from pygltflib import GLTF2

gltf = GLTF2()
```

#### Add a scene?

```python
from pygltflib import GLTF2, Scene

gltf = GLTF2()
scene = Scene()
gltf.scenes.append(scene)  # scene available at gltf.scenes[0]
```

#### Load a file?

```python
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
```

#### Load a binary GLB file?

```python
glb_filename = "glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb"
glb = GLTF2().load(glb_filename)  # load method auto detects based on extension
```

#### Load a binary file with an unusual extension?

```python
glb = GLTF2().load_binary("BinaryGLTF.glk")   # load_json and load_binary helper methods
```

#### Load A B3DM file?
.B3DM files are a deprecated format used by CesiumJS. They are a wrapper around a GLTF1 file. pygltflib only supports
GLTF2 files. Please open an issue if this is important to you!

#### Access the first node (the objects comprising the scene) of a scene?

```python
gltf = GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")
current_scene = gltf.scenes[gltf.scene]
node_index = current_scene.nodes[0]  # scene.nodes is the indices, not the objects 
box = gltf.nodes[node_index]
box.matrix  # will output vertices for the box object
```


#### Create a mesh?
Consult the longer examples in the second half of this document
  * [A simple mesh](#a-simple-mesh)
  * [Reading vertex data from a primitive and/or getting bounding sphere](#reading-vertex-data-from-a-primitive-andor-getting-bounding-sphere)
  * [Create a mesh, convert to bytes, convert back to mesh](#create-a-mesh-convert-to-bytes-convert-back-to-mesh)


#### Convert buffers to glb binary buffers?

```python
from pygltflib import GLTF2, BufferFormat

gltf = GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")
gltf.convert_buffers(BufferFormat.BINARYBLOB)   # convert buffers to GLB blob
```

#### Convert buffer to data uri (embedded) buffer?
```python
gltf.convert_buffers(BufferFormat.DATAURI)  # convert buffer URIs to data.
```

#### Convert buffers to binary file (external) buffers?
```python
gltf.convert_buffers(BufferFormat.BINFILE)   # convert buffers to files
gltf.save("test.gltf")  # all the buffers are saved in 0.bin, 1.bin, 2.bin.
```


#### Convert a glb to a gltf file?
```python
from pygltflib.utils import glb2gltf, gltf2glb

# convert glb to gltf
glb2gltf("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")
```

#### Access an extension?
```python
# on a primitve
gltf.meshes[0].primitives[0].extensions['KHR_draco_mesh_compression']

# on a material
gltf.materials[0].extensions['ADOBE_materials_thin_transparency']

```

#### Add a custom attribute to Attributes?
```python
# Application-specific semantics must start with an underscore, e.g., _TEMPERATURE.
a = Attributes()
a._MYCUSTOMATTRIBUTE = 123

gltf.meshes[0].primitives[0].attributes._MYOTHERATTRIBUTE = 456
```

#### Remove a bufferView?
```python
gltf.remove_bufferView(0)  # this will update all accessors, images and sparse accessors to remove the first bufferView
```

#### Validate a gltf object?
```python
from pygltflib import GLTF2
from pygltflib.validator import validate, summary
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
validate(gltf)  # will throw an error depending on the problem
summary(gltf)  # will pretty print human readable summary of errors
# NOTE: Currently this experimental validator only validates a few rules about GLTF2 objects
```

#### Convert texture images inside a GLTF file to their own PNG files?
```python
from pygltflib import GLTF2
from pygltflib.utils import ImageFormat
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
gltf.convert_images(ImageFormat.FILE)
gltf.images[0].uri  # will now be 0.png and the texture image will be saved in 0.png
```

#### Convert texture images from a GLTF file to their own PNG files using custom file names?
```python
from pygltflib import GLTF2
from pygltflib.utils import ImageFormat
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
gltf.images[0].name = "cube.png"  # will save the data uri to this file (regardless of data format)
gltf.convert_images(ImageFormat.FILE)
gltf.images[0].uri  # will now be cube.png and the texture image will be saved in cube.png
```

#### Specify a path to my images when converting to files?
By default pygltflib will load images from the same location as the GLTF file.

It will also try and save image files to the that location when converting image buffers or data uris.

You can override the load/save location using the 'path' argument to `convert_images`
```python
from pygltflib import GLTF2
from pygltflib.utils import ImageFormat
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
gltf.images[0].name = "cube.png"  # will save the data uri to this file (regardless of data format)
gltf.convert_images(ImageFormat.FILE, path='/destination/') 
gltf.images[0].uri  # will now be cube.png and the texture image will be saved in /destination/cube.png
```


#### Export images from the GLTF file to any location (ie outside the GLTF file)?
```python
from pygltflib import GLTF2
from pygltflib.utils import ImageFormat
filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
gltf = GLTF2().load(filename)
gltf.export_image(0, "output/cube.png", override=True)  # There is now an image file at output/cube.png
```


#### Import PNG files as textures into a GLTF?
```python
from pygltflib import GLTF2
from pygltflib.utils import ImageFormat, Image
gltf = GLTF2()
image = Image()
image.uri = "myfile.png"
gltf.images.append(image)
gltf.convert_images(ImageFormat.DATAURI)
gltf.images[0].uri  # will now be something like "data:image/png;base64,iVBORw0KGg..."
gltf.images[0].name  # will be myfile.png
```


### More Detailed Usage Below

## About
This is an unofficial library that tracks the [official file format](https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md) for GLTF2. 

The library was initially built to load and save simple meshes but support for the entire spec, including materials 
and animations is pretty good. Supports both json (.gltf) and binary (.glb) file formats, although .glb support 
is missing some features at the moment. 

It requires python 3.6 and above because it uses dataclasses and all attributes are type hinted. And f-strings, plenty of f-strings.

Check the table below for an idea of which sample models validate.

Questions? Contributions? Bug reports? Open an issue on the [gitlab page for the project](https://gitlab.com/dodgyville/pygltflib).
We are very interested in hearing your use cases for `pygltflib` to help drive the roadmap.

### Contributors
* Luke Miller
* Sebastian Höffner
* Arthur van Hoff
* Arifullah Jan
* Daniel Haehn
* Jon Time
* Laurie O
* Peter Suter
* Frédéric Devernay
* Julian Stirling
* Johannes Deml
* Margarida Silva 
* Patiphan Wongklaew
* Alexander Druz
* Adriano Martins
* Dzmitry Stabrouski
* irtimir
* Florian Bruggisser
* Kevin Kreiser
* Neui
* Bernhard Rainer
* Philip Holzmann
* Gabriel Unmüßig
* Benjamin Renz
* Raphael Delhome


#### Thanks
`pygltflib` made for 'The Beat: A Glam Noir Game' supported by Film Victoria / VicScreen. 

### Changelog
* 1.16.5:
  * Material alphaCutoff attribute is now None by default (was 0.5) (Kevin Kreiser)

* 1.16.4:
  * update build and publish to include python wheel (first attempt)

* 1.16.3:
  * correctly identify URIs pointing to file paths that start with "data" (Yi Liu)
  * `load_binary` and `load_json` now set object _name and _path to align with `load` method functionality (Johannes Pieger)  

* 1.16.2:
  * add documentation about b3dm file format
  * warn user if trying to load a GLTF v1 file (or any file outside the supported range) (Raphael Delhome)
  
* 1.16.1:
  * remove buffer data when converting images (Gabriel Unmüßig)
  * make validator accept animation channel sampler = 0  (Benjamin Renz)

* 1.16.0:
  * fix compile error by removing dead extension code
  * fix type hint in GLTF2.from_json() (Philip Holzmann)
  * add support for larger alignment for BIN-Chunk (for EXT_structural_metadata) (Philip Holzmann)


* 1.15.6:
  * fix buffer.uri and .bin file name mismatch when a glb is loaded from a path that contains additional period characters (Bernhard Rainer)  

* 1.15.4:
  * fix buffer alignment by adding padding bytes in GLB export (Neui)

* 1.15.3:
  * Use sort_keys by default for deterministic output (Kevin Kreise)

* 1.15.2:
  * buffer.uri defaults to None (Kevin Kreise)

* 1.15.1:
  * Dataclasses install only required on python 3.6.x (cherry-pick from Saeid Akbari branch)
  * Removed deprecated `AlphaMode` after two years (use the `pygltflib.BLEND`, `pygltflib.MASK`, `pygltflib.OPAQUE` constants directly)
  * Removed deprecated `SparseAccessor` after two years (use `AccessorSparseIndices` and `AccessorSparseValues` instead)
  * Removed deprecated `MaterialTexture` after two years (use `TextureInfo` instead)
  * removed `deprecated` requirement from project

* 1.15.0: 
  * Significantly improved `save_to_bytes` performance (20x faster) (Florian Bruggisser)
    * NOTE: Underlying binary blob is now mutable instead of immutable. 

See [CHANGELOG.md] (https://gitlab.com/dodgyville/pygltflib/-/blob/master/CHANGELOG.md) for older versions

## Installing
```
pip install pygltflib
```
or
```
py -m pip install pygltflib
```


## Source

```
git clone https://gitlab.com/dodgyville/pygltflib
```


## More Detailed Usage
Note: These examples use the official [sample models](https://github.com/KhronosGroup/glTF-Sample-Models) provided by Khronos at:

https://github.com/KhronosGroup/glTF-Sample-Models

### A simple mesh
```python
from pygltflib import *

# create gltf objects for a scene with a primitive triangle with indexed geometry
gltf = GLTF2()
scene = Scene()
mesh = Mesh()
primitive = Primitive()
node = Node()
buffer = Buffer()
bufferView1 = BufferView()
bufferView2 = BufferView()
accessor1 = Accessor()
accessor2 = Accessor()

# add data
buffer.uri = "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA="
buffer.byteLength = 44

bufferView1.buffer = 0
bufferView1.byteOffset = 0
bufferView1.byteLength = 6
bufferView1.target = ELEMENT_ARRAY_BUFFER

bufferView2.buffer = 0
bufferView2.byteOffset = 8
bufferView2.byteLength = 36
bufferView2.target = ARRAY_BUFFER

accessor1.bufferView = 0
accessor1.byteOffset = 0
accessor1.componentType = UNSIGNED_SHORT
accessor1.count = 3
accessor1.type = SCALAR
accessor1.max = [2]
accessor1.min = [0]

accessor2.bufferView = 1
accessor2.byteOffset = 0
accessor2.componentType = FLOAT
accessor2.count = 3
accessor2.type = VEC3
accessor2.max = [1.0, 1.0, 0.0]
accessor2.min = [0.0, 0.0, 0.0]

primitive.attributes.POSITION = 1
node.mesh = 0
scene.nodes = [0]

# assemble into a gltf structure
gltf.scenes.append(scene)
gltf.meshes.append(mesh)
gltf.meshes[0].primitives.append(primitive)
gltf.nodes.append(node)
gltf.buffers.append(buffer)
gltf.bufferViews.append(bufferView1)
gltf.bufferViews.append(bufferView2)
gltf.accessors.append(accessor1)
gltf.accessors.append(accessor2)

# save to file
gltf.save("triangle.gltf")
```


### Reading vertex data from a primitive and/or getting bounding sphere
```python
import pathlib
import struct

import miniball
import numpy
from pygltflib import GLTF2

# load an example gltf file from the khronos collection
fname = pathlib.Path("glTF-Sample-Models/2.0/Box/glTF-Embedded/Box.gltf")
gltf = GLTF2().load(fname)

# get the first mesh in the current scene (in this example there is only one scene and one mesh)
mesh = gltf.meshes[gltf.scenes[gltf.scene].nodes[0]]

# get the vertices for each primitive in the mesh (in this example there is only one)
for primitive in mesh.primitives:

    # get the binary data for this mesh primitive from the buffer
    accessor = gltf.accessors[primitive.attributes.POSITION]
    bufferView = gltf.bufferViews[accessor.bufferView]
    buffer = gltf.buffers[bufferView.buffer]
    data = gltf.get_data_from_buffer_uri(buffer.uri)

    # pull each vertex from the binary buffer and convert it into a tuple of python floats
    vertices = []
    for i in range(accessor.count):
        index = bufferView.byteOffset + accessor.byteOffset + i*12  # the location in the buffer of this vertex
        d = data[index:index+12]  # the vertex data
        v = struct.unpack("<fff", d)   # convert from base64 to three floats
        vertices.append(v)
        print(i, v)

# convert a numpy array for some manipulation
S = numpy.array(vertices)

# use a third party library to perform Ritter's algorithm for finding smallest bounding sphere
C, radius_squared = miniball.get_bounding_ball(S)

# output the results
print(f"center of bounding sphere: {C}\nradius squared of bounding sphere: {radius_squared}")
```


### Create a mesh, convert to bytes, convert back to mesh
The geometry is derived from [glTF 2.0 Box Sample](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Box), but point normals were removed and points were reused where it was possible in order to reduce the size of the example. Be aware that some parts are hard-coded (types and shapes for en- and decoding of arrays, no bytes padding).
```python
import numpy as np
import pygltflib
```
Define mesh using `numpy`:
```python
points = np.array(
    [
        [-0.5, -0.5, 0.5],
        [0.5, -0.5, 0.5],
        [-0.5, 0.5, 0.5],
        [0.5, 0.5, 0.5],
        [0.5, -0.5, -0.5],
        [-0.5, -0.5, -0.5],
        [0.5, 0.5, -0.5],
        [-0.5, 0.5, -0.5],
    ],
    dtype="float32",
)
triangles = np.array(
    [
        [0, 1, 2],
        [3, 2, 1],
        [1, 0, 4],
        [5, 4, 0],
        [3, 1, 6],
        [4, 6, 1],
        [2, 3, 7],
        [6, 7, 3],
        [0, 2, 5],
        [7, 5, 2],
        [5, 7, 4],
        [6, 4, 7],
    ],
    dtype="uint8",
)
```
Create glb-style `GLTF2` with single scene, single node and single mesh from arrays of points and triangles:
```python
triangles_binary_blob = triangles.flatten().tobytes()
points_binary_blob = points.tobytes()
gltf = pygltflib.GLTF2(
    scene=0,
    scenes=[pygltflib.Scene(nodes=[0])],
    nodes=[pygltflib.Node(mesh=0)],
    meshes=[
        pygltflib.Mesh(
            primitives=[
                pygltflib.Primitive(
                    attributes=pygltflib.Attributes(POSITION=1), indices=0
                )
            ]
        )
    ],
    accessors=[
        pygltflib.Accessor(
            bufferView=0,
            componentType=pygltflib.UNSIGNED_BYTE,
            count=triangles.size,
            type=pygltflib.SCALAR,
            max=[int(triangles.max())],
            min=[int(triangles.min())],
        ),
        pygltflib.Accessor(
            bufferView=1,
            componentType=pygltflib.FLOAT,
            count=len(points),
            type=pygltflib.VEC3,
            max=points.max(axis=0).tolist(),
            min=points.min(axis=0).tolist(),
        ),
    ],
    bufferViews=[
        pygltflib.BufferView(
            buffer=0,
            byteLength=len(triangles_binary_blob),
            target=pygltflib.ELEMENT_ARRAY_BUFFER,
        ),
        pygltflib.BufferView(
            buffer=0,
            byteOffset=len(triangles_binary_blob),
            byteLength=len(points_binary_blob),
            target=pygltflib.ARRAY_BUFFER,
        ),
    ],
    buffers=[
        pygltflib.Buffer(
            byteLength=len(triangles_binary_blob) + len(points_binary_blob)
        )
    ],
)
gltf.set_binary_blob(triangles_binary_blob + points_binary_blob)
```
Write `GLTF2` to bytes:
```python
glb = b"".join(gltf.save_to_bytes())  # save_to_bytes returns an array of the components of a glb
```
Load `GLTF2` from bytes:
```python
gltf = pygltflib.GLTF2.load_from_bytes(glb)
```
Decode `numpy` arrays from `GLTF2`:
```python
binary_blob = gltf.binary_blob()

triangles_accessor = gltf.accessors[gltf.meshes[0].primitives[0].indices]
triangles_buffer_view = gltf.bufferViews[triangles_accessor.bufferView]
triangles = np.frombuffer(
    binary_blob[
        triangles_buffer_view.byteOffset
        + triangles_accessor.byteOffset : triangles_buffer_view.byteOffset
        + triangles_buffer_view.byteLength
    ],
    dtype="uint8",
    count=triangles_accessor.count,
).reshape((-1, 3))

points_accessor = gltf.accessors[gltf.meshes[0].primitives[0].attributes.POSITION]
points_buffer_view = gltf.bufferViews[points_accessor.bufferView]
points = np.frombuffer(
    binary_blob[
        points_buffer_view.byteOffset
        + points_accessor.byteOffset : points_buffer_view.byteOffset
        + points_buffer_view.byteLength
    ],
    dtype="float32",
    count=points_accessor.count * 3,
).reshape((-1, 3))
```
**P.S.**: If you'd like to use "compiled" version of mesh writing:
```python
gltf = pygltflib.GLTF2(
    scene=0,
    scenes=[pygltflib.Scene(nodes=[0])],
    nodes=[pygltflib.Node(mesh=0)],
    meshes=[
        pygltflib.Mesh(
            primitives=[
                pygltflib.Primitive(
                    attributes=pygltflib.Attributes(POSITION=1), indices=0
                )
            ]
        )
    ],
    accessors=[
        pygltflib.Accessor(
            bufferView=0,
            componentType=pygltflib.UNSIGNED_BYTE,
            count=36,
            type=pygltflib.SCALAR,
            max=[7],
            min=[0],
        ),
        pygltflib.Accessor(
            bufferView=1,
            componentType=pygltflib.FLOAT,
            count=8,
            type=pygltflib.VEC3,
            max=[0.5, 0.5, 0.5],
            min=[-0.5, -0.5, -0.5],
        ),
    ],
    bufferViews=[
        pygltflib.BufferView(
            buffer=0, byteLength=36, target=pygltflib.ELEMENT_ARRAY_BUFFER
        ),
        pygltflib.BufferView(
            buffer=0, byteOffset=36, byteLength=96, target=pygltflib.ARRAY_BUFFER
        ),
    ],
    buffers=[pygltflib.Buffer(byteLength=132)],
)
gltf.set_binary_blob(
    b"\x00\x01\x02\x03\x02\x01\x01\x00\x04\x05\x04\x00\x03\x01\x06\x04\x06\x01"
    b"\x02\x03\x07\x06\x07\x03\x00\x02\x05\x07\x05\x02\x05\x07\x04\x06\x04\x07"
    b"\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00?\x00\x00\x00"
    b"\xbf\x00\x00\x00?\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00?\x00\x00\x00?"
    b"\x00\x00\x00?\x00\x00\x00?\x00\x00\x00?\x00\x00\x00\xbf\x00\x00\x00\xbf"
    b"\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00"
    b"\x00?\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00\xbf"
)
```

### Loading and saving

`pygltflib` can load json-based .GLTF files and binary .GLB files, based on the file extension. 

#### GLTF files

```
>>> from pygltflib import GLTF2
>>> filename = "glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"
>>> gltf = GLTF2().load(filename)
>>> gltf.scene
0

>>> gltf.scenes
[Scene(name='', nodes=[0])]

>>> gltf.nodes[0]
Node(mesh=0, skin=None, rotation=[0.0, -1.0, 0.0, 0.0], translation=[], scale=[], children=[], matrix=[], camera=None, name='AnimatedCube')
>>> gltf.nodes[0].name
'AnimatedCube'

>>> gltf.meshes[0].primitives[0].attributes
Attributes(NORMAL=4, POSITION=None, TANGENT=5, TEXCOORD_0=6)

>>> filename2 = "test.gltf"
>>> gltf.save(filename2)
```

#### GLB files 

```
>>> from pygltflib import GLTF2
>>> glb_filename = "glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb"
>>> glb = GLTF2().load(glb_filename)
>>> glb.scene
0

>>> glb.scenes
[Scene(name='', nodes=[0])]

>>> glb.nodes[0]
Node(mesh=None, skin=None, rotation=[], translation=[], scale=[], children=[1], matrix=[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], camera=None, name=None)

>>> glb.meshes[0].primitives[0].attributes
Attributes(POSITION=2, NORMAL=1, TANGENT=None, TEXCOORD_0=None, TEXCOORD_1=None, COLOR_0=None, JOINTS_0=None, WEIGHTS_0=None)

>>> glb.save("test.glb")

>>> glb.binary_blob()  # read the binary blob used by the buffer in a glb
<a bunch of binary data>
```

### Converting files

#### First method

```python
from pygltflib import GLTF2

# convert glb to gltf
glb = GLTF2().load("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")
glb.save("test.gltf")

# convert gltf to glb
gltf = GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")
gltf.save("test.glb")
```

#### Second method using utils

```python
from pygltflib import GLTF2
from pygltflib.utils import glb2gltf, gltf2glb

# convert glb to gltf
glb2gltf("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")

# convert gltf to glb
gltf2glb("glTF-Sample-Models/2.0/Box/glTF/Box.gltf", "test.glb", override=True)

```

### Converting buffers 
The data for a buffer in a GLTF2 files can be stored in the buffer object's URI string 
or in a binary file pointed to by the buffer objects' URI string or as a binary blob
inside a GLB file.

While saving and loading GLTF2 files is mostly handled transparently by the library, 
there may be some situations where you want a specific type of buffer storage.

For example, if you have a GLTF file that stores all the associated data in .bin files
but you want to create a single file, you need to convert the buffers from binary files
to data uris or glb binary data.

There is a convenience method named `convert_buffers` that can help.

```python
from pygltflib import GLTF2, BufferFormat

gltf = GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")
gltf.convert_buffers(BufferFormat.DATAURI)  # convert buffer URIs to data.
gltf.save_binary("test.glb")  # try and save, will get warning.
# Will receive: Warning: Unable to save data uri to glb format.

gltf.convert_buffers(BufferFormat.BINARYBLOB)   # convert buffers to GLB blob
gltf.save_binary("test.glb")

gltf.convert_buffers(BufferFormat.BINFILE)   # convert buffers to files
gltf.save("test.gltf")  # all the buffers are saved in 0.bin, 1.bin, 2.bin.
```

### Converting texture images
The image data for textures in GLTF2 files can be stored in the image objects URI string
or in an image file pointed to by the image objects' URI string or as part of the buffer.

While saving and loading GLTF2 files is mostly handled transparently by the library,
there may be some situations where you want a specific type of image storage.

For example, if you have a GLB file that stores all its image files in .PNG files 
but you want to create a single GLTF file, you need to convert the images from files
to data uris.

Currently converting images to and from the buffer is not supported. Only image
files and data uris are supported.

There is a convenience method named `convert_images` that can help.  

```python

# embed an image file to your GLTF.

from pygltflib.utils import ImageFormat, Image
gltf = GLTF2()
image = Image()
image.uri = "myfile.png"
gltf.images.append(image)

gltf.convert_images(ImageFormat.DATAURI)  # image file will be imported into the GLTF
gltf.images[0].uri  # will now be something like "data:image/png;base64,iVBORw0KGg..."
gltf.images[0].name  # will be myfile.png

```

```python
# create an image file from GLTF data uris

from pathlib import Path
from pygltflib.utils import ImageFormat, Image
gltf = GLTF2()
image = Image()
image.uri = "data:image/png;base64,iVBORw0KGg..."
image.name = "myfile.png"  # optional file name, if not provided, the image files will be called "0.png", "1.png"
gltf.images.append(image)

gltf.convert_images(ImageFormat.FILE)  # image file will be imported into the GLTF
gltf.images[0].uri  # will be myfile.png

assert Path("myfile.png").exists() is True
```


## Extensions
The GLTF2 spec allows for extensions to added to any component of a GLTF file.

As of writing (August 2019) there are [about a dozen extensions from Khronos and other vendors](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/)

In pygltflib, extensions are loaded as ordinary `dict` objects and so should be accessed like regular key,value pairs.

For example `extensions["KHR_draco_mesh_compression"]["bufferView"]` instead of `extensions["KHR_draco_mesh_compression"].bufferView`.

This allows future extensions to be automatically supported by pygltflib.

*Extras* should work the same way.


### EXT_structural_metadata

The [EXT_structural_metadata](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata) 
is a draft (August 2023) extension 
that defines a means of storing structured metadata within a glTF 2.0 asset. 


`EXT_structural_metadata` imposes 8-byte binary data alignment requirements on an asset, 
allowing support for 64-bit data types while remaining compatible with the 4-byte alignments in the core glTF specification.

To support this meta extension, when `pygltflib` detects the presence of this extension in a GLTF2 object (for example, if
EXT_structural_metadata is in `self.extensionsUsed`, `self.extensionsRequired`, or `self.extensions`) will pad chunks using 8-bytes instead of 4.

This alignment value (4 or 8 or indeed any power-of-two value) can be set manually using the `set_min_alignment` method.


## Running the tests

### Status of gltf-validator
Using sample models loaded and then saved using this library, here are validator reports (blank is untested). 
If available, The result of a visual inspection is in brackets next to the validator result. 


#### Validator Status
| Model | gltf to gltf | gltf to glb | glb to gltf | glb to glb | 
| ------| ------- | ------- | ------- | ------ |
| 2CylinderEngine | passes | passes | passes | passes
| AlphaBlendModeTest | passes | passes | passes | passes
| AnimatedCube | passes | passes | no glb available | no glb available|
| AnimatedMorphCube | passes |  passes | passes | passes
| AnimatedMorphSphere | passes |  passes | passes | passes
| AnimatedTriangle | passes |  passes | no glb available | no glb available|
| Avocado | passes |  passes | passes | passes
| BarramundiFish | passes | passes | passes | passes
| BoomBox | passes | passes | passes | passes
| BoomBoxWithAxes | passes | passes | no glb available | no glb available|
| Box | passes | passes | passes | passes
| BoxAnimated | passes | passes | passes
| BoxInterleaved | passes | passes | | passes
| BoxTextured | passes | passes
| BoxTexturedNonPowerOfTwo | passes | passes
| BoxVertexColors | passes | passes 
| BrainStem | passes | passes | passes
| Buggy | passes | passes | passes
| Cameras | passes | passes | no glb available | no glb available|
| CesiumMan | passes | passes
| CesiumMilkTruck | passes | passes
| Corset | passes | passes | passes | passes |
| Cube | passes | passes | no glb available | no glb available|
| DamagedHelmet | passes | passes | passes | passes
| Duck | passes | passes | passes | passes
| FlightHelmet | passes | passes | no glb available | no glb available|
| GearboxAssy | passes | passes
| Lantern | passes | passes |
| MetalRoughSpheres | passes | passes | 
| Monster | passes | passes
| MultiUVTest | passes | passes
| NormalTangentMirrorTest | passes | passes | 
| NormalTangentTest | passes | passes | | passes
| OrientationTest | passes | passes |
| ReciprocatingSaw | passes | passes |
| RiggedFigure | passes |  passes |
| RiggedSimple | passes |  passes |
| SciFiHelmet | passes |  passes | no glb available | no glb available|
| SimpleMeshes | passes | passes | no glb available | no glb available|
| SimpleMorph | passes | passes | no glb available | no glb available|
| SimpleSparseAccessor | passes | passes | no glb available | no glb available 
| SpecGlossVsMetalRough | passes | passes | passes | passes
| Sponza | passes | passes | no glb available | no glb available|
| Suzanne | passes | passes | no glb available | no glb available|
| TextureCoordinateTest | passes | passes | passes | passes
| TextureSettingsTest | passes | passes | passes | passes
| TextureTransformTest | passes | passes | no glb available | no glb available| 
| Triangle | passes | passes | no glb available | no glb available|
| TriangleWithoutIndices | passes | passes | no glb available | no glb available|
| TwoSidedPlane | passes | passes | no glb available | no glb available|
| VC | passes | *fails* | passes | passes
| VertexColorTest | passes | passes | passes  | passes
| WaterBottle | passes | passes | passes | passes


### utils.validator status
What does pygltflib.utils.validator test?
NOTE: At the moment the validator raises an exception when an rule is broken. If you have ideas of the best way to 
return information on validation warnings/errors please open a ticket on our gitlab.

| Rule | validator tests | exception raised
| ------| ------- | ----- 
| accessor.componentType must be valid |  yes | InvalidAcccessorComponentTypeException
| accessor min and max arrays must be valid length | yes | InvalidArrayLengthException
| accessor min and max arrays must be same length | yes | MismatchedArrayLengthException
| mesh.primitive.mode must be valid | yes | InvalidMeshPrimitiveMode 
| accessor.sparse.indices.componentType must be valid |  yes | InvalidAccessorSparseIndicesComponentTypeException
| bufferView byteOffset and byteStrides must be valid | yes | InvalidValueError
| bufferView targets must be valid | yes | InvalidBufferViewTarget
| all other tests | no  



### unittests
```
git clone https://github.com/KhronosGroup/glTF-Sample-Models
pytest test_pygltflib.py
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/dodgyville/pygltflib",
    "name": "pygltflib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Luke Miller",
    "author_email": "dodgyville@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/22/e8/f8232abdf9c085333689b0a428dcd1d0f83edd1ecafa6ed878a633d8c9d5/pygltflib-1.16.5.tar.gz",
    "platform": null,
    "description": "# pygltflib\n\nThis is a library for reading, writing and handling GLTF v2 files. It works for Python3.6 and above.\n\nIt supports the entire specification, including materials and animations. Main features are:\n* GLB and GLTF support\n* Buffer data conversion\n* Extensions\n* All attributes are type-hinted\n\n# Table of Contents\n\n* [Quickstart](#quickstart)\n  * [Install](#install)\n  * [How do I...](#how-do-i)\n    * [Create an empty GLTF2 object?](#create-an-empty-gltf2-object)\n    * [Add a scene?](#add-a-scene)\n    * [Load a file?](#load-a-file)\n    * [Load a binary GLB file?](#load-a-binary-glb-file)\n    * [Load a binary file with an unusual extension?](#load-a-binary-file-with-an-unusual-extension)\n    * [Load a B3DM file?](#load-a-b3dm-file)\n    * [Access the first node (the objects comprising the scene) of a scene?](#access-the-first-node-the-objects-comprising-the-scene-of-a-scene)\n    * [Create a mesh?](#create-a-mesh)\n    * [Convert buffers to GLB binary buffers?](#convert-buffers-to-glb-binary-buffers)\n    * [Convert buffer to data uri (embedded) buffer?](#convert-buffer-to-data-uri-embedded-buffer)\n    * [Convert buffers to binary file (external) buffers?](#convert-buffers-to-binary-file-external-buffers)\n    * [Convert a glb to a gltf file?](#convert-a-glb-to-a-gltf-file)\n    * [Access an extension?](#access-an-extension)\n    * [Add a custom attribute to Attributes?](#add-a-custom-attribute-to-attributes)\n    * [Remove a bufferView?](#remove-a-bufferview)\n    * [Validate a gltf object?](#validate-a-gltf-object)\n    * [Convert texture images inside a GLTF file to their own PNG files?](#convert-texture-images-inside-a-gltf-file-to-their-own-png-files)\n    * [Convert texture images from a GLTF file to their own PNG files using custom file names?](#convert-texture-images-from-a-gltf-file-to-their-own-png-files-using-custom-file-names)\n    * [Specify a path to my images when converting to files?](#specify-a-path-to-my-images-when-converting-to-files)\n    * [Export images from the GLTF file to any location (ie outside the GLTF file)?](#export-images-from-the-GLTF-file-to-any-location-ie-outside-the-GLTF-file)\n    * [Import PNG files as textures into a GLTF?](#import-png-files-as-textures-into-a-gltf)\n* [About](#about)\n  * [Contributors](#contributors)\n  * [Thanks](#thanks)\n  * [Changelog](#changelog)\n  * [Installing](#installing)\n  * [Source](#source)\n* [More Detailed Usage](#more-detailed-usage)\n  * [A simple mesh](#a-simple-mesh)\n  * [Reading vertex data from a primitive and/or getting bounding sphere](#reading-vertex-data-from-a-primitive-andor-getting-bounding-sphere)\n  * [Create a mesh, convert to bytes, convert back to mesh](#create-a-mesh-convert-to-bytes-convert-back-to-mesh)\n  * [Loading and saving](#loading-and-saving)\n  * [Converting files](#converting-files)\n  * [Converting buffers](#converting-buffers)\n  * [Converting texture images](#converting-texture-images)\n* [Extensions](#extensions)\n  * [EXT_structural_metadata](#ext_structural_metadata)\n* [Running the tests](#running-the-tests)\n\n## Quickstart\n\n### Install\n\n```\npip install pygltflib\n```\n\n\n### How do I...\n\n\n#### Create an empty GLTF2 object?\n\n```python\nfrom pygltflib import GLTF2\n\ngltf = GLTF2()\n```\n\n#### Add a scene?\n\n```python\nfrom pygltflib import GLTF2, Scene\n\ngltf = GLTF2()\nscene = Scene()\ngltf.scenes.append(scene)  # scene available at gltf.scenes[0]\n```\n\n#### Load a file?\n\n```python\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\n```\n\n#### Load a binary GLB file?\n\n```python\nglb_filename = \"glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb\"\nglb = GLTF2().load(glb_filename)  # load method auto detects based on extension\n```\n\n#### Load a binary file with an unusual extension?\n\n```python\nglb = GLTF2().load_binary(\"BinaryGLTF.glk\")   # load_json and load_binary helper methods\n```\n\n#### Load A B3DM file?\n.B3DM files are a deprecated format used by CesiumJS. They are a wrapper around a GLTF1 file. pygltflib only supports\nGLTF2 files. Please open an issue if this is important to you!\n\n#### Access the first node (the objects comprising the scene) of a scene?\n\n```python\ngltf = GLTF2().load(\"glTF-Sample-Models/2.0/Box/glTF/Box.gltf\")\ncurrent_scene = gltf.scenes[gltf.scene]\nnode_index = current_scene.nodes[0]  # scene.nodes is the indices, not the objects \nbox = gltf.nodes[node_index]\nbox.matrix  # will output vertices for the box object\n```\n\n\n#### Create a mesh?\nConsult the longer examples in the second half of this document\n  * [A simple mesh](#a-simple-mesh)\n  * [Reading vertex data from a primitive and/or getting bounding sphere](#reading-vertex-data-from-a-primitive-andor-getting-bounding-sphere)\n  * [Create a mesh, convert to bytes, convert back to mesh](#create-a-mesh-convert-to-bytes-convert-back-to-mesh)\n\n\n#### Convert buffers to glb binary buffers?\n\n```python\nfrom pygltflib import GLTF2, BufferFormat\n\ngltf = GLTF2().load(\"glTF-Sample-Models/2.0/Box/glTF/Box.gltf\")\ngltf.convert_buffers(BufferFormat.BINARYBLOB)   # convert buffers to GLB blob\n```\n\n#### Convert buffer to data uri (embedded) buffer?\n```python\ngltf.convert_buffers(BufferFormat.DATAURI)  # convert buffer URIs to data.\n```\n\n#### Convert buffers to binary file (external) buffers?\n```python\ngltf.convert_buffers(BufferFormat.BINFILE)   # convert buffers to files\ngltf.save(\"test.gltf\")  # all the buffers are saved in 0.bin, 1.bin, 2.bin.\n```\n\n\n#### Convert a glb to a gltf file?\n```python\nfrom pygltflib.utils import glb2gltf, gltf2glb\n\n# convert glb to gltf\nglb2gltf(\"glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb\")\n```\n\n#### Access an extension?\n```python\n# on a primitve\ngltf.meshes[0].primitives[0].extensions['KHR_draco_mesh_compression']\n\n# on a material\ngltf.materials[0].extensions['ADOBE_materials_thin_transparency']\n\n```\n\n#### Add a custom attribute to Attributes?\n```python\n# Application-specific semantics must start with an underscore, e.g., _TEMPERATURE.\na = Attributes()\na._MYCUSTOMATTRIBUTE = 123\n\ngltf.meshes[0].primitives[0].attributes._MYOTHERATTRIBUTE = 456\n```\n\n#### Remove a bufferView?\n```python\ngltf.remove_bufferView(0)  # this will update all accessors, images and sparse accessors to remove the first bufferView\n```\n\n#### Validate a gltf object?\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.validator import validate, summary\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\nvalidate(gltf)  # will throw an error depending on the problem\nsummary(gltf)  # will pretty print human readable summary of errors\n# NOTE: Currently this experimental validator only validates a few rules about GLTF2 objects\n```\n\n#### Convert texture images inside a GLTF file to their own PNG files?\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import ImageFormat\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\ngltf.convert_images(ImageFormat.FILE)\ngltf.images[0].uri  # will now be 0.png and the texture image will be saved in 0.png\n```\n\n#### Convert texture images from a GLTF file to their own PNG files using custom file names?\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import ImageFormat\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\ngltf.images[0].name = \"cube.png\"  # will save the data uri to this file (regardless of data format)\ngltf.convert_images(ImageFormat.FILE)\ngltf.images[0].uri  # will now be cube.png and the texture image will be saved in cube.png\n```\n\n#### Specify a path to my images when converting to files?\nBy default pygltflib will load images from the same location as the GLTF file.\n\nIt will also try and save image files to the that location when converting image buffers or data uris.\n\nYou can override the load/save location using the 'path' argument to `convert_images`\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import ImageFormat\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\ngltf.images[0].name = \"cube.png\"  # will save the data uri to this file (regardless of data format)\ngltf.convert_images(ImageFormat.FILE, path='/destination/') \ngltf.images[0].uri  # will now be cube.png and the texture image will be saved in /destination/cube.png\n```\n\n\n#### Export images from the GLTF file to any location (ie outside the GLTF file)?\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import ImageFormat\nfilename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\ngltf = GLTF2().load(filename)\ngltf.export_image(0, \"output/cube.png\", override=True)  # There is now an image file at output/cube.png\n```\n\n\n#### Import PNG files as textures into a GLTF?\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import ImageFormat, Image\ngltf = GLTF2()\nimage = Image()\nimage.uri = \"myfile.png\"\ngltf.images.append(image)\ngltf.convert_images(ImageFormat.DATAURI)\ngltf.images[0].uri  # will now be something like \"data:image/png;base64,iVBORw0KGg...\"\ngltf.images[0].name  # will be myfile.png\n```\n\n\n### More Detailed Usage Below\n\n## About\nThis is an unofficial library that tracks the [official file format](https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md) for GLTF2. \n\nThe library was initially built to load and save simple meshes but support for the entire spec, including materials \nand animations is pretty good. Supports both json (.gltf) and binary (.glb) file formats, although .glb support \nis missing some features at the moment. \n\nIt requires python 3.6 and above because it uses dataclasses and all attributes are type hinted. And f-strings, plenty of f-strings.\n\nCheck the table below for an idea of which sample models validate.\n\nQuestions? Contributions? Bug reports? Open an issue on the [gitlab page for the project](https://gitlab.com/dodgyville/pygltflib).\nWe are very interested in hearing your use cases for `pygltflib` to help drive the roadmap.\n\n### Contributors\n* Luke Miller\n* Sebastian H\u00f6ffner\n* Arthur van Hoff\n* Arifullah Jan\n* Daniel Haehn\n* Jon Time\n* Laurie O\n* Peter Suter\n* Fr\u00e9d\u00e9ric Devernay\n* Julian Stirling\n* Johannes Deml\n* Margarida Silva \n* Patiphan Wongklaew\n* Alexander Druz\n* Adriano Martins\n* Dzmitry Stabrouski\n* irtimir\n* Florian Bruggisser\n* Kevin Kreiser\n* Neui\n* Bernhard Rainer\n* Philip Holzmann\n* Gabriel Unm\u00fc\u00dfig\n* Benjamin Renz\n* Raphael Delhome\n\n\n#### Thanks\n`pygltflib` made for 'The Beat: A Glam Noir Game' supported by Film Victoria / VicScreen. \n\n### Changelog\n* 1.16.5:\n  * Material alphaCutoff attribute is now None by default (was 0.5) (Kevin Kreiser)\n\n* 1.16.4:\n  * update build and publish to include python wheel (first attempt)\n\n* 1.16.3:\n  * correctly identify URIs pointing to file paths that start with \"data\" (Yi Liu)\n  * `load_binary` and `load_json` now set object _name and _path to align with `load` method functionality (Johannes Pieger)  \n\n* 1.16.2:\n  * add documentation about b3dm file format\n  * warn user if trying to load a GLTF v1 file (or any file outside the supported range) (Raphael Delhome)\n  \n* 1.16.1:\n  * remove buffer data when converting images (Gabriel Unm\u00fc\u00dfig)\n  * make validator accept animation channel sampler = 0  (Benjamin Renz)\n\n* 1.16.0:\n  * fix compile error by removing dead extension code\n  * fix type hint in GLTF2.from_json() (Philip Holzmann)\n  * add support for larger alignment for BIN-Chunk (for EXT_structural_metadata) (Philip Holzmann)\n\n\n* 1.15.6:\n  * fix buffer.uri and .bin file name mismatch when a glb is loaded from a path that contains additional period characters (Bernhard Rainer)  \n\n* 1.15.4:\n  * fix buffer alignment by adding padding bytes in GLB export (Neui)\n\n* 1.15.3:\n  * Use sort_keys by default for deterministic output (Kevin Kreise)\n\n* 1.15.2:\n  * buffer.uri defaults to None (Kevin Kreise)\n\n* 1.15.1:\n  * Dataclasses install only required on python 3.6.x (cherry-pick from Saeid Akbari branch)\n  * Removed deprecated `AlphaMode` after two years (use the `pygltflib.BLEND`, `pygltflib.MASK`, `pygltflib.OPAQUE` constants directly)\n  * Removed deprecated `SparseAccessor` after two years (use `AccessorSparseIndices` and `AccessorSparseValues` instead)\n  * Removed deprecated `MaterialTexture` after two years (use `TextureInfo` instead)\n  * removed `deprecated` requirement from project\n\n* 1.15.0: \n  * Significantly improved `save_to_bytes` performance (20x faster) (Florian Bruggisser)\n    * NOTE: Underlying binary blob is now mutable instead of immutable. \n\nSee [CHANGELOG.md] (https://gitlab.com/dodgyville/pygltflib/-/blob/master/CHANGELOG.md) for older versions\n\n## Installing\n```\npip install pygltflib\n```\nor\n```\npy -m pip install pygltflib\n```\n\n\n## Source\n\n```\ngit clone https://gitlab.com/dodgyville/pygltflib\n```\n\n\n## More Detailed Usage\nNote: These examples use the official [sample models](https://github.com/KhronosGroup/glTF-Sample-Models) provided by Khronos at:\n\nhttps://github.com/KhronosGroup/glTF-Sample-Models\n\n### A simple mesh\n```python\nfrom pygltflib import *\n\n# create gltf objects for a scene with a primitive triangle with indexed geometry\ngltf = GLTF2()\nscene = Scene()\nmesh = Mesh()\nprimitive = Primitive()\nnode = Node()\nbuffer = Buffer()\nbufferView1 = BufferView()\nbufferView2 = BufferView()\naccessor1 = Accessor()\naccessor2 = Accessor()\n\n# add data\nbuffer.uri = \"data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=\"\nbuffer.byteLength = 44\n\nbufferView1.buffer = 0\nbufferView1.byteOffset = 0\nbufferView1.byteLength = 6\nbufferView1.target = ELEMENT_ARRAY_BUFFER\n\nbufferView2.buffer = 0\nbufferView2.byteOffset = 8\nbufferView2.byteLength = 36\nbufferView2.target = ARRAY_BUFFER\n\naccessor1.bufferView = 0\naccessor1.byteOffset = 0\naccessor1.componentType = UNSIGNED_SHORT\naccessor1.count = 3\naccessor1.type = SCALAR\naccessor1.max = [2]\naccessor1.min = [0]\n\naccessor2.bufferView = 1\naccessor2.byteOffset = 0\naccessor2.componentType = FLOAT\naccessor2.count = 3\naccessor2.type = VEC3\naccessor2.max = [1.0, 1.0, 0.0]\naccessor2.min = [0.0, 0.0, 0.0]\n\nprimitive.attributes.POSITION = 1\nnode.mesh = 0\nscene.nodes = [0]\n\n# assemble into a gltf structure\ngltf.scenes.append(scene)\ngltf.meshes.append(mesh)\ngltf.meshes[0].primitives.append(primitive)\ngltf.nodes.append(node)\ngltf.buffers.append(buffer)\ngltf.bufferViews.append(bufferView1)\ngltf.bufferViews.append(bufferView2)\ngltf.accessors.append(accessor1)\ngltf.accessors.append(accessor2)\n\n# save to file\ngltf.save(\"triangle.gltf\")\n```\n\n\n### Reading vertex data from a primitive and/or getting bounding sphere\n```python\nimport pathlib\nimport struct\n\nimport miniball\nimport numpy\nfrom pygltflib import GLTF2\n\n# load an example gltf file from the khronos collection\nfname = pathlib.Path(\"glTF-Sample-Models/2.0/Box/glTF-Embedded/Box.gltf\")\ngltf = GLTF2().load(fname)\n\n# get the first mesh in the current scene (in this example there is only one scene and one mesh)\nmesh = gltf.meshes[gltf.scenes[gltf.scene].nodes[0]]\n\n# get the vertices for each primitive in the mesh (in this example there is only one)\nfor primitive in mesh.primitives:\n\n    # get the binary data for this mesh primitive from the buffer\n    accessor = gltf.accessors[primitive.attributes.POSITION]\n    bufferView = gltf.bufferViews[accessor.bufferView]\n    buffer = gltf.buffers[bufferView.buffer]\n    data = gltf.get_data_from_buffer_uri(buffer.uri)\n\n    # pull each vertex from the binary buffer and convert it into a tuple of python floats\n    vertices = []\n    for i in range(accessor.count):\n        index = bufferView.byteOffset + accessor.byteOffset + i*12  # the location in the buffer of this vertex\n        d = data[index:index+12]  # the vertex data\n        v = struct.unpack(\"<fff\", d)   # convert from base64 to three floats\n        vertices.append(v)\n        print(i, v)\n\n# convert a numpy array for some manipulation\nS = numpy.array(vertices)\n\n# use a third party library to perform Ritter's algorithm for finding smallest bounding sphere\nC, radius_squared = miniball.get_bounding_ball(S)\n\n# output the results\nprint(f\"center of bounding sphere: {C}\\nradius squared of bounding sphere: {radius_squared}\")\n```\n\n\n### Create a mesh, convert to bytes, convert back to mesh\nThe geometry is derived from [glTF 2.0 Box Sample](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Box), but point normals were removed and points were reused where it was possible in order to reduce the size of the example. Be aware that some parts are hard-coded (types and shapes for en- and decoding of arrays, no bytes padding).\n```python\nimport numpy as np\nimport pygltflib\n```\nDefine mesh using `numpy`:\n```python\npoints = np.array(\n    [\n        [-0.5, -0.5, 0.5],\n        [0.5, -0.5, 0.5],\n        [-0.5, 0.5, 0.5],\n        [0.5, 0.5, 0.5],\n        [0.5, -0.5, -0.5],\n        [-0.5, -0.5, -0.5],\n        [0.5, 0.5, -0.5],\n        [-0.5, 0.5, -0.5],\n    ],\n    dtype=\"float32\",\n)\ntriangles = np.array(\n    [\n        [0, 1, 2],\n        [3, 2, 1],\n        [1, 0, 4],\n        [5, 4, 0],\n        [3, 1, 6],\n        [4, 6, 1],\n        [2, 3, 7],\n        [6, 7, 3],\n        [0, 2, 5],\n        [7, 5, 2],\n        [5, 7, 4],\n        [6, 4, 7],\n    ],\n    dtype=\"uint8\",\n)\n```\nCreate glb-style `GLTF2` with single scene, single node and single mesh from arrays of points and triangles:\n```python\ntriangles_binary_blob = triangles.flatten().tobytes()\npoints_binary_blob = points.tobytes()\ngltf = pygltflib.GLTF2(\n    scene=0,\n    scenes=[pygltflib.Scene(nodes=[0])],\n    nodes=[pygltflib.Node(mesh=0)],\n    meshes=[\n        pygltflib.Mesh(\n            primitives=[\n                pygltflib.Primitive(\n                    attributes=pygltflib.Attributes(POSITION=1), indices=0\n                )\n            ]\n        )\n    ],\n    accessors=[\n        pygltflib.Accessor(\n            bufferView=0,\n            componentType=pygltflib.UNSIGNED_BYTE,\n            count=triangles.size,\n            type=pygltflib.SCALAR,\n            max=[int(triangles.max())],\n            min=[int(triangles.min())],\n        ),\n        pygltflib.Accessor(\n            bufferView=1,\n            componentType=pygltflib.FLOAT,\n            count=len(points),\n            type=pygltflib.VEC3,\n            max=points.max(axis=0).tolist(),\n            min=points.min(axis=0).tolist(),\n        ),\n    ],\n    bufferViews=[\n        pygltflib.BufferView(\n            buffer=0,\n            byteLength=len(triangles_binary_blob),\n            target=pygltflib.ELEMENT_ARRAY_BUFFER,\n        ),\n        pygltflib.BufferView(\n            buffer=0,\n            byteOffset=len(triangles_binary_blob),\n            byteLength=len(points_binary_blob),\n            target=pygltflib.ARRAY_BUFFER,\n        ),\n    ],\n    buffers=[\n        pygltflib.Buffer(\n            byteLength=len(triangles_binary_blob) + len(points_binary_blob)\n        )\n    ],\n)\ngltf.set_binary_blob(triangles_binary_blob + points_binary_blob)\n```\nWrite `GLTF2` to bytes:\n```python\nglb = b\"\".join(gltf.save_to_bytes())  # save_to_bytes returns an array of the components of a glb\n```\nLoad `GLTF2` from bytes:\n```python\ngltf = pygltflib.GLTF2.load_from_bytes(glb)\n```\nDecode `numpy` arrays from `GLTF2`:\n```python\nbinary_blob = gltf.binary_blob()\n\ntriangles_accessor = gltf.accessors[gltf.meshes[0].primitives[0].indices]\ntriangles_buffer_view = gltf.bufferViews[triangles_accessor.bufferView]\ntriangles = np.frombuffer(\n    binary_blob[\n        triangles_buffer_view.byteOffset\n        + triangles_accessor.byteOffset : triangles_buffer_view.byteOffset\n        + triangles_buffer_view.byteLength\n    ],\n    dtype=\"uint8\",\n    count=triangles_accessor.count,\n).reshape((-1, 3))\n\npoints_accessor = gltf.accessors[gltf.meshes[0].primitives[0].attributes.POSITION]\npoints_buffer_view = gltf.bufferViews[points_accessor.bufferView]\npoints = np.frombuffer(\n    binary_blob[\n        points_buffer_view.byteOffset\n        + points_accessor.byteOffset : points_buffer_view.byteOffset\n        + points_buffer_view.byteLength\n    ],\n    dtype=\"float32\",\n    count=points_accessor.count * 3,\n).reshape((-1, 3))\n```\n**P.S.**: If you'd like to use \"compiled\" version of mesh writing:\n```python\ngltf = pygltflib.GLTF2(\n    scene=0,\n    scenes=[pygltflib.Scene(nodes=[0])],\n    nodes=[pygltflib.Node(mesh=0)],\n    meshes=[\n        pygltflib.Mesh(\n            primitives=[\n                pygltflib.Primitive(\n                    attributes=pygltflib.Attributes(POSITION=1), indices=0\n                )\n            ]\n        )\n    ],\n    accessors=[\n        pygltflib.Accessor(\n            bufferView=0,\n            componentType=pygltflib.UNSIGNED_BYTE,\n            count=36,\n            type=pygltflib.SCALAR,\n            max=[7],\n            min=[0],\n        ),\n        pygltflib.Accessor(\n            bufferView=1,\n            componentType=pygltflib.FLOAT,\n            count=8,\n            type=pygltflib.VEC3,\n            max=[0.5, 0.5, 0.5],\n            min=[-0.5, -0.5, -0.5],\n        ),\n    ],\n    bufferViews=[\n        pygltflib.BufferView(\n            buffer=0, byteLength=36, target=pygltflib.ELEMENT_ARRAY_BUFFER\n        ),\n        pygltflib.BufferView(\n            buffer=0, byteOffset=36, byteLength=96, target=pygltflib.ARRAY_BUFFER\n        ),\n    ],\n    buffers=[pygltflib.Buffer(byteLength=132)],\n)\ngltf.set_binary_blob(\n    b\"\\x00\\x01\\x02\\x03\\x02\\x01\\x01\\x00\\x04\\x05\\x04\\x00\\x03\\x01\\x06\\x04\\x06\\x01\"\n    b\"\\x02\\x03\\x07\\x06\\x07\\x03\\x00\\x02\\x05\\x07\\x05\\x02\\x05\\x07\\x04\\x06\\x04\\x07\"\n    b\"\\x00\\x00\\x00\\xbf\\x00\\x00\\x00\\xbf\\x00\\x00\\x00?\\x00\\x00\\x00?\\x00\\x00\\x00\"\n    b\"\\xbf\\x00\\x00\\x00?\\x00\\x00\\x00\\xbf\\x00\\x00\\x00?\\x00\\x00\\x00?\\x00\\x00\\x00?\"\n    b\"\\x00\\x00\\x00?\\x00\\x00\\x00?\\x00\\x00\\x00?\\x00\\x00\\x00\\xbf\\x00\\x00\\x00\\xbf\"\n    b\"\\x00\\x00\\x00\\xbf\\x00\\x00\\x00\\xbf\\x00\\x00\\x00\\xbf\\x00\\x00\\x00?\\x00\\x00\"\n    b\"\\x00?\\x00\\x00\\x00\\xbf\\x00\\x00\\x00\\xbf\\x00\\x00\\x00?\\x00\\x00\\x00\\xbf\"\n)\n```\n\n### Loading and saving\n\n`pygltflib` can load json-based .GLTF files and binary .GLB files, based on the file extension. \n\n#### GLTF files\n\n```\n>>> from pygltflib import GLTF2\n>>> filename = \"glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf\"\n>>> gltf = GLTF2().load(filename)\n>>> gltf.scene\n0\n\n>>> gltf.scenes\n[Scene(name='', nodes=[0])]\n\n>>> gltf.nodes[0]\nNode(mesh=0, skin=None, rotation=[0.0, -1.0, 0.0, 0.0], translation=[], scale=[], children=[], matrix=[], camera=None, name='AnimatedCube')\n>>> gltf.nodes[0].name\n'AnimatedCube'\n\n>>> gltf.meshes[0].primitives[0].attributes\nAttributes(NORMAL=4, POSITION=None, TANGENT=5, TEXCOORD_0=6)\n\n>>> filename2 = \"test.gltf\"\n>>> gltf.save(filename2)\n```\n\n#### GLB files \n\n```\n>>> from pygltflib import GLTF2\n>>> glb_filename = \"glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb\"\n>>> glb = GLTF2().load(glb_filename)\n>>> glb.scene\n0\n\n>>> glb.scenes\n[Scene(name='', nodes=[0])]\n\n>>> glb.nodes[0]\nNode(mesh=None, skin=None, rotation=[], translation=[], scale=[], children=[1], matrix=[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], camera=None, name=None)\n\n>>> glb.meshes[0].primitives[0].attributes\nAttributes(POSITION=2, NORMAL=1, TANGENT=None, TEXCOORD_0=None, TEXCOORD_1=None, COLOR_0=None, JOINTS_0=None, WEIGHTS_0=None)\n\n>>> glb.save(\"test.glb\")\n\n>>> glb.binary_blob()  # read the binary blob used by the buffer in a glb\n<a bunch of binary data>\n```\n\n### Converting files\n\n#### First method\n\n```python\nfrom pygltflib import GLTF2\n\n# convert glb to gltf\nglb = GLTF2().load(\"glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb\")\nglb.save(\"test.gltf\")\n\n# convert gltf to glb\ngltf = GLTF2().load(\"glTF-Sample-Models/2.0/Box/glTF/Box.gltf\")\ngltf.save(\"test.glb\")\n```\n\n#### Second method using utils\n\n```python\nfrom pygltflib import GLTF2\nfrom pygltflib.utils import glb2gltf, gltf2glb\n\n# convert glb to gltf\nglb2gltf(\"glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb\")\n\n# convert gltf to glb\ngltf2glb(\"glTF-Sample-Models/2.0/Box/glTF/Box.gltf\", \"test.glb\", override=True)\n\n```\n\n### Converting buffers \nThe data for a buffer in a GLTF2 files can be stored in the buffer object's URI string \nor in a binary file pointed to by the buffer objects' URI string or as a binary blob\ninside a GLB file.\n\nWhile saving and loading GLTF2 files is mostly handled transparently by the library, \nthere may be some situations where you want a specific type of buffer storage.\n\nFor example, if you have a GLTF file that stores all the associated data in .bin files\nbut you want to create a single file, you need to convert the buffers from binary files\nto data uris or glb binary data.\n\nThere is a convenience method named `convert_buffers` that can help.\n\n```python\nfrom pygltflib import GLTF2, BufferFormat\n\ngltf = GLTF2().load(\"glTF-Sample-Models/2.0/Box/glTF/Box.gltf\")\ngltf.convert_buffers(BufferFormat.DATAURI)  # convert buffer URIs to data.\ngltf.save_binary(\"test.glb\")  # try and save, will get warning.\n# Will receive: Warning: Unable to save data uri to glb format.\n\ngltf.convert_buffers(BufferFormat.BINARYBLOB)   # convert buffers to GLB blob\ngltf.save_binary(\"test.glb\")\n\ngltf.convert_buffers(BufferFormat.BINFILE)   # convert buffers to files\ngltf.save(\"test.gltf\")  # all the buffers are saved in 0.bin, 1.bin, 2.bin.\n```\n\n### Converting texture images\nThe image data for textures in GLTF2 files can be stored in the image objects URI string\nor in an image file pointed to by the image objects' URI string or as part of the buffer.\n\nWhile saving and loading GLTF2 files is mostly handled transparently by the library,\nthere may be some situations where you want a specific type of image storage.\n\nFor example, if you have a GLB file that stores all its image files in .PNG files \nbut you want to create a single GLTF file, you need to convert the images from files\nto data uris.\n\nCurrently converting images to and from the buffer is not supported. Only image\nfiles and data uris are supported.\n\nThere is a convenience method named `convert_images` that can help.  \n\n```python\n\n# embed an image file to your GLTF.\n\nfrom pygltflib.utils import ImageFormat, Image\ngltf = GLTF2()\nimage = Image()\nimage.uri = \"myfile.png\"\ngltf.images.append(image)\n\ngltf.convert_images(ImageFormat.DATAURI)  # image file will be imported into the GLTF\ngltf.images[0].uri  # will now be something like \"data:image/png;base64,iVBORw0KGg...\"\ngltf.images[0].name  # will be myfile.png\n\n```\n\n```python\n# create an image file from GLTF data uris\n\nfrom pathlib import Path\nfrom pygltflib.utils import ImageFormat, Image\ngltf = GLTF2()\nimage = Image()\nimage.uri = \"data:image/png;base64,iVBORw0KGg...\"\nimage.name = \"myfile.png\"  # optional file name, if not provided, the image files will be called \"0.png\", \"1.png\"\ngltf.images.append(image)\n\ngltf.convert_images(ImageFormat.FILE)  # image file will be imported into the GLTF\ngltf.images[0].uri  # will be myfile.png\n\nassert Path(\"myfile.png\").exists() is True\n```\n\n\n## Extensions\nThe GLTF2 spec allows for extensions to added to any component of a GLTF file.\n\nAs of writing (August 2019) there are [about a dozen extensions from Khronos and other vendors](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/)\n\nIn pygltflib, extensions are loaded as ordinary `dict` objects and so should be accessed like regular key,value pairs.\n\nFor example `extensions[\"KHR_draco_mesh_compression\"][\"bufferView\"]` instead of `extensions[\"KHR_draco_mesh_compression\"].bufferView`.\n\nThis allows future extensions to be automatically supported by pygltflib.\n\n*Extras* should work the same way.\n\n\n### EXT_structural_metadata\n\nThe [EXT_structural_metadata](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata) \nis a draft (August 2023) extension \nthat defines a means of storing structured metadata within a glTF 2.0 asset. \n\n\n`EXT_structural_metadata` imposes 8-byte binary data alignment requirements on an asset, \nallowing support for 64-bit data types while remaining compatible with the 4-byte alignments in the core glTF specification.\n\nTo support this meta extension, when `pygltflib` detects the presence of this extension in a GLTF2 object (for example, if\nEXT_structural_metadata is in `self.extensionsUsed`, `self.extensionsRequired`, or `self.extensions`) will pad chunks using 8-bytes instead of 4.\n\nThis alignment value (4 or 8 or indeed any power-of-two value) can be set manually using the `set_min_alignment` method.\n\n\n## Running the tests\n\n### Status of gltf-validator\nUsing sample models loaded and then saved using this library, here are validator reports (blank is untested). \nIf available, The result of a visual inspection is in brackets next to the validator result. \n\n\n#### Validator Status\n| Model | gltf to gltf | gltf to glb | glb to gltf | glb to glb | \n| ------| ------- | ------- | ------- | ------ |\n| 2CylinderEngine | passes | passes | passes | passes\n| AlphaBlendModeTest | passes | passes | passes | passes\n| AnimatedCube | passes | passes | no glb available | no glb available|\n| AnimatedMorphCube | passes |  passes | passes | passes\n| AnimatedMorphSphere | passes |  passes | passes | passes\n| AnimatedTriangle | passes |  passes | no glb available | no glb available|\n| Avocado | passes |  passes | passes | passes\n| BarramundiFish | passes | passes | passes | passes\n| BoomBox | passes | passes | passes | passes\n| BoomBoxWithAxes | passes | passes | no glb available | no glb available|\n| Box | passes | passes | passes | passes\n| BoxAnimated | passes | passes | passes\n| BoxInterleaved | passes | passes | | passes\n| BoxTextured | passes | passes\n| BoxTexturedNonPowerOfTwo | passes | passes\n| BoxVertexColors | passes | passes \n| BrainStem | passes | passes | passes\n| Buggy | passes | passes | passes\n| Cameras | passes | passes | no glb available | no glb available|\n| CesiumMan | passes | passes\n| CesiumMilkTruck | passes | passes\n| Corset | passes | passes | passes | passes |\n| Cube | passes | passes | no glb available | no glb available|\n| DamagedHelmet | passes | passes | passes | passes\n| Duck | passes | passes | passes | passes\n| FlightHelmet | passes | passes | no glb available | no glb available|\n| GearboxAssy | passes | passes\n| Lantern | passes | passes |\n| MetalRoughSpheres | passes | passes | \n| Monster | passes | passes\n| MultiUVTest | passes | passes\n| NormalTangentMirrorTest | passes | passes | \n| NormalTangentTest | passes | passes | | passes\n| OrientationTest | passes | passes |\n| ReciprocatingSaw | passes | passes |\n| RiggedFigure | passes |  passes |\n| RiggedSimple | passes |  passes |\n| SciFiHelmet | passes |  passes | no glb available | no glb available|\n| SimpleMeshes | passes | passes | no glb available | no glb available|\n| SimpleMorph | passes | passes | no glb available | no glb available|\n| SimpleSparseAccessor | passes | passes | no glb available | no glb available \n| SpecGlossVsMetalRough | passes | passes | passes | passes\n| Sponza | passes | passes | no glb available | no glb available|\n| Suzanne | passes | passes | no glb available | no glb available|\n| TextureCoordinateTest | passes | passes | passes | passes\n| TextureSettingsTest | passes | passes | passes | passes\n| TextureTransformTest | passes | passes | no glb available | no glb available| \n| Triangle | passes | passes | no glb available | no glb available|\n| TriangleWithoutIndices | passes | passes | no glb available | no glb available|\n| TwoSidedPlane | passes | passes | no glb available | no glb available|\n| VC | passes | *fails* | passes | passes\n| VertexColorTest | passes | passes | passes  | passes\n| WaterBottle | passes | passes | passes | passes\n\n\n### utils.validator status\nWhat does pygltflib.utils.validator test?\nNOTE: At the moment the validator raises an exception when an rule is broken. If you have ideas of the best way to \nreturn information on validation warnings/errors please open a ticket on our gitlab.\n\n| Rule | validator tests | exception raised\n| ------| ------- | ----- \n| accessor.componentType must be valid |  yes | InvalidAcccessorComponentTypeException\n| accessor min and max arrays must be valid length | yes | InvalidArrayLengthException\n| accessor min and max arrays must be same length | yes | MismatchedArrayLengthException\n| mesh.primitive.mode must be valid | yes | InvalidMeshPrimitiveMode \n| accessor.sparse.indices.componentType must be valid |  yes | InvalidAccessorSparseIndicesComponentTypeException\n| bufferView byteOffset and byteStrides must be valid | yes | InvalidValueError\n| bufferView targets must be valid | yes | InvalidBufferViewTarget\n| all other tests | no  \n\n\n\n### unittests\n```\ngit clone https://github.com/KhronosGroup/glTF-Sample-Models\npytest test_pygltflib.py\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for reading, writing and managing 3D objects in the Khronos Group gltf and gltf2 formats.",
    "version": "1.16.5",
    "project_urls": {
        "Homepage": "https://gitlab.com/dodgyville/pygltflib"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91d67eb8a0e4eb30add2b76c957a41107a5f2ba26472d656e2733728bec0476b",
                "md5": "4f802712e2bccc9fbe2d057e9ebfa2a4",
                "sha256": "41d3349c59dcf1586faeaee29c967be07ac2bf7cecdb8ae2b527da1f25afdaac"
            },
            "downloads": -1,
            "filename": "pygltflib-1.16.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4f802712e2bccc9fbe2d057e9ebfa2a4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 27557,
            "upload_time": "2025-07-24T06:35:37",
            "upload_time_iso_8601": "2025-07-24T06:35:37.328233Z",
            "url": "https://files.pythonhosted.org/packages/91/d6/7eb8a0e4eb30add2b76c957a41107a5f2ba26472d656e2733728bec0476b/pygltflib-1.16.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22e8f8232abdf9c085333689b0a428dcd1d0f83edd1ecafa6ed878a633d8c9d5",
                "md5": "66e16565ebc3696bd89e44dd45cf4e8d",
                "sha256": "1f15740d5a7aaf71a5083e285af6b361184958e255659132f4ba8fe4f3d21ea9"
            },
            "downloads": -1,
            "filename": "pygltflib-1.16.5.tar.gz",
            "has_sig": false,
            "md5_digest": "66e16565ebc3696bd89e44dd45cf4e8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 43272,
            "upload_time": "2025-07-24T06:35:38",
            "upload_time_iso_8601": "2025-07-24T06:35:38.611321Z",
            "url": "https://files.pythonhosted.org/packages/22/e8/f8232abdf9c085333689b0a428dcd1d0f83edd1ecafa6ed878a633d8c9d5/pygltflib-1.16.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-24 06:35:38",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "dodgyville",
    "gitlab_project": "pygltflib",
    "lcname": "pygltflib"
}
        
Elapsed time: 1.34887s