I have a huge amount of .wrl files. They mostly contain a single mesh. I want to write a small python script that loads each of these files, then reduces the contained meshes and saves it to a new file (ideally again a .wrl, but not necessary)
My script so far
import bpy import os for i in os.listdir("C:/PathToFiles"): if i.endswith("n.wrl"): fullPath = "C:/PathToFiles/" + i bpy.ops.import_scene.x3d(filepath=fullPath) bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() continue else: continue
The saving part is missing for now. When first trying this I got the error message "blendata not defined" in line 2223 of import_x3d.py. I corrected this by replacing all occurences of blendata with bpydata.
Now it crashes with error in line 2044 of import_x3d.py with
ValueError: matrix * vector: len(matrix.col) and len(vector) must be the same
Since I have no real insight into the script or the .wrl file format I am kinda lost. Any suggestions?