hi all,
well here i am again, trying to get the mesh data…
I took a good look at the manual : www1.panda3d.org/manual/index.php/ … metry_data
But my attempts are not getting any better, here is the code I am using:
main.py:
from pandac.PandaModules import loadPrcFileData
loadPrcFileData('','show-frame-rate-meter 1')
import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
#egg stuff
from pandac.PandaModules import EggAttributes
from pandac.PandaModules import GeomNode
from VectorMesh import VectorMesh
import sys
a = loader.loadModel('res/planoSimples')
a.setScale(1)
a.setPos(0,5,-1)
a.reparentTo(render)
obj = VectorMesh(a)
run()
now the VectorMesh class:
from pandac.PandaModules import GeomNode
class VectorMesh(object):
def __init__(self, np):
print (' np: '), np
print (' np type: '), type(np)
print (' np pointer: '), np.node()
print (' np list: '), np.ls()
print (' np find geom: '), np.find('Plane')
plane = np.find('Plane')
print (' Plane: '), plane
print (' Plane type: '), type(plane)
print (' np getChild: '), np.getChildren()
print ('np getChild type: '), type(np.getChildren())
print (' find GeomNode: '), np.findAllMatches('**/+GeomNode')
plane2 = np.findAllMatches('**/+GeomNode')
for nodeFound in plane2:
print (' nodeFound: '), nodeFound
print (' type: '), type(nodeFound)
print (' numGeoms: '), nodeFound.getGeom(1)
and finally the outputs…
DirectStart: Starting the game.
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
np: render/planoSimples.egg
np type: <type 'libpanda.NodePath'>
np pointer: ModelRoot planoSimples.egg T:(pos 0 5 -1)
np list: ModelRoot planoSimples.egg T:(pos 0 5 -1)
GeomNode Plane (1 geoms)
None
np find geom: render/planoSimples.egg/Plane
Plane: render/planoSimples.egg/Plane
Plane type: <type 'libpanda.NodePath'>
np getChild: render/planoSimples.egg/Plane
np getChild type: <type 'libpanda.NodePathCollection'>
find GeomNode: render/planoSimples.egg/Plane
nodeFound: render/planoSimples.egg/Plane
type: <type 'libpanda.NodePath'>
numGeoms:
Traceback (most recent call last):
File "tentativa01.py", line 22, in <module>
obj = VectorMesh(a)
File "/home/web/Documentos/Pesquisas/geomNode/VectorMesh.py", line 20, in __init__
print (' numGeoms: '), nodeFound.getGeom(1)
AttributeError: 'libpanda.NodePath' object has no attribute 'getGeom'
I’m gonna cry… sniff sniff
Why it is not working? i mean… the GeomNode, how can i get it?
I always get stuck in the NodePaths.
Ah… Using the Panda 1.6.0