You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importbmeshfromtypingimportassert_typebm=bmesh.new()
layer=bm.verts.layers.float.verify()
deform=bm.verts.layers.deform.activevert=bm.verts[0]
f=vert[layer]
dv=vert[deform]
# It would be nice if it could support those cases:# "assert_type" mismatch: expected "float" but received "Any"assert_type(f, float)
# "assert_type" mismatch: expected "BMDeformVert" but received "Any"assert_type(dv, bmesh.types.BMDeformVert)
# Possibly by adding generics support for BMLayerItem:assert_type(layer, bmesh.types.BMLayerItem[float])
assert_type(layer, bmesh.types.BMLayerItem[bmesh.types.BMDeformVert])
The text was updated successfully, but these errors were encountered:
Andrej730
changed the title
Feature request - support typing for bmesh layers
Feature request - support typing for bmesh layers values
Jul 10, 2024
Added __getitem__(), __setitem__() and __delitem__() to BMVert, BMEdge, BMLoop and BMFace.*
*Presently these methods get/set Any—to fix this BMLayerItem needs to be made generic (trivial), but that generic type needs to come from BMLayerCollection which also needs to be made generic, which involves modding all of its methods and uses (non-trivial), and I don't think it's currently possible to bind that generic type to BMLayerItem (but it might be after #161's work on PEP 695 is implemented?).
See example below:
The text was updated successfully, but these errors were encountered: