Package: pygltflib-py37
pygltflibThis is a library for reading, writing and handling GLTF files. It works for Python3.6 and above.It supports the entire specification, including materials and animations. Main features are:GLB and GLTF supportBuffer data conversionExtensionsAll attributes are type-hintedTable of ContentsQuickstartInstallHow do I...Create an empty GLTF2 object?Add a scene?Load a file?Load a binary GLB file?Load a binary file with an unusual extension?Access the first node (the objects comprising the scene) of a scene?Create a mesh?Convert buffers to GLB binary buffers?Convert buffer to data uri (embedded) buffer?Convert buffers to binary file (external) buffers?Convert a glb to a gltf file?Access an extension?Add a custom attribute to Attributes?Remove a bufferView?Validate a gltf object?Convert texture images inside a GLTF file to their own PNG files?Convert texture images from a GLTF file to their own PNG files using custom file names?Specify a path to my images when converting to files?Export images from the GLTF file to any location (ie outside the GLTF file)?Import PNG files as textures into a GLTF?AboutRoadmapContributorsThanks1ChangelogInstallingSourceMore Detailed UsageA simple meshReading vertex data from a primitive and/or getting bounding sphereCreate a mesh, convert to bytes, convert back to meshLoading and savingConverting filesConverting buffersConverting texture imagesExtensionsRunning the testsQuickstartInstallpip install pygltflibHow do I...Create an empty GLTF2 object?frompygltflibimportGLTF2gltf=GLTF2()Add a scene?frompygltflibimportGLTF2,Scenegltf=GLTF2()scene=Scene()gltf.scenes.append(scene)# scene available at gltf.scenes[0]Load a file?filename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)Load a binary GLB file?glb_filename="glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb"glb=GLTF2().load(glb_filename)# load method auto detects based on extensionLoad a binary file with an unusual extension?glb=GLTF2().load_binary("BinaryGLTF.glk")# load_json and load_binary helper methodsAccess the first node (the objects comprising the scene) of a scene?gltf=GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")current_scene=gltf.scenes[gltf.scene]node_index=current_scene.nodes[0]# scene.nodes is the indices, not the objectsbox=gltf.nodes[node_index]box.matrix# will output vertices for the box objectCreate a mesh?Consult the longer examples in the second half of this documentA simple meshReading vertex data from a primitive and/or getting bounding sphereCreate a mesh, convert to bytes, convert back to meshConvert buffers to glb binary buffers?frompygltflibimportGLTF2,BufferFormatgltf=GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")gltf.convert_buffers(BufferFormat.BINARYBLOB)# convert buffers to GLB blobConvert buffer to data uri (embedded) buffer?gltf.convert_buffers(BufferFormat.DATAURI)# convert buffer URIs to data.Convert buffers to binary file (external) buffers?gltf.convert_buffers(BufferFormat.BINFILE)# convert buffers to filesgltf.save("test.gltf")# all the buffers are saved in 0.bin, 1.bin, 2.bin.Convert a glb to a gltf file?frompygltflib.utilsimportglb2gltf,gltf2glb# convert glb to gltfglb2gltf("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")Access an extension?# on a primitvegltf.meshes[0].primitives[0].extensions['KHR_draco_mesh_compression']# on a materialgltf.materials[0].extensions['ADOBE_materials_thin_transparency']Add a custom attribute to Attributes?# Application-specific semantics must start with an underscore, e.g., _TEMPERATURE.a=Attributes()a._MYCUSTOMATTRIBUTE=123gltf.meshes[0].primitives[0].attributes._MYOTHERATTRIBUTE=456Remove a bufferView?gltf.remove_bufferView(0)# this will update all accessors, images and sparse accessors to remove the first bufferViewValidate a gltf object?frompygltflibimportGLTF2frompygltflib.validatorimportvalidate,summaryfilename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)validate(gltf)# will throw an error depending on the problemsummary(gltf)# will pretty print human readable summary of errors# NOTE: Currently this experimental validator only validates a few rules about GLTF2 objectsConvert texture images inside a GLTF file to their own PNG files?frompygltflibimportGLTF2frompygltflib.utilsimportImageFormatfilename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)gltf.convert_images(ImageFormat.FILE)gltf.images[0].uri# will now be 0.png and the texture image will be saved in 0.pngConvert texture images from a GLTF file to their own PNG files using custom file names?frompygltflibimportGLTF2frompygltflib.utilsimportImageFormatfilename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)gltf.images[0].name="cube.png"# will save the data uri to this file (regardless of data format)gltf.convert_images(ImageFormat.FILE)gltf.images[0].uri# will now be cube.png and the texture image will be saved in cube.pngSpecify a path to my images when converting to files?By default pygltflib will load images from the same location as the GLTF file.It will also try and save image files to the that location when converting image buffers or data uris.You can override the load/save location using the 'path' argument toconvert_imagesfrompygltflibimportGLTF2frompygltflib.utilsimportImageFormatfilename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)gltf.images[0].name="cube.png"# will save the data uri to this file (regardless of data format)gltf.convert_images(ImageFormat.FILE,path='/destination/')gltf.images[0].uri# will now be cube.png and the texture image will be saved in /destination/cube.pngExport images from the GLTF file to any location (ie outside the GLTF file)?frompygltflibimportGLTF2frompygltflib.utilsimportImageFormatfilename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf"gltf=GLTF2().load(filename)gltf.export_image(0,"output/cube.png",override=True)# There is now an image file at output/cube.pngImport PNG files as textures into a GLTF?frompygltflibimportGLTF2frompygltflib.utilsimportImageFormat,Imagegltf=GLTF2()image=Image()image.uri="myfile.png"gltf.images.append(image)gltf.convert_images(ImageFormat.DATAURI)gltf.images[0].uri# will now be something like "data:image/png;base64,iVBORw0KGg..."gltf.images[0].name# will be myfile.pngMore Detailed Usage BelowAboutThis is an unofficial library that tracks theofficial file formatfor GLTF2.The library was initially built to load and save simple meshes but support for the entire spec, including materials
and animations is pretty good. Supports both json (.gltf) and binary (.glb) file formats, although .glb support
is missing some features at the moment.It requires python 3.6 and above because it uses dataclasses and all attributes are type hinted. And f-strings, plenty of f-strings.Check the table below for an idea of which sample models validate.Questions? Contributions? Bug reports? Open an issue on thegitlab page for the project.
We are very interested in hearing your use cases forpygltflibto help drive the roadmap.RoadmapAdd helper functions for creating meshesTest coverageEnforce single underscore on custom Attribute attributesInvestigate creating classes from extensionsAutomated validation and visual inspectionContributorsLuke MillerSebastian HöffnerArthur van HoffArifullah JanDaniel HaehnJon TimeLaurie OPeter SuterFrédéric DevernayJulian StirlingJohannes DemlMargarida SilvaPatiphan WongklaewAlexander DruzAdriano MartinsDzmitry StabrouskiirtimirThankspyltflibmade for 'The Beat: A Glam Noir Game' supported by Film Victoria.Changelog1.14.7addGLTF.get_data_from_buffer_urihelper method to simplify access to buffer data (see bounding box example in README.md) (el_flamenco)1.14.6use compact json when saving binary glb files (Laubeee)1.14.5unquote filepath in compliance with standard (irtimir)1.14.4AddGLTF.export_imagemethod to export images from an GLTF2 file to any location (Khac Hoa Le)remove extraneous print message when loading extensions (Michael Daw)See [CHANGELOG.md] (https://gitlab.com/dodgyville/pygltflib/-/blob/master/CHANGELOG.md) for older versionsInstallingpip install pygltfliborpy -m pip install pygltflibSourcegit clone https://gitlab.com/dodgyville/pygltflibMore Detailed UsageNote: These examples use the officialsample modelsprovided by Khronos at:https://github.com/KhronosGroup/glTF-Sample-ModelsA simple meshfrompygltflibimport*# create gltf objects for a scene with a primitive triangle with indexed geometrygltf=GLTF2()scene=Scene()mesh=Mesh()primitive=Primitive()node=Node()buffer=Buffer()bufferView1=BufferView()bufferView2=BufferView()accessor1=Accessor()accessor2=Accessor()# add databuffer.uri="data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA="buffer.byteLength=44bufferView1.buffer=0bufferView1.byteOffset=0bufferView1.byteLength=6bufferView1.target=ELEMENT_ARRAY_BUFFERbufferView2.buffer=0bufferView2.byteOffset=8bufferView2.byteLength=36bufferView2.target=ARRAY_BUFFERaccessor1.bufferView=0accessor1.byteOffset=0accessor1.componentType=UNSIGNED_SHORTaccessor1.count=3accessor1.type=SCALARaccessor1.max=[2]accessor1.min=[0]accessor2.bufferView=1accessor2.byteOffset=0accessor2.componentType=FLOATaccessor2.count=3accessor2.type=VEC3accessor2.max=[1.0,1.0,0.0]accessor2.min=[0.0,0.0,0.0]primitive.attributes.POSITION=1node.mesh=0scene.nodes=[0]# assemble into a gltf structuregltf.scenes.append(scene)gltf.meshes.append(mesh)gltf.meshes[0].primitives.append(primitive)gltf.nodes.append(node)gltf.buffers.append(buffer)gltf.bufferViews.append(bufferView1)gltf.bufferViews.append(bufferView2)gltf.accessors.append(accessor1)gltf.accessors.append(accessor2)# save to filegltf.save("triangle.gltf")Reading vertex data from a primitive and/or getting bounding sphereimportpathlibimportstructimportminiballimportnumpyfrompygltflibimportGLTF2# load an example gltf file from the khronos collectionfname=pathlib.Path("glTF-Sample-Models/2.0/Box/glTF-Embedded/Box.gltf")gltf=GLTF2().load(fname)# get the first mesh in the current scene (in this example there is only one scene and one mesh)mesh=gltf.meshes[gltf.scenes[gltf.scene].nodes[0]]# get the vertices for each primitive in the mesh (in this example there is only one)forprimitiveinmesh.primitives:# get the binary data for this mesh primitive from the bufferaccessor=gltf.accessors[primitive.attributes.POSITION]bufferView=gltf.bufferViews[accessor.bufferView]buffer=gltf.buffers[bufferView.buffer]data=gltf.get_data_from_buffer_uri(buffer.uri)# pull each vertex from the binary buffer and convert it into a tuple of python floatsvertices=[]foriinrange(accessor.count):index=bufferView.byteOffset+accessor.byteOffset+i*12# the location in the buffer of this vertexd=data[index:index+12]# the vertex datav=struct.unpack("<fff",d)# convert from base64 to three floatsvertices.append(v)print(i,v)# convert a numpy array for some manipulationS=numpy.array(vertices)# use a third party library to perform Ritter's algorithm for finding smallest bounding sphereC,radius_squared=miniball.get_bounding_ball(S)# output the resultsprint(f"center of bounding sphere:{C}\nradius squared of bounding sphere:{radius_squared}")Create a mesh, convert to bytes, convert back to meshThe geometry is derived fromglTF 2.0 Box Sample, but point normals were removed and points were reused where it was possible in order to reduce the size of the example. Be aware that some parts are hard-coded (types and shapes for en- and decoding of arrays, no bytes padding).importnumpyasnpimportpygltflibDefine mesh usingnumpy:points=np.array([[-0.5,-0.5,0.5],[0.5,-0.5,0.5],[-0.5,0.5,0.5],[0.5,0.5,0.5],[0.5,-0.5,-0.5],[-0.5,-0.5,-0.5],[0.5,0.5,-0.5],[-0.5,0.5,-0.5],],dtype="float32",)triangles=np.array([[0,1,2],[3,2,1],[1,0,4],[5,4,0],[3,1,6],[4,6,1],[2,3,7],[6,7,3],[0,2,5],[7,5,2],[5,7,4],[6,4,7],],dtype="uint8",)Create glb-styleGLTF2with single scene, single node and single mesh from arrays of points and triangles:triangles_binary_blob=triangles.flatten().tobytes()points_binary_blob=points.tobytes()gltf=pygltflib.GLTF2(scene=0,scenes=[pygltflib.Scene(nodes=[0])],nodes=[pygltflib.Node(mesh=0)],meshes=[pygltflib.Mesh(primitives=[pygltflib.Primitive(attributes=pygltflib.Attributes(POSITION=1),indices=0)])],accessors=[pygltflib.Accessor(bufferView=0,componentType=pygltflib.UNSIGNED_BYTE,count=triangles.size,type=pygltflib.SCALAR,max=[int(triangles.max())],min=[int(triangles.min())],),pygltflib.Accessor(bufferView=1,componentType=pygltflib.FLOAT,count=len(points),type=pygltflib.VEC3,max=points.max(axis=0).tolist(),min=points.min(axis=0).tolist(),),],bufferViews=[pygltflib.BufferView(buffer=0,byteLength=len(triangles_binary_blob),target=pygltflib.ELEMENT_ARRAY_BUFFER,),pygltflib.BufferView(buffer=0,byteOffset=len(triangles_binary_blob),byteLength=len(points_binary_blob),target=pygltflib.ARRAY_BUFFER,),],buffers=[pygltflib.Buffer(byteLength=len(triangles_binary_blob)+len(points_binary_blob))],)gltf.set_binary_blob(triangles_binary_blob+points_binary_blob)WriteGLTF2to bytes:glb=b"".join(gltf.save_to_bytes())# save_to_bytes returns an array of the components of a glbLoadGLTF2from bytes:gltf=pygltflib.GLTF2.load_from_bytes(glb)Decodenumpyarrays fromGLTF2:binary_blob=gltf.binary_blob()triangles_accessor=gltf.accessors[gltf.meshes[0].primitives[0].indices]triangles_buffer_view=gltf.bufferViews[triangles_accessor.bufferView]triangles=np.frombuffer(binary_blob[triangles_buffer_view.byteOffset+triangles_accessor.byteOffset:triangles_buffer_view.byteOffset+triangles_buffer_view.byteLength],dtype="uint8",count=triangles_accessor.count,).reshape((-1,3))points_accessor=gltf.accessors[gltf.meshes[0].primitives[0].attributes.POSITION]points_buffer_view=gltf.bufferViews[points_accessor.bufferView]points=np.frombuffer(binary_blob[points_buffer_view.byteOffset+points_accessor.byteOffset:points_buffer_view.byteOffset+points_buffer_view.byteLength],dtype="float32",count=points_accessor.count*3,).reshape((-1,3))P.S.: If you'd like to use "compiled" version of mesh writing:gltf=pygltflib.GLTF2(scene=0,scenes=[pygltflib.Scene(nodes=[0])],nodes=[pygltflib.Node(mesh=0)],meshes=[pygltflib.Mesh(primitives=[pygltflib.Primitive(attributes=pygltflib.Attributes(POSITION=1),indices=0)])],accessors=[pygltflib.Accessor(bufferView=0,componentType=pygltflib.UNSIGNED_BYTE,count=36,type=pygltflib.SCALAR,max=[7],min=[0],),pygltflib.Accessor(bufferView=1,componentType=pygltflib.FLOAT,count=8,type=pygltflib.VEC3,max=[0.5,0.5,0.5],min=[-0.5,-0.5,-0.5],),],bufferViews=[pygltflib.BufferView(buffer=0,byteLength=36,target=pygltflib.ELEMENT_ARRAY_BUFFER),pygltflib.BufferView(buffer=0,byteOffset=36,byteLength=96,target=pygltflib.ARRAY_BUFFER),],buffers=[pygltflib.Buffer(byteLength=132)],)gltf.set_binary_blob(b"\x00\x01\x02\x03\x02\x01\x01\x00\x04\x05\x04\x00\x03\x01\x06\x04\x06\x01"b"\x02\x03\x07\x06\x07\x03\x00\x02\x05\x07\x05\x02\x05\x07\x04\x06\x04\x07"b"\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00?\x00\x00\x00"b"\xbf\x00\x00\x00?\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00?\x00\x00\x00?"b"\x00\x00\x00?\x00\x00\x00?\x00\x00\x00?\x00\x00\x00\xbf\x00\x00\x00\xbf"b"\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00"b"\x00?\x00\x00\x00\xbf\x00\x00\x00\xbf\x00\x00\x00?\x00\x00\x00\xbf")Loading and savingpygltflibcan load json-based .GLTF files and binary .GLB files, based on the file extension.GLTF files>>>frompygltflibimportGLTF2>>>filename="glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf">>>gltf=GLTF2().load(filename)>>>gltf.scene0>>>gltf.scenes[Scene(name='',nodes=[0])]>>>gltf.nodes[0]Node(mesh=0,skin=None,rotation=[0.0,-1.0,0.0,0.0],translation=[],scale=[],children=[],matrix=[],camera=None,name='AnimatedCube')>>>gltf.nodes[0].name'AnimatedCube'>>>gltf.meshes[0].primitives[0].attributesAttributes(NORMAL=4,POSITION=None,TANGENT=5,TEXCOORD_0=6)>>>filename2="test.gltf">>>gltf.save(filename2)GLB files>>>frompygltflibimportGLTF2>>>glb_filename="glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb">>>glb=GLTF2().load(glb_filename)>>>glb.scene0>>>glb.scenes[Scene(name='',nodes=[0])]>>>glb.nodes[0]Node(mesh=None,skin=None,rotation=[],translation=[],scale=[],children=[1],matrix=[1.0,0.0,0.0,0.0,0.0,0.0,-1.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0],camera=None,name=None)>>>glb.meshes[0].primitives[0].attributesAttributes(POSITION=2,NORMAL=1,TANGENT=None,TEXCOORD_0=None,TEXCOORD_1=None,COLOR_0=None,JOINTS_0=None,WEIGHTS_0=None)>>>glb.save("test.glb")>>>glb.binary_blob()# read the binary blob used by the buffer in a glb<abunchofbinarydata>Converting filesFirst method>>>frompygltflibimportGLTF2>>># convert glb to gltf>>>glb=GLTF2().load("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")>>>glb.save("test.gltf")>>># convert gltf to glb>>>gltf=GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")>>>gltf.save("test.glb")Second method using utils>>>frompygltflibimportGLTF2>>>frompygltflib.utilsimportglb2gltf,gltf2glb>>># convert glb to gltf>>>glb2gltf("glTF-Sample-Models/2.0/Box/glTF-Binary/Box.glb")>>># convert gltf to glb>>>gltf2glb("glTF-Sample-Models/2.0/Box/glTF/Box.gltf","test.glb",override=True)Converting buffersThe data for a buffer in a GLTF2 files can be stored in the buffer object's URI string
or in a binary file pointed to by the buffer objects' URI string or as a binary blob
inside a GLB file.While saving and loading GLTF2 files is mostly handled transparently by the library,
there may be some situations where you want a specific type of buffer storage.For example, if you have a GLTF file that stores all the associated data in .bin files
but you want to create a single file, you need to convert the buffers from binary files
to data uris or glb binary data.There is a convenience method namedconvert_buffersthat can help.>>>frompygltflibimportGLTF2,BufferFormat>>>gltf=GLTF2().load("glTF-Sample-Models/2.0/Box/glTF/Box.gltf")>>>gltf.convert_buffers(BufferFormat.DATAURI)# convert buffer URIs to data.>>>gltf.save_binary("test.glb")# try and save, will get warning.Warning:Unabletosavedatauritoglbformat.>>>gltf.convert_buffers(BufferFormat.BINARYBLOB)# convert buffers to GLB blob>>>gltf.save_binary("test.glb")>>>gltf.convert_buffers(BufferFormat.BINFILE)# convert buffers to files>>>gltf.save("test.gltf")# all the buffers are saved in 0.bin, 1.bin, 2.bin.Converting texture imagesThe image data for textures in GLTF2 files can be stored in the image objects URI string
or in an image file pointed to by the image objects' URI string or as part of the buffer.While saving and loading GLTF2 files is mostly handled transparently by the library,
there may be some situations where you want a specific type of image storage.For example, if you have a GLB file that stores all its image files in .PNG files
but you want to create a single GLTF file, you need to convert the images from files
to data uris.Currently converting images to and from the buffer is not supported. Only image
files and data uris are supported.There is a convenience method namedconvert_imagesthat can help.>>># embed an image file to your GLTF.>>>frompygltflib.utilsimportImageFormat,Image>>>gltf=GLTF2()>>>image=Image()>>>image.uri="myfile.png">>>gltf.images.append(image)>>>gltf.convert_images(ImageFormat.DATAURI)# image file will be imported into the GLTF>>>gltf.images[0].uri# will now be something like "data:image/png;base64,iVBORw0KGg...">>>gltf.images[0].name# will be myfile.png>>># create an image file from GLTF data uris>>>frompathlibimportPath>>>frompygltflib.utilsimportImageFormat,Image>>>gltf=GLTF2()>>>image=Image()>>>image.uri="data:image/png;base64,iVBORw0KGg...">>>image.name="myfile.png"# optional file name, if not provided, the image files will be called "0.png", "1.png">>>gltf.images.append(image)>>>gltf.convert_images(ImageFormat.FILE)# image file will be imported into the GLTF>>>gltf.images[0].uri# will be myfile.png"myfile.png">>>Path("myfile.png").exists()TrueExtensionsThe GLTF2 spec allows for extensions to added to any component of a GLTF file.As of writing (August 2019) there areabout a dozen extensions from Khronos and other vendorsIn pygltflib, extensions are loaded as ordinarydictobjects and so should be accessed like regular key,value pairs.For exampleextensions["KHR_draco_mesh_compression"]["bufferView"]instead ofextensions["KHR_draco_mesh_compression"].bufferView.This allows future extensions to be automatically supported by pygltflib.Extrasshould work the same way.Running the testsStatus of gltf-validatorUsing sample models loaded and then saved using this library, here are validator reports (blank is untested).
If available, The result of a visual inspection is in brackets next to the validator result.Validator StatusModelgltf to gltfgltf to glbglb to gltfglb to glb2CylinderEnginepassespassespassespassesAlphaBlendModeTestpassespassespassespassesAnimatedCubepassespassesno glb availableno glb availableAnimatedMorphCubepassespassespassespassesAnimatedMorphSpherepassespassespassespassesAnimatedTrianglepassespassesno glb availableno glb availableAvocadopassespassespassespassesBarramundiFishpassespassespassespassesBoomBoxpassespassespassespassesBoomBoxWithAxespassespassesno glb availableno glb availableBoxpassespassespassespassesBoxAnimatedpassespassespassesBoxInterleavedpassespassespassesBoxTexturedpassespassesBoxTexturedNonPowerOfTwopassespassesBoxVertexColorspassespassesBrainStempassespassespassesBuggypassespassespassesCameraspassespassesno glb availableno glb availableCesiumManpassespassesCesiumMilkTruckpassespassesCorsetpassespassespassespassesCubepassespassesno glb availableno glb availableDamagedHelmetpassespassespassespassesDuckpassespassespassespassesFlightHelmetpassespassesno glb availableno glb availableGearboxAssypassespassesLanternpassespassesMetalRoughSpherespassespassesMonsterpassespassesMultiUVTestpassespassesNormalTangentMirrorTestpassespassesNormalTangentTestpassespassespassesOrientationTestpassespassesReciprocatingSawpassespassesRiggedFigurepassespassesRiggedSimplepassespassesSciFiHelmetpassespassesno glb availableno glb availableSimpleMeshespassespassesno glb availableno glb availableSimpleMorphpassespassesno glb availableno glb availableSimpleSparseAccessorpassespassesno glb availableno glb availableSpecGlossVsMetalRoughpassespassespassespassesSponzapassespassesno glb availableno glb availableSuzannepassespassesno glb availableno glb availableTextureCoordinateTestpassespassespassespassesTextureSettingsTestpassespassespassespassesTextureTransformTestpassespassesno glb availableno glb availableTrianglepassespassesno glb availableno glb availableTriangleWithoutIndicespassespassesno glb availableno glb availableTwoSidedPlanepassespassesno glb availableno glb availableVCpassesfailspassespassesVertexColorTestpassespassespassespassesWaterBottlepassespassespassespassesutils.validator statusWhat does pygltflib.utils.validator test?
NOTE: At the moment the validator raises an exception when an rule is broken. If you have ideas of the best way to
return information on validation warnings/errors please open a ticket on our gitlab.Rulevalidator testsexception raisedaccessor.componentType must be validyesInvalidAcccessorComponentTypeExceptionaccessor min and max arrays must be valid lengthyesInvalidArrayLengthExceptionaccessor min and max arrays must be same lengthyesMismatchedArrayLengthExceptionmesh.primitive.mode must be validyesInvalidMeshPrimitiveModeaccessor.sparse.indices.componentType must be validyesInvalidAccessorSparseIndicesComponentTypeExceptionbufferView byteOffset and byteStrides must be validyesInvalidValueErrorbufferView targets must be validyesInvalidBufferViewTargetall other testsnounittestsgit clone https://github.com/KhronosGroup/glTF-Sample-Models
pytest test_pygltflib.py