Merge branch 'blender-v4.0-release'
[blender-addons.git] / io_scene_fbx / __init__.py
blob2d5e1f221958f810f87867e081a13d8219998031
1 # SPDX-FileCopyrightText: 2011-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 bl_info = {
6 "name": "FBX format",
7 "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
8 "version": (5, 8, 8),
9 "blender": (3, 6, 0),
10 "location": "File > Import-Export",
11 "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",
12 "warning": "",
13 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/scene_fbx.html",
14 "support": 'OFFICIAL',
15 "category": "Import-Export",
19 if "bpy" in locals():
20 import importlib
21 if "import_fbx" in locals():
22 importlib.reload(import_fbx)
23 if "export_fbx_bin" in locals():
24 importlib.reload(export_fbx_bin)
25 if "export_fbx" in locals():
26 importlib.reload(export_fbx)
29 import bpy
30 from bpy.props import (
31 StringProperty,
32 BoolProperty,
33 FloatProperty,
34 EnumProperty,
35 CollectionProperty,
37 from bpy_extras.io_utils import (
38 ImportHelper,
39 ExportHelper,
40 orientation_helper,
41 path_reference_mode,
42 axis_conversion,
46 @orientation_helper(axis_forward='-Z', axis_up='Y')
47 class ImportFBX(bpy.types.Operator, ImportHelper):
48 """Load a FBX file"""
49 bl_idname = "import_scene.fbx"
50 bl_label = "Import FBX"
51 bl_options = {'UNDO', 'PRESET'}
53 directory: StringProperty()
55 filename_ext = ".fbx"
56 filter_glob: StringProperty(default="*.fbx", options={'HIDDEN'})
58 files: CollectionProperty(
59 name="File Path",
60 type=bpy.types.OperatorFileListElement,
63 ui_tab: EnumProperty(
64 items=(('MAIN', "Main", "Main basic settings"),
65 ('ARMATURE', "Armatures", "Armature-related settings"),
67 name="ui_tab",
68 description="Import options categories",
71 use_manual_orientation: BoolProperty(
72 name="Manual Orientation",
73 description="Specify orientation and scale, instead of using embedded data in FBX file",
74 default=False,
76 global_scale: FloatProperty(
77 name="Scale",
78 min=0.001, max=1000.0,
79 default=1.0,
81 bake_space_transform: BoolProperty(
82 name="Apply Transform",
83 description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
84 "target space is not aligned with Blender's space "
85 "(WARNING! experimental option, use at own risk, known to be broken with armatures/animations)",
86 default=False,
89 use_custom_normals: BoolProperty(
90 name="Custom Normals",
91 description="Import custom normals, if available (otherwise Blender will recompute them)",
92 default=True,
94 colors_type: EnumProperty(
95 name="Vertex Colors",
96 items=(('NONE', "None", "Do not import color attributes"),
97 ('SRGB', "sRGB", "Expect file colors in sRGB color space"),
98 ('LINEAR', "Linear", "Expect file colors in linear color space"),
100 description="Import vertex color attributes",
101 default='SRGB',
104 use_image_search: BoolProperty(
105 name="Image Search",
106 description="Search subdirs for any associated images (WARNING: may be slow)",
107 default=True,
110 use_alpha_decals: BoolProperty(
111 name="Alpha Decals",
112 description="Treat materials with alpha as decals (no shadow casting)",
113 default=False,
115 decal_offset: FloatProperty(
116 name="Decal Offset",
117 description="Displace geometry of alpha meshes",
118 min=0.0, max=1.0,
119 default=0.0,
122 use_anim: BoolProperty(
123 name="Import Animation",
124 description="Import FBX animation",
125 default=True,
127 anim_offset: FloatProperty(
128 name="Animation Offset",
129 description="Offset to apply to animation during import, in frames",
130 default=1.0,
133 use_subsurf: BoolProperty(
134 name="Subdivision Data",
135 description="Import FBX subdivision information as subdivision surface modifiers",
136 default=False,
139 use_custom_props: BoolProperty(
140 name="Custom Properties",
141 description="Import user properties as custom properties",
142 default=True,
144 use_custom_props_enum_as_string: BoolProperty(
145 name="Import Enums As Strings",
146 description="Store enumeration values as strings",
147 default=True,
150 ignore_leaf_bones: BoolProperty(
151 name="Ignore Leaf Bones",
152 description="Ignore the last bone at the end of each chain (used to mark the length of the previous bone)",
153 default=False,
155 force_connect_children: BoolProperty(
156 name="Force Connect Children",
157 description="Force connection of children bones to their parent, even if their computed head/tail "
158 "positions do not match (can be useful with pure-joints-type armatures)",
159 default=False,
161 automatic_bone_orientation: BoolProperty(
162 name="Automatic Bone Orientation",
163 description="Try to align the major bone axis with the bone children",
164 default=False,
166 primary_bone_axis: EnumProperty(
167 name="Primary Bone Axis",
168 items=(('X', "X Axis", ""),
169 ('Y', "Y Axis", ""),
170 ('Z', "Z Axis", ""),
171 ('-X', "-X Axis", ""),
172 ('-Y', "-Y Axis", ""),
173 ('-Z', "-Z Axis", ""),
175 default='Y',
177 secondary_bone_axis: EnumProperty(
178 name="Secondary Bone Axis",
179 items=(('X', "X Axis", ""),
180 ('Y', "Y Axis", ""),
181 ('Z', "Z Axis", ""),
182 ('-X', "-X Axis", ""),
183 ('-Y', "-Y Axis", ""),
184 ('-Z', "-Z Axis", ""),
186 default='X',
189 use_prepost_rot: BoolProperty(
190 name="Use Pre/Post Rotation",
191 description="Use pre/post rotation from FBX transform (you may have to disable that in some cases)",
192 default=True,
195 def draw(self, context):
196 pass
198 def execute(self, context):
199 keywords = self.as_keywords(ignore=("filter_glob", "directory", "ui_tab", "filepath", "files"))
201 from . import import_fbx
202 import os
204 if self.files:
205 ret = {'CANCELLED'}
206 dirname = os.path.dirname(self.filepath)
207 for file in self.files:
208 path = os.path.join(dirname, file.name)
209 if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
210 ret = {'FINISHED'}
211 return ret
212 else:
213 return import_fbx.load(self, context, filepath=self.filepath, **keywords)
216 class FBX_PT_import_include(bpy.types.Panel):
217 bl_space_type = 'FILE_BROWSER'
218 bl_region_type = 'TOOL_PROPS'
219 bl_label = "Include"
220 bl_parent_id = "FILE_PT_operator"
222 @classmethod
223 def poll(cls, context):
224 sfile = context.space_data
225 operator = sfile.active_operator
227 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
229 def draw(self, context):
230 layout = self.layout
231 layout.use_property_split = True
232 layout.use_property_decorate = False # No animation.
234 sfile = context.space_data
235 operator = sfile.active_operator
237 layout.prop(operator, "use_custom_normals")
238 layout.prop(operator, "use_subsurf")
239 layout.prop(operator, "use_custom_props")
240 sub = layout.row()
241 sub.enabled = operator.use_custom_props
242 sub.prop(operator, "use_custom_props_enum_as_string")
243 layout.prop(operator, "use_image_search")
244 layout.prop(operator, "colors_type")
247 class FBX_PT_import_transform(bpy.types.Panel):
248 bl_space_type = 'FILE_BROWSER'
249 bl_region_type = 'TOOL_PROPS'
250 bl_label = "Transform"
251 bl_parent_id = "FILE_PT_operator"
253 @classmethod
254 def poll(cls, context):
255 sfile = context.space_data
256 operator = sfile.active_operator
258 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
260 def draw(self, context):
261 layout = self.layout
262 layout.use_property_split = True
263 layout.use_property_decorate = False # No animation.
265 sfile = context.space_data
266 operator = sfile.active_operator
268 layout.prop(operator, "global_scale")
269 layout.prop(operator, "decal_offset")
270 row = layout.row()
271 row.prop(operator, "bake_space_transform")
272 row.label(text="", icon='ERROR')
273 layout.prop(operator, "use_prepost_rot")
276 class FBX_PT_import_transform_manual_orientation(bpy.types.Panel):
277 bl_space_type = 'FILE_BROWSER'
278 bl_region_type = 'TOOL_PROPS'
279 bl_label = "Manual Orientation"
280 bl_parent_id = "FBX_PT_import_transform"
282 @classmethod
283 def poll(cls, context):
284 sfile = context.space_data
285 operator = sfile.active_operator
287 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
289 def draw_header(self, context):
290 sfile = context.space_data
291 operator = sfile.active_operator
293 self.layout.prop(operator, "use_manual_orientation", text="")
295 def draw(self, context):
296 layout = self.layout
297 layout.use_property_split = True
298 layout.use_property_decorate = False # No animation.
300 sfile = context.space_data
301 operator = sfile.active_operator
303 layout.enabled = operator.use_manual_orientation
305 layout.prop(operator, "axis_forward")
306 layout.prop(operator, "axis_up")
309 class FBX_PT_import_animation(bpy.types.Panel):
310 bl_space_type = 'FILE_BROWSER'
311 bl_region_type = 'TOOL_PROPS'
312 bl_label = "Animation"
313 bl_parent_id = "FILE_PT_operator"
314 bl_options = {'DEFAULT_CLOSED'}
316 @classmethod
317 def poll(cls, context):
318 sfile = context.space_data
319 operator = sfile.active_operator
321 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
323 def draw_header(self, context):
324 sfile = context.space_data
325 operator = sfile.active_operator
327 self.layout.prop(operator, "use_anim", text="")
329 def draw(self, context):
330 layout = self.layout
331 layout.use_property_split = True
332 layout.use_property_decorate = False # No animation.
334 sfile = context.space_data
335 operator = sfile.active_operator
337 layout.enabled = operator.use_anim
339 layout.prop(operator, "anim_offset")
342 class FBX_PT_import_armature(bpy.types.Panel):
343 bl_space_type = 'FILE_BROWSER'
344 bl_region_type = 'TOOL_PROPS'
345 bl_label = "Armature"
346 bl_parent_id = "FILE_PT_operator"
347 bl_options = {'DEFAULT_CLOSED'}
349 @classmethod
350 def poll(cls, context):
351 sfile = context.space_data
352 operator = sfile.active_operator
354 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
356 def draw(self, context):
357 layout = self.layout
358 layout.use_property_split = True
359 layout.use_property_decorate = False # No animation.
361 sfile = context.space_data
362 operator = sfile.active_operator
364 layout.prop(operator, "ignore_leaf_bones")
365 layout.prop(operator, "force_connect_children"),
366 layout.prop(operator, "automatic_bone_orientation"),
367 sub = layout.column()
368 sub.enabled = not operator.automatic_bone_orientation
369 sub.prop(operator, "primary_bone_axis")
370 sub.prop(operator, "secondary_bone_axis")
373 @orientation_helper(axis_forward='-Z', axis_up='Y')
374 class ExportFBX(bpy.types.Operator, ExportHelper):
375 """Write a FBX file"""
376 bl_idname = "export_scene.fbx"
377 bl_label = "Export FBX"
378 bl_options = {'UNDO', 'PRESET'}
380 filename_ext = ".fbx"
381 filter_glob: StringProperty(default="*.fbx", options={'HIDDEN'})
383 # List of operator properties, the attributes will be assigned
384 # to the class instance from the operator settings before calling.
386 use_selection: BoolProperty(
387 name="Selected Objects",
388 description="Export selected and visible objects only",
389 default=False,
391 use_visible: BoolProperty(
392 name='Visible Objects',
393 description='Export visible objects only',
394 default=False
396 use_active_collection: BoolProperty(
397 name="Active Collection",
398 description="Export only objects from the active collection (and its children)",
399 default=False,
401 global_scale: FloatProperty(
402 name="Scale",
403 description="Scale all data (Some importers do not support scaled armatures!)",
404 min=0.001, max=1000.0,
405 soft_min=0.01, soft_max=1000.0,
406 default=1.0,
408 apply_unit_scale: BoolProperty(
409 name="Apply Unit",
410 description="Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)",
411 default=True,
413 apply_scale_options: EnumProperty(
414 items=(('FBX_SCALE_NONE', "All Local",
415 "Apply custom scaling and units scaling to each object transformation, FBX scale remains at 1.0"),
416 ('FBX_SCALE_UNITS', "FBX Units Scale",
417 "Apply custom scaling to each object transformation, and units scaling to FBX scale"),
418 ('FBX_SCALE_CUSTOM', "FBX Custom Scale",
419 "Apply custom scaling to FBX scale, and units scaling to each object transformation"),
420 ('FBX_SCALE_ALL', "FBX All",
421 "Apply custom scaling and units scaling to FBX scale"),
423 name="Apply Scalings",
424 description="How to apply custom and units scalings in generated FBX file "
425 "(Blender uses FBX scale to detect units on import, "
426 "but many other applications do not handle the same way)",
429 use_space_transform: BoolProperty(
430 name="Use Space Transform",
431 description="Apply global space transform to the object rotations. When disabled "
432 "only the axis space is written to the file and all object transforms are left as-is",
433 default=True,
435 bake_space_transform: BoolProperty(
436 name="Apply Transform",
437 description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
438 "target space is not aligned with Blender's space "
439 "(WARNING! experimental option, use at own risk, known to be broken with armatures/animations)",
440 default=False,
443 object_types: EnumProperty(
444 name="Object Types",
445 options={'ENUM_FLAG'},
446 items=(('EMPTY', "Empty", ""),
447 ('CAMERA', "Camera", ""),
448 ('LIGHT', "Lamp", ""),
449 ('ARMATURE', "Armature", "WARNING: not supported in dupli/group instances"),
450 ('MESH', "Mesh", ""),
451 ('OTHER', "Other", "Other geometry types, like curve, metaball, etc. (converted to meshes)"),
453 description="Which kind of object to export",
454 default={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'},
457 use_mesh_modifiers: BoolProperty(
458 name="Apply Modifiers",
459 description="Apply modifiers to mesh objects (except Armature ones) - "
460 "WARNING: prevents exporting shape keys",
461 default=True,
463 use_mesh_modifiers_render: BoolProperty(
464 name="Use Modifiers Render Setting",
465 description="Use render settings when applying modifiers to mesh objects (DISABLED in Blender 2.8)",
466 default=True,
468 mesh_smooth_type: EnumProperty(
469 name="Smoothing",
470 items=(('OFF', "Normals Only", "Export only normals instead of writing edge or face smoothing data"),
471 ('FACE', "Face", "Write face smoothing"),
472 ('EDGE', "Edge", "Write edge smoothing"),
474 description="Export smoothing information "
475 "(prefer 'Normals Only' option if your target importer understand split normals)",
476 default='OFF',
478 colors_type: EnumProperty(
479 name="Vertex Colors",
480 items=(('NONE', "None", "Do not export color attributes"),
481 ('SRGB', "sRGB", "Export colors in sRGB color space"),
482 ('LINEAR', "Linear", "Export colors in linear color space"),
484 description="Export vertex color attributes",
485 default='SRGB',
487 prioritize_active_color: BoolProperty(
488 name="Prioritize Active Color",
489 description="Make sure active color will be exported first. Could be important "
490 "since some other software can discard other color attributes besides the first one",
491 default=False,
493 use_subsurf: BoolProperty(
494 name="Export Subdivision Surface",
495 description="Export the last Catmull-Rom subdivision modifier as FBX subdivision "
496 "(does not apply the modifier even if 'Apply Modifiers' is enabled)",
497 default=False,
499 use_mesh_edges: BoolProperty(
500 name="Loose Edges",
501 description="Export loose edges (as two-vertices polygons)",
502 default=False,
504 use_tspace: BoolProperty(
505 name="Tangent Space",
506 description="Add binormal and tangent vectors, together with normal they form the tangent space "
507 "(will only work correctly with tris/quads only meshes!)",
508 default=False,
510 use_triangles: BoolProperty(
511 name="Triangulate Faces",
512 description="Convert all faces to triangles",
513 default=False,
515 use_custom_props: BoolProperty(
516 name="Custom Properties",
517 description="Export custom properties",
518 default=False,
520 add_leaf_bones: BoolProperty(
521 name="Add Leaf Bones",
522 description="Append a final bone to the end of each chain to specify last bone length "
523 "(use this when you intend to edit the armature from exported data)",
524 default=True # False for commit!
526 primary_bone_axis: EnumProperty(
527 name="Primary Bone Axis",
528 items=(('X', "X Axis", ""),
529 ('Y', "Y Axis", ""),
530 ('Z', "Z Axis", ""),
531 ('-X', "-X Axis", ""),
532 ('-Y', "-Y Axis", ""),
533 ('-Z', "-Z Axis", ""),
535 default='Y',
537 secondary_bone_axis: EnumProperty(
538 name="Secondary Bone Axis",
539 items=(('X', "X Axis", ""),
540 ('Y', "Y Axis", ""),
541 ('Z', "Z Axis", ""),
542 ('-X', "-X Axis", ""),
543 ('-Y', "-Y Axis", ""),
544 ('-Z', "-Z Axis", ""),
546 default='X',
548 use_armature_deform_only: BoolProperty(
549 name="Only Deform Bones",
550 description="Only write deforming bones (and non-deforming ones when they have deforming children)",
551 default=False,
553 armature_nodetype: EnumProperty(
554 name="Armature FBXNode Type",
555 items=(('NULL', "Null", "'Null' FBX node, similar to Blender's Empty (default)"),
556 ('ROOT', "Root", "'Root' FBX node, supposed to be the root of chains of bones..."),
557 ('LIMBNODE', "LimbNode", "'LimbNode' FBX node, a regular joint between two bones..."),
559 description="FBX type of node (object) used to represent Blender's armatures "
560 "(use the Null type unless you experience issues with the other app, "
561 "as other choices may not import back perfectly into Blender...)",
562 default='NULL',
564 bake_anim: BoolProperty(
565 name="Baked Animation",
566 description="Export baked keyframe animation",
567 default=True,
569 bake_anim_use_all_bones: BoolProperty(
570 name="Key All Bones",
571 description="Force exporting at least one key of animation for all bones "
572 "(needed with some target applications, like UE4)",
573 default=True,
575 bake_anim_use_nla_strips: BoolProperty(
576 name="NLA Strips",
577 description="Export each non-muted NLA strip as a separated FBX's AnimStack, if any, "
578 "instead of global scene animation",
579 default=True,
581 bake_anim_use_all_actions: BoolProperty(
582 name="All Actions",
583 description="Export each action as a separated FBX's AnimStack, instead of global scene animation "
584 "(note that animated objects will get all actions compatible with them, "
585 "others will get no animation at all)",
586 default=True,
588 bake_anim_force_startend_keying: BoolProperty(
589 name="Force Start/End Keying",
590 description="Always add a keyframe at start and end of actions for animated channels",
591 default=True,
593 bake_anim_step: FloatProperty(
594 name="Sampling Rate",
595 description="How often to evaluate animated values (in frames)",
596 min=0.01, max=100.0,
597 soft_min=0.1, soft_max=10.0,
598 default=1.0,
600 bake_anim_simplify_factor: FloatProperty(
601 name="Simplify",
602 description="How much to simplify baked values (0.0 to disable, the higher the more simplified)",
603 min=0.0, max=100.0, # No simplification to up to 10% of current magnitude tolerance.
604 soft_min=0.0, soft_max=10.0,
605 default=1.0, # default: min slope: 0.005, max frame step: 10.
607 path_mode: path_reference_mode
608 embed_textures: BoolProperty(
609 name="Embed Textures",
610 description="Embed textures in FBX binary file (only for \"Copy\" path mode!)",
611 default=False,
613 batch_mode: EnumProperty(
614 name="Batch Mode",
615 items=(('OFF', "Off", "Active scene to file"),
616 ('SCENE', "Scene", "Each scene as a file"),
617 ('COLLECTION', "Collection",
618 "Each collection (data-block ones) as a file, does not include content of children collections"),
619 ('SCENE_COLLECTION', "Scene Collections",
620 "Each collection (including master, non-data-block ones) of each scene as a file, "
621 "including content from children collections"),
622 ('ACTIVE_SCENE_COLLECTION', "Active Scene Collections",
623 "Each collection (including master, non-data-block one) of the active scene as a file, "
624 "including content from children collections"),
627 use_batch_own_dir: BoolProperty(
628 name="Batch Own Dir",
629 description="Create a dir for each exported file",
630 default=True,
632 use_metadata: BoolProperty(
633 name="Use Metadata",
634 default=True,
635 options={'HIDDEN'},
638 def draw(self, context):
639 pass
641 @property
642 def check_extension(self):
643 return self.batch_mode == 'OFF'
645 def execute(self, context):
646 from mathutils import Matrix
647 if not self.filepath:
648 raise Exception("filepath not set")
650 global_matrix = (axis_conversion(to_forward=self.axis_forward,
651 to_up=self.axis_up,
652 ).to_4x4()
653 if self.use_space_transform else Matrix())
655 keywords = self.as_keywords(ignore=("check_existing",
656 "filter_glob",
657 "ui_tab",
660 keywords["global_matrix"] = global_matrix
662 from . import export_fbx_bin
663 return export_fbx_bin.save(self, context, **keywords)
666 class FBX_PT_export_main(bpy.types.Panel):
667 bl_space_type = 'FILE_BROWSER'
668 bl_region_type = 'TOOL_PROPS'
669 bl_label = ""
670 bl_parent_id = "FILE_PT_operator"
671 bl_options = {'HIDE_HEADER'}
673 @classmethod
674 def poll(cls, context):
675 sfile = context.space_data
676 operator = sfile.active_operator
678 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
680 def draw(self, context):
681 layout = self.layout
682 layout.use_property_split = True
683 layout.use_property_decorate = False # No animation.
685 sfile = context.space_data
686 operator = sfile.active_operator
688 row = layout.row(align=True)
689 row.prop(operator, "path_mode")
690 sub = row.row(align=True)
691 sub.enabled = (operator.path_mode == 'COPY')
692 sub.prop(operator, "embed_textures", text="", icon='PACKAGE' if operator.embed_textures else 'UGLYPACKAGE')
693 row = layout.row(align=True)
694 row.prop(operator, "batch_mode")
695 sub = row.row(align=True)
696 sub.prop(operator, "use_batch_own_dir", text="", icon='NEWFOLDER')
699 class FBX_PT_export_include(bpy.types.Panel):
700 bl_space_type = 'FILE_BROWSER'
701 bl_region_type = 'TOOL_PROPS'
702 bl_label = "Include"
703 bl_parent_id = "FILE_PT_operator"
705 @classmethod
706 def poll(cls, context):
707 sfile = context.space_data
708 operator = sfile.active_operator
710 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
712 def draw(self, context):
713 layout = self.layout
714 layout.use_property_split = True
715 layout.use_property_decorate = False # No animation.
717 sfile = context.space_data
718 operator = sfile.active_operator
720 sublayout = layout.column(heading="Limit to")
721 sublayout.enabled = (operator.batch_mode == 'OFF')
722 sublayout.prop(operator, "use_selection")
723 sublayout.prop(operator, "use_visible")
724 sublayout.prop(operator, "use_active_collection")
726 layout.column().prop(operator, "object_types")
727 layout.prop(operator, "use_custom_props")
730 class FBX_PT_export_transform(bpy.types.Panel):
731 bl_space_type = 'FILE_BROWSER'
732 bl_region_type = 'TOOL_PROPS'
733 bl_label = "Transform"
734 bl_parent_id = "FILE_PT_operator"
736 @classmethod
737 def poll(cls, context):
738 sfile = context.space_data
739 operator = sfile.active_operator
741 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
743 def draw(self, context):
744 layout = self.layout
745 layout.use_property_split = True
746 layout.use_property_decorate = False # No animation.
748 sfile = context.space_data
749 operator = sfile.active_operator
751 layout.prop(operator, "global_scale")
752 layout.prop(operator, "apply_scale_options")
754 layout.prop(operator, "axis_forward")
755 layout.prop(operator, "axis_up")
757 layout.prop(operator, "apply_unit_scale")
758 layout.prop(operator, "use_space_transform")
759 row = layout.row()
760 row.prop(operator, "bake_space_transform")
761 row.label(text="", icon='ERROR')
764 class FBX_PT_export_geometry(bpy.types.Panel):
765 bl_space_type = 'FILE_BROWSER'
766 bl_region_type = 'TOOL_PROPS'
767 bl_label = "Geometry"
768 bl_parent_id = "FILE_PT_operator"
769 bl_options = {'DEFAULT_CLOSED'}
771 @classmethod
772 def poll(cls, context):
773 sfile = context.space_data
774 operator = sfile.active_operator
776 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
778 def draw(self, context):
779 layout = self.layout
780 layout.use_property_split = True
781 layout.use_property_decorate = False # No animation.
783 sfile = context.space_data
784 operator = sfile.active_operator
786 layout.prop(operator, "mesh_smooth_type")
787 layout.prop(operator, "use_subsurf")
788 layout.prop(operator, "use_mesh_modifiers")
789 #sub = layout.row()
790 #sub.enabled = operator.use_mesh_modifiers and False # disabled in 2.8...
791 #sub.prop(operator, "use_mesh_modifiers_render")
792 layout.prop(operator, "use_mesh_edges")
793 layout.prop(operator, "use_triangles")
794 sub = layout.row()
795 #~ sub.enabled = operator.mesh_smooth_type in {'OFF'}
796 sub.prop(operator, "use_tspace")
797 layout.prop(operator, "colors_type")
798 layout.prop(operator, "prioritize_active_color")
801 class FBX_PT_export_armature(bpy.types.Panel):
802 bl_space_type = 'FILE_BROWSER'
803 bl_region_type = 'TOOL_PROPS'
804 bl_label = "Armature"
805 bl_parent_id = "FILE_PT_operator"
806 bl_options = {'DEFAULT_CLOSED'}
808 @classmethod
809 def poll(cls, context):
810 sfile = context.space_data
811 operator = sfile.active_operator
813 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
815 def draw(self, context):
816 layout = self.layout
817 layout.use_property_split = True
818 layout.use_property_decorate = False # No animation.
820 sfile = context.space_data
821 operator = sfile.active_operator
823 layout.prop(operator, "primary_bone_axis")
824 layout.prop(operator, "secondary_bone_axis")
825 layout.prop(operator, "armature_nodetype")
826 layout.prop(operator, "use_armature_deform_only")
827 layout.prop(operator, "add_leaf_bones")
830 class FBX_PT_export_bake_animation(bpy.types.Panel):
831 bl_space_type = 'FILE_BROWSER'
832 bl_region_type = 'TOOL_PROPS'
833 bl_label = "Bake Animation"
834 bl_parent_id = "FILE_PT_operator"
835 bl_options = {'DEFAULT_CLOSED'}
837 @classmethod
838 def poll(cls, context):
839 sfile = context.space_data
840 operator = sfile.active_operator
842 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
844 def draw_header(self, context):
845 sfile = context.space_data
846 operator = sfile.active_operator
848 self.layout.prop(operator, "bake_anim", text="")
850 def draw(self, context):
851 layout = self.layout
852 layout.use_property_split = True
853 layout.use_property_decorate = False # No animation.
855 sfile = context.space_data
856 operator = sfile.active_operator
858 layout.enabled = operator.bake_anim
859 layout.prop(operator, "bake_anim_use_all_bones")
860 layout.prop(operator, "bake_anim_use_nla_strips")
861 layout.prop(operator, "bake_anim_use_all_actions")
862 layout.prop(operator, "bake_anim_force_startend_keying")
863 layout.prop(operator, "bake_anim_step")
864 layout.prop(operator, "bake_anim_simplify_factor")
867 def menu_func_import(self, context):
868 self.layout.operator(ImportFBX.bl_idname, text="FBX (.fbx)")
871 def menu_func_export(self, context):
872 self.layout.operator(ExportFBX.bl_idname, text="FBX (.fbx)")
875 classes = (
876 ImportFBX,
877 FBX_PT_import_include,
878 FBX_PT_import_transform,
879 FBX_PT_import_transform_manual_orientation,
880 FBX_PT_import_animation,
881 FBX_PT_import_armature,
882 ExportFBX,
883 FBX_PT_export_main,
884 FBX_PT_export_include,
885 FBX_PT_export_transform,
886 FBX_PT_export_geometry,
887 FBX_PT_export_armature,
888 FBX_PT_export_bake_animation,
892 def register():
893 for cls in classes:
894 bpy.utils.register_class(cls)
896 bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
897 bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
900 def unregister():
901 bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
902 bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
904 for cls in classes:
905 bpy.utils.unregister_class(cls)
908 if __name__ == "__main__":
909 register()