Hi all,
So I have been trying to parse through an egg file of a simple plane with subdivisions using the EggData, EggGroupNode… classes.
I wish to get each vertex value printed out.
Here is the code:
import direct.directbase.DirectStart
from pandac.PandaModules import *
class MyApp():
def __init__(self):
egg = EggData()
fname = Filename('fullMeshMax.egg')
egg.resolveEggFilename(fname)
egg.read(fname, "full")
model = NodePath(loadEggData(egg))
model.reparentTo(render)
self.iterateEgg(egg)
def handleVertexPool(self, vpool):
print "Vertex Pool for node ..."
for i in range(vpool.getHighestIndex() + 1):
vertex = vpool.getVertex(i)
if vertex:
print vertex
def iterateEgg(self, egg):
print "Iterating ...."
if isinstance(egg, EggVertexPool):
self.handleVertexPool(egg)
print "Group nodes."
if isinstance(egg, EggGroupNode):
child = egg.getFirstChild()
while child != None:
self.iterateEgg(child)
child = egg.getNextChild()
print "child = null"
app = MyApp()
run()
Unfortunately, the output doesn’t reach the handleVertexPool function at all.
It just prints :
**** End of process output ****
DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Iterating egg ....
Group nodes ....
child = null
Here is the corresponding egg file structure:
<CoordinateSystem> { Z-Up }
<Group> character {
<Dart> { 1 }
<Group> Plane01 {
<VertexPool> Plane01.verts {
<Vertex> 0 {
-48.7817 -28.2246 0
<Normal> { 0 0 1 }
}
<Vertex> 1 {
-48.7817 -58.2246 0
<Normal> { 0 0 1 }
}
<Vertex> 2 {
-18.7817 -28.2246 0
<Normal> { 0 0 1 }
}
<Vertex> 3 {
-18.7817 -58.2246 0
<Normal> { 0 0 1 }
}
<Vertex> 4 {
11.2183 -28.2246 0
<Normal> { 0 0 1 }
}
<Vertex> 5 {
11.2183 -58.2246 0
<Normal> { 0 0 1 }
}
...
Any help would be great!
Thanks
[/code]