I'm trying to make an operator for my algorithm that worked fine runned just from script main function, but bmesh in edit mode loaded from operator is dead... So i just can't do anything with it.
def execute(cls, context): if context.mode == 'EDIT_MESH': bm = bmesh.from_edit_mesh(context.active_object.data) print(bm) bm.any_operation_at_bmesh()
<BMesh dead at 0x7f1f5558a670> Traceback (most recent call last): File "/home/michal/untitled.blend/paper_models.py", line 491, in poll ReferenceError: BMesh data of type BMesh has been removed location: <unknown location>:-1 location: <unknown location>:-1
And on second try of running anything from my script blender crashes...
In object mode loading mesh by:
bm = bmesh.new() bm.from_mesh(context.active_object.data)
works just fine but the object mode is just not appropriate for this operator.
What am I doing wrong?
My blender version is 2.71