summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-08-18 15:40:57 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-08-18 15:40:57 -0400
commit9827dff971807471a2c20c2342bd77c43a931e6f (patch)
treef1721461b53dc72f3d153ef9a22881ae14212cdd /indra
parentba2b77d0882f8ca3ef0ae95ca9d388aa217f9a7a (diff)
Fix frequent deep findChild calls for LLFloaterSidePanelContainer main during various ui callbacks
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatersidepanelcontainer.cpp28
-rw-r--r--indra/newview/llfloatersidepanelcontainer.h9
2 files changed, 32 insertions, 5 deletions
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index 6c5d2570f2..9e577c83a8 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -53,9 +53,15 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer()
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
}
+bool LLFloaterSidePanelContainer::postBuild()
+{
+ mMainPanel = getChild<LLPanel>(sMainPanelName);
+ return TRUE;
+}
+
void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
{
- getChild<LLPanel>(sMainPanelName)->onOpen(key);
+ mMainPanel->onOpen(key);
}
void LLFloaterSidePanelContainer::closeFloater(bool app_quitting)
@@ -206,10 +212,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std::
LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name)
{
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
-
if (floaterp)
{
- return floaterp->findChild<LLPanel>(panel_name, true);
+ if (panel_name == sMainPanelName)
+ {
+ return floaterp->mMainPanel;
+ }
+ else
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
}
return NULL;
@@ -218,10 +230,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st
LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name)
{
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name);
-
if (floaterp)
{
- return floaterp->findChild<LLPanel>(panel_name, true);
+ if (panel_name == sMainPanelName)
+ {
+ return floaterp->mMainPanel;
+ }
+ else
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
}
return NULL;
diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h
index d7f6c309c4..a57a2da4d9 100644
--- a/indra/newview/llfloatersidepanelcontainer.h
+++ b/indra/newview/llfloatersidepanelcontainer.h
@@ -49,6 +49,8 @@ public:
LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
~LLFloaterSidePanelContainer();
+ bool postBuild() override;
+
void onOpen(const LLSD& key) override;
void closeFloater(bool app_quitting = false) override;
@@ -77,6 +79,11 @@ public:
* @returns a pointer to the panel of given type T.
*/
template <typename T>
+ static T* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName)
+ {
+ return dynamic_cast<T*>(findPanel(floater_name, panel_name));
+ }
+ template <typename T>
static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName)
{
T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
@@ -89,6 +96,8 @@ public:
protected:
void onCloseMsgCallback(const LLSD& notification, const LLSD& response);
+
+ LLPanel* mMainPanel = nullptr;
};
#endif // LL_LLFLOATERSIDEPANELCONTAINER_H