Fix #105045: Error importing FBX custom properties on placeholder PoseBones
[blender-addons.git] / io_scene_fbx / __init__.py
blob8996771ca8e8b5e480f2d0bbb2f5a0bc495283c7
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 bl_info = {
4 "name": "FBX format",
5 "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
6 "version": (5, 4, 1),
7 "blender": (3, 6, 0),
8 "location": "File > Import-Export",
9 "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",
10 "warning": "",
11 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/scene_fbx.html",
12 "support": 'OFFICIAL',
13 "category": "Import-Export",
17 if "bpy" in locals():
18 import importlib
19 if "import_fbx" in locals():
20 importlib.reload(import_fbx)
21 if "export_fbx_bin" in locals():
22 importlib.reload(export_fbx_bin)
23 if "export_fbx" in locals():
24 importlib.reload(export_fbx)
27 import bpy
28 from bpy.props import (
29 StringProperty,
30 BoolProperty,
31 FloatProperty,
32 EnumProperty,
33 CollectionProperty,
35 from bpy_extras.io_utils import (
36 ImportHelper,
37 ExportHelper,
38 orientation_helper,
39 path_reference_mode,
40 axis_conversion,
44 @orientation_helper(axis_forward='-Z', axis_up='Y')
45 class ImportFBX(bpy.types.Operator, ImportHelper):
46 """Load a FBX file"""
47 bl_idname = "import_scene.fbx"
48 bl_label = "Import FBX"
49 bl_options = {'UNDO', 'PRESET'}
51 directory: StringProperty()
53 filename_ext = ".fbx"
54 filter_glob: StringProperty(default="*.fbx", options={'HIDDEN'})
56 files: CollectionProperty(
57 name="File Path",
58 type=bpy.types.OperatorFileListElement,
61 ui_tab: EnumProperty(
62 items=(('MAIN', "Main", "Main basic settings"),
63 ('ARMATURE', "Armatures", "Armature-related settings"),
65 name="ui_tab",
66 description="Import options categories",
69 use_manual_orientation: BoolProperty(
70 name="Manual Orientation",
71 description="Specify orientation and scale, instead of using embedded data in FBX file",
72 default=False,
74 global_scale: FloatProperty(
75 name="Scale",
76 min=0.001, max=1000.0,
77 default=1.0,
79 bake_space_transform: BoolProperty(
80 name="Apply Transform",
81 description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
82 "target space is not aligned with Blender's space "
83 "(WARNING! experimental option, use at own risk, known to be broken with armatures/animations)",
84 default=False,
87 use_custom_normals: BoolProperty(
88 name="Custom Normals",
89 description="Import custom normals, if available (otherwise Blender will recompute them)",
90 default=True,
92 colors_type: EnumProperty(
93 name="Vertex Colors",
94 items=(('NONE', "None", "Do not import color attributes"),
95 ('SRGB', "sRGB", "Expect file colors in sRGB color space"),
96 ('LINEAR', "Linear", "Expect file colors in linear color space"),
98 description="Import vertex color attributes",
99 default='SRGB',
102 use_image_search: BoolProperty(
103 name="Image Search",
104 description="Search subdirs for any associated images (WARNING: may be slow)",
105 default=True,
108 use_alpha_decals: BoolProperty(
109 name="Alpha Decals",
110 description="Treat materials with alpha as decals (no shadow casting)",
111 default=False,
113 decal_offset: FloatProperty(
114 name="Decal Offset",
115 description="Displace geometry of alpha meshes",
116 min=0.0, max=1.0,
117 default=0.0,
120 use_anim: BoolProperty(
121 name="Import Animation",
122 description="Import FBX animation",
123 default=True,
125 anim_offset: FloatProperty(
126 name="Animation Offset",
127 description="Offset to apply to animation during import, in frames",
128 default=1.0,
131 use_subsurf: BoolProperty(
132 name="Subdivision Data",
133 description="Import FBX subdivision information as subdivision surface modifiers",
134 default=False,
137 use_custom_props: BoolProperty(
138 name="Custom Properties",
139 description="Import user properties as custom properties",
140 default=True,
142 use_custom_props_enum_as_string: BoolProperty(
143 name="Import Enums As Strings",
144 description="Store enumeration values as strings",
145 default=True,
148 ignore_leaf_bones: BoolProperty(
149 name="Ignore Leaf Bones",
150 description="Ignore the last bone at the end of each chain (used to mark the length of the previous bone)",
151 default=False,
153 force_connect_children: BoolProperty(
154 name="Force Connect Children",
155 description="Force connection of children bones to their parent, even if their computed head/tail "
156 "positions do not match (can be useful with pure-joints-type armatures)",
157 default=False,
159 automatic_bone_orientation: BoolProperty(
160 name="Automatic Bone Orientation",
161 description="Try to align the major bone axis with the bone children",
162 default=False,
164 primary_bone_axis: EnumProperty(
165 name="Primary Bone Axis",
166 items=(('X', "X Axis", ""),
167 ('Y', "Y Axis", ""),
168 ('Z', "Z Axis", ""),
169 ('-X', "-X Axis", ""),
170 ('-Y', "-Y Axis", ""),
171 ('-Z', "-Z Axis", ""),
173 default='Y',
175 secondary_bone_axis: EnumProperty(
176 name="Secondary Bone Axis",
177 items=(('X', "X Axis", ""),
178 ('Y', "Y Axis", ""),
179 ('Z', "Z Axis", ""),
180 ('-X', "-X Axis", ""),
181 ('-Y', "-Y Axis", ""),
182 ('-Z', "-Z Axis", ""),
184 default='X',
187 use_prepost_rot: BoolProperty(
188 name="Use Pre/Post Rotation",
189 description="Use pre/post rotation from FBX transform (you may have to disable that in some cases)",
190 default=True,
193 def draw(self, context):
194 pass
196 def execute(self, context):
197 keywords = self.as_keywords(ignore=("filter_glob", "directory", "ui_tab", "filepath", "files"))
199 from . import import_fbx
200 import os
202 if self.files:
203 ret = {'CANCELLED'}
204 dirname = os.path.dirname(self.filepath)
205 for file in self.files:
206 path = os.path.join(dirname, file.name)
207 if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
208 ret = {'FINISHED'}
209 return ret
210 else:
211 return import_fbx.load(self, context, filepath=self.filepath, **keywords)
214 class FBX_PT_import_include(bpy.types.Panel):
215 bl_space_type = 'FILE_BROWSER'
216 bl_region_type = 'TOOL_PROPS'
217 bl_label = "Include"
218 bl_parent_id = "FILE_PT_operator"
220 @classmethod
221 def poll(cls, context):
222 sfile = context.space_data
223 operator = sfile.active_operator
225 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
227 def draw(self, context):
228 layout = self.layout
229 layout.use_property_split = True
230 layout.use_property_decorate = False # No animation.
232 sfile = context.space_data
233 operator = sfile.active_operator
235 layout.prop(operator, "use_custom_normals")
236 layout.prop(operator, "use_subsurf")
237 layout.prop(operator, "use_custom_props")
238 sub = layout.row()
239 sub.enabled = operator.use_custom_props
240 sub.prop(operator, "use_custom_props_enum_as_string")
241 layout.prop(operator, "use_image_search")
242 layout.prop(operator, "colors_type")
245 class FBX_PT_import_transform(bpy.types.Panel):
246 bl_space_type = 'FILE_BROWSER'
247 bl_region_type = 'TOOL_PROPS'
248 bl_label = "Transform"
249 bl_parent_id = "FILE_PT_operator"
251 @classmethod
252 def poll(cls, context):
253 sfile = context.space_data
254 operator = sfile.active_operator
256 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
258 def draw(self, context):
259 layout = self.layout
260 layout.use_property_split = True
261 layout.use_property_decorate = False # No animation.
263 sfile = context.space_data
264 operator = sfile.active_operator
266 layout.prop(operator, "global_scale")
267 layout.prop(operator, "decal_offset")
268 row = layout.row()
269 row.prop(operator, "bake_space_transform")
270 row.label(text="", icon='ERROR')
271 layout.prop(operator, "use_prepost_rot")
274 class FBX_PT_import_transform_manual_orientation(bpy.types.Panel):
275 bl_space_type = 'FILE_BROWSER'
276 bl_region_type = 'TOOL_PROPS'
277 bl_label = "Manual Orientation"
278 bl_parent_id = "FBX_PT_import_transform"
280 @classmethod
281 def poll(cls, context):
282 sfile = context.space_data
283 operator = sfile.active_operator
285 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
287 def draw_header(self, context):
288 sfile = context.space_data
289 operator = sfile.active_operator
291 self.layout.prop(operator, "use_manual_orientation", text="")
293 def draw(self, context):
294 layout = self.layout
295 layout.use_property_split = True
296 layout.use_property_decorate = False # No animation.
298 sfile = context.space_data
299 operator = sfile.active_operator
301 layout.enabled = operator.use_manual_orientation
303 layout.prop(operator, "axis_forward")
304 layout.prop(operator, "axis_up")
307 class FBX_PT_import_animation(bpy.types.Panel):
308 bl_space_type = 'FILE_BROWSER'
309 bl_region_type = 'TOOL_PROPS'
310 bl_label = "Animation"
311 bl_parent_id = "FILE_PT_operator"
312 bl_options = {'DEFAULT_CLOSED'}
314 @classmethod
315 def poll(cls, context):
316 sfile = context.space_data
317 operator = sfile.active_operator
319 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
321 def draw_header(self, context):
322 sfile = context.space_data
323 operator = sfile.active_operator
325 self.layout.prop(operator, "use_anim", text="")
327 def draw(self, context):
328 layout = self.layout
329 layout.use_property_split = True
330 layout.use_property_decorate = False # No animation.
332 sfile = context.space_data
333 operator = sfile.active_operator
335 layout.enabled = operator.use_anim
337 layout.prop(operator, "anim_offset")
340 class FBX_PT_import_armature(bpy.types.Panel):
341 bl_space_type = 'FILE_BROWSER'
342 bl_region_type = 'TOOL_PROPS'
343 bl_label = "Armature"
344 bl_parent_id = "FILE_PT_operator"
345 bl_options = {'DEFAULT_CLOSED'}
347 @classmethod
348 def poll(cls, context):
349 sfile = context.space_data
350 operator = sfile.active_operator
352 return operator.bl_idname == "IMPORT_SCENE_OT_fbx"
354 def draw(self, context):
355 layout = self.layout
356 layout.use_property_split = True
357 layout.use_property_decorate = False # No animation.
359 sfile = context.space_data
360 operator = sfile.active_operator
362 layout.prop(operator, "ignore_leaf_bones")
363 layout.prop(operator, "force_connect_children"),
364 layout.prop(operator, "automatic_bone_orientation"),
365 sub = layout.column()
366 sub.enabled = not operator.automatic_bone_orientation
367 sub.prop(operator, "primary_bone_axis")
368 sub.prop(operator, "secondary_bone_axis")
371 @orientation_helper(axis_forward='-Z', axis_up='Y')
372 class ExportFBX(bpy.types.Operator, ExportHelper):
373 """Write a FBX file"""
374 bl_idname = "export_scene.fbx"
375 bl_label = "Export FBX"
376 bl_options = {'UNDO', 'PRESET'}
378 filename_ext = ".fbx"
379 filter_glob: StringProperty(default="*.fbx", options={'HIDDEN'})
381 # List of operator properties, the attributes will be assigned
382 # to the class instance from the operator settings before calling.
384 use_selection: BoolProperty(
385 name="Selected Objects",
386 description="Export selected and visible objects only",
387 default=False,
389 use_visible: BoolProperty(
390 name='Visible Objects',
391 description='Export visible objects only',
392 default=False
394 use_active_collection: BoolProperty(
395 name="Active Collection",
396 description="Export only objects from the active collection (and its children)",
397 default=False,
399 global_scale: FloatProperty(
400 name="Scale",
401 description="Scale all data (Some importers do not support scaled armatures!)",
402 min=0.001, max=1000.0,
403 soft_min=0.01, soft_max=1000.0,
404 default=1.0,
406 apply_unit_scale: BoolProperty(
407 name="Apply Unit",
408 description="Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)",
409 default=True,
411 apply_scale_options: EnumProperty(
412 items=(('FBX_SCALE_NONE', "All Local",
413 "Apply custom scaling and units scaling to each object transformation, FBX scale remains at 1.0"),
414 ('FBX_SCALE_UNITS', "FBX Units Scale",
415 "Apply custom scaling to each object transformation, and units scaling to FBX scale"),
416 ('FBX_SCALE_CUSTOM', "FBX Custom Scale",
417 "Apply custom scaling to FBX scale, and units scaling to each object transformation"),
418 ('FBX_SCALE_ALL', "FBX All",
419 "Apply custom scaling and units scaling to FBX scale"),
421 name="Apply Scalings",
422 description="How to apply custom and units scalings in generated FBX file "
423 "(Blender uses FBX scale to detect units on import, "
424 "but many other applications do not handle the same way)",
427 use_space_transform: BoolProperty(
428 name="Use Space Transform",
429 description="Apply global space transform to the object rotations. When disabled "
430 "only the axis space is written to the file and all object transforms are left as-is",
431 default=True,
433 bake_space_transform: BoolProperty(
434 name="Apply Transform",
435 description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
436 "target space is not aligned with Blender's space "
437 "(WARNING! experimental option, use at own risk, known to be broken with armatures/animations)",
438 default=False,
441 object_types: EnumProperty(
442 name="Object Types",
443 options={'ENUM_FLAG'},
444 items=(('EMPTY', "Empty", ""),
445 ('CAMERA', "Camera", ""),
446 ('LIGHT', "Lamp", ""),
447 ('ARMATURE', "Armature", "WARNING: not supported in dupli/group instances"),
448 ('MESH', "Mesh", ""),
449 ('OTHER', "Other", "Other geometry types, like curve, metaball, etc. (converted to meshes)"),
451 description="Which kind of object to export",
452 default={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'},
455 use_mesh_modifiers: BoolProperty(
456 name="Apply Modifiers",
457 description="Apply modifiers to mesh objects (except Armature ones) - "
458 "WARNING: prevents exporting shape keys",
459 default=True,
461 use_mesh_modifiers_render: BoolProperty(
462 name="Use Modifiers Render Setting",
463 description="Use render settings when applying modifiers to mesh objects (DISABLED in Blender 2.8)",
464 default=True,
466 mesh_smooth_type: EnumProperty(
467 name="Smoothing",
468 items=(('OFF', "Normals Only", "Export only normals instead of writing edge or face smoothing data"),
469 ('FACE', "Face", "Write face smoothing"),
470 ('EDGE', "Edge", "Write edge smoothing"),
472 description="Export smoothing information "
473 "(prefer 'Normals Only' option if your target importer understand split normals)",
474 default='OFF',
476 colors_type: EnumProperty(
477 name="Vertex Colors",
478 items=(('NONE', "None", "Do not export color attributes"),
479 ('SRGB', "sRGB", "Export colors in sRGB color space"),
480 ('LINEAR', "Linear", "Export colors in linear color space"),
482 description="Export vertex color attributes",
483 default='SRGB',
485 prioritize_active_color: BoolProperty(
486 name="Prioritize Active Color",
487 description="Make sure active color will be exported first. Could be important "
488 "since some other software can discard other color attributes besides the first one",
489 default=False,
491 use_subsurf: BoolProperty(
492 name="Export Subdivision Surface",
493 description="Export the last Catmull-Rom subdivision modifier as FBX subdivision "
494 "(does not apply the modifier even if 'Apply Modifiers' is enabled)",
495 default=False,
497 use_mesh_edges: BoolProperty(
498 name="Loose Edges",
499 description="Export loose edges (as two-vertices polygons)",
500 default=False,
502 use_tspace: BoolProperty(
503 name="Tangent Space",
504 description="Add binormal and tangent vectors, together with normal they form the tangent space "
505 "(will only work correctly with tris/quads only meshes!)",
506 default=False,
508 use_triangles: BoolProperty(
509 name="Triangulate Faces",
510 description="Convert all faces to triangles",
511 default=False,
513 use_custom_props: BoolProperty(
514 name="Custom Properties",
515 description="Export custom properties",
516 default=False,
518 add_leaf_bones: BoolProperty(
519 name="Add Leaf Bones",
520 description="Append a final bone to the end of each chain to specify last bone length "
521 "(use this when you intend to edit the armature from exported data)",
522 default=True # False for commit!
524 primary_bone_axis: EnumProperty(
525 name="Primary Bone Axis",
526 items=(('X', "X Axis", ""),
527 ('Y', "Y Axis", ""),
528 ('Z', "Z Axis", ""),
529 ('-X', "-X Axis", ""),
530 ('-Y', "-Y Axis", ""),
531 ('-Z', "-Z Axis", ""),
533 default='Y',
535 secondary_bone_axis: EnumProperty(
536 name="Secondary Bone Axis",
537 items=(('X', "X Axis", ""),
538 ('Y', "Y Axis", ""),
539 ('Z', "Z Axis", ""),
540 ('-X', "-X Axis", ""),
541 ('-Y', "-Y Axis", ""),
542 ('-Z', "-Z Axis", ""),
544 default='X',
546 use_armature_deform_only: BoolProperty(
547 name="Only Deform Bones",
548 description="Only write deforming bones (and non-deforming ones when they have deforming children)",
549 default=False,
551 armature_nodetype: EnumProperty(
552 name="Armature FBXNode Type",
553 items=(('NULL', "Null", "'Null' FBX node, similar to Blender's Empty (default)"),
554 ('ROOT', "Root", "'Root' FBX node, supposed to be the root of chains of bones..."),
555 ('LIMBNODE', "LimbNode", "'LimbNode' FBX node, a regular joint between two bones..."),
557 description="FBX type of node (object) used to represent Blender's armatures "
558 "(use the Null type unless you experience issues with the other app, "
559 "as other choices may not import back perfectly into Blender...)",
560 default='NULL',
562 bake_anim: BoolProperty(
563 name="Baked Animation",
564 description="Export baked keyframe animation",
565 default=True,
567 bake_anim_use_all_bones: BoolProperty(
568 name="Key All Bones",
569 description="Force exporting at least one key of animation for all bones "
570 "(needed with some target applications, like UE4)",
571 default=True,
573 bake_anim_use_nla_strips: BoolProperty(
574 name="NLA Strips",
575 description="Export each non-muted NLA strip as a separated FBX's AnimStack, if any, "
576 "instead of global scene animation",
577 default=True,
579 bake_anim_use_all_actions: BoolProperty(
580 name="All Actions",
581 description="Export each action as a separated FBX's AnimStack, instead of global scene animation "
582 "(note that animated objects will get all actions compatible with them, "
583 "others will get no animation at all)",
584 default=True,
586 bake_anim_force_startend_keying: BoolProperty(
587 name="Force Start/End Keying",
588 description="Always add a keyframe at start and end of actions for animated channels",
589 default=True,
591 bake_anim_step: FloatProperty(
592 name="Sampling Rate",
593 description="How often to evaluate animated values (in frames)",
594 min=0.01, max=100.0,
595 soft_min=0.1, soft_max=10.0,
596 default=1.0,
598 bake_anim_simplify_factor: FloatProperty(
599 name="Simplify",
600 description="How much to simplify baked values (0.0 to disable, the higher the more simplified)",
601 min=0.0, max=100.0, # No simplification to up to 10% of current magnitude tolerance.
602 soft_min=0.0, soft_max=10.0,
603 default=1.0, # default: min slope: 0.005, max frame step: 10.
605 path_mode: path_reference_mode
606 embed_textures: BoolProperty(
607 name="Embed Textures",
608 description="Embed textures in FBX binary file (only for \"Copy\" path mode!)",
609 default=False,
611 batch_mode: EnumProperty(
612 name="Batch Mode",
613 items=(('OFF', "Off", "Active scene to file"),
614 ('SCENE', "Scene", "Each scene as a file"),
615 ('COLLECTION', "Collection",
616 "Each collection (data-block ones) as a file, does not include content of children collections"),
617 ('SCENE_COLLECTION', "Scene Collections",
618 "Each collection (including master, non-data-block ones) of each scene as a file, "
619 "including content from children collections"),
620 ('ACTIVE_SCENE_COLLECTION', "Active Scene Collections",
621 "Each collection (including master, non-data-block one) of the active scene as a file, "
622 "including content from children collections"),
625 use_batch_own_dir: BoolProperty(
626 name="Batch Own Dir",
627 description="Create a dir for each exported file",
628 default=True,
630 use_metadata: BoolProperty(
631 name="Use Metadata",
632 default=True,
633 options={'HIDDEN'},
636 def draw(self, context):
637 pass
639 @property
640 def check_extension(self):
641 return self.batch_mode == 'OFF'
643 def execute(self, context):
644 from mathutils import Matrix
645 if not self.filepath:
646 raise Exception("filepath not set")
648 global_matrix = (axis_conversion(to_forward=self.axis_forward,
649 to_up=self.axis_up,
650 ).to_4x4()
651 if self.use_space_transform else Matrix())
653 keywords = self.as_keywords(ignore=("check_existing",
654 "filter_glob",
655 "ui_tab",
658 keywords["global_matrix"] = global_matrix
660 from . import export_fbx_bin
661 return export_fbx_bin.save(self, context, **keywords)
664 class FBX_PT_export_main(bpy.types.Panel):
665 bl_space_type = 'FILE_BROWSER'
666 bl_region_type = 'TOOL_PROPS'
667 bl_label = ""
668 bl_parent_id = "FILE_PT_operator"
669 bl_options = {'HIDE_HEADER'}
671 @classmethod
672 def poll(cls, context):
673 sfile = context.space_data
674 operator = sfile.active_operator
676 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
678 def draw(self, context):
679 layout = self.layout
680 layout.use_property_split = True
681 layout.use_property_decorate = False # No animation.
683 sfile = context.space_data
684 operator = sfile.active_operator
686 row = layout.row(align=True)
687 row.prop(operator, "path_mode")
688 sub = row.row(align=True)
689 sub.enabled = (operator.path_mode == 'COPY')
690 sub.prop(operator, "embed_textures", text="", icon='PACKAGE' if operator.embed_textures else 'UGLYPACKAGE')
691 row = layout.row(align=True)
692 row.prop(operator, "batch_mode")
693 sub = row.row(align=True)
694 sub.prop(operator, "use_batch_own_dir", text="", icon='NEWFOLDER')
697 class FBX_PT_export_include(bpy.types.Panel):
698 bl_space_type = 'FILE_BROWSER'
699 bl_region_type = 'TOOL_PROPS'
700 bl_label = "Include"
701 bl_parent_id = "FILE_PT_operator"
703 @classmethod
704 def poll(cls, context):
705 sfile = context.space_data
706 operator = sfile.active_operator
708 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
710 def draw(self, context):
711 layout = self.layout
712 layout.use_property_split = True
713 layout.use_property_decorate = False # No animation.
715 sfile = context.space_data
716 operator = sfile.active_operator
718 sublayout = layout.column(heading="Limit to")
719 sublayout.enabled = (operator.batch_mode == 'OFF')
720 sublayout.prop(operator, "use_selection")
721 sublayout.prop(operator, "use_visible")
722 sublayout.prop(operator, "use_active_collection")
724 layout.column().prop(operator, "object_types")
725 layout.prop(operator, "use_custom_props")
728 class FBX_PT_export_transform(bpy.types.Panel):
729 bl_space_type = 'FILE_BROWSER'
730 bl_region_type = 'TOOL_PROPS'
731 bl_label = "Transform"
732 bl_parent_id = "FILE_PT_operator"
734 @classmethod
735 def poll(cls, context):
736 sfile = context.space_data
737 operator = sfile.active_operator
739 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
741 def draw(self, context):
742 layout = self.layout
743 layout.use_property_split = True
744 layout.use_property_decorate = False # No animation.
746 sfile = context.space_data
747 operator = sfile.active_operator
749 layout.prop(operator, "global_scale")
750 layout.prop(operator, "apply_scale_options")
752 layout.prop(operator, "axis_forward")
753 layout.prop(operator, "axis_up")
755 layout.prop(operator, "apply_unit_scale")
756 layout.prop(operator, "use_space_transform")
757 row = layout.row()
758 row.prop(operator, "bake_space_transform")
759 row.label(text="", icon='ERROR')
762 class FBX_PT_export_geometry(bpy.types.Panel):
763 bl_space_type = 'FILE_BROWSER'
764 bl_region_type = 'TOOL_PROPS'
765 bl_label = "Geometry"
766 bl_parent_id = "FILE_PT_operator"
767 bl_options = {'DEFAULT_CLOSED'}
769 @classmethod
770 def poll(cls, context):
771 sfile = context.space_data
772 operator = sfile.active_operator
774 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
776 def draw(self, context):
777 layout = self.layout
778 layout.use_property_split = True
779 layout.use_property_decorate = False # No animation.
781 sfile = context.space_data
782 operator = sfile.active_operator
784 layout.prop(operator, "mesh_smooth_type")
785 layout.prop(operator, "use_subsurf")
786 layout.prop(operator, "use_mesh_modifiers")
787 #sub = layout.row()
788 #sub.enabled = operator.use_mesh_modifiers and False # disabled in 2.8...
789 #sub.prop(operator, "use_mesh_modifiers_render")
790 layout.prop(operator, "use_mesh_edges")
791 layout.prop(operator, "use_triangles")
792 sub = layout.row()
793 #~ sub.enabled = operator.mesh_smooth_type in {'OFF'}
794 sub.prop(operator, "use_tspace")
795 layout.prop(operator, "colors_type")
796 layout.prop(operator, "prioritize_active_color")
799 class FBX_PT_export_armature(bpy.types.Panel):
800 bl_space_type = 'FILE_BROWSER'
801 bl_region_type = 'TOOL_PROPS'
802 bl_label = "Armature"
803 bl_parent_id = "FILE_PT_operator"
804 bl_options = {'DEFAULT_CLOSED'}
806 @classmethod
807 def poll(cls, context):
808 sfile = context.space_data
809 operator = sfile.active_operator
811 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
813 def draw(self, context):
814 layout = self.layout
815 layout.use_property_split = True
816 layout.use_property_decorate = False # No animation.
818 sfile = context.space_data
819 operator = sfile.active_operator
821 layout.prop(operator, "primary_bone_axis")
822 layout.prop(operator, "secondary_bone_axis")
823 layout.prop(operator, "armature_nodetype")
824 layout.prop(operator, "use_armature_deform_only")
825 layout.prop(operator, "add_leaf_bones")
828 class FBX_PT_export_bake_animation(bpy.types.Panel):
829 bl_space_type = 'FILE_BROWSER'
830 bl_region_type = 'TOOL_PROPS'
831 bl_label = "Bake Animation"
832 bl_parent_id = "FILE_PT_operator"
833 bl_options = {'DEFAULT_CLOSED'}
835 @classmethod
836 def poll(cls, context):
837 sfile = context.space_data
838 operator = sfile.active_operator
840 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
842 def draw_header(self, context):
843 sfile = context.space_data
844 operator = sfile.active_operator
846 self.layout.prop(operator, "bake_anim", text="")
848 def draw(self, context):
849 layout = self.layout
850 layout.use_property_split = True
851 layout.use_property_decorate = False # No animation.
853 sfile = context.space_data
854 operator = sfile.active_operator
856 layout.enabled = operator.bake_anim
857 layout.prop(operator, "bake_anim_use_all_bones")
858 layout.prop(operator, "bake_anim_use_nla_strips")
859 layout.prop(operator, "bake_anim_use_all_actions")
860 layout.prop(operator, "bake_anim_force_startend_keying")
861 layout.prop(operator, "bake_anim_step")
862 layout.prop(operator, "bake_anim_simplify_factor")
865 def menu_func_import(self, context):
866 self.layout.operator(ImportFBX.bl_idname, text="FBX (.fbx)")
869 def menu_func_export(self, context):
870 self.layout.operator(ExportFBX.bl_idname, text="FBX (.fbx)")
873 classes = (
874 ImportFBX,
875 FBX_PT_import_include,
876 FBX_PT_import_transform,
877 FBX_PT_import_transform_manual_orientation,
878 FBX_PT_import_animation,
879 FBX_PT_import_armature,
880 ExportFBX,
881 FBX_PT_export_main,
882 FBX_PT_export_include,
883 FBX_PT_export_transform,
884 FBX_PT_export_geometry,
885 FBX_PT_export_armature,
886 FBX_PT_export_bake_animation,
890 def register():
891 for cls in classes:
892 bpy.utils.register_class(cls)
894 bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
895 bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
898 def unregister():
899 bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
900 bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
902 for cls in classes:
903 bpy.utils.unregister_class(cls)
906 if __name__ == "__main__":
907 register()