[Bf-python] Efficient verts substitution

Manuel Bastioni manuelbastioni at tin.it
Mon Apr 26 00:36:27 CEST 2004


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

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

mesh.verts = copyOfMesh
mesh.update(1)
--------------------------------------------

This don't work: the object return without faces,
only verts, visible in edit mode. Why?


To have a working function, I must use a "for"
and a replace loop, like

--------------------------------------------
for v in mesh.verts:
     copyOfVert = [v.co[0],v.co[1],v.co[2]]
     copyOfMesh.append(copyOfVert)

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

for vert in copyOfMesh:
     i = copyOfMesh.index(vert)
     v = mesh.verts[i]
     v.co[0],v.co[1],v.co[2] = vert[0],vert[1],vert[2]
--------------------------------------------

But this is too expensive and require a long time:
it's unusable :-(
The first method is quick, but the faces disappear :-(((

Please, help me

ciao,

             Manuel







More information about the Bf-python mailing list