[Bf-extensions-cvs] [18099be] master: Fix T50453: Add option to FBX export to apply render or preview modifiers.

Bastien Montagne noreply at git.blender.org
Tue Jan 17 12:32:26 CET 2017


Commit: 18099be5f837a3141f7150fdc6c068e297b7da47
Author: Bastien Montagne
Date:   Tue Jan 17 12:23:24 2017 +0100
Branches: master
https://developer.blender.org/rBA18099be5f837a3141f7150fdc6c068e297b7da47

Fix T50453: Add option to FBX export to apply render or preview modifiers.

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 661955b..e187259 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (3, 7, 7),
+    "version": (3, 7, 8),
     "blender": (2, 77, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
@@ -314,6 +314,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
                         "WARNING: prevents exporting shape keys",
             default=True,
             )
+    use_mesh_modifiers_render = BoolProperty(
+            name="Use Modifiers Render Setting",
+            description="Use render settings when applying modifiers to mesh objects",
+            default=True,
+            )
     mesh_smooth_type = EnumProperty(
             name="Smoothing",
             items=(('OFF', "Normals Only", "Export only normals instead of writing edge or face smoothing data"),
@@ -518,6 +523,9 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
                 sub.prop(self, "use_batch_own_dir", text="", icon='NEWFOLDER')
             elif self.ui_tab == 'GEOMETRY':
                 layout.prop(self, "use_mesh_modifiers")
+                sub = layout.row()
+                sub.enabled = self.use_mesh_modifiers
+                sub.prop(self, "use_mesh_modifiers_render")
                 layout.prop(self, "mesh_smooth_type")
                 layout.prop(self, "use_mesh_edges")
                 sub = layout.row()
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 36e8ea1..70d149b 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -2188,7 +2188,8 @@ def fbx_data_from_scene(scene, settings):
                     if mod.show_render:
                         use_org_data = False
             if not use_org_data:
-                tmp_me = ob.to_mesh(scene, apply_modifiers=True, settings='RENDER')
+                tmp_me = ob.to_mesh(scene, apply_modifiers=True,
+                                    settings='RENDER' if settings.use_mesh_modifiers_render else 'PREVIEW')
                 data_meshes[ob_obj] = (get_blenderID_key(tmp_me), tmp_me, True)
             # Re-enable temporary disabled modifiers.
             for mod, show_render in tmp_mods:
@@ -2871,6 +2872,7 @@ def save_single(operator, scene, filepath="",
                 context_objects=None,
                 object_types=None,
                 use_mesh_modifiers=True,
+                use_mesh_modifiers_render=True,
                 mesh_smooth_type='FACE',
                 use_armature_deform_only=False,
                 bake_anim=True,
@@ -2941,7 +2943,7 @@ def save_single(operator, scene, filepath="",
     settings = FBXExportSettings(
         operator.report, (axis_up, axis_forward), global_matrix, global_scale, apply_unit_scale,
         bake_space_transform, global_matrix_inv, global_matrix_inv_transposed,
-        context_objects, object_types, use_mesh_modifiers,
+        context_objects, object_types, use_mesh_modifiers, use_mesh_modifiers_render,
         mesh_smooth_type, use_mesh_edges, use_tspace,
         armature_nodetype, use_armature_deform_only,
         add_leaf_bones, bone_correction_matrix, bone_correction_matrix_inv,
@@ -3012,6 +3014,7 @@ def defaults_unity3d():
 
         "object_types": {'ARMATURE', 'EMPTY', 'MESH', 'OTHER'},
         "use_mesh_modifiers": True,
+        "use_mesh_modifiers_render": True,
         "use_mesh_edges": False,
         "mesh_smooth_type": 'FACE',
         "use_tspace": False,  # XXX Why? Unity is expected to support tspace import...
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 7467f4f..d79023e 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -1193,7 +1193,7 @@ FBXExportSettingsMedia = namedtuple("FBXExportSettingsMedia", (
 FBXExportSettings = namedtuple("FBXExportSettings", (
     "report", "to_axes", "global_matrix", "global_scale", "apply_unit_scale",
     "bake_space_transform", "global_matrix_inv", "global_matrix_inv_transposed",
-    "context_objects", "object_types", "use_mesh_modifiers",
+    "context_objects", "object_types", "use_mesh_modifiers", "use_mesh_modifiers_render",
     "mesh_smooth_type", "use_mesh_edges", "use_tspace",
     "armature_nodetype", "use_armature_deform_only", "add_leaf_bones",
     "bone_correction_matrix", "bone_correction_matrix_inv",



More information about the Bf-extensions-cvs mailing list