Good day all,
I’m writing a simple script for an import function that creates an object and parents it to an armature, but I’m having a problem.
The issue is in vertex / face weighting.
The script successfully creates vertex groups for the statically named bones of the armature, and if I go to the vertex groups at the end of the import, i can press SELECT in the mesh data panel, and the vertices get selected as expected.
The problem lies here though: the script selection of the vertices does not select the ‘attached’ faces, as would instead happen when selecting the vertices manually.
I have reproduced this problem by ‘feeding’ the script with the standard cube (triangulated), and the following script:
import bpy
import bmesh
bpy.ops.object.mode_set(mode='EDIT')
bpy.context.tool_settings.mesh_select_mode = (True , False , False)
mesh=bmesh.from_edit_mesh(bpy.context.object.data)
if hasattr(mesh.verts, 'ensure_lookup_table'): mesh.verts.ensure_lookup_table()
mesh.verts[5].select_set(True)
mesh.verts[6].select_set(True)
mesh.verts[7].select_set(True)
As the image shows, selecting 5, 6 and 7 manually will highlight the relevant face. Doing the same with the above code, the face is not selected. It’s a couple of days I’m stuck with this already, and I fear I’m not looking in the right place so help if you can.
What do i need to do to select the face once I select the vertices? I use vertex selection because I can’t know the face index in advance.
Thanks.
I