I'd like to batch import multiple VRML 2.0 files using a script. However, in contrast to other importers (i.e that for .obj files) the X3D importer add-on rename the imported objects as ShapeIndexedFaceSet.(increasing numbers).
I succesfully modified a script originally doing a batch import of .obj files but since the file names are not specified, this is completely unuseful for me!
Any help to give the object the name of the file from which it was imported will be greatly appreciated!
here is the script
import os
import bpy
# location to the directory where the wrml are located
# if you are using windows style backslashes, you need to cancel one with another
path_to_obj_dir = os.path.join('C:\\', 'prova')
# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))
# get a list of files ending in 'wrl'
obj_list = [item for item in file_list if item[-3:] == 'wrl']
# loop through the strings in obj_list and add the files to the scene
for item in obj_list:
path_to_file = os.path.join(path_to_obj_dir, item)
bpy.ops.import_scene.x3d(filepath = path_to_file)