Skip to main content

A set of python libraries for reading, manipulating, and saving gltf files.

Project description

gltfutils

This package allows you to load, save and manipulate GLTF 2.0 files in Python 3.x.

Installation

gltfutils is available on pypi, allowing it to be installed by running pip install gltfutils.

Installing from source

Clone the repository, and from the repository's root directory run python setup.py install

Running the tests

Clone the repository, and from the repository's root directory run python setup.py test

Examples

Loading a gltf file

from gltfutils import GLTF2

with open(GLTF_FILENAME, 'r') as f:
	gltf = gltfutils.GLTF2.load(f)

Loading a GLB file

from gltfutils import GLB

with open(GLB_FILENAME, 'r') as f:
	gltf = gltfutils.GLB.load(f)

Accessing the Contents of a GLTF 2.0 File

Access is done through dotted notation. Assuming an existing gltf file is loaded with the name gltf:

print(gltf.asset

for node in gltf.nodes:
	print(node.mesh)

NOTE: Optional attributes are always present and in most cases default to None (in the case of indices, for example), or an empty list, when the variable is a list (i.e. a node's children).

Saving gltf JSON

Assuming an existing gltf file is loaded with the name gltf:

import json

with f as open(OUTPUT_FILENAME, 'w'):
	json.dump(f, gltfutils.to_json(gltf))

TODO

For 1.0:

  • <input type="checkbox" disabled="" /> Test coverage measurement + badge
  • <input type="checkbox" disabled="" /> CI badge
  • <input type="checkbox" disabled="" /> Buffer Loaing and Accessor implementation
  • <input type="checkbox" disabled="" /> Sparse accessors
  • <input type="checkbox" disabled="" /> Editor module

For the future:

  • <input type="checkbox" disabled="" /> Draco compression
  • <input type="checkbox" disabled="" /> Lighting extension
  • <input type="checkbox" disabled="" /> LOD Extension

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gltfutils, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size gltfutils-0.0.1-py3-none-any.whl (8.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size gltfutils-0.0.1.tar.gz (7.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page