Merge branch 'master' into blender2.8
Conflicts: io_scene_fbx/export_fbx.py io_scene_fbx/import_fbx.py
This commit is contained in:
commit
9c5c696bec
|
@ -21,7 +21,7 @@
|
|||
bl_info = {
|
||||
"name": "FBX format",
|
||||
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
|
||||
"version": (3, 9, 2),
|
||||
"version": (3, 10, 0),
|
||||
"blender": (2, 79, 1),
|
||||
"location": "File > Import-Export",
|
||||
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
|
||||
|
@ -246,16 +246,6 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
|
||||
version = EnumProperty(
|
||||
items=(('BIN7400', "FBX 7.4 binary", "Modern 7.4 binary version"),
|
||||
('ASCII6100', "FBX 6.1 ASCII",
|
||||
"Legacy 6.1 ascii version - WARNING: Deprecated and no more maintained"),
|
||||
),
|
||||
name="Version",
|
||||
description="Choose which version of the exporter to use",
|
||||
)
|
||||
|
||||
# 7.4 only
|
||||
ui_tab = EnumProperty(
|
||||
items=(('MAIN', "Main", "Main basic settings"),
|
||||
('GEOMETRY', "Geometries", "Geometry-related settings"),
|
||||
|
@ -278,13 +268,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
soft_min=0.01, soft_max=1000.0,
|
||||
default=1.0,
|
||||
)
|
||||
# 7.4 only
|
||||
apply_unit_scale = BoolProperty(
|
||||
name="Apply Unit",
|
||||
description="Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)",
|
||||
default=True,
|
||||
)
|
||||
# 7.4 only
|
||||
apply_scale_options = EnumProperty(
|
||||
items=(('FBX_SCALE_NONE', "All Local",
|
||||
"Apply custom scaling and units scaling to each object transformation, FBX scale remains at 1.0"),
|
||||
|
@ -300,7 +288,6 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
"(Blender uses FBX scale to detect units on import, "
|
||||
"but many other applications do not handle the same way)",
|
||||
)
|
||||
# 7.4 only
|
||||
bake_space_transform = BoolProperty(
|
||||
name="!EXPERIMENTAL! Apply Transform",
|
||||
description="Bake space transform into object data, avoids getting unwanted rotations to objects when "
|
||||
|
@ -349,14 +336,12 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
description="Export loose edges (as two-vertices polygons)",
|
||||
default=False,
|
||||
)
|
||||
# 7.4 only
|
||||
use_tspace = BoolProperty(
|
||||
name="Tangent Space",
|
||||
description="Add binormal and tangent vectors, together with normal they form the tangent space "
|
||||
"(will only work correctly with tris/quads only meshes!)",
|
||||
default=False,
|
||||
)
|
||||
# 7.4 only
|
||||
use_custom_props = BoolProperty(
|
||||
name="Custom Properties",
|
||||
description="Export custom properties",
|
||||
|
@ -406,7 +391,6 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
"perfectly in Blender...)",
|
||||
default='NULL',
|
||||
)
|
||||
# Anim - 7.4
|
||||
bake_anim = BoolProperty(
|
||||
name="Baked Animation",
|
||||
description="Export baked keyframe animation",
|
||||
|
@ -450,38 +434,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
soft_min=0.0, soft_max=10.0,
|
||||
default=1.0, # default: min slope: 0.005, max frame step: 10.
|
||||
)
|
||||
# Anim - 6.1
|
||||
use_anim = BoolProperty(
|
||||
name="Animation",
|
||||
description="Export keyframe animation",
|
||||
default=True,
|
||||
)
|
||||
use_anim_action_all = BoolProperty(
|
||||
name="All Actions",
|
||||
description=("Export all actions for armatures or just the currently selected action"),
|
||||
default=True,
|
||||
)
|
||||
use_default_take = BoolProperty(
|
||||
name="Default Take",
|
||||
description="Export currently assigned object and armature animations into a default take from the scene "
|
||||
"start/end frames",
|
||||
default=True
|
||||
)
|
||||
use_anim_optimize = BoolProperty(
|
||||
name="Optimize Keyframes",
|
||||
description="Remove double keyframes",
|
||||
default=True,
|
||||
)
|
||||
anim_optimize_precision = FloatProperty(
|
||||
name="Precision",
|
||||
description="Tolerance for comparing double keyframes (higher for greater accuracy)",
|
||||
min=0.0, max=20.0, # from 10^2 to 10^-18 frames precision.
|
||||
soft_min=1.0, soft_max=16.0,
|
||||
default=6.0, # default: 10^-4 frames.
|
||||
)
|
||||
# End anim
|
||||
path_mode = path_reference_mode
|
||||
# 7.4 only
|
||||
embed_textures = BoolProperty(
|
||||
name="Embed Textures",
|
||||
description="Embed textures in FBX binary file (only for \"Copy\" path mode!)",
|
||||
|
@ -508,92 +461,61 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.prop(self, "version")
|
||||
|
||||
if self.version == 'BIN7400':
|
||||
layout.prop(self, "ui_tab", expand=True)
|
||||
if self.ui_tab == 'MAIN':
|
||||
layout.prop(self, "use_selection")
|
||||
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
row.prop(self, "global_scale")
|
||||
sub = row.row(align=True)
|
||||
sub.prop(self, "apply_unit_scale", text="", icon='NDOF_TRANS')
|
||||
col.prop(self, "apply_scale_options")
|
||||
|
||||
layout.prop(self, "axis_forward")
|
||||
layout.prop(self, "axis_up")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(self, "object_types")
|
||||
layout.prop(self, "bake_space_transform")
|
||||
layout.prop(self, "use_custom_props")
|
||||
|
||||
layout.separator()
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "path_mode")
|
||||
sub = row.row(align=True)
|
||||
sub.enabled = (self.path_mode == 'COPY')
|
||||
sub.prop(self, "embed_textures", text="", icon='PACKAGE' if self.embed_textures else 'UGLYPACKAGE')
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "batch_mode")
|
||||
sub = row.row(align=True)
|
||||
sub.prop(self, "use_batch_own_dir", text="", icon='NEWFOLDER')
|
||||
elif self.ui_tab == 'GEOMETRY':
|
||||
layout.prop(self, "use_mesh_modifiers")
|
||||
sub = layout.row()
|
||||
sub.enabled = self.use_mesh_modifiers
|
||||
sub.prop(self, "use_mesh_modifiers_render")
|
||||
layout.prop(self, "mesh_smooth_type")
|
||||
layout.prop(self, "use_mesh_edges")
|
||||
sub = layout.row()
|
||||
#~ sub.enabled = self.mesh_smooth_type in {'OFF'}
|
||||
sub.prop(self, "use_tspace")
|
||||
elif self.ui_tab == 'ARMATURE':
|
||||
layout.prop(self, "use_armature_deform_only")
|
||||
layout.prop(self, "add_leaf_bones")
|
||||
layout.prop(self, "primary_bone_axis")
|
||||
layout.prop(self, "secondary_bone_axis")
|
||||
layout.prop(self, "armature_nodetype")
|
||||
elif self.ui_tab == 'ANIMATION':
|
||||
layout.prop(self, "bake_anim")
|
||||
col = layout.column()
|
||||
col.enabled = self.bake_anim
|
||||
col.prop(self, "bake_anim_use_all_bones")
|
||||
col.prop(self, "bake_anim_use_nla_strips")
|
||||
col.prop(self, "bake_anim_use_all_actions")
|
||||
col.prop(self, "bake_anim_force_startend_keying")
|
||||
col.prop(self, "bake_anim_step")
|
||||
col.prop(self, "bake_anim_simplify_factor")
|
||||
else:
|
||||
layout.prop(self, "ui_tab", expand=True)
|
||||
if self.ui_tab == 'MAIN':
|
||||
layout.prop(self, "use_selection")
|
||||
layout.prop(self, "global_scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
row.prop(self, "global_scale")
|
||||
sub = row.row(align=True)
|
||||
sub.prop(self, "apply_unit_scale", text="", icon='NDOF_TRANS')
|
||||
col.prop(self, "apply_scale_options")
|
||||
|
||||
layout.prop(self, "axis_forward")
|
||||
layout.prop(self, "axis_up")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(self, "object_types")
|
||||
layout.prop(self, "bake_space_transform")
|
||||
layout.prop(self, "use_custom_props")
|
||||
|
||||
layout.separator()
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "path_mode")
|
||||
sub = row.row(align=True)
|
||||
sub.enabled = (self.path_mode == 'COPY')
|
||||
sub.prop(self, "embed_textures", text="", icon='PACKAGE' if self.embed_textures else 'UGLYPACKAGE')
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "batch_mode")
|
||||
sub = row.row(align=True)
|
||||
sub.prop(self, "use_batch_own_dir", text="", icon='NEWFOLDER')
|
||||
elif self.ui_tab == 'GEOMETRY':
|
||||
layout.prop(self, "use_mesh_modifiers")
|
||||
sub = layout.row()
|
||||
sub.enabled = self.use_mesh_modifiers
|
||||
sub.prop(self, "use_mesh_modifiers_render")
|
||||
layout.prop(self, "mesh_smooth_type")
|
||||
layout.prop(self, "use_mesh_edges")
|
||||
sub = layout.row()
|
||||
#~ sub.enabled = self.mesh_smooth_type in {'OFF'}
|
||||
sub.prop(self, "use_tspace")
|
||||
elif self.ui_tab == 'ARMATURE':
|
||||
layout.prop(self, "use_armature_deform_only")
|
||||
layout.prop(self, "use_anim")
|
||||
layout.prop(self, "add_leaf_bones")
|
||||
layout.prop(self, "primary_bone_axis")
|
||||
layout.prop(self, "secondary_bone_axis")
|
||||
layout.prop(self, "armature_nodetype")
|
||||
elif self.ui_tab == 'ANIMATION':
|
||||
layout.prop(self, "bake_anim")
|
||||
col = layout.column()
|
||||
col.enabled = self.use_anim
|
||||
col.prop(self, "use_anim_action_all")
|
||||
col.prop(self, "use_default_take")
|
||||
col.prop(self, "use_anim_optimize")
|
||||
col.prop(self, "anim_optimize_precision")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(self, "path_mode")
|
||||
|
||||
layout.prop(self, "batch_mode")
|
||||
layout.prop(self, "use_batch_own_dir")
|
||||
col.enabled = self.bake_anim
|
||||
col.prop(self, "bake_anim_use_all_bones")
|
||||
col.prop(self, "bake_anim_use_nla_strips")
|
||||
col.prop(self, "bake_anim_use_all_actions")
|
||||
col.prop(self, "bake_anim_force_startend_keying")
|
||||
col.prop(self, "bake_anim_step")
|
||||
col.prop(self, "bake_anim_simplify_factor")
|
||||
|
||||
@property
|
||||
def check_extension(self):
|
||||
|
@ -615,12 +537,8 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
|
|||
|
||||
keywords["global_matrix"] = global_matrix
|
||||
|
||||
if self.version == 'BIN7400':
|
||||
from . import export_fbx_bin
|
||||
return export_fbx_bin.save(self, context, **keywords)
|
||||
else:
|
||||
from . import export_fbx
|
||||
return export_fbx.save(self, context, **keywords)
|
||||
from . import export_fbx_bin
|
||||
return export_fbx_bin.save(self, context, **keywords)
|
||||
|
||||
|
||||
def menu_func_import(self, context):
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1328,7 +1328,6 @@ def blen_read_material(fbx_tmpl, fbx_obj, settings):
|
|||
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
#~ assert(fbx_props[0] is not None) # Some Material may be missing that one, it seems... see T50566.
|
||||
|
||||
ma_diff = elem_props_get_color_rgb(fbx_props, b'DiffuseColor', const_color_white)
|
||||
ma_spec = elem_props_get_color_rgb(fbx_props, b'SpecularColor', const_color_white)
|
||||
|
@ -1446,7 +1445,6 @@ def blen_read_camera(fbx_tmpl, fbx_obj, global_scale):
|
|||
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
assert(fbx_props[0] is not None)
|
||||
|
||||
camera = bpy.data.cameras.new(name=elem_name_utf8)
|
||||
|
||||
|
@ -1475,10 +1473,6 @@ def blen_read_light(fbx_tmpl, fbx_obj, global_scale):
|
|||
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
# rare
|
||||
if fbx_props[0] is None:
|
||||
lamp = bpy.data.lights.new(name=elem_name_utf8, type='POINT')
|
||||
return lamp
|
||||
|
||||
light_type = {
|
||||
0: 'POINT',
|
||||
|
@ -1959,7 +1953,6 @@ class FbxImportHelperNode:
|
|||
|
||||
fbx_props = (elem_find_first(self.fbx_elem, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
assert(fbx_props[0] is not None)
|
||||
|
||||
# ----
|
||||
# Misc Attributes
|
||||
|
@ -2116,7 +2109,6 @@ class FbxImportHelperNode:
|
|||
if self.fbx_elem:
|
||||
fbx_props = (elem_find_first(self.fbx_elem, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
assert(fbx_props[0] is not None)
|
||||
|
||||
if settings.use_custom_props:
|
||||
blen_read_custom_properties(self.fbx_elem, arm, settings)
|
||||
|
@ -2436,7 +2428,7 @@ def load(operator, context, filepath="",
|
|||
|
||||
def fbx_template_get(key):
|
||||
ret = fbx_templates.get(key, fbx_elem_nil)
|
||||
if ret is None:
|
||||
if ret is fbx_elem_nil:
|
||||
# Newest FBX (7.4 and above) use no more 'K' in their type names...
|
||||
key = (key[0], key[1][1:])
|
||||
return fbx_templates.get(key, fbx_elem_nil)
|
||||
|
@ -2596,7 +2588,6 @@ def load(operator, context, filepath="",
|
|||
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
assert(fbx_props[0] is not None)
|
||||
|
||||
transform_data = blen_read_object_transform_preprocess(fbx_props, fbx_obj, Matrix(), use_prepost_rot)
|
||||
# Note: 'Root' "bones" are handled as (armature) objects.
|
||||
|
@ -2957,8 +2948,6 @@ def load(operator, context, filepath="",
|
|||
assert(fbx_obj.id == b'Material')
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
# Do not assert, it can be None actually, sigh...
|
||||
#~ assert(fbx_props[0] is not None)
|
||||
# (x / 7.142) is only a guess, cycles usable range is (0.0 -> 0.5)
|
||||
return elem_props_get_number(fbx_props, b'BumpFactor', 2.5) / 7.142
|
||||
|
||||
|
@ -2967,8 +2956,6 @@ def load(operator, context, filepath="",
|
|||
|
||||
fbx_props = (elem_find_first(fbx_obj, b'Properties70'),
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
# Do not assert, it can be None actually, sigh...
|
||||
#~ assert(fbx_props[0] is not None)
|
||||
return (elem_props_get_vector_3d(fbx_props, b'Translation', (0.0, 0.0, 0.0)),
|
||||
elem_props_get_vector_3d(fbx_props, b'Rotation', (0.0, 0.0, 0.0)),
|
||||
elem_props_get_vector_3d(fbx_props, b'Scaling', (1.0, 1.0, 1.0)),
|
||||
|
|
Loading…
Reference in New Issue