Hello, does anybody have a working example of vtkGLTFWriter().
The documentation is very concise, and I’m trying different patterns similar to other writers, but I always get the error:
Process finished with exit code -1073741819 (0xC0000005)
Basically I am building a vtkMultiBlockDataSet(), required as input, and then I am trying to write it as GLTF (I simplified the following code to give an idea).
multi_block = vtkMultiBlockDataSet()
gltf_writer = vtkGLTFWriter()
i = 0
for polydata in list_of_polydata:
multi_block.SetBlock(i, polydata)
i = i+1
gltf_writer.SetFileName(out_file_name)
gltf_writer.SetInputDataObject(multi_block)
gltf_writer.Write()
I had the same problem with a crash in gltf_writer.Write() (VTK 9.5.2).
I solved it by putting each polydata in a vtkMultiBlockDataSet node.
Here is the corrected version of your code that should work now:
multi_block = vtkMultiBlockDataSet()
gltf_writer = vtkGLTFWriter()
i = 0
multi_block.SetNumberOfBlocks(len(list_of_polydata))
for polydata in list_of_polydata:
node_block = vtkMultiBlockDataSet() # one node for each polydata
node_block.SetNumberOfBlocks(1)
node_block.SetBlock(0, polydata)
multi_block.SetBlock(i, node_block)
i = i+1
gltf_writer.SetFileName(out_file_name)
gltf_writer.SetInputDataObject(multi_block)
gltf_writer.Write()