Yeah, let's just do this...

master
Ansariel 2022-11-08 00:19:41 +01:00
parent d94343152d
commit da76a7bc73
5 changed files with 57 additions and 69 deletions

View File

@ -67,19 +67,19 @@
#include "rlvhandler.h"
// max number of objects that can be (de-)selected in a single packet.
const S32 MAX_OBJECTS_PER_PACKET = 255;
constexpr S32 MAX_OBJECTS_PER_PACKET = 255;
// time in seconds between refreshes when active
const F32 REFRESH_INTERVAL = 1.0f;
constexpr F32 REFRESH_INTERVAL = 1.0f;
// this is used to prevent refreshing too often and affecting performance.
const F32 MIN_REFRESH_INTERVAL = 0.25f;
constexpr F32 MIN_REFRESH_INTERVAL = 0.25f;
// how far the avatar needs to move to trigger a distance update
const F32 MIN_DISTANCE_MOVED = 1.0f;
constexpr F32 MIN_DISTANCE_MOVED = 1.0f;
// timeout to resend object properties request again
const F32 REQUEST_TIMEOUT = 30.0f;
constexpr F32 REQUEST_TIMEOUT = 30.0f;
std::string RLVa_hideNameIfRestricted(std::string const &name)
{
@ -1185,7 +1185,7 @@ void FSAreaSearch::callbackLoadFullName(const LLUUID& id, const std::string& ful
}
}
mPanelList->updateName(id, full_name);
mPanelList->updateName(id, full_name);
}
void FSAreaSearch::updateCounterText()
@ -1283,7 +1283,7 @@ void FSAreaSearch::onCommitLine()
}
}
bool FSAreaSearch::regexTest(std::string text)
bool FSAreaSearch::regexTest(std::string_view text)
{
// couple regex patters one can use for testing. The regex will match a UUID.
// boost::regex pattern("[\\w]{8}-[\\w]{4}-[\\w]{4}-[\\w]{4}-[\\w]{12}");
@ -1292,8 +1292,8 @@ bool FSAreaSearch::regexTest(std::string text)
try
{
std::string test_text = "asdfghjklqwerty1234567890";
boost::regex pattern(text.c_str());
static const std::string test_text = "asdfghjklqwerty1234567890";
boost::regex pattern(text.data());
boost::regex_match(test_text, pattern);
}
catch(boost::regex_error& e)
@ -1822,15 +1822,15 @@ bool FSPanelAreaSearchList::onContextMenuItemClick(const LLSD& userdata)
if (camera_aspect < 1.0f || invert)
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect());
distance = width * 0.5 * 1.1 / tanf(angle_of_view * 0.5f);
distance = width * 0.5f * 1.1f / tanf(angle_of_view * 0.5f);
}
else
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView());
distance = height * 0.5 * 1.1 / tanf(angle_of_view * 0.5f);
distance = height * 0.5f * 1.1f / tanf(angle_of_view * 0.5f);
}
distance += depth * 0.5;
distance += depth * 0.5f;
// Verify that the bounding box isn't inside the near clip. Using OBB-plane intersection to check if the
// near-clip plane intersects with the bounding box, and if it does, adjust the distance such that the

View File

@ -175,7 +175,7 @@ private:
void getNameFromUUID(const LLUUID& id, std::string& name, bool group, bool& name_requested);
void updateCounterText();
bool regexTest(std::string text);
bool regexTest(std::string_view text);
void findObjects();
void processRequestQueue();

View File

