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.
This commit is contained in:
parent
b91319aead
commit
514aca8ac9
Notes:
blender-bot
2023-02-14 18:20:26 +01:00
Referenced by issue #98345, Import von FBX didn't work.
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue