[Bf-python] Thinmesh module, v1.1
Ken Hughes
khughes at pacific.edu
Thu Sep 22 22:51:55 CEST 2005
Thought before I shut down for a day or so (heading out-of-town to
relax) I'd taunt (or tempt? whatever) with today's thinmesh work. I
decided to implement a TMesh.addEdges() method which accepts a list of
tuples of vertices and adds to the mesh. This is part of an experiment
to see if it's better or worse or indifferent to use Python's memory
management vs my own. (I didn't implement addVertices() yet; just
created a bunch of vertices in Edit Mode and then ran a thinmesh script).
So you can do something like this:
mesh = Blender.TMesh.Get('mesh')
v=mesh.verts
mesh.appendEdges( [ (v[0],v[1]), (v[1],v[2]), (v[2],v[0]) ] )
and you get edges.
Advantage of this: there's only one MEM_callocN() / memcpy() needed for
this since I process the list of edges once (I order and sort both the
new and old edge lists, remove duplicated edges, etc) I think it would
be faster than:
mesh.appendEdge(v[0],v[1])
mesh.appendEdge(v[1],v[2])
mesh.appendEdge(v[2],v[0])
But since I'm relying on Python to build my list of tuples (and assuming
a more complex script is going to be using append() operations to build
the actual list) I don't know which is more advantageous. So later this
weekend I'll try some tests with larger meshs and see what results.
Anyway, want to get users thinking about (and explain) how they create
and edit meshes, and start getting some ideas for how things should
proceed in the next step.
BTW, noticed that nobody's beating down the door to add comments to the
wiki page I set up....
Back tomorrow night -- Ken
More information about the Bf-python
mailing list