Page MenuHome

Object.to_mesh(preserve_all_data_layers=True,...) causes strange stateful-behavior in exporters
Closed, InvalidPublic

Description

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.

  1. Is this a bug then or does "preserving_all_data_layers" also mean making some stateful-ness.
  2. I would also like to know what exact data layers get dropped when preserving_all_data_layers is set to False.

Exact steps for others to reproduce the error

  1. Unless you really want to install and use the addon, I've provided the outputted files (look at how the VT entries change) and a screenshot

  1. The relevant code is in a file called xplane_mesh.py, lines 60-63 and 136. See on github (https://github.com/X-Plane/XPlane2Blender/blob/399-blender-28-support/io_xplane2blender/xplane_types/xplane_mesh.py)

Event Timeline

Jacques Lucke (JacquesLucke) changed the task status from Needs Triage to Needs Information from User.Sat, Dec 28, 3:30 PM

Are you able to reproduce this issue outside of your addon in a simple standalone script? That would make debugging the issue much easier.

Philipp Oeser (lichtwerk) claimed this task.

More than a week without reply or activity. Due to the policy of the tracker closing for until required info/data are provided.