IO: Importing multiple 3DS files at once #105227

Merged
Sebastian Sille merged 2 commits from :roblop-patch-1 into main 2024-03-08 19:21:52 +01:00
2 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,7 @@ from bpy.props import (
EnumProperty, EnumProperty,
FloatProperty, FloatProperty,
StringProperty, StringProperty,
CollectionProperty,
) )
import bpy import bpy
bl_info = { bl_info = {
@ -47,6 +48,8 @@ class Import3DS(bpy.types.Operator, ImportHelper):
filename_ext = ".3ds" filename_ext = ".3ds"
filter_glob: StringProperty(default="*.3ds", options={'HIDDEN'}) filter_glob: StringProperty(default="*.3ds", options={'HIDDEN'})
filepath: StringProperty(subtype='FILE_PATH', options={'SKIP_SAVE'}) filepath: StringProperty(subtype='FILE_PATH', options={'SKIP_SAVE'})
files: CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'})
directory: StringProperty(subtype='DIR_PATH')
constrain_size: FloatProperty( constrain_size: FloatProperty(
name="Constrain Size", name="Constrain Size",

View File

@ -1768,11 +1768,12 @@ def load_3ds(filepath, context, CONSTRAIN=10.0, UNITS=False, IMAGE_SEARCH=True,
file.close() file.close()
def load(operator, context, filepath="", constrain_size=0.0, use_scene_unit=False, def load(operator, context, files=None, directory="", filepath="", constrain_size=0.0, use_scene_unit=False,
use_image_search=True, object_filter=None, use_world_matrix=False, use_keyframes=True, use_image_search=True, object_filter=None, use_world_matrix=False, use_keyframes=True,
use_apply_transform=True, global_matrix=None, use_cursor=False, use_center_pivot=False): use_apply_transform=True, global_matrix=None, use_cursor=False, use_center_pivot=False):
load_3ds(filepath, context, CONSTRAIN=constrain_size, UNITS=use_scene_unit, for f in files:
load_3ds(os.path.join(directory, f.name), context, CONSTRAIN=constrain_size, UNITS=use_scene_unit,
IMAGE_SEARCH=use_image_search, FILTER=object_filter, WORLD_MATRIX=use_world_matrix, KEYFRAME=use_keyframes, IMAGE_SEARCH=use_image_search, FILTER=object_filter, WORLD_MATRIX=use_world_matrix, KEYFRAME=use_keyframes,
APPLY_MATRIX=use_apply_transform, CONVERSE=global_matrix, CURSOR=use_cursor, PIVOT=use_center_pivot,) APPLY_MATRIX=use_apply_transform, CONVERSE=global_matrix, CURSOR=use_cursor, PIVOT=use_center_pivot,)