@ -64,9 +64,9 @@ static const std::string FS_ERROR_ATTRIBUTE = "error=";
class NameCollectFunctor : public LLInventoryCollectFunctor
{
public:
NameCollectFunctor(std::string name)
NameCollectFunctor(std::string_view name)
{
sName = name;
sName = static_cast<std::string>(name);
}
virtual ~NameCollectFunctor() {}
virtual bool operator()(LLInventoryCategory* cat,
@ -147,7 +147,7 @@ void FSLSLBridge::setTimerResult(TimerResult result)
mTimerResult = result;
}
bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID, const LLUUID& ownerID)
bool FSLSLBridge::lslToViewer(std::string_view message, const LLUUID& fromID, const LLUUID& ownerID)
{
LL_DEBUGS("FSLSLBridge") << message << LL_ENDL;
@ -175,7 +175,7 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID,
{
return false;
}
std::string tag = message.substr(0, tagend + 1);
std::string_view tag = message.substr(0, tagend + 1);
std::string ourBridge = findFSCategory().asString();
//</FS:TS> FIRE-962
@ -199,9 +199,9 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID,
size_t authEnd = message.find("</bridgeAuth>");
size_t verStart = message.find(bridge_ver_tag) + bridge_ver_tag.size();
size_t verEnd = message.find("</bridgeVer>");
std::string bURL = message.substr(urlStart,urlEnd - urlStart);
std::string bAuth = message.substr(authStart,authEnd - authStart);
std::string bVer = message.substr(verStart,verEnd - verStart);
std::string bURL = static_cast<std::string>(message.substr(urlStart,urlEnd - urlStart));
std::string bAuth = static_cast<std::string>(message.substr(authStart,authEnd - authStart));
std::string bVer = static_cast<std::string>(message.substr(verStart,verEnd - verStart));
// Verify Authorization
if (ourBridge != bAuth)
@ -402,7 +402,7 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID,
size_t getScriptInfoEnd = message.find("</bridgeGetScriptInfo>");
if (getScriptInfoEnd != std::string::npos)
{
std::string getScriptInfoString = message.substr(tag_size, getScriptInfoEnd - tag_size);
std::string getScriptInfoString = static_cast<std::string>(message.substr(tag_size, getScriptInfoEnd - tag_size));
std::istringstream strStreamGetScriptInfo(getScriptInfoString);
std::string scriptInfoToken;
LLSD scriptInfoArray = LLSD::emptyArray();
@ -556,7 +556,7 @@ bool FSLSLBridge::canUseBridge()
return (isBridgeValid() && sUseLSLBridge && !mCurrentURL.empty());
}
bool FSLSLBridge::viewerToLSL(const std::string& message, Callback_t aCallback)
bool FSLSLBridge::viewerToLSL(std::string_view message, Callback_t aCallback)
{
LL_DEBUGS("FSLSLBridge") << message << LL_ENDL;
@ -571,32 +571,21 @@ bool FSLSLBridge::viewerToLSL(const std::string& message, Callback_t aCallback)
pCallback = FSLSLBridgeRequest_Success;
}
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(mCurrentURL, LLSD(message), pCallback, FSLSLBridgeRequest_Failure);
// Calling data() should be fine here since message is a view on a null-terminated string
LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost(mCurrentURL, LLSD(message.data()), pCallback, FSLSLBridgeRequest_Failure);
return true;
}
bool FSLSLBridge::updateBoolSettingValue(const std::string& msgVal)
{
std::string boolVal = "0";
if (gSavedPerAccountSettings.getBOOL(msgVal))
{
boolVal = "1";
}
return viewerToLSL(msgVal + "|" + boolVal );
const std::string boolVal = gSavedPerAccountSettings.getBOOL(msgVal) ? "1" : "0";
return viewerToLSL(msgVal + "|" + boolVal);
}
bool FSLSLBridge::updateBoolSettingValue(const std::string& msgVal, bool contentVal)
{
std::string boolVal = "0";
if (contentVal)
{
boolVal = "1";
}
const std::string boolVal = contentVal ? "1" : "0";
return viewerToLSL(msgVal + "|" + boolVal);
}
@ -677,9 +666,9 @@ void FSLSLBridge::cleanUpPreCreation()
gInventory.collectDescendentsIf(findFSCategory(), cats, items, FALSE, namefunctor);
mAllowedDetachables.clear();
for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
for (const auto item : items)
{
LLUUID item_id= (*it)->getUUID();
const LLUUID& item_id = item->getUUID();
if (get_is_item_worn(item_id))
{
LL_INFOS("FSLSLBridge") << "Found worn object " << item_id << " bridge category - detaching..." << LL_ENDL;
@ -712,10 +701,10 @@ void FSLSLBridge::finishCleanUpPreCreation()
NameCollectFunctor namefunctor(mCurrentFullName);
gInventory.collectDescendentsIf(findFSCategory(), cats, items, FALSE, namefunctor);
for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
for (const auto item : items)
{
LL_INFOS("FSLSLBridge") << "Bridge folder cleanup: Deleting " << (*it)->getName() << " (" << (*it)->getUUID() << ")" << LL_ENDL;
remove_inventory_item((*it)->getUUID(), nullptr, true); // Don't wait for callback from server to update inventory model
LL_INFOS("FSLSLBridge") << "Bridge folder cleanup: Deleting " << item->getName() << " (" << item->getUUID() << ")" << LL_ENDL;
remove_inventory_item(item->getUUID(), nullptr, true); // Don't wait for callback from server to update inventory model
}
gInventory.notifyObservers();
@ -1143,6 +1132,9 @@ void FSLSLBridge::processDetach(LLViewerObject* object, const LLViewerJointAttac
void FSLSLBridge::setupBridgePrim(LLViewerObject* object)
{
LL_DEBUGS("FSLSLBridge") << "Entering bridge container setup..." << LL_ENDL;
if (!object->getRegion())
return;
LLProfileParams profParams(LL_PCODE_PROFILE_CIRCLE, 0.230f, 0.250f, 0.95f);
LLPathParams pathParams(LL_PCODE_PATH_CIRCLE, 0.2f, 0.22f,
@ -1509,11 +1501,11 @@ LLUUID FSLSLBridge::findFSCategory()
gInventory.getDirectDescendentsOf(fsCatID, cats, items);
if (cats)
{
for (LLInventoryModel::cat_array_t::iterator it = cats->begin(); it != cats->end(); ++it)
for (const auto cat : *cats)
{
if ((*it)->getName() == FS_BRIDGE_FOLDER)
if (cat->getName() == FS_BRIDGE_FOLDER)
{
bridgeCatID = (*it)->getUUID();
bridgeCatID = cat->getUUID();
break;
}
}
@ -1551,11 +1543,11 @@ LLUUID FSLSLBridge::findFSBridgeContainerCategory()
gInventory.getDirectDescendentsOf(LibRootID, cats, items);
if (cats)
{
for (LLInventoryModel::cat_array_t::iterator it = cats->begin(); it != cats->end(); ++it)
for (const auto cat : *cats)
{
if ((*it)->getName() == "Objects")
if (cat->getName() == "Objects")
{
LLUUID LibObjectsCatID = (*it)->getUUID();
const LLUUID& LibObjectsCatID = cat->getUUID();
if (LibObjectsCatID.notNull())
{
LLInventoryModel::item_array_t* objects_items;
@ -1563,11 +1555,11 @@ LLUUID FSLSLBridge::findFSBridgeContainerCategory()
gInventory.getDirectDescendentsOf(LibObjectsCatID, objects_cats, objects_items);
if (objects_cats)
{
for (LLInventoryModel::cat_array_t::iterator object_it = objects_cats->begin(); object_it != objects_cats->end(); ++object_it)
for (const auto object_cat : *objects_cats)
{
if ((*object_it)->getName() == FS_BRIDGE_CONTAINER_FOLDER)
if (object_cat->getName() == FS_BRIDGE_CONTAINER_FOLDER)
{
mBridgeContainerFolderID = (*object_it)->getUUID();
mBridgeContainerFolderID = object_cat->getUUID();
LL_INFOS("FSLSLBridge") << "FSBridge container category found in library. UUID: " << mBridgeContainerFolderID << LL_ENDL;
gInventory.fetchDescendentsOf(mBridgeContainerFolderID);
return mBridgeContainerFolderID;
@ -1594,12 +1586,11 @@ LLViewerInventoryItem* FSLSLBridge::findInvObject(const std::string& obj_name, c
gInventory.collectDescendentsIf(catID, cats, items, FALSE, namefunctor);
for (LLViewerInventoryItem::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
for (const auto item : items)
{
const LLViewerInventoryItem* itemp = *it;
if (!itemp->getIsLinkType() && (itemp->getType() == LLAssetType::AT_OBJECT))
if (!item->getIsLinkType() && (item->getType() == LLAssetType::AT_OBJECT))
{
itemID = itemp->getUUID();
itemID = item->getUUID();
break;
}
}
@ -1631,13 +1622,12 @@ void FSLSLBridge::cleanUpBridgeFolder(const std::string& nameToCleanUp)
NameCollectFunctor namefunctor(nameToCleanUp);
gInventory.collectDescendentsIf(catID, cats, items, FALSE, namefunctor);
for (LLViewerInventoryItem::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
for (const auto item : items)
{
const LLViewerInventoryItem* itemp = *it;
if (!itemp->getIsLinkType() && (itemp->getUUID() != mpBridge->getUUID()))
if (!item->getIsLinkType() && (item->getUUID() != mpBridge->getUUID()))
{
LL_INFOS("FSLSLBridge") << "Bridge folder cleanup: Deleting " << itemp->getName() << " (" << itemp->getUUID() << ")" << LL_ENDL;
remove_inventory_item(itemp->getUUID(), nullptr, true);
LL_INFOS("FSLSLBridge") << "Bridge folder cleanup: Deleting " << item->getName() << " (" << item->getUUID() << ")" << LL_ENDL;
remove_inventory_item(item->getUUID(), nullptr, true);
}
}
@ -1684,13 +1674,12 @@ void FSLSLBridge::detachOtherBridges()
//detach everything except current valid bridge - if any
gInventory.collectDescendents(catID, cats, items, FALSE);
for (LLViewerInventoryItem::item_array_t::iterator it = items.begin(); it != items.end(); ++it)
for (const auto item : items)
{
const LLViewerInventoryItem* itemp = *it;
if (get_is_item_worn(itemp->getUUID()) &&
((!fsBridge) || (itemp->getUUID() != fsBridge->getUUID())))
if (get_is_item_worn(item->getUUID()) &&
((!fsBridge) || (item->getUUID() != fsBridge->getUUID())))
{
LLVOAvatarSelf::detachAttachmentIntoInventory(itemp->getUUID());
LLVOAvatarSelf::detachAttachmentIntoInventory(item->getUUID());
}
}
}

View File

@ -65,8 +65,8 @@ public:
typedef std::function<void(const LLSD &)> Callback_t;
bool lslToViewer(const std::string& message, const LLUUID& fromID, const LLUUID& ownerID);
bool viewerToLSL(const std::string& message, Callback_t = nullptr);
bool lslToViewer(std::string_view message, const LLUUID& fromID, const LLUUID& ownerID);
bool viewerToLSL(std::string_view message, Callback_t = nullptr);
bool updateBoolSettingValue(const std::string& msgVal);
bool updateBoolSettingValue(const std::string& msgVal, bool contentVal);

View File

@ -63,7 +63,6 @@ private:
void onClickRemovePseudonym();
void refreshContactSets();
void removeAvatarFromSet();
void resetControls();
void updateSets(LGGContactSets::EContactSetUpdate type);