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:
authorBastien Montagne <bastien@blender.org>2022-06-13 13:55:09 +0300
committerBastien Montagne <bastien@blender.org>2022-06-13 13:55:09 +0300
commit514aca8ac9cf485a27676fca5441a6445aef498b (patch)
tree97d1dc863365025182f7277b172ef913d529c181 /io_scene_fbx
parentb91319aead96a5f6eaa11728626765dc288e8649 (diff)
Fix T98345: Import von FBX didn't work.
Highly suspect the source FBX file to be broken, but investigating a 20MB binary FBX file is not really an option right now, so cannot be 100% sure. This can only be realistically investigated if we get a much smaller reproducible case. In the mean while, add similar check about indices validity for source FBX data as we already have for destination Blender data arrays. This allows to keep importing instead of 'crshing' the import process at least.
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/__init__.py2
-rw-r--r--io_scene_fbx/import_fbx.py12
2 files changed, 10 insertions, 4 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index f7415a38..1b7e646d 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -3,7 +3,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (4, 36, 1),
+ "version": (4, 36, 2),
"blender": (3, 2, 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 5fabec24..90f0c016 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -778,16 +778,22 @@ def blen_read_geom_layerinfo(fbx_layer):
def blen_read_geom_array_setattr(generator, blen_data, blen_attr, fbx_data, stride, item_size, descr, xform):
"""Generic fbx_layer to blen_data setter, generator is expected to yield tuples (ble_idx, fbx_idx)."""
- max_idx = len(blen_data) - 1
+ max_blen_idx = len(blen_data) - 1
+ max_fbx_idx = len(fbx_data) - 1
print_error = True
def check_skip(blen_idx, fbx_idx):
nonlocal print_error
if fbx_idx < 0: # Negative values mean 'skip'.
return True
- if blen_idx > max_idx:
+ if blen_idx > max_blen_idx:
if print_error:
- print("ERROR: too much data in this layer, compared to elements in mesh, skipping!")
+ print("ERROR: too much data in this Blender layer, compared to elements in mesh, skipping!")
+ print_error = False
+ return True
+ if fbx_idx + item_size - 1 > max_fbx_idx:
+ if print_error:
+ print("ERROR: not enough data in this FBX layer, skipping!")
print_error = False
return True
return False