Skinify: fix shape generation
[blender-addons.git] / io_scene_fbx / __init__.py
blob42d7563a61c40bf61b03838e66b6547c6b4a47ca
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 bl_info = {
4 "name": "FBX format",
5 "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
6 "version": (4, 37, 5),
7 "blender": (3, 4, 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 use_subsurf: BoolProperty(
486 name="Export Subdivision Surface",
487 description="Export the last Catmull-Rom subdivision modifier as FBX subdivision "
488 "(does not apply the modifier even if 'Apply Modifiers' is enabled)",
489 default=False,
491 use_mesh_edges: BoolProperty(
492 name="Loose Edges",
493 description="Export loose edges (as two-vertices polygons)",
494 default=False,
496 use_tspace: BoolProperty(
497 name="Tangent Space",
498 description="Add binormal and tangent vectors, together with normal they form the tangent space "
499 "(will only work correctly with tris/quads only meshes!)",
500 default=False,
502 use_triangles: BoolProperty(
503 name="Triangulate Faces",
504 description="Convert all faces to triangles",
505 default=False,
507 use_custom_props: BoolProperty(
508 name="Custom Properties",
509 description="Export custom properties",
510 default=False,
512 add_leaf_bones: BoolProperty(
513 name="Add Leaf Bones",
514 description="Append a final bone to the end of each chain to specify last bone length "
515 "(use this when you intend to edit the armature from exported data)",
516 default=True # False for commit!
518 primary_bone_axis: EnumProperty(
519 name="Primary Bone Axis",
520 items=(('X', "X Axis", ""),
521 ('Y', "Y Axis", ""),
522 ('Z', "Z Axis", ""),
523 ('-X', "-X Axis", ""),
524 ('-Y', "-Y Axis", ""),
525 ('-Z', "-Z Axis", ""),
527 default='Y',
529 secondary_bone_axis: EnumProperty(
530 name="Secondary Bone Axis",
531 items=(('X', "X Axis", ""),
532 ('Y', "Y Axis", ""),
533 ('Z', "Z Axis", ""),
534 ('-X', "-X Axis", ""),
535 ('-Y', "-Y Axis", ""),
536 ('-Z', "-Z Axis", ""),
538 default='X',
540 use_armature_deform_only: BoolProperty(
541 name="Only Deform Bones",
542 description="Only write deforming bones (and non-deforming ones when they have deforming children)",
543 default=False,
545 armature_nodetype: EnumProperty(
546 name="Armature FBXNode Type",
547 items=(('NULL', "Null", "'Null' FBX node, similar to Blender's Empty (default)"),
548 ('ROOT', "Root", "'Root' FBX node, supposed to be the root of chains of bones..."),
549 ('LIMBNODE', "LimbNode", "'LimbNode' FBX node, a regular joint between two bones..."),
551 description="FBX type of node (object) used to represent Blender's armatures "
552 "(use the Null type unless you experience issues with the other app, "
553 "as other choices may not import back perfectly into Blender...)",
554 default='NULL',
556 bake_anim: BoolProperty(
557 name="Baked Animation",
558 description="Export baked keyframe animation",
559 default=True,
561 bake_anim_use_all_bones: BoolProperty(
562 name="Key All Bones",
563 description="Force exporting at least one key of animation for all bones "
564 "(needed with some target applications, like UE4)",
565 default=True,
567 bake_anim_use_nla_strips: BoolProperty(
568 name="NLA Strips",
569 description="Export each non-muted NLA strip as a separated FBX's AnimStack, if any, "
570 "instead of global scene animation",
571 default=True,
573 bake_anim_use_all_actions: BoolProperty(
574 name="All Actions",
575 description="Export each action as a separated FBX's AnimStack, instead of global scene animation "
576 "(note that animated objects will get all actions compatible with them, "
577 "others will get no animation at all)",
578 default=True,
580 bake_anim_force_startend_keying: BoolProperty(
581 name="Force Start/End Keying",
582 description="Always add a keyframe at start and end of actions for animated channels",
583 default=True,
585 bake_anim_step: FloatProperty(
586 name="Sampling Rate",
587 description="How often to evaluate animated values (in frames)",
588 min=0.01, max=100.0,
589 soft_min=0.1, soft_max=10.0,
590 default=1.0,
592 bake_anim_simplify_factor: FloatProperty(
593 name="Simplify",
594 description="How much to simplify baked values (0.0 to disable, the higher the more simplified)",
595 min=0.0, max=100.0, # No simplification to up to 10% of current magnitude tolerance.
596 soft_min=0.0, soft_max=10.0,
597 default=1.0, # default: min slope: 0.005, max frame step: 10.
599 path_mode: path_reference_mode
600 embed_textures: BoolProperty(
601 name="Embed Textures",
602 description="Embed textures in FBX binary file (only for \"Copy\" path mode!)",
603 default=False,
605 batch_mode: EnumProperty(
606 name="Batch Mode",
607 items=(('OFF', "Off", "Active scene to file"),
608 ('SCENE', "Scene", "Each scene as a file"),
609 ('COLLECTION', "Collection",
610 "Each collection (data-block ones) as a file, does not include content of children collections"),
611 ('SCENE_COLLECTION', "Scene Collections",
612 "Each collection (including master, non-data-block ones) of each scene as a file, "
613 "including content from children collections"),
614 ('ACTIVE_SCENE_COLLECTION', "Active Scene Collections",
615 "Each collection (including master, non-data-block one) of the active scene as a file, "
616 "including content from children collections"),
619 use_batch_own_dir: BoolProperty(
620 name="Batch Own Dir",
621 description="Create a dir for each exported file",
622 default=True,
624 use_metadata: BoolProperty(
625 name="Use Metadata",
626 default=True,
627 options={'HIDDEN'},
630 def draw(self, context):
631 pass
633 @property
634 def check_extension(self):
635 return self.batch_mode == 'OFF'
637 def execute(self, context):
638 from mathutils import Matrix
639 if not self.filepath:
640 raise Exception("filepath not set")
642 global_matrix = (axis_conversion(to_forward=self.axis_forward,
643 to_up=self.axis_up,
644 ).to_4x4()
645 if self.use_space_transform else Matrix())
647 keywords = self.as_keywords(ignore=("check_existing",
648 "filter_glob",
649 "ui_tab",
652 keywords["global_matrix"] = global_matrix
654 from . import export_fbx_bin
655 return export_fbx_bin.save(self, context, **keywords)
658 class FBX_PT_export_main(bpy.types.Panel):
659 bl_space_type = 'FILE_BROWSER'
660 bl_region_type = 'TOOL_PROPS'
661 bl_label = ""
662 bl_parent_id = "FILE_PT_operator"
663 bl_options = {'HIDE_HEADER'}
665 @classmethod
666 def poll(cls, context):
667 sfile = context.space_data
668 operator = sfile.active_operator
670 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
672 def draw(self, context):
673 layout = self.layout
674 layout.use_property_split = True
675 layout.use_property_decorate = False # No animation.
677 sfile = context.space_data
678 operator = sfile.active_operator
680 row = layout.row(align=True)
681 row.prop(operator, "path_mode")
682 sub = row.row(align=True)
683 sub.enabled = (operator.path_mode == 'COPY')
684 sub.prop(operator, "embed_textures", text="", icon='PACKAGE' if operator.embed_textures else 'UGLYPACKAGE')
685 row = layout.row(align=True)
686 row.prop(operator, "batch_mode")
687 sub = row.row(align=True)
688 sub.prop(operator, "use_batch_own_dir", text="", icon='NEWFOLDER')
691 class FBX_PT_export_include(bpy.types.Panel):
692 bl_space_type = 'FILE_BROWSER'
693 bl_region_type = 'TOOL_PROPS'
694 bl_label = "Include"
695 bl_parent_id = "FILE_PT_operator"
697 @classmethod
698 def poll(cls, context):
699 sfile = context.space_data
700 operator = sfile.active_operator
702 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
704 def draw(self, context):
705 layout = self.layout
706 layout.use_property_split = True
707 layout.use_property_decorate = False # No animation.
709 sfile = context.space_data
710 operator = sfile.active_operator
712 sublayout = layout.column(heading="Limit to")
713 sublayout.enabled = (operator.batch_mode == 'OFF')
714 sublayout.prop(operator, "use_selection")
715 sublayout.prop(operator, "use_visible")
716 sublayout.prop(operator, "use_active_collection")
718 layout.column().prop(operator, "object_types")
719 layout.prop(operator, "use_custom_props")
722 class FBX_PT_export_transform(bpy.types.Panel):
723 bl_space_type = 'FILE_BROWSER'
724 bl_region_type = 'TOOL_PROPS'
725 bl_label = "Transform"
726 bl_parent_id = "FILE_PT_operator"
728 @classmethod
729 def poll(cls, context):
730 sfile = context.space_data
731 operator = sfile.active_operator
733 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
735 def draw(self, context):
736 layout = self.layout
737 layout.use_property_split = True
738 layout.use_property_decorate = False # No animation.
740 sfile = context.space_data
741 operator = sfile.active_operator
743 layout.prop(operator, "global_scale")
744 layout.prop(operator, "apply_scale_options")
746 layout.prop(operator, "axis_forward")
747 layout.prop(operator, "axis_up")
749 layout.prop(operator, "apply_unit_scale")
750 layout.prop(operator, "use_space_transform")
751 row = layout.row()
752 row.prop(operator, "bake_space_transform")
753 row.label(text="", icon='ERROR')
756 class FBX_PT_export_geometry(bpy.types.Panel):
757 bl_space_type = 'FILE_BROWSER'
758 bl_region_type = 'TOOL_PROPS'
759 bl_label = "Geometry"
760 bl_parent_id = "FILE_PT_operator"
761 bl_options = {'DEFAULT_CLOSED'}
763 @classmethod
764 def poll(cls, context):
765 sfile = context.space_data
766 operator = sfile.active_operator
768 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
770 def draw(self, context):
771 layout = self.layout
772 layout.use_property_split = True
773 layout.use_property_decorate = False # No animation.
775 sfile = context.space_data
776 operator = sfile.active_operator
778 layout.prop(operator, "mesh_smooth_type")
779 layout.prop(operator, "use_subsurf")
780 layout.prop(operator, "use_mesh_modifiers")
781 #sub = layout.row()
782 #sub.enabled = operator.use_mesh_modifiers and False # disabled in 2.8...
783 #sub.prop(operator, "use_mesh_modifiers_render")
784 layout.prop(operator, "use_mesh_edges")
785 layout.prop(operator, "use_triangles")
786 sub = layout.row()
787 #~ sub.enabled = operator.mesh_smooth_type in {'OFF'}
788 sub.prop(operator, "use_tspace")
789 layout.prop(operator, "colors_type")
792 class FBX_PT_export_armature(bpy.types.Panel):
793 bl_space_type = 'FILE_BROWSER'
794 bl_region_type = 'TOOL_PROPS'
795 bl_label = "Armature"
796 bl_parent_id = "FILE_PT_operator"
797 bl_options = {'DEFAULT_CLOSED'}
799 @classmethod
800 def poll(cls, context):
801 sfile = context.space_data
802 operator = sfile.active_operator
804 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
806 def draw(self, context):
807 layout = self.layout
808 layout.use_property_split = True
809 layout.use_property_decorate = False # No animation.
811 sfile = context.space_data
812 operator = sfile.active_operator
814 layout.prop(operator, "primary_bone_axis")
815 layout.prop(operator, "secondary_bone_axis")
816 layout.prop(operator, "armature_nodetype")
817 layout.prop(operator, "use_armature_deform_only")
818 layout.prop(operator, "add_leaf_bones")
821 class FBX_PT_export_bake_animation(bpy.types.Panel):
822 bl_space_type = 'FILE_BROWSER'
823 bl_region_type = 'TOOL_PROPS'
824 bl_label = "Bake Animation"
825 bl_parent_id = "FILE_PT_operator"
826 bl_options = {'DEFAULT_CLOSED'}
828 @classmethod
829 def poll(cls, context):
830 sfile = context.space_data
831 operator = sfile.active_operator
833 return operator.bl_idname == "EXPORT_SCENE_OT_fbx"
835 def draw_header(self, context):
836 sfile = context.space_data
837 operator = sfile.active_operator
839 self.layout.prop(operator, "bake_anim", text="")
841 def draw(self, context):
842 layout = self.layout
843 layout.use_property_split = True
844 layout.use_property_decorate = False # No animation.
846 sfile = context.space_data
847 operator = sfile.active_operator
849 layout.enabled = operator.bake_anim
850 layout.prop(operator, "bake_anim_use_all_bones")
851 layout.prop(operator, "bake_anim_use_nla_strips")
852 layout.prop(operator, "bake_anim_use_all_actions")
853 layout.prop(operator, "bake_anim_force_startend_keying")
854 layout.prop(operator, "bake_anim_step")
855 layout.prop(operator, "bake_anim_simplify_factor")
858 def menu_func_import(self, context):
859 self.layout.operator(ImportFBX.bl_idname, text="FBX (.fbx)")
862 def menu_func_export(self, context):
863 self.layout.operator(ExportFBX.bl_idname, text="FBX (.fbx)")
866 classes = (
867 ImportFBX,
868 FBX_PT_import_include,
869 FBX_PT_import_transform,
870 FBX_PT_import_transform_manual_orientation,
871 FBX_PT_import_animation,
872 FBX_PT_import_armature,
873 ExportFBX,
874 FBX_PT_export_main,
875 FBX_PT_export_include,
876 FBX_PT_export_transform,
877 FBX_PT_export_geometry,
878 FBX_PT_export_armature,
879 FBX_PT_export_bake_animation,
883 def register():
884 for cls in classes:
885 bpy.utils.register_class(cls)
887 bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
888 bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
891 def unregister():
892 bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
893 bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
895 for cls in classes:
896 bpy.utils.unregister_class(cls)
899 if __name__ == "__main__":
900 register()