Program hangs indefinitely when attempting to access any property of "link_loops" (BMElemSeq) #72946

Closed
opened 2020-01-07 07:24:15 +01:00 by Greg · 8 comments

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 432.00

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: blender/blender@f1aa4d18d4
Worked: (optional)

Short description of error
Program hangs indefinitely when attempting to get length of, iterate, or access any element in "link_loops" property of BMElemSeq, of bmesh created from object in blend file:

crash.7z

Exact steps for others to reproduce the error

  1. load blend file

  2. Switch to Scripting View

  3. Run the following python script code:


import bmesh
obj = bpy.context.scene.objects[0]
bm = bmesh.new()
bm.from_mesh(obj.data)
bm.verts.ensure_lookup_table()
len(bm.verts[0].link_loops)

**System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 432.00 **Blender Version** Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: `blender/blender@f1aa4d18d4` Worked: (optional) **Short description of error** Program hangs indefinitely when attempting to get length of, iterate, or access any element in "link_loops" property of BMElemSeq, of bmesh created from object in blend file: [crash.7z](https://archive.blender.org/developer/F8263956/crash.7z) **Exact steps for others to reproduce the error** 1) load blend file 2) Switch to Scripting View 3) Run the following python script code: ``` import bmesh obj = bpy.context.scene.objects[0] bm = bmesh.new() bm.from_mesh(obj.data) bm.verts.ensure_lookup_table() len(bm.verts[0].link_loops) ```
Author

Added subscriber: @pyro789x

Added subscriber: @pyro789x
Greg changed title from Program hangs indefinitely when attempting to get list of, or iterate, "link_loops" property of BMElemSeq to Program hangs indefinitely when attempting to access any property of "link_loops" (BMElemSeq) 2020-01-07 07:31:12 +01:00

Added subscriber: @Stan_Pancakes

Added subscriber: @Stan_Pancakes

There's something very wrong with the geometry in that particular mesh. For example, there are edgeless faces (0 and 5). Attempting to cut an edge there manually (between verts 0 and 3) will also result in this freeze. Deleting both faces and trying to fill the hole with alt+f fills with "edgeless" faces again.

How was this mesh created? Is that an import? If this was created solely with Blender's tools, it'd be nice to find out how, exactly, such errors became even possible.

To "fix" the geometry you can run, in Python console, this (while being in object mode):

C.object.data.validate()

There's something very wrong with the geometry in that particular mesh. For example, there are edgeless faces (0 and 5). Attempting to cut an edge there manually (between verts 0 and 3) will also result in this freeze. Deleting both faces and trying to fill the hole with alt+f fills with "edgeless" faces again. How was this mesh created? Is that an import? If this was created solely with Blender's tools, it'd be nice to find out how, exactly, such errors became even possible. To "fix" the geometry you can run, in Python console, this (while being in object mode): > C.object.data.validate()
Author

Not sure if you consider it "with Blender's tools", but it was created with the "from_pydata()" function

Here's the raw input:

make_bad_mesh.py

looks like throwing a blendMesh.validate() after blendMesh.from_pydata() does fix the issue. I wonder if from_pydata() should include an internal call to validate()?

Not sure if you consider it "with Blender's tools", but it was created with the "from_pydata()" function Here's the raw input: [make_bad_mesh.py](https://archive.blender.org/developer/F8265361/make_bad_mesh.py) looks like throwing a blendMesh.validate() after blendMesh.from_pydata() does fix the issue. I wonder if from_pydata() should include an internal call to validate()?
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Philipp Oeser self-assigned this 2020-01-08 11:50:46 +01:00
Member

Thx for the report, but this does not look like a bug to me.
(I havent checked in detail -- debugging external scripts for the exact misusage is out of scope of the bugtracker in this case, sorry)

But there is already a fat warning in the docs regarding this:

Invalid mesh data (out of range indices, edges with matching indices, 2 sided faces… etc) are not prevented. If the data used for mesh creation isn’t known to be valid, run Mesh.validate after this function.

https://docs.blender.org/api/master/bpy.types.Mesh.html#bpy.types.Mesh.from_pydata

Closing as this is working as intended...

Thx for the report, but this does not look like a bug to me. (I havent checked in detail -- debugging external scripts for the exact misusage is out of scope of the bugtracker in this case, sorry) But there is already a fat warning in the docs regarding this: > Invalid mesh data (out of range indices, edges with matching indices, 2 sided faces… etc) are **not** prevented. If the data used for mesh creation isn’t known to be valid, run Mesh.validate after this function. https://docs.blender.org/api/master/bpy.types.Mesh.html#bpy.types.Mesh.from_pydata Closing as this is working as intended...
Author

I wouldn't really classify it as a "script", the provided input is just providing a set of hardcoded vertices and faces. I'm also not seeing any of the issues you mention in the face list (out-of-range-indices, edges that contain the same index multiple times, or 2-sided faces, as each face is a simple triangle)

I wouldn't really classify it as a "script", the provided input is just providing a set of hardcoded vertices and faces. I'm also not seeing any of the issues you mention in the face list (out-of-range-indices, edges that contain the same index multiple times, or 2-sided faces, as each face is a simple triangle)
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#72946
No description provided.