Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/templates_py/bmesh_simple.py')
-rw-r--r--release/scripts/templates_py/bmesh_simple.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/release/scripts/templates_py/bmesh_simple.py b/release/scripts/templates_py/bmesh_simple.py
new file mode 100644
index 00000000000..45e6b52d578
--- /dev/null
+++ b/release/scripts/templates_py/bmesh_simple.py
@@ -0,0 +1,22 @@
+# 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)
+bm.free() # free and prevent further access