diff options
| author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2026-08-05 12:46:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-05 12:46:07 +0300 |
| commit | b68613f24ff4bb80c0571335d9274392ab3deaea (patch) | |
| tree | 4d4510f24a0328db7a1640e09dfc9ab6dafd5563 /indra | |
| parent | 18dc4ebf13dddd5116f0f64f1cff5fa4da098265 (diff) | |
#5869 Add LEAP API to get a full tree from root (getInfo and getPaths combined)
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llwindowlistener.cpp | 41 | ||||
| -rw-r--r-- | indra/newview/llwindowlistener.h | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 38e49d0750..54eb61a6bf 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -90,6 +90,12 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& "to list; all nodes from root if no [\"under\"].", &LLWindowListener::getPaths, LLSDMap("reply", LLSD())); + add("getSubtree", + "Send on [\"reply\"] a nested tree of info maps for all descendants of\n" + "optional [\"under\"] path (default: root). Each node contains the same\n" + "fields as getInfo plus a [\"children\"] array of child nodes.", + &LLWindowListener::getSubtree, + LLSDMap("reply", LLSD())); add("keyDown", keySomething + "keypress event.\n" + keyExplain + "The [\"char\"] parameter detects and handles non-ASCII characters seperately\n" + mask, @@ -265,6 +271,41 @@ void LLWindowListener::getPaths(LLSD const & request) } } +static LLSD buildSubtree(LLView* view) +{ + LLSD children; + LLSD node = view->getInfo(); + for (LLView::child_list_const_iter_t it = view->beginChild(); it != view->endChild(); ++it) + { + children.append(buildSubtree(*it)); + } + node["children"] = children; + return node; +} + +void LLWindowListener::getSubtree(LLSD const & request) +{ + Response response(LLSD(), request); + LLView* root = LLUI::getInstance()->getRootView(); + LLView* base = nullptr; + std::string under(request["under"]); + + if (under.empty()) + { + base = root; + } + else + { + base = LLUI::getInstance()->resolvePath(root, under); + if (!base) + { + return response.error(STRINGIZE(request["op"].asString() << " request specified invalid \"under\" path: '" << under << "'")); + } + } + + response.setResponse(buildSubtree(base)); +} + void LLWindowListener::keyDown(LLSD const & evt) { Response response(LLSD(), evt); diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h index d3a16cfde9..537322b19b 100644 --- a/indra/newview/llwindowlistener.h +++ b/indra/newview/llwindowlistener.h @@ -41,6 +41,7 @@ public: void getInfo(LLSD const & evt); void getPaths(LLSD const & evt); + void getSubtree(LLSD const & evt); void keyDown(LLSD const & evt); void keyUp(LLSD const & evt); void mouseDown(LLSD const & evt); |
