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:

  • Test coverage measurement + badge
  • CI badge
  • Buffer Loaing and Accessor implementation
  • Sparse accessors
  • Editor module

For the future:

  • Draco compression
  • Lighting extension
  • 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.

Source Distribution

gltfutils-0.0.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

gltfutils-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file gltfutils-0.0.1.tar.gz.

File metadata

  • Download URL: gltfutils-0.0.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for gltfutils-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bab3cd9d94df2cd7b4a5797e83fc7910a16d0da5a8657471accca62d05078e98
MD5 12abe660f70e6982d244b54428c1cbc9
BLAKE2b-256 4e8132484fd303ac93e4d60a0349c747de83ea320b9816aeda991ebe6c0310cf

See more details on using hashes here.

File details

Details for the file gltfutils-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gltfutils-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for gltfutils-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f21e49b5f05dae57eed54a70f61e72586499ba8601284a32aff2b3fc4dd4b7bc
MD5 def9d6b5f1197a2b54beea9f5e04f9d5
BLAKE2b-256 99f8a9bba19d2f553f4bd7499b8740c8af88fc0d4ef9602c6e5262c57f405101

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page