Improved support GUIEventHandler's being node event callbacks.
This commit is contained in:
parent
4fa830315d
commit
ce68304f90
@ -72,6 +72,9 @@ public:
|
||||
virtual CompositeGUIEventHandler* getComposite() { return 0; }
|
||||
|
||||
/** Handle events, return true if handled, false otherwise. */
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*) { return handle(ea,aa); }
|
||||
|
||||
/** deprecated, Handle events, return true if handled, false otherwise. */
|
||||
virtual bool handle(const GUIEventAdapter&,GUIActionAdapter&) { return false; }
|
||||
|
||||
/** Accept visits from GUIEventHandler visitors */
|
||||
@ -98,7 +101,7 @@ public:
|
||||
|
||||
virtual CompositeGUIEventHandler* getComposite() { return this; }
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa);
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
|
||||
|
||||
virtual void accept(GUIEventHandlerVisitor& v) { v.visit(*this); }
|
||||
|
||||
|
@ -26,13 +26,13 @@ void GUIEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
itr != ev->getEventList().end();
|
||||
++itr)
|
||||
{
|
||||
handle(*(*itr), *(ev->getActionAdapter()));
|
||||
handle(*(*itr), *(ev->getActionAdapter()), node, nv);
|
||||
}
|
||||
}
|
||||
traverse(node,nv);
|
||||
}
|
||||
|
||||
void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* /*drawable*/)
|
||||
void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* drawable)
|
||||
{
|
||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||
if (ev && ev->getActionAdapter() && !ev->getEventList().empty())
|
||||
@ -41,7 +41,7 @@ void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* /*drawable*/)
|
||||
itr != ev->getEventList().end();
|
||||
++itr)
|
||||
{
|
||||
handle(*(*itr), *(ev->getActionAdapter()));
|
||||
handle(*(*itr), *(ev->getActionAdapter()), drawable, nv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ void CompositeGUIEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
||||
}
|
||||
}
|
||||
|
||||
bool CompositeGUIEventHandler::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
|
||||
bool CompositeGUIEventHandler::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
||||
{
|
||||
bool result=false;
|
||||
|
||||
@ -64,7 +64,7 @@ bool CompositeGUIEventHandler::handle(const GUIEventAdapter& ea,GUIActionAdapter
|
||||
itr!=_children.end();
|
||||
++itr)
|
||||
{
|
||||
result |= (*itr)->handle(ea,aa);
|
||||
result |= (*itr)->handle(ea, aa, object, nv);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -652,9 +652,9 @@ void Viewer::update()
|
||||
handler_itr!=_eventHandlerList.end() && !handled;
|
||||
++handler_itr)
|
||||
{
|
||||
handled = (*handler_itr)->handle(*(*event_itr),*this);
|
||||
handled = (*handler_itr)->handle(*(*event_itr),*this,0,0);
|
||||
}
|
||||
if (!handled && _eventVisitor.valid())
|
||||
if (_eventVisitor.valid())
|
||||
{
|
||||
_eventVisitor->reset();
|
||||
_eventVisitor->addEvent(event_itr->get());
|
||||
@ -854,7 +854,7 @@ bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::No
|
||||
|
||||
bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask)
|
||||
{
|
||||
return computeIntersections(x,y,cameraNum,getSceneData(),hits,traversalMask);
|
||||
return computeIntersections(x,y,cameraNum,getTopMostSceneData(),hits,traversalMask);
|
||||
}
|
||||
|
||||
bool Viewer::computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask)
|
||||
@ -870,7 +870,7 @@ bool Viewer::computeIntersections(float x,float y,osg::Node *node,osgUtil::Inter
|
||||
|
||||
bool Viewer::computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask)
|
||||
{
|
||||
return computeIntersections(x,y,getSceneData(),hits,traversalMask);
|
||||
return computeIntersections(x,y,getTopMostSceneData(),hits,traversalMask);
|
||||
}
|
||||
|
||||
void Viewer::selectCameraManipulator(unsigned int no)
|
||||
|
Loading…
Reference in New Issue
Block a user