summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llenvironment.cpp1
-rw-r--r--indra/newview/llfloaterregioninfo.cpp44
-rw-r--r--indra/newview/llfloaterregioninfo.h3
3 files changed, 35 insertions, 13 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 20021fb075..d8095ad2ce 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -364,6 +364,7 @@ void LLEnvironment::initSingleton()
//TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer.
// We need to know new env version to fix this, without it we can only do full re-request
+ // Happens: on updates, on opening LLFloaterRegionInfo, on region crossing if info floater is open
LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); });
gAgent.addRegionChangedCallback([this]() { onRegionChange(); });
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index d7d114ca41..fcaa7d2bf9 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -226,7 +226,8 @@ LLUUID LLFloaterRegionInfo::sRequestInvoice;
LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
: LLFloater(seed),
- mEnvironmentPanel(NULL)
+ mEnvironmentPanel(NULL),
+ mRegionChangedCallback()
{}
BOOL LLFloaterRegionInfo::postBuild()
@@ -285,13 +286,18 @@ BOOL LLFloaterRegionInfo::postBuild()
&processEstateOwnerRequest);
// Request region info when agent region changes.
- gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this));
+ mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::onRegionChanged, this));
return TRUE;
}
LLFloaterRegionInfo::~LLFloaterRegionInfo()
-{}
+{
+ if (mRegionChangedCallback.connected())
+ {
+ mRegionChangedCallback.disconnect();
+ }
+}
void LLFloaterRegionInfo::onOpen(const LLSD& key)
{
@@ -304,15 +310,24 @@ void LLFloaterRegionInfo::onOpen(const LLSD& key)
requestMeshRezInfo();
}
-// static
-void LLFloaterRegionInfo::requestRegionInfo()
+void LLFloaterRegionInfo::onRegionChanged()
{
- LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
+ if (getVisible()) //otherwise onOpen will do request
+ {
+ requestRegionInfo();
+ }
+}
- tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
+void LLFloaterRegionInfo::requestRegionInfo()
+{
+ LLTabContainer* tab = findChild<LLTabContainer>("region_panels");
+ if (tab)
+ {
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
+ }
// Must allow anyone to request the RegionInfo data
// so non-owners/non-gods can see the values.
@@ -483,9 +498,12 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->setCtrlsEnabled(allow_modify);
- // Note: region info also causes LLRegionInfoModel::instance().update(msg); -> requestRegion(); -> changed message
- // we need to know env version here and in update(msg) to know when to request and when not to, when to filter 'changed'
- floater->refreshFromRegion( gAgent.getRegion() );
+ if (floater->getVisible())
+ {
+ // Note: region info also causes LLRegionInfoModel::instance().update(msg); -> requestRegion(); -> changed message
+ // we need to know env version here and in update(msg) to know when to request and when not to, when to filter 'changed'
+ floater->refreshFromRegion(gAgent.getRegion());
+ } // else will rerequest on onOpen either way
}
// static
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 6d64ae1d60..0566c4b2ce 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -96,6 +96,7 @@ public:
// from LLPanel
virtual void refresh();
+ void onRegionChanged();
void requestRegionInfo();
void requestMeshRezInfo();
void enableTopButtons();
@@ -120,6 +121,8 @@ protected:
LLPanelRegionEnvironment *mEnvironmentPanel;
//static S32 sRequestSerial; // serial # of last EstateOwnerRequest
static LLUUID sRequestInvoice;
+private:
+ boost::signals2::connection mRegionChangedCallback;
};