I need to know the current active vertex from within a Handler, so i do this:
import bpy, bmesh from bpy.app.handlers import persistent def find_active_vertex(bm): elem = next(reversed(bm.select_history), None) if isinstance(elem, bmesh.types.BMVert): return elem return None @persistent def edit_object_change_handler(scene): context = bpy.context obj=context.edit_object if obj and obj.type=="MESH" and context.mode=="EDIT_MESH": bm = bmesh.from_edit_mesh(obj.data) avi = find_active_vertex(bm) if avi: # ... more done here ... pass def register(): bpy.app.handlers.scene_update_post.append(edit_object_change_handler)
However this approach does not work. The following line seems to create a very unwanted misbehavior of Blender:
elem = next(reversed(bm.select_history), None)
As soon as i add this statement the weight editor in the "n" panel of the 3D View no longer accepts weight values as input.
So my question is: Is there an alternative to find the active Vertex within a Handler that does not affect the behavior of the Vertex Weights panel within the "n" properties sidebar of the 3D View ?