Merged changes in the trunk up to revision 46045.
Conflicts resolved: doc/python_api/sphinx_doc_gen.py source/blender/blenkernel/intern/subsurf_ccg.c source/blender/editors/mesh/editmesh_tools.c source/blender/makesdna/DNA_scene_types.h
This commit is contained in:
41
doc/python_api/examples/bpy.types.Mesh.py
Normal file
41
doc/python_api/examples/bpy.types.Mesh.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
Mesh Data
|
||||
+++++++++
|
||||
|
||||
The mesh data is accessed in object mode and intended for compact storage,
|
||||
for more flexible mesh editing from python see :mod:`bmesh`.
|
||||
|
||||
Blender stores 4 main arrays to define mesh geometry.
|
||||
|
||||
* :class:`Mesh.vertices` (3 points in space)
|
||||
* :class:`Mesh.edges` (reference 2 vertices)
|
||||
* :class:`Mesh.loops` (reference a single vertex and edge)
|
||||
* :class:`Mesh.polygons`: (reference a range of loops)
|
||||
|
||||
|
||||
Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,
|
||||
only a reference to loops that the polygon uses.
|
||||
|
||||
:class:`Mesh.loops`, :class:`Mesh.uv_layers` :class:`Mesh.vertex_colors` are all aligned so the same polygon loop
|
||||
indicies can be used to find the UV's and vertex colors as with as the vertices.
|
||||
|
||||
To compare mesh API options see: :ref:`NGons and Tessellation Faces <info_gotcha_mesh_faces>`
|
||||
|
||||
|
||||
This example script prints the vertices and UV's for each polygon, assumes the active object is a mesh with UVs.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
||||
me = bpy.context.object.data
|
||||
uv_layer = me.uv.layers.active.data
|
||||
|
||||
for poly in me.polygons:
|
||||
print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
|
||||
|
||||
# range is used here to show how the polygons reference loops,
|
||||
# for convenience 'poly.loop_indices' can be used instead.
|
||||
for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
|
||||
print(" Vertex: %d" % me.loops[loop_index].vertex_index)
|
||||
print(" UV: %r" % uv_layer[loop_index].uv)
|
||||
|
||||
@@ -32,12 +32,11 @@ For an overview of BMesh data types and how they reference each other see:
|
||||
|
||||
.. warning::
|
||||
|
||||
TODO Items Are
|
||||
TODO items are...
|
||||
|
||||
* add access to BMesh **walkers**
|
||||
* add a way to re-tessellate an editmode bmesh.
|
||||
* add deform vert custom-data access.
|
||||
|
||||
* add api for calling BMesh operators (unrelated to bpy.ops)
|
||||
* add custom-data manipulation functions add/remove/rename.
|
||||
|
||||
Example Script
|
||||
--------------
|
||||
@@ -110,8 +109,8 @@ Here are some examples ...
|
||||
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))
|
||||
shape = vert[shape_lay]
|
||||
print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
@@ -125,7 +124,7 @@ Here are some examples ...
|
||||
|
||||
for vert in bm.verts:
|
||||
dvert = vert[dvert_lay]
|
||||
|
||||
|
||||
if group_index in dvert:
|
||||
print("Weight %f" % dvert[group_index])
|
||||
else:
|
||||
|
||||
@@ -132,6 +132,8 @@ write useful tools in python which are also fast to execute while in edit-mode.
|
||||
For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
|
||||
|
||||
|
||||
.. _info_gotcha_mesh_faces:
|
||||
|
||||
NGons and Tessellation Faces
|
||||
============================
|
||||
|
||||
|
||||
@@ -230,10 +230,10 @@ if not ARGS.partial:
|
||||
|
||||
else:
|
||||
# can manually edit this too:
|
||||
FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
|
||||
#FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
#FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
|
||||
EXCLUDE_INFO_DOCS = True
|
||||
EXCLUDE_MODULES = (
|
||||
EXCLUDE_MODULES = [
|
||||
"aud",
|
||||
"bge",
|
||||
"bge.constraints",
|
||||
@@ -262,7 +262,7 @@ else:
|
||||
"mathutils.geometry",
|
||||
"mathutils.noise",
|
||||
"Freestyle",
|
||||
)
|
||||
]
|
||||
|
||||
# ------
|
||||
# Filter
|
||||
@@ -270,7 +270,18 @@ else:
|
||||
# TODO, support bpy.ops and bpy.types filtering
|
||||
import fnmatch
|
||||
m = None
|
||||
EXCLUDE_MODULES = tuple([m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)])
|
||||
EXCLUDE_MODULES = [m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)]
|
||||
|
||||
# special support for bpy.types.XXX
|
||||
FILTER_BPY_OPS = tuple([m[8:] for m in ARGS.partial.split(":") if m.startswith("bpy.ops.")])
|
||||
if FILTER_BPY_OPS:
|
||||
EXCLUDE_MODULES.remove("bpy.ops")
|
||||
|
||||
FILTER_BPY_TYPES = tuple([m[10:] for m in ARGS.partial.split(":") if m.startswith("bpy.types.")])
|
||||
if FILTER_BPY_TYPES:
|
||||
EXCLUDE_MODULES.remove("bpy.types")
|
||||
|
||||
print(FILTER_BPY_TYPES)
|
||||
|
||||
EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user