diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-08-17 22:03:14 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-08-17 22:03:14 +0300 |
commit | 0ab6dfa12eb04238d82c7a4aea7390cbd28beacd (patch) | |
tree | 759227120c5fd01e0d75b36a3978772367561aa4 /indra/newview/llinventorypanel.cpp | |
parent | b8c46f9615bffa0e6aeb909924c39581b160fdef (diff) |
SL-17699 Multiple asset types support for LLAssetFilteredInventoryPanel
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6b102c7500..cd24b3ea43 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2010,7 +2010,43 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) void LLAssetFilteredInventoryPanel::initFromParams(const Params& p) { - mAssetType = LLAssetType::lookup(p.filter_asset_type.getValue()); + // Init asset types + std::string types = p.filter_asset_types.getValue(); + + typedef boost::tokenizer<boost::char_separator<char> > tokenizer; + boost::char_separator<char> sep("|"); + tokenizer tokens(types, sep); + tokenizer::iterator token_iter = tokens.begin(); + + memset(mAssetTypes, 0, LLAssetType::AT_COUNT * sizeof(bool)); + while (token_iter != tokens.end()) + { + const std::string& token_str = *token_iter; + LLAssetType::EType asset_type = LLAssetType::lookup(token_str); + if (asset_type > LLAssetType::AT_NONE && asset_type < LLAssetType::AT_COUNT) + { + mAssetTypes[asset_type] = true; + } + ++token_iter; + } + + // Init drag types + memset(mDragTypes, 0, EDragAndDropType::DAD_COUNT * sizeof(bool)); + for (S32 i = 0; i < LLAssetType::AT_COUNT; i++) + { + if (mAssetTypes[i]) + { + EDragAndDropType drag_type = LLViewerAssetType::lookupDragAndDropType((LLAssetType::EType)i); + if (drag_type != DAD_NONE) + { + mDragTypes[drag_type] = true; + } + } + } + // Always show AT_CATEGORY, but it shouldn't get into mDragTypes + mAssetTypes[LLAssetType::AT_CATEGORY] = true; + + // Init the panel LLInventoryPanel::initFromParams(p); U64 filter_cats = getFilter().getFilterCategoryTypes(); filter_cats &= ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS); @@ -2028,10 +2064,9 @@ BOOL LLAssetFilteredInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, B if (mAcceptsDragAndDrop) { - EDragAndDropType allow_type = LLViewerAssetType::lookupDragAndDropType(mAssetType); // Don't allow DAD_CATEGORY here since it can contain other items besides required assets // We should see everything we drop! - if (allow_type == cargo_type) + if (mDragTypes[cargo_type]) { result = LLInventoryPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } @@ -2047,8 +2082,14 @@ bool LLAssetFilteredInventoryPanel::typedViewsFilter(const LLUUID& id, LLInvento { return false; } + LLAssetType::EType asset_type = objectp->getType(); - if (objectp->getType() != mAssetType && objectp->getType() != LLAssetType::AT_CATEGORY) + if (asset_type < 0 || asset_type >= LLAssetType::AT_COUNT) + { + return false; + } + + if (!mAssetTypes[asset_type]) { return false; } @@ -2064,11 +2105,16 @@ void LLAssetFilteredInventoryPanel::itemChanged(const LLUUID& id, U32 mask, cons return; } - if (model_item - && model_item->getType() != mAssetType - && model_item->getType() != LLAssetType::AT_CATEGORY) + if (model_item) { - return; + LLAssetType::EType asset_type = model_item->getType(); + + if (asset_type < 0 + || asset_type >= LLAssetType::AT_COUNT + || !mAssetTypes[asset_type]) + { + return; + } } LLInventoryPanel::itemChanged(id, mask, model_item); |