From ab02bce279f5838242b410df418753609e31bda1 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Sat, 5 Nov 2022 17:08:49 +0000 Subject: [PATCH] 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: bb0d7fc0a71c ("src/Viewer: Move splash to cam group camera") Reported-by: Durk Talsma --- src/Viewer/CameraGroup.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 92bd7078c..f98675617 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -1185,11 +1185,23 @@ void CameraGroup::buildDefaultGroup(osgViewer::View* viewer) setValue(masterCamera->getNode("vr-mirror", true), true); } SGPropertyNode* nameNode = masterCamera->getNode("window/name"); - if (nameNode) { + if (nameNode) setValue(cgroupNode->getNode("gui/window/name", true), 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; + } } }