3
$\begingroup$

I am trying to access skin modifier vertices data. An older solution does not work in my Blender 2.75 / 2.76:

print('has skin=', bool(context.active_object.modifiers['Skin']))
data = context.active_object.data
print(data)
vert = data.skin_vertices
print('skin_vertices=', vert)
v0d = data.skin_vertices[0]
print('skin_vertices[0]=', v0d)
v0d_data = v0d.data
print('skin_vertices_data=', v0d_data)
print('--------loop--------')
for v in v0d_data:
    print('skin_vertex=', v)

That returns:

has skin= True  
bpy_struct, Mesh("Skin")  
skin_vertices= bpy_collection[1], Mesh.skin_vertices  
skin_vertices[0]= bpy_struct, MeshSkinVertexLayer("")  
skin_vertices_data= bpy_collection[4], MeshSkinVertexLayer.data  
--------loop--------  

According to python api skin_vertices return MeshSkinVertexLayer not MeshSkinVertex, what we see in print data.

Bmesh also has a some skin data BMesh.verts.layers.skin, but it doesn't return any useful data.

Is there any way to access skin data?

$\endgroup$
3
  • 2
    $\begingroup$ do it in Object mode when using obj.data.skin_vertices[0].data directly. Edit Mode will not output anything $\endgroup$
    – zeffii
    Commented Sep 27, 2015 at 21:38
  • $\begingroup$ Thanks, its work. Mesh in EDIT mode return skin data and might be modified. $\endgroup$
    – Marek
    Commented Sep 28, 2015 at 22:20
  • $\begingroup$ Why not generate a new mesh with modifiers applied via: bpy.context.object.to_mesh( bpy.context.scene, True, 'RENDER' )? $\endgroup$
    – TLousky
    Commented Sep 29, 2015 at 11:45

1 Answer 1

1
$\begingroup$

The original question you link to mentions this in the first line, but doesn't make a point to clarify why the Object/Edit mode switch is important.

Non BMesh

When using obj.data.skin_vertices[0].data, the Skin Modifier data will show the correct current values only when the object is put back in Object Mode. The same is also true for checking other information of the mesh, like vertex.select.

BMesh

It may be possible to get this skin information while still in Edit Mode using bm = bmesh.from_edit_mesh(obj.data) but I have not been able to find an obvious way. If it is possible someone will no doubt offer a suggestion.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .