Problem with transform(obj.matrix_world) durin an export operation


I’m working to maintain an import/export add-on package for Blender. There is an issue I’m experiencing with a transform operation and I’m hoping that you could explain how to fix it.

Prior to reading the mesh data for export, this python script is applying a transform to obj.matrix_world, thus:

self.meshData =

This works well, giving me the data in a common reference frame with all transforms applied. However, following the export, all of the objects have undergone an additional transform. That is, if I previously rotated an object by some angle around a point, it undergoes an additional, matching rotation during the export.

Please could you tell me how I can avoid this issue while still generating correct export data?

Note that I already attempted to use a mesh copy prior to the transform as a work-around, but I had to abandon that approach since Blender kept randomly corrupting the mesh data.

Thank you.

you should use to_mesh() on the object (with optionally modifiers applied) to get a copy of the mesh with origin at (0,0,0). You can safely transform it. If you work with an object instead, make sure to clear matrix_world after transformation the mesh, e.g. obj.matrix_world = Matrix()

Thank you, I’ll give that a try.

It is working very nicely now after I apply the ‘obj.matrix_world = Matrix()’ method. Thank you for your help!!!