[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4760] trunk/py/scripts/addons/ io_scene_fbx: Fix [#36268] FBX exporter precision min is too big

Bastien Montagne montagne29 at wanadoo.fr
Mon Sep 16 15:56:28 CEST 2013


Revision: 4760
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4760
Author:   mont29
Date:     2013-09-16 13:56:27 +0000 (Mon, 16 Sep 2013)
Log Message:
-----------
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!

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_fbx/__init__.py
    trunk/py/scripts/addons/io_scene_fbx/export_fbx.py

Modified: trunk/py/scripts/addons/io_scene_fbx/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/__init__.py	2013-09-16 13:50:20 UTC (rev 4759)
+++ trunk/py/scripts/addons/io_scene_fbx/__init__.py	2013-09-16 13:56:27 UTC (rev 4760)
@@ -157,8 +157,8 @@
             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 @@
             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(

Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-09-16 13:50:20 UTC (rev 4759)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-09-16 13:56:27 UTC (rev 4760)
@@ -1383,9 +1383,9 @@
            )
 
         # Write the Real Mesh data here
+        _tm = time.process_time()
         fw('\n\t\tVertices: ')
         i = -1
-
         for v in me_vertices:
             if i == -1:
                 fw('%.6f,%.6f,%.6f' % v.co[:])
@@ -1396,7 +1396,9 @@
                     i = 0
                 fw(',%.6f,%.6f,%.6f' % v.co[:])
             i += 1
+        print("Old verts: done in %f secs..." % (time.process_time() - _tm))
 
+        _tm = time.process_time()
         fw('\n\t\tPolygonVertexIndex: ')
         i = -1
         for f in me_faces:
@@ -1418,6 +1420,7 @@
                 else:
                     fw(',%i,%i,%i,%i' % (fi[0], fi[1], fi[2], fi[3] ^ -1))
             i += 1
+        print("Old faces: done in %f secs..." % (time.process_time() - _tm))
 
         # write loose edges as faces.
         for ed in me_edges:
@@ -2601,7 +2604,8 @@
         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 = []



More information about the Bf-extensions-cvs mailing list