Registry / serialization / panda3d-gltf

panda3d-gltf

JSON →
library1.3.0pypypi✓ verified 89d ago

`panda3d-gltf` provides utilities to load glTF (GL Transmission Format) 3D models into the Panda3D engine. It handles parsing glTF files and converting their data (meshes, materials, textures, animations, scenes) into Panda3D's native scene graph format, simplifying the process of integrating glTF assets. The current version is 1.3.0, with releases occurring as needed for fixes and feature enhancements, rather than on a fixed schedule.

pip install panda3d-gltf
INSTALL
IMPORT
SIG · PANDA3D-GLTF
P
panda3d-gltf
serializationpythonv1.3.0
Install
4.0s avg
Import
—
Disk
189MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
build_error
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 4.0s · import 0.000s · 188MB
189MB installed
● package 189MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GltfSettings
✓ from gltf import GltfSettings
✗ from panda3d_gltf import gltf_loader
load_model
✓ from gltf import load_model
✗ from panda3d_gltf import gltf_loader

This quickstart demonstrates how to initialize a basic Panda3D application and load a glTF model using `panda3d-gltf`. It sets up a camera and a dark background for visibility. Users must replace `'models/box.gltf'` with the actual path to their glTF file. It also includes basic error handling for file loading issues.

from direct.showbase.ShowBase import ShowBase from panda3d_gltf import gltf_loader class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) self.disableMouse() # Disable default camera control self.cam.setPos(0, -10, 0) self.cam.lookAt(0, 0, 0) self.setBackgroundColor(0.1, 0.1, 0.1) # --- User provided glTF model is required --- # Replace 'path/to/your_model.gltf' with an actual glTF file path. # For a runnable example, ensure this file exists or use a known sample. # Example: a simple 'box.gltf' in a 'models' directory. model_path = 'models/box.gltf' try: model = gltf_loader.load_gltf(model_path) if model: model.reparent_to(self.render) model.setPos(0, 0, 0) # Adjust position as needed model.setScale(1) # Adjust scale as needed print(f"Successfully loaded {model_path}") else: print(f"Failed to load {model_path}. Model object is None.") except Exception as e: print(f"Error loading glTF model from {model_path}: {e}") print("Please ensure the glTF file exists and is valid.") app = MyApp() app.run()
Debug
Known issues
breakingVersion 1.0.0 introduced a complete rewrite of the API. Code written for pre-1.0 versions is not compatible with 1.x and will require significant updates.
fix
Refer to the `panda3d-gltf` GitHub README for updated import paths and usage patterns for versions 1.0.0 and newer.
affects: <1.0.0
gotchaPanda3D's Virtual File System (VFS) handles asset paths, and it might not automatically resolve relative paths as expected without `addDirectory` calls or using Panda3D's `Filename` object. This can lead to `FileNotFoundError` for models or textures.
fix
Ensure that the directory containing your glTF model and its dependencies (textures, bins) is added to Panda3D's VFS using `loader.mountFileSys` or `Filename.setModuleDir(os.path.abspath(os.path.dirname(__file__)))` at the start of your application, or provide absolute paths.
affects: All versions
gotchaNot all glTF extensions are fully supported by `panda3d-gltf`. Models using advanced or custom extensions (e.g., specific PBR material extensions not common in core glTF, or complex animation nodes) may not load correctly or might lose certain features.
fix
Check the `panda3d-gltf` documentation for supported extensions. If an extension isn't supported, you may need to preprocess the glTF file to bake down unsupported features or manually implement custom loading logic.
affects: All versions
Upgrade
Version history
1.3.0latest on PyPI · released Mar 16, 2025
Audit
Dependencies
panda3drequiredCore 3D engine that this library integrates with.
pypi-gltfrequiredUsed internally for parsing glTF file structures.
Agent activity
11 hits · last 30 days
node
10
Resources
panda3d-gltf — pip install panda3d-gltf · libregistry