FBX Import: add support to load several FBX files at once.
Differential Revision: https://developer.blender.org/D5866
This commit is contained in:
parent
53e661378b
commit
b57772a883
Notes:
blender-bot
2024-03-17 01:52:04 +01:00
Referenced by issue blender/blender#119488, Complete File Handler support
|
@ -21,7 +21,7 @@
|
|||
bl_info = {
|
||||
"name": "FBX format",
|
||||
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
|
||||
"version": (4, 17, 3),
|
||||
"version": (4, 18, 0),
|
||||
"blender": (2, 81, 6),
|
||||
"location": "File > Import-Export",
|
||||
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
|
||||
|
@ -48,6 +48,7 @@ from bpy.props import (
|
|||
BoolProperty,
|
||||
FloatProperty,
|
||||
EnumProperty,
|
||||
CollectionProperty,
|
||||
)
|
||||
from bpy_extras.io_utils import (
|
||||
ImportHelper,
|
||||
|
@ -70,6 +71,11 @@ class ImportFBX(bpy.types.Operator, ImportHelper):
|
|||
filename_ext = ".fbx"
|
||||
filter_glob: StringProperty(default="*.fbx", options={'HIDDEN'})
|
||||
|
||||
files: CollectionProperty(
|
||||
name="File Path",
|
||||
type=bpy.types.OperatorFileListElement,
|
||||
)
|
||||
|
||||
ui_tab: EnumProperty(
|
||||
items=(('MAIN', "Main", "Main basic settings"),
|
||||
('ARMATURE', "Armatures", "Armature-related settings"),
|
||||
|
@ -197,10 +203,21 @@ class ImportFBX(bpy.types.Operator, ImportHelper):
|
|||
pass
|
||||
|
||||
def execute(self, context):
|
||||
keywords = self.as_keywords(ignore=("filter_glob", "directory", "ui_tab"))
|
||||
keywords = self.as_keywords(ignore=("filter_glob", "directory", "ui_tab", "filepath", "files"))
|
||||
|
||||
from . import import_fbx
|
||||
return import_fbx.load(self, context, **keywords)
|
||||
import os
|
||||
|
||||
if self.files:
|
||||
ret = {'CANCELLED'}
|
||||
dirname = os.path.dirname(self.filepath)
|
||||
for file in self.files:
|
||||
path = os.path.join(dirname, file.name)
|
||||
if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
|
||||
ret = {'FINISHED'}
|
||||
return ret
|
||||
else:
|
||||
return import_fbx.load(self, context, filepath=self.filepath, **keywords)
|
||||
|
||||
|
||||
class FBX_PT_import_include(bpy.types.Panel):
|
||||
|
|
Loading…
Reference in New Issue