BMesh.loops provides no access to data #48258

Closed
opened 2016-04-24 15:09:58 +02:00 by Alex Fraser · 4 comments
Member

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)
**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` ](https://www.blender.org/api/blender_python_api_2_77_0/bmesh.types.html#bmesh.types.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) ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @z0r

Added subscriber: @z0r

This issue was referenced by blender/blender@727f15f7d8

This issue was referenced by blender/blender@727f15f7d8820f1dc9277fdabcfce47bdb9935fe

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#48258
No description provided.