FBX: Enable the Collection exporter feature #105273
@ -315,6 +315,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
||||
description="Export only objects from the active collection (and its children)",
|
||||
default=False,
|
||||
)
|
||||
collection: StringProperty(
|
||||
name="Source Collection",
|
||||
description="Export only objects from this collection (and its children)",
|
||||
default="",
|
||||
)
|
||||
global_scale: FloatProperty(
|
||||
name="Scale",
|
||||
description="Scale all data (Some importers do not support scaled armatures!)",
|
||||
@ -681,6 +686,7 @@ class IO_FH_fbx(bpy.types.FileHandler):
|
||||
bl_idname = "IO_FH_fbx"
|
||||
bl_label = "FBX"
|
||||
bl_import_operator = "import_scene.fbx"
|
||||
bl_export_operator = "export_scene.fbx"
|
||||
bl_file_extensions = ".fbx"
|
||||
|
||||
@classmethod
|
||||
|
@ -3586,6 +3586,7 @@ def save(operator, context,
|
||||
use_selection=False,
|
||||
use_visible=False,
|
||||
use_active_collection=False,
|
||||
collection="",
|
||||
batch_mode='OFF',
|
||||
use_batch_own_dir=False,
|
||||
**kwargs
|
||||
@ -3606,13 +3607,22 @@ def save(operator, context,
|
||||
|
||||
if batch_mode == 'OFF':
|
||||
kwargs_mod = kwargs.copy()
|
||||
|
||||
source_collection = None
|
||||
if use_active_collection:
|
||||
if use_selection:
|
||||
ctx_objects = tuple(obj
|
||||
for obj in context.view_layer.active_layer_collection.collection.all_objects
|
||||
if obj.select_get())
|
||||
source_collection = context.view_layer.active_layer_collection.collection
|
||||
elif collection:
|
||||
if collection in bpy.data.collections:
|
||||
source_collection = bpy.data.collections[collection]
|
||||
else:
|
||||
ctx_objects = context.view_layer.active_layer_collection.collection.all_objects
|
||||
operator.report({'ERROR'}, "Collection %s was not found" % collection)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if source_collection:
|
||||
if use_selection:
|
||||
ctx_objects = tuple(obj for obj in source_collection.all_objects if obj.select_get())
|
||||
else:
|
||||
ctx_objects = source_collection.all_objects
|
||||
else:
|
||||
if use_selection:
|
||||
ctx_objects = context.selected_objects
|
||||
|
Loading…
Reference in New Issue
Block a user