summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2018-08-01 17:41:34 +0300
committermaxim_productengine <mnikolenko@productengine.com>2018-08-01 17:41:34 +0300
commit4dd88ee738da3851d4cf5f8ffc3058948076c53d (patch)
tree385943f64a7d9bf28693c4ee464d2f245d05602f
parent344d02af4fd568e5a55e1ed0a1a935fb4718d364 (diff)
MAINT-8803 Better UI handling of unrecognized inventory items
-rw-r--r--indra/llappearance/llwearabletype.cpp2
-rw-r--r--indra/llcommon/llassettype.cpp3
-rw-r--r--indra/llcommon/llassettype.h2
-rw-r--r--indra/llinventory/llinventorytype.cpp2
-rw-r--r--indra/llinventory/llinventorytype.h2
-rw-r--r--indra/newview/llinventorybridge.cpp34
-rw-r--r--indra/newview/llinventorybridge.h12
-rw-r--r--indra/newview/llinventoryicon.cpp3
-rw-r--r--indra/newview/llinventorymodel.cpp32
-rw-r--r--indra/newview/llinventorymodel.h1
-rw-r--r--indra/newview/llinventorypanel.cpp36
-rw-r--r--indra/newview/llviewerassettype.cpp2
-rw-r--r--indra/newview/skins/default/textures/icons/Inv_UnknownObject.pngbin0 -> 1048 bytes
-rw-r--r--indra/newview/skins/default/textures/textures.xml1
14 files changed, 113 insertions, 19 deletions
diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index 207e0c4011..cd602b43b4 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -94,7 +94,7 @@ LLWearableDictionary::LLWearableDictionary()
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
- addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
+ addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_UNKNOWN, FALSE, FALSE));
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
}
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index 4304db36be..7e5a157cdf 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -95,6 +95,7 @@ LLAssetDictionary::LLAssetDictionary()
addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false));
addEntry(LLAssetType::AT_WIDGET, new AssetEntry("WIDGET", "widget", "widget", false, false, false));
addEntry(LLAssetType::AT_PERSON, new AssetEntry("PERSON", "person", "person", false, false, false));
+ addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", NULL, false, false, false));
addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE));
};
@@ -156,7 +157,7 @@ LLAssetType::EType LLAssetType::lookup(const std::string& type_name)
return iter->first;
}
}
- return AT_NONE;
+ return AT_UNKNOWN;
}
// static
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index b849be9f16..79ab3d7efe 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -130,7 +130,7 @@ public:
// | 4. ADD TO LLViewerAssetType.cpp |
// | 5. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp |
// +*********************************************************+
-
+ AT_UNKNOWN = 255,
AT_NONE = -1
};
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index d1e6807f52..7399e1bca4 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -181,7 +181,7 @@ LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType a
}
else
{
- return IT_NONE;
+ return IT_UNKNOWN;
}
}
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index fc3c78cf50..891ab217fd 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -66,6 +66,7 @@ public:
IT_PERSON = 24,
IT_COUNT = 25,
+ IT_UNKNOWN = 255,
IT_NONE = -1
};
@@ -111,6 +112,7 @@ public:
ICONNAME_MESH,
ICONNAME_INVALID,
+ ICONNAME_UNKNOWN,
ICONNAME_COUNT,
ICONNAME_NONE = -1
};
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 90a000c196..e4b6c3b554 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1406,7 +1406,9 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
}
new_listener = new LLMeshBridge(inventory, root, uuid);
break;
-
+ case LLAssetType::AT_UNKNOWN:
+ new_listener = new LLUnknownItemBridge(inventory, root, uuid);
+ break;
case LLAssetType::AT_IMAGE_TGA:
case LLAssetType::AT_IMAGE_JPEG:
//LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL;
@@ -6949,6 +6951,21 @@ const LLUUID &LLLinkFolderBridge::getFolderID() const
return LLUUID::null;
}
+void LLUnknownItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ items.push_back(std::string("Properties"));
+ items.push_back(std::string("Rename"));
+ hide_context_entries(menu, items, disabled_items);
+}
+
+LLUIImagePtr LLUnknownItemBridge::getIcon() const
+{
+ return LLInventoryIcon::getIcon(LLAssetType::AT_UNKNOWN, mInvType);
+}
+
+
/********************************************************************************
**
** BRIDGE ACTIONS
@@ -7310,7 +7327,7 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ
menuentry_vec_t disabled_items;
if (get_selection_item_uuids(selected_items, ids))
{
- if (!LLAppearanceMgr::instance().canAddWearables(ids))
+ if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids))
{
disabled_items.push_back(std::string("Wearable Add"));
}
@@ -7318,4 +7335,17 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ
disable_context_entries_if_present(menu, disabled_items);
}
+bool LLFolderViewGroupedItemBridge::canWearSelected(uuid_vec_t item_ids)
+{
+ for (uuid_vec_t::const_iterator it = item_ids.begin(); it != item_ids.end(); ++it)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(*it);
+ LLAssetType::EType asset_type = item->getType();
+ if (!item || (asset_type >= LLAssetType::AT_COUNT) || (asset_type <= LLAssetType::AT_NONE))
+ {
+ return false;
+ }
+ }
+ return true;
+}
// EOF
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index fd5c0433b1..ce06e8fffc 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -575,6 +575,17 @@ protected:
static std::string sPrefix;
};
+class LLUnknownItemBridge : public LLItemBridge
+{
+public:
+ LLUnknownItemBridge(LLInventoryPanel* inventory,
+ LLFolderView* root,
+ const LLUUID& uuid) :
+ LLItemBridge(inventory, root, uuid) {}
+ virtual LLUIImagePtr getIcon() const;
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
+};
+
class LLLinkFolderBridge : public LLItemBridge
{
public:
@@ -747,6 +758,7 @@ class LLFolderViewGroupedItemBridge: public LLFolderViewGroupedItemModel
public:
LLFolderViewGroupedItemBridge();
virtual void groupFilterContextMenu(folder_view_item_deque& selected_items, LLMenuGL& menu);
+ bool canWearSelected(uuid_vec_t item_ids);
};
#endif // LL_LLINVENTORYBRIDGE_H
diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp
index 495180f087..d0df1c94d5 100644
--- a/indra/newview/llinventoryicon.cpp
+++ b/indra/newview/llinventoryicon.cpp
@@ -93,6 +93,7 @@ LLIconDictionary::LLIconDictionary()
addEntry(LLInventoryType::ICONNAME_MESH, new IconEntry("Inv_Mesh"));
addEntry(LLInventoryType::ICONNAME_INVALID, new IconEntry("Inv_Invalid"));
+ addEntry(LLInventoryType::ICONNAME_UNKNOWN, new IconEntry("Inv_Unknown"));
addEntry(LLInventoryType::ICONNAME_NONE, new IconEntry("NONE"));
}
@@ -166,6 +167,8 @@ const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
break;
case LLAssetType::AT_MESH:
idx = LLInventoryType::ICONNAME_MESH;
+ case LLAssetType::AT_UNKNOWN:
+ idx = LLInventoryType::ICONNAME_UNKNOWN;
default:
break;
}
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b447166764..2b9607f7a2 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1810,11 +1810,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
llassert(item);
if(item)
{
- // This can happen if assettype enums from llassettype.h ever change.
- // For example, there is a known backwards compatibility issue in some viewer prototypes prior to when
- // the AT_LINK enum changed from 23 to 24.
- if ((item->getType() == LLAssetType::AT_NONE)
- || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup())
+ if (item->getType() <= LLAssetType::AT_NONE)
{
LL_WARNS(LOG_INV) << "Got bad asset type for item [ name: " << item->getName()
<< " type: " << item->getType()
@@ -1822,6 +1818,13 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
return;
}
+ if (LLAssetType::lookup(item->getType()) == LLAssetType::badLookup())
+ {
+ LL_WARNS(LOG_INV) << "Got unknown asset type for item [ name: " << item->getName()
+ << " type: " << item->getType()
+ << " inv-type: " << item->getInventoryType() << " ]." << LL_ENDL;
+ }
+
// This condition means that we tried to add a link without the baseobj being in memory.
// The item will show up as a broken link.
if (item->getIsBrokenLink())
@@ -2030,6 +2033,7 @@ bool LLInventoryModel::loadSkeleton(
update_map_t child_counts;
cat_array_t categories;
item_array_t items;
+ changed_items_t categories_to_update;
item_array_t possible_broken_links;
cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
std::string inventory_filename = getInvCacheAddres(owner_id);
@@ -2055,7 +2059,7 @@ bool LLInventoryModel::loadSkeleton(
}
}
bool is_cache_obsolete = false;
- if(loadFromFile(inventory_filename, categories, items, is_cache_obsolete))
+ if (loadFromFile(inventory_filename, categories, items, categories_to_update, is_cache_obsolete))
{
// We were able to find a cache of files. So, use what we
// found to generate a set of categories we should add. We
@@ -2073,6 +2077,12 @@ bool LLInventoryModel::loadSkeleton(
continue; // cache corruption?? not sure why this happens -SJB
}
LLViewerInventoryCategory* tcat = *cit;
+
+ if (categories_to_update.find(tcat->getUUID()) != categories_to_update.end())
+ {
+ tcat->setVersion(NO_VERSION);
+ LL_WARNS() << "folder to update: " << tcat->getName() << LL_ENDL;
+ }
// we can safely ignore anything loaded from file, but
// not sent down in the skeleton. Must have been removed from inventory.
@@ -2621,6 +2631,7 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const
bool LLInventoryModel::loadFromFile(const std::string& filename,
LLInventoryModel::cat_array_t& categories,
LLInventoryModel::item_array_t& items,
+ LLInventoryModel::changed_items_t& cats_to_update,
bool &is_cache_obsolete)
{
if(filename.empty())
@@ -2695,7 +2706,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
}
else
{
- items.push_back(inv_item);
+ if (inv_item->getType() == LLAssetType::AT_UNKNOWN)
+ {
+ cats_to_update.insert(inv_item->getParentUUID());
+ }
+ else
+ {
+ items.push_back(inv_item);
+ }
}
}
else
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 01e0ed7e9b..a4326aaeed 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -613,6 +613,7 @@ protected:
static bool loadFromFile(const std::string& filename,
cat_array_t& categories,
item_array_t& items,
+ changed_items_t& cats_to_update,
bool& is_cache_obsolete);
static bool saveToFile(const std::string& filename,
const cat_array_t& categories,
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 702675ad49..1481992f43 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -861,13 +861,37 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
if (!folder_view_item && parent_folder)
{
- if (objectp->getType() <= LLAssetType::AT_NONE ||
- objectp->getType() >= LLAssetType::AT_COUNT)
+ if (objectp->getType() <= LLAssetType::AT_NONE)
+ {
+ LL_WARNS() << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : "
+ << ((S32)objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
+ << LL_ENDL;
+ return NULL;
+ }
+
+ if (objectp->getType() >= LLAssetType::AT_COUNT)
{
- LL_WARNS() << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : "
- << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
- << LL_ENDL;
- return NULL;
+ LL_WARNS() << "LLInventoryPanel::buildNewViews called with unknown objectp->mType : "
+ << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
+ << LL_ENDL;
+
+ LLInventoryItem* item = (LLInventoryItem*)objectp;
+ if (item)
+ {
+ LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_UNKNOWN,
+ LLAssetType::AT_UNKNOWN,
+ LLInventoryType::IT_UNKNOWN,
+ this,
+ &mInventoryViewModel,
+ mFolderRoot.get(),
+ item->getUUID(),
+ item->getFlags());
+
+ if (new_listener)
+ {
+ folder_view_item = createFolderViewItem(new_listener);
+ }
+ }
}
if ((objectp->getType() == LLAssetType::AT_CATEGORY) &&
diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp
index ad0c1734f9..f07c14d01f 100644
--- a/indra/newview/llviewerassettype.cpp
+++ b/indra/newview/llviewerassettype.cpp
@@ -84,6 +84,8 @@ LLViewerAssetDictionary::LLViewerAssetDictionary()
addEntry(LLViewerAssetType::AT_PERSON, new ViewerAssetEntry(DAD_PERSON));
+ addEntry(LLViewerAssetType::AT_UNKNOWN, new ViewerAssetEntry(DAD_NONE));
+
addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE));
};
diff --git a/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png b/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png
new file mode 100644
index 0000000000..10f2b31cb5
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/Inv_UnknownObject.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index d757e39366..2540ee148d 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -324,6 +324,7 @@ with the same filename but different name
<texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
<texture name="Inv_Link" file_name="icons/Inv_Link.png" preload="false" />
<texture name="Inv_Invalid" file_name="icons/Inv_Invalid.png" preload="false" />
+ <texture name="Inv_Unknown" file_name="icons/Inv_UnknownObject.png" preload="false" />
<texture name="Inv_VersionFolderClosed" file_name="icons/Inv_VersionFolderClosed.png" preload="false" />
<texture name="Inv_VersionFolderOpen" file_name="icons/Inv_VersionFolderOpen.png" preload="false" />