Note
This issue has already been reported (https://developer.blender.org/T72581), but the task was closed due to missing information.
My attempt to provide the missing data didn't receive any attention, hence I am opening a new task now.
System Information
Operating system: Linux-5.8.0-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.5
Blender Version
Tested by original reporter: 2.80-2.82a2
Broken: version: 2.83.2, 2.83.3, 2.83.4, 2.90.0 Beta, branch: master, commit date: 2020-08-19 10:14, hash: rB83c78529b9ef, 2.91.0 Alpha, branch: master, commit date: 2020-08-19 22:55, hash: rB940b239ad473
Worked: -
Short description of error
We can use the following snippet to retrieve an evaluated mesh from an object while preserving all data layers.
This is useful e.g. in exporter scripts.
obj = context.object.evaluated_get(depsgraph) me = obj.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph) me.transform(obj.matrix_world) foo(me) # do something useful with 'me' obj.to_mesh_clear()
The problem arises when executing this code several times in a row. In that case the transformation of the mesh will 'stick' and then be applied multiple times.
It feels as if to_mesh_clear() didn't do anything and executing to_mesh(..) a second time would return the same, already transformed, mesh again.
This is contrary to the documentation of to_mesh:
The result is temporary [...]
Exact steps for others to reproduce the error
Open the attached .blend file and follow the instruction on screen (Readme file is included).
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