summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2026-03-31 18:41:04 +0300
committerGitHub <noreply@github.com>2026-03-31 18:41:04 +0300
commita77156ebbdfa61a9c88437a61b78f986e191ac80 (patch)
treec284384ec4dcfb9a4ba78bf0d5b09084be99bc09
parente2d8ace323fa4980a6a6e12f4585c2b90f388934 (diff)
#5373 add leap api to open Build floater and change selected tool
-rw-r--r--indra/llui/llfloaterreglistener.cpp9
-rw-r--r--indra/llui/llfloaterreglistener.h1
-rw-r--r--indra/newview/lltoolmgr.cpp62
3 files changed, 72 insertions, 0 deletions
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 17641b8375..7cf09369ec 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -60,6 +60,10 @@ LLFloaterRegListener::LLFloaterRegListener():
"Ask to toggle the state of the floater specified in [\"name\"]",
&LLFloaterRegListener::toggleInstance,
requiredName);
+ add("toggleInstanceOrBringToFront",
+ "Ask to toggle the state of the floater specified in [\"name\"] or bring it to front if already opened",
+ &LLFloaterRegListener::toggleInstance,
+ requiredName);
add("instanceVisible",
"Return on [\"reply\"] an event whose [\"visible\"] indicates the visibility "
"of the floater specified in [\"name\"]",
@@ -107,6 +111,11 @@ void LLFloaterRegListener::toggleInstance(const LLSD& event) const
LLFloaterReg::toggleInstance(event["name"].asString(), event["key"]);
}
+void LLFloaterRegListener::toggleInstanceOrBringToFront(const LLSD& event) const
+{
+ LLFloaterReg::toggleInstanceOrBringToFront(event["name"].asString(), event["key"]);
+}
+
void LLFloaterRegListener::instanceVisible(const LLSD& event) const
{
sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"].asString(), event["key"])),
diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h
index 28f6e7c66b..610a2831dc 100644
--- a/indra/llui/llfloaterreglistener.h
+++ b/indra/llui/llfloaterreglistener.h
@@ -46,6 +46,7 @@ private:
void showInstance(const LLSD& event) const;
void hideInstance(const LLSD& event) const;
void toggleInstance(const LLSD& event) const;
+ void toggleInstanceOrBringToFront(const LLSD& event) const;
void instanceVisible(const LLSD& event) const;
void clickButton(const LLSD& event) const;
};
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp
index 07963a7bed..c7e6f774dc 100644
--- a/indra/newview/lltoolmgr.cpp
+++ b/indra/newview/lltoolmgr.cpp
@@ -57,6 +57,7 @@
#include "llviewerjoystick.h"
#include "llviewermenu.h"
#include "llviewerparcelmgr.h"
+#include "lleventapi.h"
// Used when app not active to avoid processing hover.
@@ -69,6 +70,67 @@ LLToolset* gMouselookToolset = NULL;
LLToolset* gFaceEditToolset = NULL;
/////////////////////////////////////////////////////
+// LLToolMgrListener
+
+class LLToolMgrListener: public LLEventAPI
+{
+public:
+ LLToolMgrListener():
+ LLEventAPI("LLToolMgr",
+ "LLToolMgr listener for tool management operations")
+ {
+ add("openBuildFloater",
+ "Open the build floater by toggling build mode",
+ &LLToolMgrListener::openFloater);
+ add("selectTool",
+ "Select the specified tool by [\"tool_name\"]. Valid tool names: Focus, Move, Edit, Create, Land",
+ &LLToolMgrListener::selectTool);
+ }
+
+private:
+ void openFloater(const LLSD& event) const
+ {
+ LLToolMgr::getInstance()->toggleBuildMode(LLSD("build"));
+ }
+
+ void selectTool(const LLSD& event) const
+ {
+ if (!event.has("tool_name"))
+ {
+ LL_WARNS() << "selectTool: called without tool_name" << LL_ENDL;
+ return;
+ }
+
+ static const std::unordered_map<std::string, S32> tool_indices = {
+ {"focus", 1},
+ {"move", 2},
+ {"edit", 3},
+ {"create", 4},
+ {"land", 5}
+ };
+
+ const std::string tool_name = utf8str_tolower(event["tool_name"].asString());
+ const auto it = tool_indices.find(tool_name);
+ if (it == tool_indices.end())
+ {
+ LL_WARNS() << "selectTool: unknown tool_name: " << std::quoted(tool_name) << LL_ENDL;
+ return;
+ }
+
+ LLToolset* current_toolset = LLToolMgr::getInstance()->getCurrentToolset();
+ if (!current_toolset)
+ {
+ LL_WARNS() << "selectTool: no current toolset available" << LL_ENDL;
+ return;
+ }
+
+ current_toolset->selectToolByIndex(it->second);
+ }
+};
+
+static LLToolMgrListener sToolMgrListener;
+
+/////////////////////////////////////////////////////
// LLToolMgr
LLToolMgr::LLToolMgr()