From c911de1e8a657aea81135ad76d90fb14ba7aa239 Mon Sep 17 00:00:00 2001 From: Beq Date: Wed, 19 Jul 2023 13:53:55 +0100 Subject: [PATCH] 360 photo and Area Search Improvements Ensure that full update interest list is re-established for the current region after a TP Ensure that it works properly with both 360 and Area Search overlapping Make the Developer menu full update toggle show current state and allow it to reset to 0/default when floaters are in use as an override. --- indra/newview/fsareasearch.cpp | 49 ++++++-- indra/newview/fsareasearch.h | 3 +- indra/newview/llfloater360capture.cpp | 119 ++++++++++++------ indra/newview/llfloater360capture.h | 7 +- indra/newview/llviewermenu.cpp | 115 +++++++++++------ indra/newview/llviewerregion.cpp | 48 +++++++ indra/newview/llviewerregion.h | 6 +- .../skins/default/xui/en/menu_viewer.xml | 10 +- 8 files changed, 267 insertions(+), 90 deletions(-) diff --git a/indra/newview/fsareasearch.cpp b/indra/newview/fsareasearch.cpp index b81a20454f..e1cf90b490 100644 --- a/indra/newview/fsareasearch.cpp +++ b/indra/newview/fsareasearch.cpp @@ -174,6 +174,11 @@ FSAreaSearch::FSAreaSearch(const LLSD& key) : mRlvBehaviorCallbackConnection() { LLViewerRegion::sFSAreaSearchActive = true; + if( LLViewerRegion* region = gAgent.getRegion() ) + { + checkRegion(); + } + mFactoryMap["area_search_list_panel"] = LLCallbackMap(createPanelList, this); mFactoryMap["area_search_find_panel"] = LLCallbackMap(createPanelFind, this); mFactoryMap["area_search_filter_panel"] = LLCallbackMap(createPanelFilter, this); @@ -185,11 +190,24 @@ FSAreaSearch::FSAreaSearch(const LLSD& key) : mParcelChangedObserver = std::make_unique(this); LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver.get()); + mRegionChangeConnection = gAgent.addRegionChangedCallback(boost::bind(&FSAreaSearch::checkRegion, this)); } FSAreaSearch::~FSAreaSearch() { LLViewerRegion::sFSAreaSearchActive = false; + + // Tell the Simulator not to send us everything anymore + // and revert to the regular "keyhole" frustum of interest + // list updates. + if( !LLApp::isExiting() ) + { + if( LLViewerRegion* region = gAgent.getRegion() ) + { + region->useFullUpdateInterestListMode(false); + } + } + if (!gIdleCallbacks.deleteFunction(idle, this)) { LL_WARNS("FSAreaSearch") << "FSAreaSearch::~FSAreaSearch() failed to delete callback" << LL_ENDL; @@ -214,6 +232,11 @@ FSAreaSearch::~FSAreaSearch() LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver.get()); mParcelChangedObserver = nullptr; } + + if (mRegionChangeConnection.connected()) + { + mRegionChangeConnection.disconnect(); + } } BOOL FSAreaSearch::postBuild() @@ -320,24 +343,27 @@ void FSAreaSearch::updateRlvRestrictions(ERlvBehaviour behavior) void FSAreaSearch::checkRegion() { - if (mActive) - { - // Check if we changed region, and if we did, clear the object details cache. - if (LLViewerRegion* region = gAgent.getRegion(); region && (region != mLastRegion)) + static LLViewerRegion *last_region = nullptr; + // Check if we changed region, if so reset the interest list to full, + LLViewerRegion* region = gAgent.getRegion(); + if( region && (region != last_region) ) + { + region->useFullUpdateInterestListMode(true, true); // we force this because we want a true count + if ( mActive ) { - if (!mExcludeNeighborRegions) + // and if we did and are active, clear the object details cache. + if( !mExcludeNeighborRegions ) { std::vector uniqueRegions; region->getNeighboringRegions(uniqueRegions); - if (std::find(uniqueRegions.begin(), uniqueRegions.end(), mLastRegion) != uniqueRegions.end()) + if( std::find( uniqueRegions.begin(), uniqueRegions.end(), last_region ) != uniqueRegions.end() ) { // Crossed into a neighboring region, no need to clear everything. - mLastRegion = region; + last_region = region; return; } // else teleported into a new region } - mLastRegion = region; mRequested = 0; mObjectDetails.clear(); mRegionRequests.clear(); @@ -347,7 +373,14 @@ void FSAreaSearch::checkRegion() mPanelList->setAgentLastPosition(gAgent.getPositionGlobal()); mRefresh = true; } + if( last_region ) + { + // we clear the old region status, because the instance may persist for us + // but the region itself will have reset when we left. + last_region->clearFullUpdateInterestList(); + } } + last_region = region; } void FSAreaSearch::refreshList(bool cache_clear) diff --git a/indra/newview/fsareasearch.h b/indra/newview/fsareasearch.h index 95939f17d7..b7dc2be0f3 100644 --- a/indra/newview/fsareasearch.h +++ b/indra/newview/fsareasearch.h @@ -213,7 +213,8 @@ private: typedef std::map name_cache_connection_map_t; name_cache_connection_map_t mNameCacheConnections; - LLViewerRegion* mLastRegion; + boost::signals2::connection mRegionChangeConnection; // reset interest list verbosity after TP + class FSParcelChangeObserver; friend class FSParcelChangeObserver; diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index 0648d651d1..975beca295 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -51,6 +51,27 @@ #include +// Fix 360 capture missing objects after TP +void LLFloater360Capture::checkRegion() +{ + static LLViewerRegion *last_region = nullptr; + // Check if we changed region, if so reset the interest list to full, + LLViewerRegion* region = gAgent.getRegion(); + if( region && (region != last_region) ) + { + region->useFullUpdateInterestListMode(true, true); + if( last_region ) + { + // we clear the old region status, because the instance may persist for us + // but the region itself will have reset when we left. + last_region->clearFullUpdateInterestList(); + } + } + last_region = region; +} + +// + LLFloater360Capture::LLFloater360Capture(const LLSD& key) : LLFloater(key) { @@ -66,10 +87,19 @@ LLFloater360Capture::LLFloater360Capture(const LLSD& key) // will take care of cleaning up for us. if (gSavedSettings.getBOOL("360CaptureUseInterestListCap")) { +// Fix 360 capture missing objects after TP // send everything to us for as long as this floater is open - const bool send_everything = true; - changeInterestListMode(send_everything); + // const bool send_everything = true; + // changeInterestListMode(send_everything); + // } + // } + if( LLViewerRegion* region = gAgent.getRegion() ) + { + checkRegion(); + } } + mRegionChangeConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloater360Capture::checkRegion, this)); +// } LLFloater360Capture::~LLFloater360Capture() @@ -86,9 +116,22 @@ LLFloater360Capture::~LLFloater360Capture() // list updates. if (!LLApp::isExiting() && gSavedSettings.getBOOL("360CaptureUseInterestListCap")) { - const bool send_everything = false; - changeInterestListMode(send_everything); +// Fix 360 capture missing objects after TP +// const bool send_everything = false; +// changeInterestListMode(send_everything); +// } +// } + + if( LLViewerRegion* region = gAgent.getRegion() ) + { + region->useFullUpdateInterestListMode(false); + } } + if (mRegionChangeConnection.connected()) + { + mRegionChangeConnection.disconnect(); + } +// } BOOL LLFloater360Capture::postBuild() @@ -171,6 +214,8 @@ void LLFloater360Capture::onChooseQualityRadioGroup() setSourceImageSize(); } +// Area search improvements - allow area search and 360 to coexist nicely. +// Code moved to LLViewerRegion.cpp // Using a new capability, tell the simulator that we want it to send everything // it knows about and not just what is in front of the camera, in its view // frustum. We need this feature so that the contents of the region that appears @@ -183,40 +228,40 @@ void LLFloater360Capture::onChooseQualityRadioGroup() // (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 LLFloater360Capture::changeInterestListMode(bool send_everything) -{ - LLSD body; +// void LLFloater360Capture::changeInterestListMode(bool send_everything) +// { +// LLSD body; +// if (send_everything) +// { +// body["mode"] = LLSD::String("360"); +// } +// else +// { +// body["mode"] = LLSD::String("default"); +// } - if (send_everything) - { - body["mode"] = LLSD::String("360"); - } - else - { - body["mode"] = LLSD::String("default"); - } - - if (gAgent.requestPostCapability("InterestList", body, [](const LLSD & response) - { - LL_INFOS("360Capture") << - "InterestList capability responded: \n" << - ll_pretty_print_sd(response) << - LL_ENDL; - })) - { - LL_INFOS("360Capture") << - "Successfully posted an InterestList capability request with payload: \n" << - ll_pretty_print_sd(body) << - LL_ENDL; - } - else - { - LL_INFOS("360Capture") << - "Unable to post an InterestList capability request with payload: \n" << - ll_pretty_print_sd(body) << - LL_ENDL; - } -} +// if (gAgent.requestPostCapability("InterestList", body, [](const LLSD & response) +// { +// LL_INFOS("360Capture") << +// "InterestList capability responded: \n" << +// ll_pretty_print_sd(response) << +// LL_ENDL; +// })) +// { +// LL_INFOS("360Capture") << +// "Successfully posted an InterestList capability request with payload: \n" << +// ll_pretty_print_sd(body) << +// LL_ENDL; +// } +// else +// { +// LL_INFOS("360Capture") << +// "Unable to post an InterestList capability request with payload: \n" << +// ll_pretty_print_sd(body) << +// LL_ENDL; +// } +// } +// // There is is a setting (360CaptureSourceImageSize) that holds the size // (width == height since it's a square) of each of the 6 source snapshots. diff --git a/indra/newview/llfloater360capture.h b/indra/newview/llfloater360capture.h index 8f765c0b1b..ccaab5ce6d 100644 --- a/indra/newview/llfloater360capture.h +++ b/indra/newview/llfloater360capture.h @@ -50,11 +50,14 @@ class LLFloater360Capture: void onOpen(const LLSD& key) override; void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override; - void changeInterestListMode(bool send_everything); + // void changeInterestListMode(bool send_everything); // Area search improvements - code relocated to LLViewerRegion const std::string getHTMLBaseFolder(); void capture360Images(); - + // make 360 work properly after region crossing/TP + void checkRegion(); + boost::signals2::connection mRegionChangeConnection; + // const std::string makeFullPathToJS(const std::string filename); void writeDataURLHeader(const std::string filename); void writeDataURLFooter(const std::string filename); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 628ca47bee..d0b119a24d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1480,49 +1480,85 @@ class LLAdvancedDumpRegionObjectCache : public view_listener_t } }; -class LLAdvancedInterestListFullUpdate : public view_listener_t +// Handle InterestListFullUpdate as a proper state toggle +// class LLAdvancedInterestListFullUpdate : public view_listener_t +// { +// bool handleEvent(const LLSD& userdata) +// { +// LLSD request; +// LLSD body; +// static bool using_360 = false; + +// if (using_360) +// { +// body["mode"] = LLSD::String("default"); +// } +// else +// { +// body["mode"] = LLSD::String("360"); +// } +// using_360 = !using_360; + +// if (gAgent.requestPostCapability("InterestList", body, [](const LLSD& response) +// { +// LL_INFOS("Int") << +// "InterestList capability responded: \n" << +// ll_pretty_print_sd(response) << +// LL_ENDL; +// })) +// { +// LL_INFOS("360Capture") << +// "Successfully posted an InterestList capability request with payload: \n" << +// ll_pretty_print_sd(body) << +// LL_ENDL; +// return true; +// } +// else +// { +// LL_INFOS("360Capture") << +// "Unable to post an InterestList capability request with payload: \n" << +// ll_pretty_print_sd(body) << +// LL_ENDL; +// return false; +// } +// } +// }; +class LLAdvancedCheckInterestListFullUpdate : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLSD request; - LLSD body; - static bool using_360 = false; - - if (using_360) + LLViewerRegion* regionp = gAgent.getRegion(); + if (regionp) { - body["mode"] = LLSD::String("default"); + bool current_value = ( regionp->mFullUpdateInUseCount > 0 ); + return current_value; } - else - { - body["mode"] = LLSD::String("360"); - } - using_360 = !using_360; - - if (gAgent.requestPostCapability("InterestList", body, [](const LLSD& response) - { - LL_INFOS("360Capture") << - "InterestList capability responded: \n" << - ll_pretty_print_sd(response) << - LL_ENDL; - })) - { - LL_INFOS("360Capture") << - "Successfully posted an InterestList capability request with payload: \n" << - ll_pretty_print_sd(body) << - LL_ENDL; - return true; - } - else - { - LL_INFOS("360Capture") << - "Unable to post an InterestList capability request with payload: \n" << - ll_pretty_print_sd(body) << - LL_ENDL; - return false; - } + return false; } }; - +class LLAdvancedToggleInterestListFullUpdate : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLViewerRegion* regionp = gAgent.getRegion(); + if (regionp) + { + bool current_value = ( regionp->mFullUpdateInUseCount > 0 ); + if(current_value) + { + regionp->useFullUpdateInterestListMode(false, true); + return false; + } + else + { + regionp->useFullUpdateInterestListMode(true); + return true; + } + } + return false; + } +}; +// class LLAdvancedBuyCurrencyTest : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -12238,7 +12274,12 @@ void initialize_menus() // Advanced > World view_listener_t::addMenu(new LLAdvancedDumpScriptedCamera(), "Advanced.DumpScriptedCamera"); view_listener_t::addMenu(new LLAdvancedDumpRegionObjectCache(), "Advanced.DumpRegionObjectCache"); - view_listener_t::addMenu(new LLAdvancedInterestListFullUpdate(), "Advanced.InterestListFullUpdate"); + + // Make InterestList a proper stateful toggle + // view_listener_t::addMenu(new LLAdvancedInterestListFullUpdate(), "Advanced.InterestListFullUpdate"); + view_listener_t::addMenu(new LLAdvancedCheckInterestListFullUpdate(), "Advanced.CheckInterestListFullUpdate"); + view_listener_t::addMenu(new LLAdvancedToggleInterestListFullUpdate(), "Advanced.ToggleInterestListFullUpdate"); + // // Advanced > UI commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 5fd65c3405..4e069b5842 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1728,6 +1728,7 @@ BOOL LLViewerRegion::isViewerCameraStatic() void LLViewerRegion::killInvisibleObjects(F32 max_time) { + if(sFSAreaSearchActive){ return; } // FIRE-32668 Area Search improvements if(!sVOCacheCullingEnabled) { return; @@ -3554,6 +3555,53 @@ void LLViewerRegion::logActiveCapabilities() const log_capabilities(mImpl->mCapabilities); } +// Area Search improvement +void LLViewerRegion::useFullUpdateInterestListMode(bool send_everything, bool force_update) +{ + static const char *FSLogTag = "InterestListMode"; + U32 previousCount = mFullUpdateInUseCount; + LLSD body; + LL_DEBUGS(FSLogTag) << "useFullUpdateInterestListMode" << " send_everything:" << send_everything << " inUse: " << mFullUpdateInUseCount << LL_ENDL; + if (send_everything) + { + body["mode"] = LLSD::String("360"); + mFullUpdateInUseCount++; // we increment irrespective of the actual success as we're really just tracking the attempts. + } + else + { + if(mFullUpdateInUseCount > 0) + { + mFullUpdateInUseCount--; // see above. + } + if(force_update) + { + mFullUpdateInUseCount=0; // when we are forcing the off state then we need to clear the count to zero. + } + body["mode"] = LLSD::String("default"); + } + + if( force_update || ( send_everything && mFullUpdateInUseCount == 1 ) || ( ( !send_everything ) && mFullUpdateInUseCount == 0 && previousCount != 0) ) // Only send if this is the first enable or last disable. + { + if (gAgent.requestPostCapability("InterestList", body, + [](const LLSD &response) + { + LL_INFOS(FSLogTag) << "InterestList capability responded: \n" + << ll_pretty_print_sd(response) << LL_ENDL; + })) + { + LL_INFOS(FSLogTag) << "Successfully posted an InterestList capability request with payload: \n" + << ll_pretty_print_sd(body) << LL_ENDL; + } + else + { + LL_INFOS(FSLogTag) << "Unable to post an InterestList capability request with payload: \n" + << ll_pretty_print_sd(body) << LL_ENDL; + } + } + LL_DEBUGS(FSLogTag) << "useFullUpdateInterestListMode" << " (AFTER): inUse: " << mFullUpdateInUseCount << LL_ENDL; +} +// + 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 786b530ab9..e1ab37b890 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -351,7 +351,11 @@ public: bool dynamicPathfindingEnabled() const; bool avatarHoverHeightEnabled() const; - +// Area search improvements + U32 mFullUpdateInUseCount {0}; + void clearFullUpdateInterestList(){ LL_DEBUGS("InterestListMode") << "Resetting for previous region" << LL_ENDL; mFullUpdateInUseCount = 0; }; + void useFullUpdateInterestListMode(bool full_update, bool force_update=false); +// // #ifdef OPENSIM std::set getGods() { return mGodNames; }; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 06fbe361a8..d5ef57b1b3 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -4756,13 +4756,15 @@ function="Advanced.DumpRegionObjectCache" /> - - - + + +