added face sorting to mesh so you can do mesh.faces.sort(...)

uses list sorting internally so is exactly the same as list sorting.
This commit is contained in:
2007-08-20 10:08:59 +00:00
parent 196a3e4104
commit e8c39a5864
4 changed files with 112 additions and 1 deletions

View File

@@ -690,6 +690,22 @@ class MFaceSeq:
- a integer, specifying an index into the mesh's face list
"""
def sort():
"""
Sorts the faces using exactly the same syntax as pythons own list sorting function.
Example::
import Blender
from Blender import Mesh
me = Mesh.Get('mymesh')
me.faces.sort(key=lambda f: f.area)
me.faces.sort(key=lambda f: f.cent)
@note: Internally faces only refer to their index, so after sorting, faces you alredy have will not have their index changed to match the new sorted order.
"""
def selected():
"""
Get selected faces.