Let it given that i have a mesh-object, get its vertices, filtering for “v.select == true” i get a list of all selected vertices. But as im writing an mesh operator i noticed that the selected vertices don’t get updated. That means it runs correctly the first time. But if the user changes the selection in editmode the script still gets the old selection, since v.select did not change.
Is there the need to update something first?
My lines:
def getSelectedVertices(mesh):
vertexList = []
for vert in mesh.vertices:
if vert.select:
vertexList.append(vert)
return vertexList
Thank you. But now i have the next question. How can i let a script leaving the editmode and entering it again? Looked at the API but could not find it. Google is also no help, because of the same naming for user input. Any suggestions where this functionality is hiding inside bpy?
OK. Lets see. I have to switch to object-mode to update the selections. But i need to stay in objectmode for changes to be applied. After all is finished i update the Mesh with MeshData.update() (only needed if mesh structure is changed) and switch back to editmode again, before the script ends.