Fix #115827: Follow active quad fails with an assertion

Replace check for Mesh.uv_layers with BMesh layer check
and report other failures which weren't accounted for.
This commit is contained in:
Campbell Barton
2023-12-06 20:12:25 +11:00
parent 86146c79f8
commit 3d0731e66c

View File

@@ -32,7 +32,7 @@ def extend(obj, EXTEND_MODE, use_uv_selection):
return STATUS_ERR_NOT_SELECTED # Active face is not selected.
if len(f_act.verts) != 4:
return STATUS_ERR_NOT_QUAD # Active face is not a quad
if not me.uv_layers:
if not bm.loops.layers.uv:
return STATUS_ERR_MISSING_UV_LAYER # Object's mesh doesn't have any UV layers.
uv_act = bm.loops.layers.uv.active # Always use the active UV layer.
@@ -240,6 +240,10 @@ def main(context, operator):
operator.report({'ERROR'}, "Active face must be a quad")
elif status & STATUS_ERR_NOT_SELECTED:
operator.report({'ERROR'}, "Active face not selected")
elif status & STATUS_ERR_NO_FACES_SELECTED:
operator.report({'ERROR'}, "No selected faces")
elif status & STATUS_ERR_MISSING_UV_LAYER:
operator.report({'ERROR'}, "No UV layers")
else:
assert status & STATUS_ERR_ACTIVE_FACE != 0
operator.report({'ERROR'}, "No active face")