[Bf-extensions-cvs] [4075cdbd] master: FBX Export: Add Limit To > Visible Objects checkbox to match GLTF export
Thomas Hope
noreply at git.blender.org
Tue Apr 5 12:35:04 CEST 2022
Commit: 4075cdbdc751051ba8b84088bdf190a8fce00b4b
Author: Thomas Hope
Date: Tue Apr 5 12:33:24 2022 +0200
Branches: master
https://developer.blender.org/rBA4075cdbdc751051ba8b84088bdf190a8fce00b4b
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:
https://github.com/KhronosGroup/glTF-Blender-IO/pull/1361/commits/f39e14c1ba1310576614eed919e08950f68793fb
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D14539
===================================================================
M io_scene_fbx/__init__.py
M io_scene_fbx/export_fbx_bin.py
===================================================================
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 9933322b..a84dca34 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -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")
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index b017a400..473b2947 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -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()
More information about the Bf-extensions-cvs
mailing list