[Bf-extensions-cvs] [91d241f5] master: Fix T62224: FBX importer dosen't import uv-maps correctly when there is 2 or more maps.

Bastien Montagne noreply at git.blender.org
Tue Mar 5 21:48:59 CET 2019


Commit: 91d241f5b7df9a3806072765cc5371c5ee34dbd7
Author: Bastien Montagne
Date:   Tue Mar 5 21:46:14 2019 +0100
Branches: master
https://developer.blender.org/rBA91d241f5b7df9a3806072765cc5371c5ee34dbd7

Fix T62224: FBX importer dosen't import uv-maps correctly when there is 2 or more maps.

Do not do 'smart' init of our UV/VCol data layers, this is lost
computation and can generate issues when not all items are explicitely
defined in FBX file.

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/import_fbx.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 6487bf01..ce7f748f 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (4, 14, 3),
+    "version": (4, 14, 4),
     "blender": (2, 80, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index b3f78660..08b7c0fe 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1006,7 +1006,8 @@ def blen_read_geom_layer_uv(fbx_obj, mesh):
             fbx_layer_data = elem_prop_first(elem_find_first(fbx_layer, b'UV'))
             fbx_layer_index = elem_prop_first(elem_find_first(fbx_layer, b'UVIndex'))
 
-            uv_lay = mesh.uv_layers.new(name=fbx_layer_name)
+            # Always init our new layers with (0, 0) UVs.
+            uv_lay = mesh.uv_layers.new(name=fbx_layer_name, do_init=False)
             if uv_lay is None:
                 print("Failed to add {%r %r} UVLayer to %r (probably too many of them?)"
                       "" % (layer_id, fbx_layer_name, mesh.name))
@@ -1040,7 +1041,8 @@ def blen_read_geom_layer_color(fbx_obj, mesh):
             fbx_layer_data = elem_prop_first(elem_find_first(fbx_layer, b'Colors'))
             fbx_layer_index = elem_prop_first(elem_find_first(fbx_layer, b'ColorIndex'))
 
-            color_lay = mesh.vertex_colors.new(name=fbx_layer_name)
+            # Always init our new layers with full white opaque color.
+            color_lay = mesh.vertex_colors.new(name=fbx_layer_name, do_init=False)
             blen_data = color_lay.data
 
             # some valid files omit this data



More information about the Bf-extensions-cvs mailing list