Object.to_mesh(preserve_all_data_layers=True,...) causes strange stateful-behavior in exporters #72581
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#72581
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Tested Windows 10, x64, various Mac OS versions
Graphics card:
Blender Version
Tested: Blender 2.80-2.82a2
Short description of error
I am not sure if this is a bug or me not understanding this API. I am the maintainer of XPlane2Blender, an exporter for our flight sim's own 3D format. My users noticed that exported geometry can sometimes shift or rotate (and other weird side-effects, such as the Blender Object itself having moved after export) after each time hitting export. The common theme we found was that things with Scale transformations and modifiers on the objects seemed to trigger it. The fix is to either restart Blender or Apply All Transformations to all objects and bones.
I tracked this issue down to one parameter of in my call to Object.to_mesh: if preserve_all_data_layers is set to False these problems (as far as I've seen) go away.
I am very confused by this. I thought this API (depsgraph_get, evaluated_get, to_mesh, to_mesh_clear) was all read only and any side effects would only be applied to the temporary mesh from to_mesh.
Exact steps for others to reproduce the error
export_multiple_times_result.blend
test_multiple_export_works3.obj
test_multiple_export_works6.obj
test_multiple_export_works9.obj
Added subscriber: @tngreene
Added subscriber: @JacquesLucke
Changed status from 'Needs Triage' to: 'Needs User Info'
Are you able to reproduce this issue outside of your addon in a simple standalone script? That would make debugging the issue much easier.
Added subscriber: @lichtwerk
Changed status from 'Needs User Info' to: 'Archived'
More than a week without reply or activity. Due to the policy of the tracker closing for until required info/data are provided.
Added subscriber: @skatbude
System Information
Operating system: Linux-5.7.2-sparky-amd64-x86_64-with-glibc2.29 64 Bits
Graphics card: Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2) Intel Open Source Technology Center 3.3 (Core Profile) Mesa 20.1.2
Blender Version
Broken: version: 2.83.2
Worked: -
Short description of error
I stumbled across the same issue while modifying the .obj-exporter.
The issue seems to be related to both
object.evaluated_get(depsgraph)
and
obj.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph)
The attached file contains a cube that is scaled by factor 2.
A custom Operator uses above code to retrieve the cube's mesh and then transform it by the cubes world matrix.
Next the coordinate of one Vertex is reported to Info.
Expected Result: (2, 2, 2) (modulo sign)
Actual Result: Coordinates double every time the Operator is executed.
Exact steps for others to reproduce the error
Open the attached .blend file and follow the instruction on screen (Readme file is included).
statefulBehaviour.blend