You might want to checkout pythons sorting function C/api code. http://svn.python.org/projects/python/trunk/Objects/listobject.c
the actual sorting will be done by bmesh - but parsing the args and calling the function should work the same as in python. On Tue, Jun 5, 2012 at 1:06 PM, Antonio Ospite <[email protected]> wrote: > On Tue, 5 Jun 2012 12:54:12 +0200 > Campbell Barton <[email protected]> wrote: > >> On Fri, Jun 1, 2012 at 3:06 PM, Antonio Ospite <[email protected]> >> wrote: > [...] >> > >> > On Wed, 15 Feb 2012 23:37:09 +0100 >> > Antonio Ospite <[email protected]> wrote: >> > > [...] >> >> I could use something like: >> >> scene.objects.sort(key=some key based on objects properties) >> >> mesh.faces.sort(key=some key [face index?] based on faces and vertices >> >> properties) >> > >> > This would be handy for my use case, maybe it is a bit of a stretch to >> > use modeling structures for rendering operations, so I will accept a >> > "you're doing it wrong" type of comments here :) > [...] >> > >> > This question boils down to: is the ability to sort faces arbitrarily >> > (or other elements) something modeling tools can make use of? >> >> replying on a single issue if face sorting, while you cant ensure >> order when adding faces - which may be added at any index. >> there is support for sorting: see >> BM_mesh_remap >> > > I'll take a look, thanks. > >> adding support for something like this isnt so hard: >> faces.sort(key=lambda f: f.calc_area()) >> > > I'll try to add this and will send a patch if I succeed. > > Regards, > Antonio > > -- > Antonio Ospite > http://ao2.it > > A: Because it messes up the order in which people normally read text. > See http://en.wikipedia.org/wiki/Posting_style > Q: Why is top-posting such a bad thing? -- - Campbell _______________________________________________ Bf-python mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-python
