FBX Export: Add Limit To > Visible Objects checkbox to match GLTF export
This change adds options to FBX Export intended to mirror existing
options available in GLTF export, namely:
Include > Limit To > Visible Objects.
The GLTF options were discussed and agreed on in this discussion:
https://github.com/KhronosGroup/glTF-Blender-IO/issues/1139
And implemented in this change:
f39e14c1ba
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D14539
This commit is contained in:
parent
22c1eb5c3d
commit
4075cdbdc7
|
@ -5,7 +5,7 @@
|
|||
bl_info = {
|
||||
"name": "FBX format",
|
||||
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
|
||||
"version": (4, 35, 0),
|
||||
"version": (4, 36, 0),
|
||||
"blender": (3, 2, 0),
|
||||
"location": "File > Import-Export",
|
||||
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
|
||||
|
@ -378,6 +378,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
|||
description="Export selected and visible objects only",
|
||||
default=False,
|
||||
)
|
||||
use_visible: BoolProperty(
|
||||
name='Visible Objects',
|
||||
description='Export visible objects only',
|
||||
default=False
|
||||
)
|
||||
use_active_collection: BoolProperty(
|
||||
name="Active Collection",
|
||||
description="Export only objects from the active collection (and its children)",
|
||||
|
@ -690,6 +695,7 @@ class FBX_PT_export_include(bpy.types.Panel):
|
|||
sublayout = layout.column(heading="Limit to")
|
||||
sublayout.enabled = (operator.batch_mode == 'OFF')
|
||||
sublayout.prop(operator, "use_selection")
|
||||
sublayout.prop(operator, "use_visible")
|
||||
sublayout.prop(operator, "use_active_collection")
|
||||
|
||||
layout.column().prop(operator, "object_types")
|
||||
|
|
|
@ -3183,6 +3183,7 @@ def defaults_unity3d():
|
|||
def save(operator, context,
|
||||
filepath="",
|
||||
use_selection=False,
|
||||
use_visible=False,
|
||||
use_active_collection=False,
|
||||
batch_mode='OFF',
|
||||
use_batch_own_dir=False,
|
||||
|
@ -3216,6 +3217,8 @@ def save(operator, context,
|
|||
ctx_objects = context.selected_objects
|
||||
else:
|
||||
ctx_objects = context.view_layer.objects
|
||||
if use_visible:
|
||||
ctx_objects = tuple(obj for obj in ctx_objects if obj.visible_get())
|
||||
kwargs_mod["context_objects"] = ctx_objects
|
||||
|
||||
depsgraph = context.evaluated_depsgraph_get()
|
||||
|
|
Loading…
Reference in New Issue