Is there any reason why the GeomVertexReader works, but the GeomVertexWriter does not (as does the GeomVertexRewriter doesn’t work either)? If you comment out the two lines dealing with the GeomVertexWriter, it works, and reads the data correctly. What am I doing wrong?\

import direct.directbase.DirectStart
from pandac.PandaModules import *

prim = GeomTriangles(Geom.UHStatic)
vdata = GeomVertexData('',GeomVertexFormat.getV3(),Geom.UHDynamic)

geom = Geom(vdata)

vertex = GeomVertexWriter(vdata,'vertex')
for i in range(0,3):


node = NodePath(GeomNode('gnode'))

mgeom = node.node().getGeom(0)
mvdata = mgeom.getVertexData()
mvertex = GeomVertexWriter(mvdata, 'vertex')	#comment this line to make work
mrvertex = GeomVertexReader(mvdata, 'vertex')
print mrvertex.getData3f()
mvertex.setData3f(0,1,0)    			#and this line


You didn’t say in what way the GeomVertexWriter is failing, so I have to guess, but I do see a problem here:

mgeom = node.node().getGeom(0)
mvdata = mgeom.getVertexData() 

You need to use modifyGeom() and modifyVertexData() if you intend to use a GeomVertexWriter to modify the vertices. Otherwise you’re just getting a read-only copy, and the GeomVertexWriter will yell at you to that effect when you try to create it.


That fixed it, thanks. The error was that it was being called with the wrong kind of arguments…