From 566a38db6d336a0cf2b6d2e1ca92ddb77c133864 Mon Sep 17 00:00:00 2001
From: Bastien Montagne <montagne29@wanadoo.fr>
Date: Mon, 16 Sep 2013 13:56:27 +0000
Subject: [PATCH] Fix [#36268] FBX exporter precision min is too big

Using a bit more flexible way to handle those values (range now from 10^-18 (20) to 10^2 (0) frames). Not sure we shouldn't rather get rid of such "magic" value and let user set frame threshold directly, though!
---
 io_scene_fbx/__init__.py   | 10 +++++-----
 io_scene_fbx/export_fbx.py |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 1bdf3efd6..1d7ba1c5e 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -157,8 +157,8 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
             name="Scale",
             description=("Scale all data "
                          "(Some importers do not support scaled armatures!)"),
-            min=0.01, max=1000.0,
-            soft_min=0.001, soft_max=1000.0,
+            min=0.001, max=1000.0,
+            soft_min=0.01, soft_max=1000.0,
             default=1.0,
             )
     axis_forward = EnumProperty(
@@ -246,9 +246,9 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
             name="Precision",
             description=("Tolerance for comparing double keyframes "
                         "(higher for greater accuracy)"),
-            min=1, max=16,
-            soft_min=1, soft_max=16,
-            default=6.0,
+            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.
             )
     path_mode = path_reference_mode
     batch_mode = EnumProperty(
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index 9513801b3..94b40eea1 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -1385,7 +1385,6 @@ def save_single(operator, scene, filepath="",
         # Write the Real Mesh data here
         fw('\n\t\tVertices: ')
         i = -1
-
         for v in me_vertices:
             if i == -1:
                 fw('%.6f,%.6f,%.6f' % v.co[:])
@@ -2601,7 +2600,8 @@ Connections:  {''')
         frame_orig = scene.frame_current
 
         if use_anim_optimize:
-            ANIM_OPTIMIZE_PRECISSION_FLOAT = 0.1 ** anim_optimize_precision
+            # Do we really want to keep such behavior? User could enter real value directly...
+            ANIM_OPTIMIZE_PRECISSION_FLOAT = 10 ** (-anim_optimize_precision + 2)
 
         # default action, when no actions are avaioable
         tmp_actions = []
-- 
GitLab