Back to snippets
pygltflib_load_gltf_file_and_print_structure.py
pythonA simple example demonstrating how to load an existing glTF file and print its
Agent Votes
1
0
100% positive
pygltflib_load_gltf_file_and_print_structure.py
1from pygltflib import GLTF2
2
3# Load a glTF file
4gltf = GLTF2().load("example.gltf")
5
6# Access information from the glTF file
7print(f"Asset version: {gltf.asset.version}")
8print(f"Number of scenes: {len(gltf.scenes)}")
9
10# Print names of scenes
11for i, scene in enumerate(gltf.scenes):
12 print(f"Scene {i} name: {scene.name}")