Create lua function to show or hide all targets and browsers

This commit is contained in:
Ylva Selling
2022-04-26 17:37:05 -04:00
parent e6cf6d3925
commit 24b6383afb
3 changed files with 17 additions and 2 deletions

View File

@@ -434,7 +434,8 @@ scripting::LuaLibrary SkyBrowserModule::luaLibrary() const {
codegen::lua::StartFinetuningTarget,
codegen::lua::FinetuneTargetPosition,
codegen::lua::ScrollOverBrowser,
codegen::lua::LoadingImageCollectionComplete
codegen::lua::LoadingImageCollectionComplete,
codegen::lua::ShowAllTargetsAndBrowsers
}
};
}

View File

@@ -735,6 +735,20 @@ namespace {
}
}
/**
* Show or hide all targets and browsers
* \param identifier Identifier of the sky browser
* \param show Sets if the targets and browsers should be enabled or disabled
*/
[[codegen::luawrap]] void showAllTargetsAndBrowsers(bool show) {
using namespace openspace;
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
const std::vector<std::unique_ptr<TargetBrowserPair>>& pairs = module->getPairs();
for (const std::unique_ptr<TargetBrowserPair>& pair : pairs) {
pair->setEnabled(show);
}
}
#include "skybrowsermodule_lua_codegen.cpp"
} // namespace

View File

@@ -123,7 +123,7 @@ void TargetBrowserPair::synchronizeAim() {
void TargetBrowserPair::setEnabled(bool enable) {
_browser->setEnabled(enable);
_targetRenderable->property("Enabled")->set(false);
_targetRenderable->property("Enabled")->set(enable);
}
void TargetBrowserPair::setOpacity(float opacity) {