[Bf-python] Efficient verts substitution

Willian Padovani Germano wgermano at ig.com.br
Mon Apr 26 01:22:22 CEST 2004


Hi Manuel,

----- Original Message -----
From: "Manuel Bastioni" <manuelbastioni at tin.it>
To: <bf-python at blender.org>
Sent: Sunday, April 25, 2004 7:36 PM
Subject: [Bf-python] Efficient verts substitution


> I want a quick retrieve of initial verts position.
> I've simpliflied my experiment here:
>
>
> -------------------------------------------
> object = Blender.Object.Get("Base")
> mesh = object.getData()
>
> copyOfMesh = mesh.verts

I'm afraid it can't really be done this way, verts are pyobjects, their
coordinates are attributes of the NMVert pyobj.

copyOfMesh = mesh.verts
and then
mesh.verts = copyOfMesh
might simply pass 'references' around, no saving involved.

> #here some mesh operation bla bla bla...
> #foo foo1 foo2
> #and finally a mesh reset position

What kind of operation, do you remove or add verts?  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.

(...)
> But this is too expensive and require a long time:
> it's unusable :-(

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.

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.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list