diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-11 06:45:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-11 06:45:27 +0400 |
commit | 21fd09c028dce833f58cdaa8a1ff45876a5e5a2f (patch) | |
tree | cf5f7b60f9abc253cc7fb811ab05ab2782d3144d /release/scripts/templates | |
parent | 0c50bedd9c960763d3e8e695b63957a964565be0 (diff) |
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.
Diffstat (limited to 'release/scripts/templates')
-rw-r--r-- | release/scripts/templates/bmesh_simple.py | 21 | ||||
-rw-r--r-- | release/scripts/templates/gamelogic_simple.py (renamed from release/scripts/templates/gamelogic_basic.py) | 0 |
2 files changed, 21 insertions, 0 deletions
diff --git a/release/scripts/templates/bmesh_simple.py b/release/scripts/templates/bmesh_simple.py new file mode 100644 index 00000000000..656febf4918 --- /dev/null +++ b/release/scripts/templates/bmesh_simple.py @@ -0,0 +1,21 @@ +# 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) diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_simple.py index dbfcf948b18..dbfcf948b18 100644 --- a/release/scripts/templates/gamelogic_basic.py +++ b/release/scripts/templates/gamelogic_simple.py |