Python API Function bpy.data.meshes.mesh_from_object() No Longer Works #87944

Closed
opened 2021-04-30 19:04:56 +02:00 by Joseph Brandenburg · 11 comments

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
2b723abea0 introduces the bug.
Looks like ea17a92cd7 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
bug_april_30.blend
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!

**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](https://gitlab.com/josephbburg/blender-chaintools/-/tree/development), which uses the function for many tasks. **Exact steps for others to reproduce the error** [bug_april_30.blend](https://archive.blender.org/developer/F10047550/bug_april_30.blend) 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!

Added subscriber: @Josephbburg

Added subscriber: @Josephbburg

Added subscriber: @rjg

Added subscriber: @rjg

@Josephbburg It seems the .blend file you're talking about is missing. Could you please attach it to your report?

@Josephbburg It seems the .blend file you're talking about is missing. Could you please attach it to your report?

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

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

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

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscribers: @ideasman42, @lichtwerk

Added subscribers: @ideasman42, @lichtwerk
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Member

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 @ideasman42

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 @ideasman42
Campbell Barton self-assigned this 2021-05-04 13:06:31 +02:00

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

Resolved d18be66a54

Resolved d18be66a54
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 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#87944
No description provided.