diff options
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 4 | ||||
-rw-r--r-- | indra/newview/rlvdefines.h | 1 | ||||
-rw-r--r-- | indra/newview/rlvhandler.cpp | 101 | ||||
-rw-r--r-- | indra/newview/rlvhelper.cpp | 2 |
4 files changed, 77 insertions, 31 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 69332e36b6..1f9a841032 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -106,6 +106,10 @@ bool hasHIDPI = 0; # include <X11/Xutil.h> #endif //LL_X11 +#if LL_WINDOWS && !LL_MESA_HEADLESS +#pragma comment(lib, "dinput8") +#endif + // TOFU HACK -- (*exactly* the same hack as LLWindowMacOSX for a similar // set of reasons): Stash a pointer to the LLWindowSDL object here and // maintain in the constructor and destructor. This assumes that there will diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 649aa75d14..4437adcf1b 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -98,6 +98,7 @@ namespace Rlv SitGround, Unsit, Detach, + RemOutfit, GetInv, Attach, AttachOver, diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 066543987f..2cc06b3bbc 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<EBehaviour::GetSitID>::onCommand(const RlvCommand& rlvCmd, template<> template<> ECmdRet ReplyHandler<EBehaviour::GetInv>::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; @@ -305,55 +308,91 @@ ECmdRet ForceHandler<EBehaviour::Unsit>::onCommand(const RlvCommand& rlvCmd) } template<> template<> -ECmdRet ForceHandler<EBehaviour::Attach>::onCommand(const RlvCommand& rlvCmd) +ECmdRet ForceHandler<EBehaviour::RemOutfit>::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()) + if (option.empty()) + { + LLAppearanceMgr::instance().removeAllClothesFromAvatar(); + } + else { - auto folderID = findDescendentCategoryIDByName(rlvFolderID, option); - if (folderID == LLUUID::null) + LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(option); + if (type >= LLWearableType::WT_SHAPE + && type < LLWearableType::WT_COUNT + && (gAgentWearables.getWearableCount(type) > 0)) { - Util::parseStringList(option, optionList, "/"); - auto iter = optionList.begin(); - for(; optionList.end() != iter; ++iter) - { - auto name = *iter; - if (!name.empty()) - folderID = findDescendentCategoryIDByName(folderID, name); - } + U32 wearable_index = gAgentWearables.getWearableCount(type) - 1; + LLUUID item_id = gAgentWearables.getWearableItemID(type,wearable_index); + LLAppearanceMgr::instance().removeItemFromAvatar(item_id); } - LLAppearanceMgr::instance().replaceCurrentOutfit(folderID); } 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<std::string> 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<EBehaviour::Attach>::onCommand(const RlvCommand& rlvCmd) +{ + RESTRAINED_LOVE_OUTFIT(RESTRAINED_LOVE_REPLACE); +} + template<> template<> ECmdRet ForceHandler<EBehaviour::AttachOver>::onCommand(const RlvCommand& rlvCmd) { - auto rlvFolderID = findDescendentCategoryIDByName(gInventory.getRootFolderID(), "#RLV"); - if (rlvFolderID == LLUUID::null) + RESTRAINED_LOVE_OUTFIT(RESTRAINED_LOVE_ADD); +} + +template<> template<> +ECmdRet ForceHandler<EBehaviour::Detach>::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<std::string> optionList; auto option = rlvCmd.getOption(); if (!option.empty()) { - auto folderID = findDescendentCategoryIDByName(rlvFolderID, option); - if (folderID == LLUUID::null) + LLNameCategoryCollector is_named(option); + if (gInventory.hasMatchingDirectDescendent(folderID, is_named)) { - Util::parseStringList(option, optionList, "/"); - auto iter = optionList.begin(); - for(; optionList.end() != iter; ++iter) - { - auto name = *iter; - if (!name.empty()) - folderID = findDescendentCategoryIDByName(folderID, name); - } + folderID = findDescendentCategoryIDByName(folderID, option); + LLAppearanceMgr::instance().takeOffOutfit(folderID); } - LLAppearanceMgr::instance().addCategoryToCurrentOutfit(folderID); } return ECmdRet::Succeeded; } diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 4a0b394acb..2c14434194 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -60,8 +60,10 @@ BehaviourDictionary::BehaviourDictionary() addEntry(new ForceProcessor<EBehaviour::Sit>("sit")); addEntry(new ForceProcessor<EBehaviour::SitGround>("sitground")); addEntry(new ForceProcessor<EBehaviour::Unsit>("unsit")); + addEntry(new ForceProcessor<EBehaviour::RemOutfit>("remoutfit")); addEntry(new ForceProcessor<EBehaviour::Attach>("attach")); addEntry(new ForceProcessor<EBehaviour::AttachOver>("attachover")); + addEntry(new ForceProcessor<EBehaviour::Detach>("detach")); // AddRem addEntry(new BehaviourProcessor<EBehaviour::Sit>("sit")); |