[Bf-python] Efficient verts substitution
Manuel Bastioni
manuelbastioni at tin.it
Mon Apr 26 02:16:17 CEST 2004
> What kind of operation, do you remove or add verts?
I must done a series of rotations using a sequence like this pseudocode:
store initial verts position in A
def Rotations:
start from A
rotation 1
rotation 2
...
rotation n
update mesh
The user can call Rotation all times he want.
Each time the function Rotation
modify the mesh, but it starting always from
no modified A.
>If so, that would explain
> why the mesh.faces data got lost. Without having an idea of what you do in foo
> foo1 foo2, things look weird. But ok, since you say the slower method works,
> then you're not "corrupting" the data in any way and can revert to the
> original coords.
However, this seem to work, but I think it's not efficient copy
all data:
------------------------------------------------
def copyMesh():
try:
object = Blender.Object.Get("Base")
mesh = object.getData()
except:
return
return mesh
def resetMesh(allData):
try:
object = Blender.Object.Get("Base")
mesh = object.getData()
except:
return
mesh = allData
mesh.update(1)
---------------------------------------------------
With usage like:
a = copyMesh()
def rot():
resetMesh(a)
rotations...
> Mmm, what about inserting a meshkey first to save the original positions, then
> going back to it at the end? We still have work to do with meshkeys, but
> maybe that can already help you. It does a fast copy in C of the blender mesh
> coordinates. After mesh.update() you might then remove meshkeys, both methods
> are in NMesh.
OK, I'll try. However I'm more sure if I can manipulate directly the
verts, for some reasons...
>
> It's important to make basic operations faster, specially with the support for
> bigger meshes that Blender got in recent versions, so please keep up with this
> discussion till we find what needs to be done.
OK, thanks!!!
Manuel
More information about the Bf-python
mailing list