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:
authorCampbell Barton <ideasman42@gmail.com>2012-11-29 09:02:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-29 09:02:06 +0400
commit858149d7c7f3bd4d6a254d560d3a0810e5739ae5 (patch)
tree6737a0d63a005b6333d18f8375044cb233663b4f /release
parentede703ab855e7a4608631780949334984e05c2b4 (diff)
bmesh py api: add bmesh.update_edit_mode(), there was no way to redraw the 3d view or re-calculate face tessellation from python.
add py template for editing meshes in editmode. also remove double call to CTX_wm_region which does a string lookup.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/templates/bmesh_simple_editmode.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/release/scripts/templates/bmesh_simple_editmode.py b/release/scripts/templates/bmesh_simple_editmode.py
new file mode 100644
index 00000000000..d79ba02c2cb
--- /dev/null
+++ b/release/scripts/templates/bmesh_simple_editmode.py
@@ -0,0 +1,23 @@
+# This example assumes we have a mesh object in edit-mode
+
+import bpy
+import bmesh
+
+# Get the active mesh
+obj = bpy.context.edit_object
+me = obj.data
+
+
+# Get a BMesh representation
+bm = bmesh.from_edit_mesh(me)
+
+bm.faces.active = None
+
+# Modify the BMesh, can do anything here...
+for v in bm.verts:
+ v.co.x += 1.0
+
+
+# Show the updates in the viewport
+# and recalculate n-gon tessellation.
+bmesh.update_edit_mesh(me, True)