2
$\begingroup$

The last state of my unsuccessful attempts has been the attached code sample.

obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
bm.faces.ensure_lookup_table()
for face in bm.faces:
    face.select_set(True)
    if bpy.ops.uv.smart_project.poll():
        bpy.ops.uv.smart_project()
    face.select_set(False)
    bmesh.update_edit_mesh(me, True)

This will lead to an error "ReferenceError: BMesh data of type BMFace has been removed". Replacing

face.select_set(False)

by

bpy.ops.mesh.select_all(action = 'DESELECT')

leads to a Blender crash.

$\endgroup$
  • $\begingroup$ The last line bmesh.update_edit_mesh(me, True) is indented and thus repeatedly executed in the for loop. I don't think this is intended and might cause the error. $\endgroup$ – pink vertex Aug 11 '15 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.