Hello, I'm trying to use node visitors from python 2.6 with osg 2.6 and osgswig. However for some reason I cannot use a subclass of osg.NodeVisitor. I crafted a simple illustrative example that fails with this message:
/home/seb/Devel/arboris-python/tst_nv.pyc in test() /home/seb/.local/lib/python2.6/site-packages/OpenSceneGraph/osg.pyc in accept(*args) 14578 def accept(*args): 14579 """accept(self, NodeVisitor nv)""" > 14580 return _osg.Group_accept(*args) 14581 14582 def asGroup(*args): TypeError: in method 'Group_accept', argument 2 of type 'osg::NodeVisitor &' Any hint why this is happening ? Thanks ! PS: I also filed the issue as http://code.google.com/p/osgswig/issues/detail?id=36 -- Cheers, SB
# coding=utf-8 """ Visualization of a simulation This module is based on the openscenegraph (osg) 2.6 python wrappers. Scene graph basics ------------------ A scene graph is a data structure that arranges the logical and spatial representation of a graphical scene. It consists of a collection of *nodes* in a tree or graph structure. In general a node may have many children but only a single parent, with the effect of a parent apparent to all its child nodes. For instance, a geometrical transformation matrix node would move all its children. In some cases, a single (child) node may be shared between several parents, for instance when the same geometry is displayed several times simultaneously (this saves memory). OSG in 20" ---------- TODO: finish Classes: - Node - Group - Geode (*geometry node*) - MatrixTransform - Switch A geode can contain: - DrawableShape - Geometry - The Viewer class can manage multiple synchronized cameras to render a single view spanning multiple monitors. Viewer creates its own window(s) and graphics context(s) based on the underlying graphics system capabilities, so a single Viewer-based application executable runs on single or multiple display systems. Internals --------- The :class:`WorldDrawer` class creates a graphic representation of an arboris world as an OSG graph. Several properties of the world are represented (shapes, inertia ellispoids,...), and the graphics can be tuned with a dict of options, whose default values are given by the :func:`graphic_option` function. The object stores a ref to the arboris world in order to update the representation when the bodies move. The :func:`init_viewer` function creates an OSG Viewer and an OSG KeayboardHandler. It is the place where window size, camera position and keyboard shortcuts are set. The end user can draw a world through, at choice, a :class:`DrawerPlugin` object, or superseding the "raw" :class:`core.World` object by a :class:`visuosg.DrawableWorld` one. """ __author__ = ("Sébastien BARTHÉLEMY <sebastien.barthel...@gmail.com>", "Joseph SALINI <joseph.sal...@gmail.com>") import os if os.name is 'nt': import osg, osgDB, osgGA, osgViewer, osgText else: from OpenSceneGraph import osg, osgDB, osgGA, osgViewer, osgText class WithoutInitNodeVisitor(osg.NodeVisitor): def apply(self, node): print node.getName() class WithInitNodeVisitor(osg.NodeVisitor): def __init__(self): pass def apply(self, node): print node.getName() def test(): print 'running test' root = osg.Group() root.setName('root') child = osg.Group() child.setName('child') root.addChild(child) # this does nothing: root.accept(osg.NodeVisitor()) # idem: root.accept(WithoutInitNodeVisitor()) # this fails: root.accept(WithInitNodeVisitor())
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org