From f0f3169e8ea14219ae179efdebf87a395ae5a029 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 23 Jul 2025 21:07:10 +0800 Subject: RLV shared folder needs to be directly under root --- indra/newview/rlvhandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/rlvhandler.cpp') diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 066543987f..18de822512 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -29,6 +29,7 @@ #include "llagent.h" #include "llstartup.h" #include "llappearancemgr.h" +#include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llmoveview.h" #include "llviewercontrol.h" @@ -243,9 +244,11 @@ ECmdRet ReplyHandler::onCommand(const RlvCommand& rlvCmd, template<> template<> ECmdRet ReplyHandler::onCommand(const RlvCommand& rlvCmd, std::string& strReply) { - auto folderID = findDescendentCategoryIDByName(gInventory.getRootFolderID(), "#RLV"); - if (folderID == LLUUID::null) + auto folderID = gInventory.getRootFolderID(); + LLNameCategoryCollector has_name("#RLV"); + if (!gInventory.hasMatchingDirectDescendent(folderID, has_name)) return ECmdRet::FailedNoSharedRoot; + folderID = findDescendentCategoryIDByName(folderID, "#RLV"); strReply = ""; LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; -- cgit v1.2.3 From 1878bf4eb76e4a79d1622aa6b907362bb94bc0f6 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 23 Jul 2025 21:08:12 +0800 Subject: Shared macros for attach-related RLV commands --- indra/newview/rlvhandler.cpp | 78 +++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 44 deletions(-) (limited to 'indra/newview/rlvhandler.cpp') diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 18de822512..e9bd715a98 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -307,58 +307,48 @@ ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) return ECmdRet::Succeeded; } +#define RESTRAINED_LOVE_OUTFIT(A) \ + auto folderID = gInventory.getRootFolderID();\ + LLNameCategoryCollector has_name("#RLV");\ + if (!gInventory.hasMatchingDirectDescendent(folderID, has_name))\ + return ECmdRet::FailedNoSharedRoot;\ + folderID = findDescendentCategoryIDByName(folderID, "#RLV");\ + std::vector optionList;\ + auto option = rlvCmd.getOption();\ + if (!option.empty())\ + {\ + folderID = findDescendentCategoryIDByName(folderID, 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);\ + }\ + }\ + A\ + }\ + return ECmdRet::Succeeded; + +#define RESTRAINED_LOVE_REPLACE \ + LLAppearanceMgr::instance().replaceCurrentOutfit(folderID); + +#define RESTRAINED_LOVE_ADD \ + LLAppearanceMgr::instance().addCategoryToCurrentOutfit(folderID); + 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; + RESTRAINED_LOVE_OUTFIT(RESTRAINED_LOVE_REPLACE); } 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().addCategoryToCurrentOutfit(folderID); - } - return ECmdRet::Succeeded; + RESTRAINED_LOVE_OUTFIT(RESTRAINED_LOVE_ADD); } // AddRem -- cgit v1.2.3 From 4ad9d65514374006a9474c9fd42254c95680458f Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 23 Jul 2025 21:41:07 +0800 Subject: @detach:=force implementation Per specification, the folder must be directly under "#RLV" for this to work, hence not using the shared folder ID retrieval macro. --- indra/newview/rlvhandler.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/rlvhandler.cpp') diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index e9bd715a98..14343143cd 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -351,6 +351,28 @@ ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd RESTRAINED_LOVE_OUTFIT(RESTRAINED_LOVE_ADD); } +template<> template<> +ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + auto folderID = gInventory.getRootFolderID(); + LLNameCategoryCollector has_name("#RLV"); + if (!gInventory.hasMatchingDirectDescendent(folderID, has_name)) + return ECmdRet::FailedNoSharedRoot; + folderID = findDescendentCategoryIDByName(folderID, "#RLV"); + std::vector optionList; + auto option = rlvCmd.getOption(); + if (!option.empty()) + { + LLNameCategoryCollector is_named(option); + if (gInventory.hasMatchingDirectDescendent(folderID, is_named)) + { + folderID = findDescendentCategoryIDByName(folderID, option); + LLAppearanceMgr::instance().takeOffOutfit(folderID); + } + } + return ECmdRet::Succeeded; +} + // AddRem ECmdRet CommandHandlerBaseImpl::processCommand(const RlvCommand& rlvCmd, BhvrHandlerFunc* pHandler, BhvrToggleHandlerFunc* pToggleHandler) -- cgit v1.2.3 From f31e224bbd8bf522542a16ec116f21de12a397ef Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 23 Jul 2025 22:21:54 +0800 Subject: Minimal @remoutfit[:]=force implementation Copying from LLEditTakeOff implementation in llviewermenu.cpp. --- indra/newview/rlvhandler.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/rlvhandler.cpp') diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 14343143cd..8eee7e36a6 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -339,6 +339,30 @@ ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) #define RESTRAINED_LOVE_ADD \ LLAppearanceMgr::instance().addCategoryToCurrentOutfit(folderID); +template<> template<> +ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + std::vector optionList; + auto option = rlvCmd.getOption(); + if (option.empty()) + { + LLAppearanceMgr::instance().removeAllClothesFromAvatar(); + } + else + { + LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(option); + if (type >= LLWearableType::WT_SHAPE + && type < LLWearableType::WT_COUNT + && (gAgentWearables.getWearableCount(type) > 0)) + { + U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; + LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); + LLAppearanceMgr::instance().removeItemFromAvatar(item_id); + } + } + return ECmdRet::Succeeded; +} + template<> template<> ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) { -- cgit v1.2.3 From 145ae5aeea43080bbf14de66d3d3886e01b8bb34 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 23 Jul 2025 22:31:19 +0800 Subject: Reorganise shared macros closer to "attach" code and reindent the appearance manager functions to call to match how they will be placed on the combining macro. --- indra/newview/rlvhandler.cpp | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'indra/newview/rlvhandler.cpp') diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 8eee7e36a6..2cc06b3bbc 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -307,6 +307,30 @@ ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) return ECmdRet::Succeeded; } +template<> template<> +ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) +{ + std::vector optionList; + auto option = rlvCmd.getOption(); + if (option.empty()) + { + LLAppearanceMgr::instance().removeAllClothesFromAvatar(); + } + else + { + LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(option); + if (type >= LLWearableType::WT_SHAPE + && type < LLWearableType::WT_COUNT + && (gAgentWearables.getWearableCount(type) > 0)) + { + U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; + LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); + LLAppearanceMgr::instance().removeItemFromAvatar(item_id); + } + } + return ECmdRet::Succeeded; +} + #define RESTRAINED_LOVE_OUTFIT(A) \ auto folderID = gInventory.getRootFolderID();\ LLNameCategoryCollector has_name("#RLV");\ @@ -334,34 +358,10 @@ ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) return ECmdRet::Succeeded; #define RESTRAINED_LOVE_REPLACE \ - LLAppearanceMgr::instance().replaceCurrentOutfit(folderID); + LLAppearanceMgr::instance().replaceCurrentOutfit(folderID); #define RESTRAINED_LOVE_ADD \ - LLAppearanceMgr::instance().addCategoryToCurrentOutfit(folderID); - -template<> template<> -ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) -{ - std::vector optionList; - auto option = rlvCmd.getOption(); - if (option.empty()) - { - LLAppearanceMgr::instance().removeAllClothesFromAvatar(); - } - else - { - LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(option); - if (type >= LLWearableType::WT_SHAPE - && type < LLWearableType::WT_COUNT - && (gAgentWearables.getWearableCount(type) > 0)) - { - U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; - LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); - LLAppearanceMgr::instance().removeItemFromAvatar(item_id); - } - } - return ECmdRet::Succeeded; -} + LLAppearanceMgr::instance().addCategoryToCurrentOutfit(folderID); template<> template<> ECmdRet ForceHandler::onCommand(const RlvCommand& rlvCmd) -- cgit v1.2.3