diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-01-17 14:23:24 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-01-17 14:23:24 +0300 |
commit | 18099be5f837a3141f7150fdc6c068e297b7da47 (patch) | |
tree | 80178c51155b4bc4900ecb20ab310b36ebc36f8f /io_scene_fbx | |
parent | e264efb7e8424d300d49fe99d87f9f279d40fe09 (diff) |
Fix T50453: Add option to FBX export to apply render or preview modifiers.
Diffstat (limited to 'io_scene_fbx')
-rw-r--r-- | io_scene_fbx/__init__.py | 10 | ||||
-rw-r--r-- | io_scene_fbx/export_fbx_bin.py | 7 | ||||
-rw-r--r-- | io_scene_fbx/fbx_utils.py | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 661955bc..e1872596 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 36e8ea10..70d149bf 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 7467f4f2..d79023ee 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", |