From 7a096d983568ec04c9fad4a33fdb64543c6aa9f2 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Mon, 2 Aug 2021 23:30:19 +0100 Subject: [PATCH] CameraGroup::buildCamera(): Return CameraInfo* Make CameraGroup::buildCamera() return the new CameraInfo* so the caller can make adjustments. --- src/Viewer/CameraGroup.cxx | 8 +++++--- src/Viewer/CameraGroup.hxx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 8b326e019..15b6f0029 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -477,7 +477,7 @@ void CameraGroup::buildDistortionCamera(const SGPropertyNode* psNode, #endif } -void CameraGroup::buildCamera(SGPropertyNode* cameraNode) +CameraInfo* CameraGroup::buildCamera(SGPropertyNode* cameraNode) { WindowBuilder *wBuild = WindowBuilder::getWindowBuilder(); const SGPropertyNode* windowNode = cameraNode->getNode("window"); @@ -491,7 +491,7 @@ void CameraGroup::buildCamera(SGPropertyNode* cameraNode) window = wBuild->buildWindow(cameraNode); } if (!window) { - return; + return nullptr; } osg::Matrix vOff; @@ -599,7 +599,7 @@ void CameraGroup::buildCamera(SGPropertyNode* cameraNode) if (it == _cameras.end()) { SG_LOG(SG_VIEW, SG_ALERT, "CameraGroup::buildCamera: " "failed to find parent camera for relative camera!"); - return; + return nullptr; } parentInfo = (*it); if (projectionNode->getNameString() == "right-of-perspective") { @@ -717,6 +717,8 @@ void CameraGroup::buildCamera(SGPropertyNode* cameraNode) info->flags = info->flags | CameraInfo::VIEW_ABSOLUTE; //buildDistortionCamera(psNode, camera); } + + return info; } void CameraGroup::buildGUICamera(SGPropertyNode* cameraNode, diff --git a/src/Viewer/CameraGroup.hxx b/src/Viewer/CameraGroup.hxx index 60d4faeb1..0f24adf65 100644 --- a/src/Viewer/CameraGroup.hxx +++ b/src/Viewer/CameraGroup.hxx @@ -150,7 +150,7 @@ public: * @param cameraNode the property node. * @return a CameraInfo object for the camera. */ - void buildCamera(SGPropertyNode* cameraNode); + CameraInfo* buildCamera(SGPropertyNode* cameraNode); /** Create a camera from properties that will draw the GUI and add * it to the camera group. * @param cameraNode the property node. This can be 0, in which