diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-28 13:34:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-28 13:34:45 +0400 |
commit | a9dd90be788f5ce894fd5a8c9bc8245980ec143e (patch) | |
tree | b4e5ae9fe4fcb456de63018ce5250d6b90bbcb0c /release/scripts/modules/bpy_extras/mesh_utils.py | |
parent | 245d36b70693f84ee2a057f950db9c4a2e6c1145 (diff) |
move load_image into image_utils and add some docstrings to bpy_extras module.
Diffstat (limited to 'release/scripts/modules/bpy_extras/mesh_utils.py')
-rw-r--r-- | release/scripts/modules/bpy_extras/mesh_utils.py | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 1f1c26a5405..b6d8a1fcf16 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -28,11 +28,15 @@ __all__ = ( ) def mesh_linked_faces(mesh): - ''' - Splits the mesh into connected parts, - these parts are returned as lists of faces. - used for seperating cubes from other mesh elements in the 1 mesh - ''' + """ + Splits the mesh into connected faces, use this for seperating cubes from + other mesh elements within 1 mesh datablock. + + :arg mesh: the mesh used to group with. + :type mesh: :class:`Mesh` + :return: lists of lists containing faces. + :rtype: list + """ # Build vert face connectivity vert_faces = [[] for i in range(len(mesh.vertices))] @@ -78,6 +82,11 @@ def mesh_linked_faces(mesh): def edge_face_count_dict(mesh): + """ + :return: dict of edge keys with their value set to the number of + faces using each edge. + :rtype: dict + """ face_edge_keys = [face.edge_keys for face in mesh.faces] face_edge_count = {} for face_keys in face_edge_keys: @@ -91,8 +100,13 @@ def edge_face_count_dict(mesh): def edge_face_count(mesh): + """ + :return: list face users for each item in mesh.edges. + :rtype: list + """ edge_face_count_dict = edge_face_count_dict(mesh) - return [edge_face_count_dict.get(ed.key, 0) for ed in mesh.edges] + get = dict.get + return [get(edge_face_count_dict, ed.key, 0) for ed in mesh.edges] def edge_loops_from_faces(mesh, faces=None, seams=()): @@ -101,12 +115,18 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): Takes me.faces or a list of faces and returns the edge loops These edge loops are the edges that sit between quads, so they dont touch - 1 quad, note: not connected will make 2 edge loops, both only containing 2 edges. + 1 quad, note: not connected will make 2 edge loops, + both only containing 2 edges. return a list of edge key lists - [ [(0,1), (4, 8), (3,8)], ...] - - return a list of edge vertex index lists + [[(0, 1), (4, 8), (3, 8)], ...] + + :arg mesh: the mesh used to get edge loops from. + :type mesh: :class:`Mesh` + :arg faces: optional face list to only use some of the meshes faces. + :type faces: :class:`MeshFaces`, sequence or or NoneType + :return: return a list of edge vertex index lists. + :rtype: list """ OTHER_INDEX = 2, 3, 0, 1 # opposite face index @@ -117,7 +137,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): edges = {} for f in faces: -# if len(f) == 4: +# if len(f) == 4: if f.vertices_raw[3] != 0: edge_keys = f.edge_keys for i, edkey in enumerate(f.edge_keys): |