Page MenuHome

Python API Function `bpy.data.meshes.mesh_from_object()` No Longer Works
Closed, ResolvedPublic

Description

System Information
Operating system: GNU/Linux Manjaro, Kernel 5.9.16-1-MANJARO
Graphics card: NVIDIA Geforce GTX 1080

Blender Version
After running git bisect, I have concluded that
2b723abea02c868d94623f4dd9e9b6775cb3aaab introduces the bug.
Looks like ea17a92cd7040c0d63a4ed3a8a60cd8f0a3cb77e was the last good commit.

Short description of error
bpy.data.meshes.mesh_from_object() returns an empty mesh where previously it would return a mesh.
There is a workaround to the problem but it requires updating the depsgraph, and in some cases the depsgraph is not available.
This breaks my addon, ChainTools, which uses the function for many tasks.

Exact steps for others to reproduce the error


Open the attached .blend file and run the script. It creates a mesh from the selected object and tells us how many faces it has, then it does the workaround and tells us again.
In an object that hasn't been changed and doesn't have any modifiers, such as this one, the results should be the same, and the mesh it produces should be the same as the mesh we see in the viewport representing the curve object.

If it produces

12
12

there is no bug.
But instead, the result is

0
12

Before the workaround, the result was a mesh with no data. After the workaround, we have the correct mesh.

It bears mentioning that the workaround I include here is from my addon, and I might have written it because of the bug this other commit was trying to fix!

Event Timeline

@Joseph Brandenburg (TheAngerSpecialist) It seems the .blend file you're talking about is missing. Could you please attach it to your report?

Robert Guetzkow (rjg) changed the task status from Needs Triage to Needs Information from User.Fri, Apr 30, 8:18 PM

Thanks, fixed it. Can't believe I forgot!

Robert Guetzkow (rjg) changed the task status from Needs Information from User to Needs Triage.Fri, Apr 30, 8:20 PM
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Mon, May 3, 5:46 PM
Philipp Oeser (lichtwerk) triaged this task as High priority.

I am seeing this in Release builds (not in Debug builds though).
Will dare setting this to High prio, since it looks like a regression.

CC @Campbell Barton (campbellbarton)