From 81f1be67109885f98f649974022aa6d444dd633d Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 13 May 2023 04:10:28 +0100 Subject: sl-19676 - 360 Intereset list mode. Changed mode to be a string for future expansion instead of a bool toggle --- indra/newview/llagent.cpp | 36 ++++++++++++++++++++--------------- indra/newview/llagent.h | 7 ++++--- indra/newview/llfloater360capture.cpp | 9 ++++----- indra/newview/llfloater360capture.h | 2 +- indra/newview/llviewermenu.cpp | 12 +++++++++--- indra/newview/llviewerregion.cpp | 34 +++++++++++++++++---------------- indra/newview/llviewerregion.h | 11 ++++++----- 7 files changed, 63 insertions(+), 48 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 89d4df7caa..307f73fab4 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -401,7 +401,7 @@ LLAgent::LLAgent() : mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), mTeleportState(TELEPORT_NONE), mRegionp(NULL), - mUse360Mode(false), + mInterestListMode(LLViewerRegion::IL_MODE_DEFAULT), mAgentOriginGlobal(), mPositionGlobal(), @@ -904,10 +904,9 @@ void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion LLAppViewer::instance()->updateNameLookupUrl(regionp); } - if (gAgent.getInterestList360Mode()) + if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) { - const bool use_360_mode = true; - gAgent.changeInterestListMode(use_360_mode); + gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); } } } @@ -2932,22 +2931,29 @@ void LLAgent::processMaturityPreferenceFromServer(const LLSD &result, U8 perferr // (hopefully) small period of time while the full contents resolves. // Pass in a flag to ask the simulator/interest list to "send everything" or // not (the default mode) -void LLAgent::changeInterestListMode(bool use_360_mode) +void LLAgent::changeInterestListMode(const std::string &new_mode) { - mUse360Mode = use_360_mode; - - // Change interest list mode for all regions. If they are already set for the current mode, - // the setting will have no effect. - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); - ++iter) + if (new_mode != mInterestListMode) { - LLViewerRegion *regionp = *iter; - if (regionp && regionp->isAlive() && regionp->capabilitiesReceived()) + mInterestListMode = new_mode; + + // Change interest list mode for all regions. If they are already set for the current mode, + // the setting will have no effect. + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); + ++iter) { - regionp->setInterestList360Mode(mUse360Mode); + LLViewerRegion *regionp = *iter; + if (regionp && regionp->isAlive() && regionp->capabilitiesReceived()) + { + regionp->setInterestListMode(mInterestListMode); + } } } + else + { + LL_DEBUGS("360Capture") << "Agent interest list mode is already set to " << mInterestListMode << LL_ENDL; + } } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index ef8df13fc6..b8ac47827a 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -295,13 +295,14 @@ public: void removeRegionChangedCallback(boost::signals2::connection callback); - void changeInterestListMode(bool use_360_mode); - bool getInterestList360Mode() const { return mUse360Mode; } + void changeInterestListMode(const std::string & new_mode); + const std::string & getInterestListMode() const { return mInterestListMode; } private: LLViewerRegion *mRegionp; region_changed_signal_t mRegionChangedSignal; - bool mUse360Mode; + + std::string mInterestListMode; // How agent wants regions to send updates //-------------------------------------------------------------------- // History diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index a0889abe2d..2c638fa959 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -64,11 +64,10 @@ LLFloater360Capture::LLFloater360Capture(const LLSD& key) // such time as we ask it not to (the dtor). If we crash or // otherwise, exit before this is turned off, the Simulator // will take care of cleaning up for us. - mWasIn360Mode = gAgent.getInterestList360Mode(); + mStartILMode = gAgent.getInterestListMode(); // send everything to us for as long as this floater is open - const bool use_360_mode = true; - gAgent.changeInterestListMode(use_360_mode); + gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); } LLFloater360Capture::~LLFloater360Capture() @@ -86,9 +85,9 @@ LLFloater360Capture::~LLFloater360Capture() // list updates. if (!LLApp::isExiting() && gSavedSettings.getBOOL("360CaptureUseInterestListCap") && - mWasIn360Mode != gAgent.getInterestList360Mode()) + mStartILMode != gAgent.getInterestListMode()) { - gAgent.changeInterestListMode(mWasIn360Mode); + gAgent.changeInterestListMode(mStartILMode); } } diff --git a/indra/newview/llfloater360capture.h b/indra/newview/llfloater360capture.h index 61316c65f3..3fb2c7f3c7 100644 --- a/indra/newview/llfloater360capture.h +++ b/indra/newview/llfloater360capture.h @@ -92,7 +92,7 @@ class LLFloater360Capture: LLPointer mRawImages[6]; - bool mWasIn360Mode; + std::string mStartILMode; }; #endif // LL_FLOATER_360CAPTURE_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 23abd0fe16..fe6676759d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1302,8 +1302,14 @@ public: bool handleEvent(const LLSD &userdata) { // Toggle the mode - regions will get updated - bool new_mode = !gAgent.getInterestList360Mode(); - gAgent.changeInterestListMode(new_mode); + if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) + { + gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_DEFAULT); + } + else + { + gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + } return true; } }; @@ -1312,7 +1318,7 @@ class LLAdvancedCheckInterestList360Mode : public view_listener_t { bool handleEvent(const LLSD& userdata) { - return gAgent.getInterestList360Mode(); + return (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360); } }; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7abd77505d..9c2dc3c761 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -104,6 +104,9 @@ S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; LLViewerRegion::vocache_entry_map_t LLViewerRegion::sRegionCacheCleanup; +const std::string LLViewerRegion::IL_MODE_DEFAULT = "default"; +const std::string LLViewerRegion::IL_MODE_360 = "360"; + typedef std::map CapabilityMap; static void log_capabilities(const CapabilityMap &capmap); @@ -647,7 +650,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mPaused(FALSE), mRegionCacheHitCount(0), mRegionCacheMissCount(0), - mUse360Mode(false) + mInterestListMode(IL_MODE_DEFAULT) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -3286,7 +3289,7 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) mCapabilitiesReceivedSignal.disconnect_all_slots(); // Set the region to the desired interest list mode - setInterestList360Mode(gAgent.getInterestList360Mode()); + setInterestListMode(gAgent.getInterestListMode()); } } @@ -3339,22 +3342,21 @@ bool LLViewerRegion::requestGetCapability(const std::string &capName, httpCallba } -void LLViewerRegion::setInterestList360Mode(bool use_360_mode) +void LLViewerRegion::setInterestListMode(const std::string &new_mode) { - if (use_360_mode != mUse360Mode) + if (new_mode != mInterestListMode) { - LLSD body; - mUse360Mode = use_360_mode; + mInterestListMode = new_mode; - if (mUse360Mode) - { - body["mode"] = LLSD::String("360"); - } - else - { - body["mode"] = LLSD::String("default"); - } + if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360)) + { + LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: " + << mInterestListMode << ", setting to default" << LL_ENDL; + mInterestListMode = IL_MODE_DEFAULT; + } + LLSD body; + body["mode"] = mInterestListMode; if (requestPostCapability("InterestList", body, [](const LLSD &response) { LL_DEBUGS("360Capture") << "InterestList capability responded: \n" @@ -3375,13 +3377,13 @@ void LLViewerRegion::setInterestList360Mode(bool use_360_mode) else { LL_DEBUGS("360Capture") << "Region " << getRegionID() << "No change, skipping Interest List mode POST to " - << (use_360_mode ? "360" : "default") << " mode" << LL_ENDL; + << new_mode << " mode" << LL_ENDL; } } -LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type) +LLSpatialPartition *LLViewerRegion::getSpatialPartition(U32 type) { if (type < mImpl->mObjectPartition.size() && type < PARTITION_VO_CACHE) { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 3da0c376d3..6308058f63 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -487,12 +487,13 @@ public: }; typedef std::set region_priority_list_t; - void setInterestList360Mode(bool use_360_mode); - bool getInterestList360Mode() const { return mUse360Mode; } + void setInterestListMode(const std::string & new_mode); + const std::string & getInterestListMode() const { return mInterestListMode; } + static const std::string IL_MODE_DEFAULT; + static const std::string IL_MODE_360; - -private: + private: static S32 sNewObjectCreationThrottle; LLViewerRegionImpl * mImpl; LLFrameTimer mRegionTimer; @@ -591,7 +592,7 @@ private: LLFrameTimer mRenderInfoReportTimer; // how the server interest list works - bool mUse360Mode; + std::string mInterestListMode; }; inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const -- cgit v1.2.3