Skip to main content

A pythonic interface for parsing gltf/glb files based on pygltflib.

Project description

Simple GLTF

Overview

Simple GLTF is a Python library that provides a user-friendly interface for parsing and accessing data within GLTF (GL Transmission Format) files. It leverages the pygltflib library to handle the low-level details of GLTF parsing, while offering a higher-level API for easy data manipulation and access.

Features

  • Pythonic Interface: Provides a clean and intuitive interface for working with GLTF data.
  • Data Access: Easily access various components of a GLTF file such as scenes, nodes, meshes, primitives, materials, etc.

Installation

You can install Simple GLTF using pip:

pip install simple-gltf

Alternatively, you can clone the repository and install it manually:

git clone https://github.com/turtleizzy/simple_gltf.git
cd simple_gltf
pip install .

Usage

Here's a basic example of how to use Simple GLTF to parse a GLTF file and access its data:

import pygltflib
from simple_gltf import RootInterface

# Load a GLTF file
gltf = pygltflib.GLTF2().load('path_to_your_file.glb')

# Create a RootInterface object
root = RootInterface(gltf)

# Access scenes
scenes = root.scenes

# Access the default scene
default_scene = root.scene

# Access nodes in the default scene
nodes = default_scene.nodes

# Access a specific node's mesh
mesh = nodes[0].mesh

# Access primitives in the mesh
primitives = mesh.primitives

# Access position data of the first primitive
positions = primitives[0].position

print(positions)

API Reference

Classes

  • RootInterface

    • scenes: List of SceneInterface objects.
    • scene: Default SceneInterface object.
  • SceneInterface

    • nodes: List of NodeInterface objects.
  • NodeInterface

    • children: List of child NodeInterface objects.
    • mesh: MeshInterface object for the attached mesh.
    • matrix: Transformation matrix of the node.
    • name: Name of the node.
  • MeshInterface

    • primitives: List of PrimitiveInterface objects.
    • name: Name of the mesh.
  • PrimitiveInterface

    • position: Numpy array of vertex positions.
    • normal: Numpy array of vertex normals.
    • tangent: Numpy array of vertex tangents.
    • color: List of numpy arrays containing vertex colors.
    • texcoords: List of numpy arrays containing texture coordinates.
    • material: Material object associated with the primitive.
    • mode: Rendering mode of the primitive.

Contributing

Contributions to Simple GLTF are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • pygltflib: A Python library for reading and writing GLTF files.
  • Khronos Group: Maintainers of the GLTF specification.

Feel free to reach out if you have any questions or need further assistance!

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

simple_gltf-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_gltf-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file simple_gltf-0.1.0.tar.gz.

File metadata

  • Download URL: simple_gltf-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.7 Linux/6.11.0-061100-generic

File hashes

Hashes for simple_gltf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2b0744634a8e886425d151cef6a3472d7008decc1cefc15963d1254a0f125f3
MD5 1b8e2217b442e71f57ac256370a7e225
BLAKE2b-256 6bc40f69a316c8692b6f9d5834f4754bf6155372a9e06dc3c70fed3a14238e70

See more details on using hashes here.

File details

Details for the file simple_gltf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: simple_gltf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.7 Linux/6.11.0-061100-generic

File hashes

Hashes for simple_gltf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0615c9c19ab762531b64a9ed394b5701ca9884c659dc3f1b32631b0d8be9f32
MD5 2edd7442b7b50cbb6ecc51876ac6dc0b
BLAKE2b-256 a0868eea801bda35eaacfb2e7226a7be3184771a06cd62e2461ec50e8306638a

See more details on using hashes here.

Supported by

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