I was under impression when I change the values of properties of operator, every time the operator is executed it runs on a snapshot of the mesh that was taken when the operator was invoked.
For instance, my operator manipulates the mesh, extrudes it and assigns values to custom properties via layers. As I see it, every time I change the property value, the operator is applied to the mesh that was changed by previous execution of the operator. Perhaps it has something to do with manipulating the mesh via bmesh.
Long story short, this is more or less what I do:
if bpy.context.mode != 'EDIT': bpy.ops.object.mode_set(mode = 'EDIT') mesh = bmesh.from_edit_mesh(context.active_object.data) fieldTypeLayer = mesh.faces.layers.int.get(pu.fieldTypeLayerName) for face in mesh.faces: face[fieldTypeLayer] = somealue extrudeVector = somevalue bpy.ops.mesh.extrude_region_move(params) bmesh.update_edit_mesh(context.active_object.data)
So basically, do I need to save a snapshot of a mesh on operator invoke and then before each execution restore our mesh from it, or am I missing something and blender is supposed to do it for me?