Skip to content

Instantly share code, notes, and snippets.

@jirihnidek
Created August 22, 2016 13:39
Show Gist options
  • Save jirihnidek/755492700ed6aa84ff62500a60abcffe to your computer and use it in GitHub Desktop.
Save jirihnidek/755492700ed6aa84ff62500a60abcffe to your computer and use it in GitHub Desktop.
import bpy
import bmesh
obj = bpy.context.active_object
mesh = obj.data
bmsh = bmesh.new()
bmsh.from_mesh(mesh)
# Do something with mesh: e.g. add layer
layer = bmsh.verts.layers.int.new('Example')
for id,vert in enumerate(bmsh.verts):
vert[layer] = id
print(id, vert, vert[layer])
bmsh.to_mesh(mesh)
mesh.mesh.update_tag()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment