diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-21 09:33:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-21 09:33:37 +0400 |
commit | 9773f87891b58e91f46b3cfd3e6f4f50de5d9411 (patch) | |
tree | 38c74bc80c389d0224514a6b5eab74d72e14b57d /doc/python_api/rst/include__bmesh.rst | |
parent | 1d5922fbaf1bf66a73761c0baceda3edca8211fe (diff) |
bmesh docs:
- add examples for custom-data access
- group BMesh types logically in docs
- added missing docstrings
needed to add grouping functionality to sphinx for this.
Diffstat (limited to 'doc/python_api/rst/include__bmesh.rst')
-rw-r--r-- | doc/python_api/rst/include__bmesh.rst | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst index 2481c4a739c..025788ae9f4 100644 --- a/doc/python_api/rst/include__bmesh.rst +++ b/doc/python_api/rst/include__bmesh.rst @@ -30,10 +30,19 @@ For an overview of BMesh data types and how they reference each other see: *Campbell Barton, 13, March 2012* -.. todo:: +.. warning:: + + TODO Items Are * add access to BMesh **walkers** * add a way to re-tessellate an editmode bmesh. + * add deform vert custom-data access. + + +Example Script +-------------- + +.. literalinclude:: ../../../release/scripts/templates/bmesh_simple.py Stand-Alone Module @@ -66,6 +75,35 @@ its good practice to call :class:`bmesh.types.BMesh.free` which will remove all further access. +CustomData Access +----------------- + +BMesh has a unified way to access mesh attributes such as UV's vertex colors, shape keys, edge crease etc. + +This works by having a **layers** property on bmesh data sequences to access the custom data layers which can then be +used to access the actual data on each vert/edge/face/loop. + +Here are some examples ... + +.. code-block:: python + + uv_lay = bm.loops.layers.uv.active + + for face in bm.faces: + for loop in f.loops: + uv = loop[uv_lay] + print("Loop UV: %f, %f" % (uv.x, uv.y)) + + +.. code-block:: python + + shape_lay = bm.verts.layers.shape["Key.001"] + + for vert in bm.verts: + shape = vert[shape_lay] + print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z)) + + Keeping a Correct State ----------------------- @@ -92,11 +130,5 @@ As mentioned above, it is possible to create an invalid selection state flush the selection after performing a series of edits. this validates the selection state. -Example Script --------------- - -.. literalinclude:: ../../../release/scripts/templates/bmesh_simple.py - - Module Functions ---------------- |