0
$\begingroup$

I'm trying to use select_next_item() function to select the next vertex , and I select the vertices from a List .

Unfortunately it does not work

Here is simple code:

import bpy,bmesh


obj = bpy.context.object.data

bm = bmesh.from_edit_mesh(obj)

vert = []

for v in bm.verts:
    if v.select:
        vert.append(v)

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

vert[0].select=True
vert[1].select=True        

bpy.ops.mesh.select_next_item()

bmesh.update_edit_mesh(obj)

Thanks in advance.

$\endgroup$
0
$\begingroup$

Using vert[0].select=True doesn't add the vertex to the bmesh select history, you need to add it yourself.

vert[0].select=True
bm.select_history.add(vert[0])
vert[1].select=True        
bm.select_history.add(vert[1])

You may notice that the select history doesn't include all selected items, if you Alt-Click to select an edge loop only one vertex (the active vertex which was closest to the click) is added to the history. Shift-Alt-Click will then add a second vertex which is the new active vertex. If you use select all then nothing is in the history.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.