[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4798] trunk/py/scripts/addons/ io_scene_fbx/export_fbx.py: More FBX fixes regarding UV/textures, found while investigating a potential issue with mifth on IRC: handling of default empty texture ( when there are none real texture to export) was rather fuzzy/inconsistent.

Bastien Montagne montagne29 at wanadoo.fr
Mon Oct 14 17:00:20 CEST 2013


Revision: 4798
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4798
Author:   mont29
Date:     2013-10-14 15:00:20 +0000 (Mon, 14 Oct 2013)
Log Message:
-----------
More FBX fixes regarding UV/textures, found while investigating a potential issue with mifth on IRC: handling of default empty texture (when there are none real texture to export) was rather fuzzy/inconsistent.

Note: not to be backported, not 100% sure this is now correct, and not a regression anyway.

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

Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-10-13 14:45:27 UTC (rev 4797)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-10-14 15:00:20 UTC (rev 4798)
@@ -1585,16 +1585,17 @@
                         t_pi = (d.image for d in uvtexture.data)  # Can't use foreach_get here :(
                         fw(',\n\t\t\t           '.join(','.join('%d' % tex2idx[i] for i in chunk)
                                                        for chunk in grouper_exact(t_pi, _nchunk_idx)))
-                else:
-                    fw('\n\t\tLayerElementTexture: 0 {'
-                       '\n\t\t\tVersion: 101'
-                       '\n\t\t\tName: ""'
-                       '\n\t\t\tMappingInformationType: "NoMappingInformation"'
-                       '\n\t\t\tReferenceInformationType: "IndexToDirect"'
-                       '\n\t\t\tBlendMode: "Translucent"'
-                       '\n\t\t\tTextureAlpha: 1'
-                       '\n\t\t\tTextureId: ')
-                fw('\n\t\t}')
+                    fw('\n\t\t}')
+            if not do_textures:
+                fw('\n\t\tLayerElementTexture: 0 {'
+                   '\n\t\t\tVersion: 101'
+                   '\n\t\t\tName: ""'
+                   '\n\t\t\tMappingInformationType: "NoMappingInformation"'
+                   '\n\t\t\tReferenceInformationType: "IndexToDirect"'
+                   '\n\t\t\tBlendMode: "Translucent"'
+                   '\n\t\t\tTextureAlpha: 1'
+                   '\n\t\t\tTextureId: '
+                   '\n\t\t}')
             del t_uv
             del t_pi
 
@@ -1652,7 +1653,8 @@
                '\n\t\t\t}')
 
         # Always write this
-        if do_textures:
+        #if do_textures:
+        if True:
             fw('\n\t\t\tLayerElement:  {'
                '\n\t\t\t\tType: "LayerElementTexture"'
                '\n\t\t\t\tTypedIndex: 0'
@@ -1667,7 +1669,7 @@
         fw('\n\t\t}')
 
         if len(uvlayers) > 1:
-            for i in range(1, len(uvlayers)):  # Why start at 1 (i.e. skip first UV layer)??? --mont29
+            for i in range(1, len(uvlayers)):
                 fw('\n\t\tLayer: %d {'
                    '\n\t\t\tVersion: 100'
                    '\n\t\t\tLayerElement:  {'
@@ -1679,6 +1681,11 @@
                        '\n\t\t\t\tType: "LayerElementTexture"'
                        '\n\t\t\t\tTypedIndex: %d'
                        '\n\t\t\t}' % i)
+                else:
+                    fw('\n\t\t\tLayerElement:  {'
+                       '\n\t\t\t\tType: "LayerElementTexture"'
+                       '\n\t\t\t\tTypedIndex: 0'
+                       '\n\t\t\t}')
                 fw('\n\t\t}')
 
         # XXX Col layers are written before UV ones above, why adding them after UV here???



More information about the Bf-extensions-cvs mailing list