SL-18918 Fix folder type when creating folders

Might be better to replace "type" with "type_default" everywere, not just for AIS
master
Andrey Kleshchev 2023-04-07 21:01:00 +03:00
parent 43ff8108f2
commit bb4967817e
3 changed files with 23 additions and 5 deletions

View File

@ -1098,11 +1098,28 @@ void LLInventoryCategory::setPreferredType(LLFolderType::EType type)
LLSD LLInventoryCategory::asLLSD() const
{
LLSD sd = LLSD();
sd["item_id"] = mUUID;
sd["parent_id"] = mParentUUID;
sd[INV_ITEM_ID_LABEL] = mUUID;
sd[INV_PARENT_ID_LABEL] = mParentUUID;
S8 type = static_cast<S8>(mPreferredType);
sd["type"] = type;
sd["name"] = mName;
sd[INV_ASSET_TYPE_LABEL] = type;
sd[INV_NAME_LABEL] = mName;
if (mThumbnailUUID.notNull())
{
sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
}
return sd;
}
LLSD LLInventoryCategory::asAISLLSD() const
{
LLSD sd = LLSD();
sd[INV_FOLDER_ID_LABEL_WS] = mUUID;
sd[INV_PARENT_ID_LABEL] = mParentUUID;
S8 type = static_cast<S8>(mPreferredType);
sd[INV_ASSET_TYPE_LABEL_WS] = type;
sd[INV_NAME_LABEL] = mName;
if (mThumbnailUUID.notNull())
{

View File

@ -253,6 +253,7 @@ public:
LLFolderType::EType getPreferredType() const;
void setPreferredType(LLFolderType::EType type);
LLSD asLLSD() const;
LLSD asAISLLSD() const;
bool fromLLSD(const LLSD& sd);
//--------------------------------------------------------------------

View File

@ -1010,7 +1010,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id,
new_inventory["categories"] = LLSD::emptyArray();
LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID());
cat.setThumbnailUUID(thumbnail_id);
LLSD cat_sd = cat.asLLSD();
LLSD cat_sd = cat.asAISLLSD();
new_inventory["categories"].append(cat_sd);
AISAPI::CreateInventory(
parent_id,