[Bf-python] BUG PYTHON very strange

Manuel Bastioni manuelbastioni at tin.it
Fri May 7 23:38:35 CEST 2004


About the benchmark in the previoue message....
this is really STRANGE: take a look  to code below:
the only difference between applymesh() and applymesh2()
is using the line
for i in range(1000):
instead
for i in mesh.getVertsFromGroup(groupOfverts):

Well...the first using only few KB, the second
use 11MB and not free the memory when exit the script.

I need help, because if this remain not solved,
the MakeHuman development is stopped. Please, help...

Regards,

              Manuel




import Blender
from Blender import NMesh
	

listOfV = []
for i in range (8000): listOfV.append([0,0,0])


def applyMesh(listOfVerts, groupOfverts):
	try:
		object = Blender.Object.GetSelected()[0]
		mesh = object.getData()
	except:
		return
	
	vertsGroups = mesh.getVertGroupNames()
	if groupOfverts in vertsGroups:
		for i in range(1000):
			mesh.verts[i].co[0] = listOfVerts[i][0]
			mesh.verts[i].co[1] = listOfVerts[i][1]
			mesh.verts[i].co[2] = listOfVerts[i][2]

	
def applyMesh2(listOfVerts, groupOfverts):
	try:
		object = Blender.Object.GetSelected()[0]
		mesh = object.getData()
	except:
		return
	
	vertsGroups = mesh.getVertGroupNames()
	if groupOfverts in vertsGroups:
		for i in mesh.getVertsFromGroup(groupOfverts):
			mesh.verts[i].co[0] = listOfVerts[i][0]
			mesh.verts[i].co[1] = listOfVerts[i][1]
			mesh.verts[i].co[2] = listOfVerts[i][2]	

for i in range(100):
	applyMesh2(listOfV, "All")



More information about the Bf-python mailing list