diff --git a/modules/skybrowser/skybrowsermodule.cpp b/modules/skybrowser/skybrowsermodule.cpp index 7be4ed401e..83d0adfbfa 100644 --- a/modules/skybrowser/skybrowsermodule.cpp +++ b/modules/skybrowser/skybrowsermodule.cpp @@ -239,6 +239,7 @@ void SkyBrowserModule::addTargetBrowserPair(const std::string& targetId, if (browser && target) { _targetsBrowsers.push_back(std::make_unique(target, browser)); } + _uniqueIdentifierCounter++; } void SkyBrowserModule::removeTargetBrowserPair(const std::string& id) { @@ -425,6 +426,10 @@ glm::ivec3 SkyBrowserModule::highlight() const { return _highlightAddition; } +int SkyBrowserModule::uniqueIdentifierCounter() const { + return _uniqueIdentifierCounter; +} + bool SkyBrowserModule::isCameraInSolarSystem() const { return _isCameraInSolarSystem; } diff --git a/modules/skybrowser/skybrowsermodule.h b/modules/skybrowser/skybrowsermodule.h index 8aa948f5af..9b82a74f49 100644 --- a/modules/skybrowser/skybrowsermodule.h +++ b/modules/skybrowser/skybrowsermodule.h @@ -64,6 +64,7 @@ public: std::string selectedBrowserId() const; std::string selectedTargetId() const; glm::ivec3 highlight() const; + int uniqueIdentifierCounter() const; void setSelectedBrowser(const std::string& id); void setHoverCircle(SceneGraphNode* circle); @@ -117,6 +118,7 @@ private: TargetBrowserPair* _mouseOnPair = nullptr; SceneGraphNode* _hoverCircle = nullptr; std::string _selectedBrowser = ""; // Currently selected browser + int _uniqueIdentifierCounter = 0; // Flags bool _isCameraInSolarSystem = true; // Visualization modes diff --git a/modules/skybrowser/skybrowsermodule_lua.inl b/modules/skybrowser/skybrowsermodule_lua.inl index b6501bf635..e215ded25e 100644 --- a/modules/skybrowser/skybrowsermodule_lua.inl +++ b/modules/skybrowser/skybrowsermodule_lua.inl @@ -422,11 +422,11 @@ namespace { SkyBrowserModule* module = global::moduleEngine->module(); - int noOfPairs = module->nPairs(); - std::string nameBrowser = "Sky Browser " + std::to_string(noOfPairs); - std::string nameTarget = "Sky Target " + std::to_string(noOfPairs); - std::string idBrowser = "SkyBrowser" + std::to_string(noOfPairs); - std::string idTarget = "SkyTarget" + std::to_string(noOfPairs); + int uniqueIdentifier = module->uniqueIdentifierCounter(); + std::string nameBrowser = "Sky Browser " + std::to_string(uniqueIdentifier); + std::string nameTarget = "Sky Target " + std::to_string(uniqueIdentifier); + std::string idBrowser = "SkyBrowser" + std::to_string(uniqueIdentifier); + std::string idTarget = "SkyTarget" + std::to_string(uniqueIdentifier); // Determine starting point on screen for the target glm::vec3 positionBrowser = glm::vec3(0.f, 0.f, -2.1f); glm::vec3 positionTarget = glm::vec3(0.9f, 0.4f, -2.1f);