summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp62
-rw-r--r--indra/llinventory/llinventory.h13
-rw-r--r--indra/llinventory/llinventorytype.cpp34
-rw-r--r--indra/llinventory/llinventorytype.h3
-rw-r--r--indra/llinventory/tests/inventorymisc_test.cpp4
5 files changed, 92 insertions, 24 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index d665deb605..5d3fbe5128 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -1324,7 +1324,7 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
LLInventoryCategory::LLInventoryCategory(
const LLUUID& uuid,
const LLUUID& parent_uuid,
- LLFolderType::EType preferred_type,
+ LLAssetType::EType preferred_type,
const std::string& name) :
LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
mPreferredType(preferred_type)
@@ -1332,7 +1332,7 @@ LLInventoryCategory::LLInventoryCategory(
}
LLInventoryCategory::LLInventoryCategory() :
- mPreferredType(LLFolderType::FT_NONE)
+ mPreferredType(LLAssetType::AT_NONE)
{
mType = LLAssetType::AT_CATEGORY;
}
@@ -1354,12 +1354,12 @@ void LLInventoryCategory::copyCategory(const LLInventoryCategory* other)
mPreferredType = other->mPreferredType;
}
-LLFolderType::EType LLInventoryCategory::getPreferredType() const
+LLAssetType::EType LLInventoryCategory::getPreferredType() const
{
return mPreferredType;
}
-void LLInventoryCategory::setPreferredType(LLFolderType::EType type)
+void LLInventoryCategory::setPreferredType(LLAssetType::EType type)
{
mPreferredType = type;
}
@@ -1405,13 +1405,13 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
if (sd.has(w))
{
S8 type = (U8)sd[w].asInteger();
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
}
w = INV_ASSET_TYPE_LABEL_WS;
if (sd.has(w))
{
S8 type = (U8)sd[w].asInteger();
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
}
w = INV_NAME_LABEL;
@@ -1433,7 +1433,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
msg->getUUIDFast(block, _PREHASH_ParentID, mParentUUID, block_num);
S8 type;
msg->getS8Fast(block, _PREHASH_Type, type, block_num);
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
msg->getStringFast(block, _PREHASH_Name, mName, block_num);
LLStringUtil::replaceNonstandardASCII(mName, ' ');
}
@@ -1482,7 +1482,7 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp)
}
else if(0 == strcmp("pref_type", keyword))
{
- mPreferredType = LLFolderType::lookup(valuestr);
+ mPreferredType = LLAssetType::lookup(valuestr);
}
else if(0 == strcmp("name", keyword))
{
@@ -1514,7 +1514,7 @@ BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const
mParentUUID.toString(uuid_str);
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
- fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str());
+ fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType));
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
fprintf(fp,"\t}\n");
return TRUE;
@@ -1561,7 +1561,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
}
else if(0 == strcmp("pref_type", keyword))
{
- mPreferredType = LLFolderType::lookup(valuestr);
+ mPreferredType = LLAssetType::lookup(valuestr);
}
else if(0 == strcmp("name", keyword))
{
@@ -1593,7 +1593,7 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
mParentUUID.toString(uuid_str);
output_stream << "\t\tparent_id\t" << uuid_str << "\n";
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
- output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n";
+ output_stream << "\t\tpref_type\t" << LLAssetType::lookup(mPreferredType) << "\n";
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
output_stream << "\t}\n";
return TRUE;
@@ -1629,6 +1629,38 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
return rv;
}
+/* deprecated, use LLInventoryItem::fromLLSD() instead
+LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item)
+{
+ LLPointer<LLInventoryItem> rv = new LLInventoryItem;
+ rv->setUUID(sd_item[INV_ITEM_ID_LABEL].asUUID());
+ rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID());
+ rv->rename(sd_item[INV_NAME_LABEL].asString());
+ rv->setType(
+ LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString()));
+ if (sd_item.has("shadow_id"))
+ {
+ LLUUID asset_id = sd_item["shadow_id"];
+ LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
+ cipher.decrypt(asset_id.mData, UUID_BYTES);
+ rv->setAssetUUID(asset_id);
+ }
+ if (sd_item.has(INV_ASSET_ID_LABEL))
+ {
+ rv->setAssetUUID(sd_item[INV_ASSET_ID_LABEL].asUUID());
+ }
+ rv->setDescription(sd_item[INV_DESC_LABEL].asString());
+ rv->setSaleInfo(ll_sale_info_from_sd(sd_item[INV_SALE_INFO_LABEL]));
+ rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL]));
+ rv->setInventoryType(
+ LLInventoryType::lookup(
+ sd_item[INV_INVENTORY_TYPE_LABEL].asString()));
+ rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger()));
+ rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger());
+ return rv;
+}
+*/
+
LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
{
LLSD rv;
@@ -1643,10 +1675,10 @@ LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
rv[INV_PARENT_ID_LABEL] = cat->getParentUUID();
rv[INV_NAME_LABEL] = cat->getName();
rv[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(cat->getType());
- if(LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ if(LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType()))
{
rv[INV_PREFERRED_TYPE_LABEL] =
- LLFolderType::lookup(cat->getPreferredType()).c_str();
+ LLAssetType::lookup(cat->getPreferredType());
}
return rv;
}
@@ -1660,7 +1692,7 @@ LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat)
rv->setType(
LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
rv->setPreferredType(
- LLFolderType::lookup(
- sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
+ LLAssetType::lookup(
+ sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
return rv;
}
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 3de9d14f54..bd581e860f 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -37,7 +37,6 @@
#include "llassetstorage.h"
#include "lldarray.h"
-#include "llfoldertype.h"
#include "llinventorytype.h"
#include "llmemtype.h"
#include "llpermissions.h"
@@ -322,15 +321,15 @@ protected:
public:
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
- LLFolderType::EType preferred_type,
+ LLAssetType::EType preferred_type,
const std::string& name);
LLInventoryCategory();
LLInventoryCategory(const LLInventoryCategory* other);
void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
// accessors and mutators
- LLFolderType::EType getPreferredType() const;
- void setPreferredType(LLFolderType::EType type);
+ LLAssetType::EType getPreferredType() const;
+ void setPreferredType(LLAssetType::EType type);
// For messaging system support
virtual void packMessage(LLMessageSystem* msg) const;
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
@@ -346,8 +345,10 @@ public:
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
protected:
- // May be the type that this category was "meant" to hold (although it may hold any type).
- LLFolderType::EType mPreferredType;
+ // The type of asset that this category was "meant" to hold
+ // (although it may in fact hold any type).
+ LLAssetType::EType mPreferredType;
+
};
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index 0e71c0d12d..a445466b26 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -79,16 +79,24 @@ LLInventoryDictionary::LLInventoryDictionary()
addEntry(LLInventoryType::IT_SOUND, new InventoryEntry("sound", "sound", 1, LLAssetType::AT_SOUND));
addEntry(LLInventoryType::IT_CALLINGCARD, new InventoryEntry("callcard", "calling card", 1, LLAssetType::AT_CALLINGCARD));
addEntry(LLInventoryType::IT_LANDMARK, new InventoryEntry("landmark", "landmark", 1, LLAssetType::AT_LANDMARK));
+ //addEntry(LLInventoryType::IT_SCRIPT, new InventoryEntry(NULL,NULL));
+ //addEntry(LLInventoryType::IT_CLOTHING, new InventoryEntry(NULL,NULL));
addEntry(LLInventoryType::IT_OBJECT, new InventoryEntry("object", "object", 1, LLAssetType::AT_OBJECT));
addEntry(LLInventoryType::IT_NOTECARD, new InventoryEntry("notecard", "note card", 1, LLAssetType::AT_NOTECARD));
addEntry(LLInventoryType::IT_CATEGORY, new InventoryEntry("category", "folder" ));
addEntry(LLInventoryType::IT_ROOT_CATEGORY, new InventoryEntry("root", "root" ));
addEntry(LLInventoryType::IT_LSL, new InventoryEntry("script", "script", 2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE));
+ //addEntry(LLInventoryType::IT_LSL_BYTECODE, new InventoryEntry(NULL,NULL));
+ //addEntry(LLInventoryType::IT_TEXTURE_TGA, new InventoryEntry(NULL,NULL));
+ //addEntry(LLInventoryType::IT_BODYPART, new InventoryEntry(NULL,NULL));
+ //addEntry(LLInventoryType::IT_TRASH, new InventoryEntry(NULL,NULL));
addEntry(LLInventoryType::IT_SNAPSHOT, new InventoryEntry("snapshot", "snapshot", 1, LLAssetType::AT_TEXTURE));
+ //addEntry(LLInventoryType::IT_LOST_AND_FOUND, new InventoryEntry(NULL,NULL, ));
addEntry(LLInventoryType::IT_ATTACHMENT, new InventoryEntry("attach", "attachment", 1, LLAssetType::AT_OBJECT));
addEntry(LLInventoryType::IT_WEARABLE, new InventoryEntry("wearable", "wearable", 2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));
addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION));
addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE));
+ addEntry(LLInventoryType::IT_FAVORITE, new InventoryEntry("favorite", "favorite", 1, LLAssetType::AT_FAVORITE));
}
@@ -120,9 +128,35 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
LLInventoryType::IT_ANIMATION, // AT_ANIMATION
LLInventoryType::IT_GESTURE, // AT_GESTURE
LLInventoryType::IT_NONE, // AT_SIMSTATE
+ LLInventoryType::IT_FAVORITE, // AT_FAVORITE
LLInventoryType::IT_NONE, // AT_LINK
LLInventoryType::IT_NONE, // AT_LINK_FOLDER
+
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+ LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE
+
+ LLInventoryType::IT_CATEGORY, // AT_CURRENT_OUTFIT
+ LLInventoryType::IT_CATEGORY, // AT_OUTFIT
+ LLInventoryType::IT_CATEGORY, // AT_MY_OUTFITS
};
// static
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index e515b8a304..14b28bfe4b 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -67,7 +67,8 @@ public:
IT_WEARABLE = 18,
IT_ANIMATION = 19,
IT_GESTURE = 20,
- IT_COUNT = 21,
+ IT_FAVORITE = 21,
+ IT_COUNT = 22,
IT_NONE = -1
};
diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp
index c797a70c50..770594dc9d 100644
--- a/indra/llinventory/tests/inventorymisc_test.cpp
+++ b/indra/llinventory/tests/inventorymisc_test.cpp
@@ -94,7 +94,7 @@ LLPointer<LLInventoryCategory> create_random_inventory_cat()
LLPointer<LLInventoryCategory> cat = new LLInventoryCategory(
item_id,
parent_id,
- LLFolderType::FT_NONE,
+ LLAssetType::AT_NONE,
std::string("Sample category"));
return cat;
}
@@ -452,7 +452,7 @@ namespace tut
ensure_equals("4.type::getType() failed", dst->getType(), src->getType());
ensure_equals("5.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());
- src->setPreferredType( LLFolderType::FT_TEXTURE);
+ src->setPreferredType( LLAssetType::AT_TEXTURE);
sd = ll_create_sd_from_inventory_category(src);
dst = ll_create_category_from_sd(sd);
ensure_equals("6.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());