1 # SPDX-FileCopyrightText: 2011-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
7 "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
10 "location": "File > Import-Export",
11 "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",
13 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/scene_fbx.html",
14 "support": 'OFFICIAL',
15 "category": "Import-Export",
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
)
30 from bpy
.props
import (
37 from bpy_extras
.io_utils
import (
46 @orientation_helper(axis_forward
='-Z', axis_up
='Y')
47 class ImportFBX(bpy
.types
.Operator
, ImportHelper
):
49 bl_idname
= "import_scene.fbx"
50 bl_label
= "Import FBX"
51 bl_options
= {'UNDO', 'PRESET'}
53 directory
: StringProperty()
56 filter_glob
: StringProperty(default
="*.fbx", options
={'HIDDEN'})
58 files
: CollectionProperty(
60 type=bpy
.types
.OperatorFileListElement
,
64 items
=(('MAIN', "Main", "Main basic settings"),
65 ('ARMATURE', "Armatures", "Armature-related settings"),
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",
76 global_scale
: FloatProperty(
78 min=0.001, max=1000.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)",
89 use_custom_normals
: BoolProperty(
90 name
="Custom Normals",
91 description
="Import custom normals, if available (otherwise Blender will recompute them)",
94 colors_type
: EnumProperty(
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",
104 use_image_search
: BoolProperty(
106 description
="Search subdirs for any associated images (WARNING: may be slow)",
110 use_alpha_decals
: BoolProperty(
112 description
="Treat materials with alpha as decals (no shadow casting)",
115 decal_offset
: FloatProperty(
117 description
="Displace geometry of alpha meshes",
122 use_anim
: BoolProperty(
123 name
="Import Animation",
124 description
="Import FBX animation",
127 anim_offset
: FloatProperty(
128 name
="Animation Offset",
129 description
="Offset to apply to animation during import, in frames",
133 use_subsurf
: BoolProperty(
134 name
="Subdivision Data",
135 description
="Import FBX subdivision information as subdivision surface modifiers",
139 use_custom_props
: BoolProperty(
140 name
="Custom Properties",
141 description
="Import user properties as custom properties",
144 use_custom_props_enum_as_string
: BoolProperty(
145 name
="Import Enums As Strings",
146 description
="Store enumeration values as strings",
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)",
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)",
161 automatic_bone_orientation
: BoolProperty(
162 name
="Automatic Bone Orientation",
163 description
="Try to align the major bone axis with the bone children",
166 primary_bone_axis
: EnumProperty(
167 name
="Primary Bone Axis",
168 items
=(('X', "X Axis", ""),
171 ('-X', "-X Axis", ""),
172 ('-Y', "-Y Axis", ""),
173 ('-Z', "-Z Axis", ""),
177 secondary_bone_axis
: EnumProperty(
178 name
="Secondary Bone Axis",
179 items
=(('X', "X Axis", ""),
182 ('-X', "-X Axis", ""),
183 ('-Y', "-Y Axis", ""),
184 ('-Z', "-Z Axis", ""),
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)",
195 def draw(self
, context
):
198 def execute(self
, context
):
199 keywords
= self
.as_keywords(ignore
=("filter_glob", "directory", "ui_tab", "filepath", "files"))
201 from . import import_fbx
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'}:
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'
220 bl_parent_id
= "FILE_PT_operator"
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
):
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")
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"
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
):
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")
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"
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
):
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'}
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
):
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'}
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
):
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",
391 use_visible
: BoolProperty(
392 name
='Visible Objects',
393 description
='Export visible objects only',
396 use_active_collection
: BoolProperty(
397 name
="Active Collection",
398 description
="Export only objects from the active collection (and its children)",
401 global_scale
: FloatProperty(
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,
408 apply_unit_scale
: BoolProperty(
410 description
="Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)",
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",
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)",
443 object_types
: EnumProperty(
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",
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)",
468 mesh_smooth_type
: EnumProperty(
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)",
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",
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",
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)",
499 use_mesh_edges
: BoolProperty(
501 description
="Export loose edges (as two-vertices polygons)",
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!)",
510 use_triangles
: BoolProperty(
511 name
="Triangulate Faces",
512 description
="Convert all faces to triangles",
515 use_custom_props
: BoolProperty(
516 name
="Custom Properties",
517 description
="Export custom properties",
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", ""),
531 ('-X', "-X Axis", ""),
532 ('-Y', "-Y Axis", ""),
533 ('-Z', "-Z Axis", ""),
537 secondary_bone_axis
: EnumProperty(
538 name
="Secondary Bone Axis",
539 items
=(('X', "X Axis", ""),
542 ('-X', "-X Axis", ""),
543 ('-Y', "-Y Axis", ""),
544 ('-Z', "-Z Axis", ""),
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)",
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...)",
564 bake_anim
: BoolProperty(
565 name
="Baked Animation",
566 description
="Export baked keyframe animation",
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)",
575 bake_anim_use_nla_strips
: BoolProperty(
577 description
="Export each non-muted NLA strip as a separated FBX's AnimStack, if any, "
578 "instead of global scene animation",
581 bake_anim_use_all_actions
: BoolProperty(
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)",
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",
593 bake_anim_step
: FloatProperty(
594 name
="Sampling Rate",
595 description
="How often to evaluate animated values (in frames)",
597 soft_min
=0.1, soft_max
=10.0,
600 bake_anim_simplify_factor
: FloatProperty(
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!)",
613 batch_mode
: EnumProperty(
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",
632 use_metadata
: BoolProperty(
638 def draw(self
, context
):
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
,
653 if self
.use_space_transform
else Matrix())
655 keywords
= self
.as_keywords(ignore
=("check_existing",
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'
670 bl_parent_id
= "FILE_PT_operator"
671 bl_options
= {'HIDE_HEADER'}
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
):
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'
703 bl_parent_id
= "FILE_PT_operator"
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
):
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"
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
):
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")
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'}
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
):
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")
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")
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'}
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
):
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'}
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
):
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)")
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
,
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
,
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
)
901 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import
)
902 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export
)
905 bpy
.utils
.unregister_class(cls
)
908 if __name__
== "__main__":