MAINT-8803 Better UI handling of unrecognized inventory items
parent
344d02af4f
commit
4dd88ee738
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType a
|
|||
}
|
||||
else
|
||||
{
|
||||
return IT_NONE;
|
||||
return IT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) &&
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
|
|
@ -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" />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue