From fcc885d4fc5ef63dad33e89a9324edc39d466d37 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 19 Nov 2013 15:51:27 -0500 Subject: replace uses of LLEnvManagerNew::setRegionChangeCallback with LLAgent::addRegionChangedCallback --- indra/newview/llagent.cpp | 13 ---- indra/newview/llenvmanager.cpp | 76 +++++++++++----------- indra/newview/llenvmanager.h | 9 +-- indra/newview/llfloatereditdaycycle.cpp | 2 +- indra/newview/llfloaterpathfindingconsole.cpp | 4 +- indra/newview/llfloaterpathfindingobjects.cpp | 3 +- indra/newview/llfloaterregioninfo.cpp | 2 +- .../llmenuoptionpathfindingrebakenavmesh.cpp | 2 +- 8 files changed, 46 insertions(+), 65 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5302ae2636..6ee8f26b9f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -850,7 +850,6 @@ boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_cal //----------------------------------------------------------------------------- void LLAgent::setRegion(LLViewerRegion *regionp) { - bool teleport = true; bool notifyRegionChange; llassert(regionp); @@ -888,9 +887,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { gSky.mVOGroundp->setRegion(regionp); } - - // Notify windlight managers - teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE); } else { @@ -938,15 +934,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLFloaterMove::sUpdateFlyingStatus(); - if (teleport) - { - LLEnvManagerNew::instance().onTeleport(); - } - else - { - LLEnvManagerNew::instance().onRegionCrossing(); - } - // If the newly entered region is using server bakes, and our // current appearance is non-baked, request appearance update from // server. diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 86fe6754dc..589cf28615 100755 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -92,9 +92,11 @@ void LLEnvPrefs::setUseDayCycle(const std::string& name) } //============================================================================= -LLEnvManagerNew::LLEnvManagerNew() +LLEnvManagerNew::LLEnvManagerNew(): + mInterpNextChangeMessage(true), + mCurRegionUUID(LLUUID::null), + mLastReceivedID(LLUUID::null) { - mInterpNextChangeMessage = true; // Set default environment settings. mUserPrefs.mUseRegionSettings = true; @@ -102,6 +104,9 @@ LLEnvManagerNew::LLEnvManagerNew() mUserPrefs.mWaterPresetName = "Default"; mUserPrefs.mSkyPresetName = "Default"; mUserPrefs.mDayCycleName = "Default"; + + LL_DEBUGS("Windlight")<getRegionID() : LLUUID::null; - if (region_uuid == mCurRegionUUID) + if (region_uuid != mCurRegionUUID) { - return; + // Clear locally modified region settings. + mNewRegionPrefs.clear(); + + // *TODO: clear environment settings of the previous region? + + // Request environment settings of the new region. + mCurRegionUUID = region_uuid; + // for region crossings, interpolate the change; for teleports, don't + mInterpNextChangeMessage = (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE); + LL_DEBUGS("Windlight") << (mInterpNextChangeMessage ? "Crossed" : "Teleported") + << " to new region: " << region_uuid + << LL_ENDL; + requestRegionSettings(); + } + else + { + LL_DEBUGS("Windlight") << "disregarding region change; interp: " + << (mInterpNextChangeMessage ? "true" : "false") + << " regionp: " << regionp + << " old: " << mCurRegionUUID + << " new: " << region_uuid + << LL_ENDL; } - - // Clear locally modified region settings. - mNewRegionPrefs.clear(); - - // *TODO: clear environment settings of the previous region? - - // Request environment settings of the new region. - LL_DEBUGS("Windlight") << "New viewer region: " << region_uuid << LL_ENDL; - mCurRegionUUID = region_uuid; - mInterpNextChangeMessage = interpolate; - requestRegionSettings(); - - // Let interested parties know agent region has been changed. - mRegionChangeSignal(); } diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index ad56761bc7..c7877303fc 100755 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -166,7 +166,6 @@ class LLEnvManagerNew : public LLSingleton public: typedef boost::signals2::signal prefs_change_signal_t; typedef boost::signals2::signal region_settings_change_signal_t; - typedef boost::signals2::signal region_change_signal_t; typedef boost::signals2::signal region_settings_applied_signal_t; LLEnvManagerNew(); @@ -222,15 +221,12 @@ public: bool sendRegionSettings(const LLEnvironmentSettings& new_settings); boost::signals2::connection setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); - boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); static bool canEditRegionSettings(); /// @return true if we have access to editing region environment static const std::string getScopeString(LLEnvKey::EScope scope); // Public callbacks. - void onRegionCrossing(); - void onTeleport(); void onRegionSettingsResponse(const LLSD& content); void onRegionSettingsApplyResponse(bool ok); @@ -251,7 +247,7 @@ private: bool useDefaultSky(); bool useDefaultWater(); - void onRegionChange(bool interpolate); + void onRegionChange(); /// Emitted when user environment preferences change. prefs_change_signal_t mUsePrefsChangeSignal; @@ -259,9 +255,6 @@ private: /// Emitted when region environment settings update comes. region_settings_change_signal_t mRegionSettingsChangeSignal; - /// Emitted when agent region changes. Move to LLAgent? - region_change_signal_t mRegionChangeSignal; - /// Emitted when agent region changes. Move to LLAgent? region_settings_applied_signal_t mRegionSettingsAppliedSignal; diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index b63677b258..78e20e3bf0 100755 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -145,7 +145,7 @@ void LLFloaterEditDayCycle::initCallbacks(void) // Connect to env manager events. LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsChange, this)); - env_mgr.setRegionChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this)); + gAgent.addRegionChangedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this)); env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsApplied, this, _1)); // Connect to day cycle manager events. diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 298454724b..161259d049 100755 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -34,11 +34,11 @@ #include +#include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llcontrol.h" -#include "llenvmanager.h" #include "llfloaterpathfindingcharacters.h" #include "llfloaterpathfindinglinksets.h" #include "llfloaterreg.h" @@ -224,7 +224,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if (!mRegionBoundarySlot.connected()) { - mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + mRegionBoundarySlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); } if (!mTeleportFailedSlot.connected()) diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 20c1215bcb..d72ee073e1 100755 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -41,7 +41,6 @@ #include "llavatarnamecache.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llenvmanager.h" #include "llfloater.h" #include "llfontgl.h" #include "llnotifications.h" @@ -85,7 +84,7 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey) if (!mRegionBoundaryCrossingSlot.connected()) { - mRegionBoundaryCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this)); + mRegionBoundaryCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this)); } if (!mGodLevelChangeSlot.connected()) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 66bf49331b..ed0209f90b 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -219,7 +219,7 @@ BOOL LLFloaterRegionInfo::postBuild() &processEstateOwnerRequest); // Request region info when agent region changes. - LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this)); + gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this)); return TRUE; } diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp index a567d1217a..8879cfd7fb 100755 --- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp +++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp @@ -79,7 +79,7 @@ void LLMenuOptionPathfindingRebakeNavmesh::initialize() if ( !mRegionCrossingSlot.connected() ) { - mRegionCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this)); + mRegionCrossingSlot = gAgent.addRegionChangedCallback(boost::bind(&LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this)); } if (!mAgentStateSlot.connected()) -- cgit v1.2.3