If you take the TextEditor Templates -> Python -> Operator File Import
- add
from bpy.props import CollectionProperty
- and add this special property in the
ImportSomeData
operator
inside the importer class
class ImportSomeData(Operator, ImportHelper):
# edit for brevity
filename_ext = ".txt"
files = CollectionProperty(type=bpy.types.PropertyGroup)
Then self.files
, with 3 files selected, gives you
... <bpy_collection[3], IMPORT_TEST_OT_some_data.files>
>>> self.files[0]
... <bpy_struct, PropertyGroup("filename_mine2.txt")>
Then to get the fullpath of those files you use the self.path dirname
import os
dirname = os.path.dirname(self.filepath)
for f in self.files:
print(os.path.join(dirname, f.name))
.../home/zeffii/filename_mine2.txt
.../home/zeffii/record_label_ep2.txt
.../home/zeffii/splines.txt