Page MenuHome

FBX and glTF importer: Handle limit for vertex color and uv layers
ClosedPublic

Authored by Robert Guetzkow (rjg) on Nov 20 2020, 3:06 PM.

Details

Summary

This patch fixes T82830 and additionally an unreported issue in the glTF 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.

Diff Detail

Repository
rBA Blender Add-ons
Branch
2020-11-20-layer-limits
Build Status
Buildable 11364
Build 11364: arc lint + arc unit

Event Timeline

Robert Guetzkow (rjg) requested review of this revision.Nov 20 2020, 3:06 PM
Robert Guetzkow (rjg) created this revision.
Robert Guetzkow (rjg) retitled this revision from Handle limit of uv layer and vertex color layers to FBX and glTF importer: Handle limit for vertex color and uv layers.Nov 20 2020, 3:07 PM
Robert Guetzkow (rjg) edited the summary of this revision. (Show Details)
Bastien Montagne (mont29) requested changes to this revision.Nov 20 2020, 3:15 PM

FBX already uses this message for None new UV layer, please harmonise them.

print("Failed to add {%r %r} UVLayer to %r (probably too many of them?)"
      "" % (layer_id, fbx_layer_name, mesh.name))

Adding @Julien DUROURE (julien) as reviewer since he's gltf dev.

This revision now requires changes to proceed.Nov 20 2020, 3:15 PM

Adjust warning message for FBX

Bastien Montagne (mont29) added 1 blocking reviewer(s): Julien DUROURE (julien).

FBX part LGTM, will let @Julien DUROURE (julien) check on the gltf one.

Seems to be OK for me too on glTF part

@Julien DUROURE (julien) Great! Could you please accept the revision then, otherwise I can't commit this as you're currently set as blocking reviewer.

This revision is now accepted and ready to land.Nov 23 2020, 12:36 PM