Changed the camera with focus code to only accept cameras with valid views
as ones that can recieve focus.
This commit is contained in:
parent
b47ef11d74
commit
8e20956511
@ -857,11 +857,13 @@ void CompositeViewer::eventTraversal()
|
||||
{
|
||||
osg::Camera* camera = *citr;
|
||||
osg::Viewport* viewport = camera ? camera->getViewport() : 0;
|
||||
if (viewport &&
|
||||
if (camera->getView() &&
|
||||
viewport &&
|
||||
x >= viewport->x() && y >= viewport->y() &&
|
||||
x <= (viewport->x()+viewport->width()) && y <= (viewport->y()+viewport->height()) )
|
||||
{
|
||||
setCameraWithFocus(camera);
|
||||
|
||||
if (getViewWithFocus()!=masterView)
|
||||
{
|
||||
// need to reset the masterView
|
||||
|
@ -821,12 +821,15 @@ void Viewer::eventTraversal()
|
||||
++citr)
|
||||
{
|
||||
osg::Camera* camera = *citr;
|
||||
osg::Viewport* viewport = camera ? camera->getViewport() : 0;
|
||||
if (viewport &&
|
||||
x >= viewport->x() && y >= viewport->y() &&
|
||||
x <= (viewport->x()+viewport->width()) && y <= (viewport->y()+viewport->height()) )
|
||||
if (camera->getView()==this)
|
||||
{
|
||||
setCameraWithFocus(camera);
|
||||
osg::Viewport* viewport = camera ? camera->getViewport() : 0;
|
||||
if (viewport &&
|
||||
x >= viewport->x() && y >= viewport->y() &&
|
||||
x <= (viewport->x()+viewport->width()) && y <= (viewport->y()+viewport->height()) )
|
||||
{
|
||||
setCameraWithFocus(camera);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user