Hi Danny, On Mon, Jul 27, 2009 at 10:34 AM, Danny Lesnik<[email protected]> wrote: > Hi Robert, > > Thank you for response, I'll explain more. > > I loaded any 3ds file using the following: > > myNode = osgDB::readNodeFile("C:\\3.3DS"); > osg::Group* root = new osg::Group(); > root->addChild(myNode); > osgViewer::Viewer viewer; > viewer.setCameraManipulator(new osgGA::TrackballManipulator); > viewer.setSceneData( root ); > > //running my window with and widget button. > wm->addChild(buttons); > return createExample(viewer, wm, root); > > Now I want to click on my widget and hide object with myNode->SetNodeMask(0), > if I understand correctly I have the following widget event > bool handlePressAdd(osgWidget::Event& ev) { ..... > ...... > } > > My question is how can I access myNode from handlePressAdd event?
There really is a C++/programming question, rather than an OSG one. How do I pass data to a callback? OO hundrends of ways, which is the best oooo I don't know it all depends exactly on your app. Do you search for the node? Do you store the node pointer in the callback? Do you have a global pointer? You have to answer this question. > and I want to perfrom opposite operation. I would like to click on myNode and > change text on the widget button. > > how can I access widget from bool handle event. Again this is your application problem, not an OSG specific issue. You need to work out how you relate two objects to each other. It's exactly the same issue as above. Main things to worry about is keeping the different implementation loosely coupled and avoid any circular references and dangling pointers in your implementation. This really is a C++/programming issue. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

