CameraGroup: Fix missing splash on explicit camera setup
The splash window name was only being set for the default / legacy
camera setup, however if the camera group is set up explicitly in the
configuration XML the splash window wouldn't get set and the splash
would no longer get displayed.
This is fixed by selecting the first referenced window name from a
camera.
A better fix (more closely matching the prior behaviour) would be to
create a splash camera for each created window, however this is proving
difficult to test due to instability with multiple windows, so this fix
will suffice in the mean time.
Fixes: bb0d7fc0a7
("src/Viewer: Move splash to cam group camera")
Reported-by: Durk Talsma <durktals@gmail.com>
This commit is contained in:
parent
fd0bb74a92
commit
ab02bce279
1 changed files with 15 additions and 3 deletions
|
@ -1185,11 +1185,23 @@ void CameraGroup::buildDefaultGroup(osgViewer::View* viewer)
|
||||||
setValue(masterCamera->getNode("vr-mirror", true), true);
|
setValue(masterCamera->getNode("vr-mirror", true), true);
|
||||||
}
|
}
|
||||||
SGPropertyNode* nameNode = masterCamera->getNode("window/name");
|
SGPropertyNode* nameNode = masterCamera->getNode("window/name");
|
||||||
if (nameNode) {
|
if (nameNode)
|
||||||
setValue(cgroupNode->getNode("gui/window/name", true),
|
setValue(cgroupNode->getNode("gui/window/name", true),
|
||||||
nameNode->getStringValue());
|
nameNode->getStringValue());
|
||||||
setValue(cgroupNode->getNode("splash/window/name", true),
|
}
|
||||||
nameNode->getStringValue());
|
|
||||||
|
SGPropertyNode* splashWindowNameNode = cgroupNode->getNode("splash/window/name");
|
||||||
|
if (!splashWindowNameNode) {
|
||||||
|
// Find the first camera with a window name
|
||||||
|
SGPropertyNodeVec cameras(cgroupNode->getChildren("camera"));
|
||||||
|
for (auto it = cameras.begin(); it != cameras.end(); ++it) {
|
||||||
|
SGPropertyNode* nameNode = (*it)->getNode("window/name");
|
||||||
|
if (nameNode) {
|
||||||
|
// Use that window name for the splash
|
||||||
|
setValue(cgroupNode->getNode("splash/window/name", true),
|
||||||
|
nameNode->getStringValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue