Page MenuHome

BMesh.loops provides no access to data
Closed, ResolvedPublic

Description

System Information
Debian Jessie, Intel Corporation 4th Gen Core Processor Integrated Graphics Controller

Blender Version
Broken: 2.77a abf6f08

Short description of error
Unlike BMesh.verts, BMesh.edges and BMesh.faces, BMesh.loops provides no access to data - only custom data layer keys. Also the docs say "This meshes face sequence (read-only)."

Suggestion: either make BMLoopSeq iterable, or update docs to say it's not allowed.

Exact steps for others to reproduce the error

  1. Open default blend file
  2. Run this in the console:
import bmesh
bm = bmesh.new()
bm.from_mesh(C.object.data)
for loop in bm.loops:
     pass

TypeError: 'BMLoopSeq' object is not iterable

bm.loops[0]

TypeError: 'BMLoopSeq' object is not subscriptable

Workaround

Iterate over this sequence instead:

loops = (l for f in bm.faces for l in f.loops)

Event Timeline

Alex Fraser (z0r) added a project: Add-ons.
Alex Fraser (z0r) set Type to Bug.
Alex Fraser (z0r) created this task.
Alex Fraser (z0r) raised the priority of this task from to Needs Triage by Developer.