0

My export operator modifies part of the scene before exporting, e. g. apply modifiers, fill holes in meshes. I have to be very careful to only save the scene before exporting. I'd like to prevent myself from accidencally saving the scene after the export.

Is there a way to undo everything the operator did?

Or another way, e. g. rename the scene? Mark it as un-saveable?

  • See https://blender.stackexchange.com/questions/146559/how-do-i-get-a-mesh-data-block-with-modifiers-and-shape-keys-applied-in-blender ie make changes to an "export proxy" mesh, in which case there are no saved changes. – batFINGER Apr 23 '21 at 07:01
  • @batFINGER Not sure how that helps. I need to make other changes by calling operators, which can't operate on the proxy. – Andreas Haferburg Apr 23 '21 at 15:33

1 Answers1

0

I ended up duplicating the meshes with bpy.ops.object.duplicate(). Requires the mesh to be selected and visible, for some reason, so I unhide it with o.hide_set(False).

I didn't delete the duplicates for testing, which resulted in an infinite loop when iterating over for o in context.scene.objects. So I collected all meshes first in a list, then iterated over that list.