BMesh: add select next/prev operator
This uses selection history to select the next vert/edge/face based on surrounding topology. Select previous just removes the last selected element. Uses key-bindings: Ctrl-Shift +/-
This commit is contained in:
@@ -148,3 +148,53 @@ class MeshMirrorUV(Operator):
|
||||
double_warn)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class MeshSelectNext(Operator):
|
||||
"""Select the next element (using selection order)"""
|
||||
bl_idname = "mesh.select_next_item"
|
||||
bl_label = "Select Next Element"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.mode == 'EDIT_MESH')
|
||||
|
||||
def execute(self, context):
|
||||
import bmesh
|
||||
from .bmesh import find_adjacent
|
||||
|
||||
obj = context.active_object
|
||||
me = obj.data
|
||||
bm = bmesh.from_edit_mesh(me)
|
||||
|
||||
if find_adjacent.select_next(bm, self.report):
|
||||
bm.select_flush_mode()
|
||||
bmesh.update_edit_mesh(me, False)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class MeshSelectPrev(Operator):
|
||||
"""Select the next element (using selection order)"""
|
||||
bl_idname = "mesh.select_prev_item"
|
||||
bl_label = "Select Previous Element"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.mode == 'EDIT_MESH')
|
||||
|
||||
def execute(self, context):
|
||||
import bmesh
|
||||
from .bmesh import find_adjacent
|
||||
|
||||
obj = context.active_object
|
||||
me = obj.data
|
||||
bm = bmesh.from_edit_mesh(me)
|
||||
|
||||
if find_adjacent.select_prev(bm, self.report):
|
||||
bm.select_flush_mode()
|
||||
bmesh.update_edit_mesh(me, False)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
Reference in New Issue
Block a user