Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Guetzkow <rjg>2020-11-23 15:32:38 +0300
committerRobert Guetzkow <gitcommit@outlook.de>2020-11-23 15:37:34 +0300
commita0e8b8b7875ba1eb883a714344d6fbace6259b4f (patch)
tree34c77c900f35308c52ef4b95a19c3b95477db24b /io_scene_fbx
parentf3a8b264d19b2adc54baa87723907ce9442b8ecb (diff)
Fix T82830: Handle limit for vertex color and uv layers in importer
Blender has a limit for both vertex color layers and UV layers. The functions `bpy.types.Mesh.vertex_colors.new()` and `bpy.types.Mesh.uv_layers.new()` will return `None` once the limit is reached. The FBX importer and glTF importer didn't handle this case before and attempted to access the `data`, which failed. This patch adds the missing checks. In case no vertex colors or uv map can be created, the assignment of colors or uv coordinates is skipped. Reviewed By: mont29, julien Differential Revision: https://developer.blender.org/D9613
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/import_fbx.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 319c4972..ec16b6d1 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1079,6 +1079,12 @@ def blen_read_geom_layer_color(fbx_obj, mesh):
# Always init our new layers with full white opaque color.
color_lay = mesh.vertex_colors.new(name=fbx_layer_name, do_init=False)
+
+ if color_lay is None:
+ print("Failed to add {%r %r} vertex color layer to %r (probably too many of them?)"
+ "" % (layer_id, fbx_layer_name, mesh.name))
+ continue
+
blen_data = color_lay.data
# some valid files omit this data