From 86493e59226b11c0ab5c57405378cdbb96e353aa Mon Sep 17 00:00:00 2001 From: ahcorde Date: Mon, 17 May 2021 10:18:25 +0200 Subject: [PATCH] Removed duplicated code with rendering::sceneFromFirstRenderEngine Signed-off-by: ahcorde --- src/plugins/screenshot/Screenshot.cc | 46 +--------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/src/plugins/screenshot/Screenshot.cc b/src/plugins/screenshot/Screenshot.cc index e78134813..bb92d2241 100644 --- a/src/plugins/screenshot/Screenshot.cc +++ b/src/plugins/screenshot/Screenshot.cc @@ -181,52 +181,8 @@ void Screenshot::FindUserCamera() if (nullptr != this->dataPtr->userCamera) return; - auto loadedEngNames = ignition::rendering::loadedEngines(); - if (loadedEngNames.empty()) - { - igndbg << "No rendering engine is loaded yet" << std::endl; - return; - } - - // assume there is only one engine loaded - auto engineName = loadedEngNames[0]; - if (loadedEngNames.size() > 1) - { - igndbg << "More than one engine is available. " - << "Using engine [" << engineName << "]" << std::endl; - } - auto engine = ignition::rendering::engine(engineName); - if (!engine) - { - ignerr << "Internal error: failed to load engine [" << engineName - << "]. Grid plugin won't work." << std::endl; - return; - } - - if (engine->SceneCount() == 0) - { - igndbg << "No scene has been created yet" << std::endl; - return; - } - // Get first scene - auto scene = engine->SceneByIndex(0); - if (nullptr == scene) - { - ignerr << "Internal error: scene is null." << std::endl; - return; - } - - if (engine->SceneCount() > 1) - { - igndbg << "More than one scene is available. " - << "Using scene [" << scene->Name() << "]" << std::endl; - } - - if (!scene->IsInitialized() || nullptr == scene->RootVisual()) - { - return; - } + auto scene = rendering::sceneFromFirstRenderEngine(); for (unsigned int i = 0; i < scene->NodeCount(); ++i) {