From f4e04a3e7bac42a8cb18e9c70b67bf97ce020d8c Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 10 Jul 2025 21:48:27 +0800 Subject: @attach:=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. --- indra/newview/rlvdefines.h | 1 + indra/newview/rlvhandler.cpp | 27 +++++++++++++++++++++++++++ indra/newview/rlvhelper.cpp | 1 + 3 files changed, 29 insertions(+) (limited to 'indra/newview') 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::onCommand(const RlvCommand& rlvCmd) return ECmdRet::Succeeded; } +template<> template<> +ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + auto rlvFolderID = findDescendentCategoryIDByName(gInventory.getRootFolderID(), "#RLV"); + if (rlvFolderID == LLUUID::null) + return ECmdRet::FailedNoSharedRoot; + std::vector 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::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("sit")); addEntry(new ForceProcessor("sitground")); addEntry(new ForceProcessor("unsit")); + addEntry(new ForceProcessor("attach")); // AddRem addEntry(new BehaviourProcessor("sit")); -- cgit v1.2.3