summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-07-10 21:48:27 +0800
committerErik Kundiman <erik@megapahit.org>2025-07-10 21:48:27 +0800
commitf4e04a3e7bac42a8cb18e9c70b67bf97ce020d8c (patch)
tree62cf8f569d33a7cd3b3db8387fab202f3088bd74
parentaf6a85ef15a3de2d4051a012b4f06c0df510a858 (diff)
@attach:<folder1/.../folderN>=force implementation
A minimal one. It would still work even when the path leading to the right name of the end folder is wrong, but since scripts would likely be trying to get path components from issuing @getinv commands beforehand instead of inserting random names, we'll perfect this implementation later.
-rw-r--r--indra/newview/rlvdefines.h1
-rw-r--r--indra/newview/rlvhandler.cpp27
-rw-r--r--indra/newview/rlvhelper.cpp1
3 files changed, 29 insertions, 0 deletions
diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h
index 5161e9241c..5de428d093 100644
--- a/indra/newview/rlvdefines.h
+++ b/indra/newview/rlvdefines.h
@@ -99,6 +99,7 @@ namespace Rlv
Unsit,
Detach,
GetInv,
+ Attach,
GetCommand,
Count,
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index 413d3758e4..f3306b0f21 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -304,6 +304,33 @@ ECmdRet ForceHandler<EBehaviour::Unsit>::onCommand(const RlvCommand& rlvCmd)
return ECmdRet::Succeeded;
}
+template<> template<>
+ECmdRet ForceHandler<EBehaviour::Attach>::onCommand(const RlvCommand& rlvCmd)
+{
+ auto rlvFolderID = findDescendentCategoryIDByName(gInventory.getRootFolderID(), "#RLV");
+ if (rlvFolderID == LLUUID::null)
+ return ECmdRet::FailedNoSharedRoot;
+ std::vector<std::string> optionList;
+ auto option = rlvCmd.getOption();
+ if (!option.empty())
+ {
+ auto folderID = findDescendentCategoryIDByName(rlvFolderID, option);
+ if (folderID == LLUUID::null)
+ {
+ Util::parseStringList(option, optionList, "/");
+ auto iter = optionList.begin();
+ for(; optionList.end() != iter; ++iter)
+ {
+ auto name = *iter;
+ if (!name.empty())
+ folderID = findDescendentCategoryIDByName(folderID, name);
+ }
+ }
+ LLAppearanceMgr::instance().replaceCurrentOutfit(folderID);
+ }
+ return ECmdRet::Succeeded;
+}
+
// AddRem
ECmdRet CommandHandlerBaseImpl<EParamType::AddRem>::processCommand(const RlvCommand& rlvCmd, BhvrHandlerFunc* pHandler, BhvrToggleHandlerFunc* pToggleHandler)
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index 9f71d81206..bba1c4c6fd 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -60,6 +60,7 @@ BehaviourDictionary::BehaviourDictionary()
addEntry(new ForceProcessor<EBehaviour::Sit>("sit"));
addEntry(new ForceProcessor<EBehaviour::SitGround>("sitground"));
addEntry(new ForceProcessor<EBehaviour::Unsit>("unsit"));
+ addEntry(new ForceProcessor<EBehaviour::Attach>("attach"));
// AddRem
addEntry(new BehaviourProcessor<EBehaviour::Sit>("sit"));