diff --git a/makehuman/plugins/9_export_fbx/__init__.py b/makehuman/plugins/9_export_fbx/__init__.py index 980275198..f67e1d457 100644 --- a/makehuman/plugins/9_export_fbx/__init__.py +++ b/makehuman/plugins/9_export_fbx/__init__.py @@ -109,7 +109,6 @@ def getConfig(self): cfg.feetOnGround = self.feetOnGround.selected cfg.scale,cfg.unit = self.taskview.getScale() cfg.binary = self.binary.selected - cfg.scale *= 10 cfg.hiddenGeom = self.hiddenGeom.selected diff --git a/makehuman/plugins/9_export_fbx/fbx_binary.py b/makehuman/plugins/9_export_fbx/fbx_binary.py index 8032e1c09..be9303843 100644 --- a/makehuman/plugins/9_export_fbx/fbx_binary.py +++ b/makehuman/plugins/9_export_fbx/fbx_binary.py @@ -731,9 +731,8 @@ def fbx_header_elements(root, config, filepath, time=None): mesh_orientation = getMeshOrientation(config) up_axis, front_axis, coord_axis = RIGHT_HAND_AXES[mesh_orientation] - # Currently not sure about that, but looks like default unit of FBX is cm... - #scale_factor = 10.0/config.scale # MH scales the mesh coordinates, the scale factor is a constant - scale_factor = 10.0 + # FBX unit scale is expressed in centimeters. + scale_factor = 10.0 / config.scale elem_props_set(props, "p_integer", b"UpAxis", up_axis[0]) elem_props_set(props, "p_integer", b"UpAxisSign", up_axis[1]) elem_props_set(props, "p_integer", b"FrontAxis", front_axis[0]) diff --git a/makehuman/plugins/9_export_fbx/fbx_header.py b/makehuman/plugins/9_export_fbx/fbx_header.py index 83b6f3ad5..932d126ec 100644 --- a/makehuman/plugins/9_export_fbx/fbx_header.py +++ b/makehuman/plugins/9_export_fbx/fbx_header.py @@ -61,6 +61,7 @@ def writeHeader(fp, filepath, config): from . import fbx_utils mesh_orientation = fbx_utils.getMeshOrientation(config) up_axis, front_axis, coord_axis = fbx_utils.RIGHT_HAND_AXES[mesh_orientation] + scale_factor = 10.0 / config.scale fp.write("""; FBX 7.3.0 project file ; Exported from MakeHuman TM (www.makehumancommunity.org) @@ -126,8 +127,8 @@ def writeHeader(fp, filepath, config): P: "CoordAxisSign", "int", "Integer", "",%s P: "OriginalUpAxis", "int", "Integer", "",-1 P: "OriginalUpAxisSign", "int", "Integer", "",1 - P: "UnitScaleFactor", "double", "Number", "",10 - P: "OriginalUnitScaleFactor", "double", "Number", "",1 + P: "UnitScaleFactor", "double", "Number", "",%s + P: "OriginalUnitScaleFactor", "double", "Number", "",%s P: "AmbientColor", "ColorRGB", "Color", "",0,0,0 P: "DefaultCamera", "KString", "", "", "Producer Perspective" P: "TimeMode", "enum", "", "",0 @@ -135,7 +136,7 @@ def writeHeader(fp, filepath, config): P: "TimeSpanStop", "KTime", "Time", "",46186158000 P: "CustomFrameRate", "double", "Number", "",-1 } -}""" % (up_axis[0], up_axis[0], front_axis[0], front_axis[1], coord_axis[0], coord_axis[1]) + """ +}""" % (up_axis[0], up_axis[0], front_axis[0], front_axis[1], coord_axis[0], coord_axis[1], scale_factor, scale_factor) + """ ; Documents Description ;------------------------------------------------------------------