blender/release/scripts/templates/bmesh_simple.py
Campbell Barton 21fd09c028 bmesh py api: change .from_mesh() / .to_mesh() to be class methods of BMesh rather than functions in the module.
added example script which converts a mesh to a bmesh, edits and converts back again.
2012-03-11 02:45:27 +00:00

22 lines
395 B
Python

# This example assumes we have a mesh object selected
import bpy
import bmesh
# Get the active mesh
me = bpy.context.object.data
# Get a BMesh representation
bm = bmesh.new() # create an empty BMesh
bm.from_mesh(me) # fill it in from a Mesh
# Modify the BMesh, can do anything here...
for v in bm.verts:
v.co.x += 1.0
# Finish up, write the bmesh back to the mesh
bm.to_mesh(me)