Actually use LLWearable::mDescription.
Set LLWearable::mDescription and keep it up to date. This allows to export (and import) the description of wearables.
This commit is contained in:
@@ -473,7 +473,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
|
||||
LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
||||
const U32 index,
|
||||
const std::string& new_name,
|
||||
const std::string& description,
|
||||
const std::string& new_description,
|
||||
BOOL save_in_lost_and_found)
|
||||
{
|
||||
if (!isWearableCopyable(type, index))
|
||||
@@ -496,9 +496,12 @@ LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType t
|
||||
}
|
||||
std::string trunc_name(new_name);
|
||||
LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
std::string trunc_description(new_description);
|
||||
LLStringUtil::truncate(trunc_description, DB_INV_ITEM_DESC_STR_LEN);
|
||||
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
|
||||
old_wearable,
|
||||
trunc_name);
|
||||
trunc_name,
|
||||
trunc_description);
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
@@ -506,7 +509,7 @@ LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType t
|
||||
index,
|
||||
new_wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_WEARITEM,
|
||||
description
|
||||
trunc_description
|
||||
);
|
||||
LLUUID category_id;
|
||||
if (save_in_lost_and_found)
|
||||
@@ -595,6 +598,25 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::descriptionChanged(LLUUID const& item_id)
|
||||
{
|
||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||
{
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
{
|
||||
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
|
||||
if (curr_item_id == item_id)
|
||||
{
|
||||
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
|
||||
llassert(wearable);
|
||||
if (!wearable) continue;
|
||||
|
||||
wearable->refreshNameAndDescription();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
@@ -751,7 +773,7 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
|
||||
if (!removed)
|
||||
{
|
||||
LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
|
||||
viewer_wearable->refreshName();
|
||||
viewer_wearable->refreshNameAndDescription();
|
||||
|
||||
// Hack pt 2. If the wearable we just loaded has definition version 24,
|
||||
// then force a re-save of this wearable after slamming the version number to 22.
|
||||
@@ -1334,6 +1356,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
const LLWearableType::EType type = new_wearable->getType();
|
||||
|
||||
new_wearable->setName(new_item->getName());
|
||||
new_wearable->setDescription(new_item->getDescription());
|
||||
new_wearable->setItemID(new_item->getUUID());
|
||||
|
||||
if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
|
||||
|
||||
@@ -116,6 +116,7 @@ public:
|
||||
// void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
|
||||
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
|
||||
void setWearableName(const LLUUID& item_id, const std::string& new_name);
|
||||
void descriptionChanged(LLUUID const& item_id);
|
||||
// *TODO: Move this into llappearance/LLWearableData ?
|
||||
void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
virtual void showProperties(void) = 0;
|
||||
virtual BOOL isItemRenameable() const = 0;
|
||||
virtual BOOL renameItem(const std::string& new_name) = 0;
|
||||
virtual void descriptionChanged(void) const = 0;
|
||||
virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder
|
||||
virtual BOOL isItemRemovable( void ) const = 0; // Can be destroyed
|
||||
virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
|
||||
|
||||
@@ -615,6 +615,15 @@ void LLFolderViewItem::rename(const std::string& new_name)
|
||||
}
|
||||
}
|
||||
|
||||
void LLFolderViewItem::descriptionChanged(void) const
|
||||
{
|
||||
// We don't have a description, but the listener does!
|
||||
if( mListener )
|
||||
{
|
||||
mListener->descriptionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void LLFolderViewItem::updateSearchLabelType()
|
||||
{
|
||||
mSearchType = mRoot->getSearchType();
|
||||
@@ -2871,4 +2880,5 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
|
||||
return (first_create > second_create);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,6 +277,8 @@ public:
|
||||
|
||||
// just rename the object.
|
||||
void rename(const std::string& new_name);
|
||||
// Alert mListener that the description of this item changed.
|
||||
void descriptionChanged(void) const;
|
||||
|
||||
// open
|
||||
virtual void openItem( void );
|
||||
|
||||
@@ -1724,6 +1724,10 @@ BOOL LLItemBridge::renameItem(const std::string& new_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLItemBridge::descriptionChanged(void) const
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
BOOL LLItemBridge::removeItem()
|
||||
{
|
||||
@@ -2966,6 +2970,12 @@ BOOL LLFolderBridge::renameItem(const std::string& new_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLFolderBridge::descriptionChanged(void) const
|
||||
{
|
||||
// A folder has no description.
|
||||
llerrs << "Calling LLFolderBridge::descriptionChanged" << llendl;
|
||||
}
|
||||
|
||||
BOOL LLFolderBridge::removeItem()
|
||||
{
|
||||
if(!isItemRemovable())
|
||||
@@ -5470,6 +5480,11 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLObjectBridge::descriptionChanged(void) const
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
// +=================================================+
|
||||
// | LLLSLTextBridge |
|
||||
// +=================================================+
|
||||
@@ -5628,6 +5643,14 @@ BOOL LLWearableBridge::renameItem(const std::string& new_name)
|
||||
return LLItemBridge::renameItem(new_name);
|
||||
}
|
||||
|
||||
void LLWearableBridge::descriptionChanged(void) const
|
||||
{
|
||||
if (get_is_item_worn(mUUID))
|
||||
{
|
||||
gAgentWearables.descriptionChanged(mUUID);
|
||||
}
|
||||
}
|
||||
|
||||
std::string LLWearableBridge::getLabelSuffix() const
|
||||
{
|
||||
if (get_is_item_worn(mUUID))
|
||||
|
||||
@@ -211,6 +211,7 @@ public:
|
||||
virtual time_t getCreationDate() const;
|
||||
virtual BOOL isItemRenameable() const;
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
virtual BOOL removeItem();
|
||||
virtual BOOL isItemCopyable() const;
|
||||
virtual BOOL hasChildren() const { return FALSE; }
|
||||
@@ -257,6 +258,7 @@ public:
|
||||
static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
|
||||
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
|
||||
virtual BOOL removeItem();
|
||||
BOOL removeSystemFolder();
|
||||
@@ -466,6 +468,7 @@ public:
|
||||
virtual std::string getLabelSuffix() const;
|
||||
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
LLInventoryObject* getObject() const;
|
||||
protected:
|
||||
static LLUUID sContextMenuItemID; // Only valid while the context menu is open.
|
||||
@@ -499,6 +502,7 @@ public:
|
||||
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
|
||||
virtual std::string getLabelSuffix() const;
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
virtual LLWearableType::EType getWearableType() const { return mWearableType; }
|
||||
|
||||
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
|
||||
|
||||
@@ -854,6 +854,10 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
|
||||
{
|
||||
mask |= LLInventoryObserver::LABEL;
|
||||
}
|
||||
if(old_item->getDescription() != item->getDescription())
|
||||
{
|
||||
mask |= LLInventoryObserver::DESCRIPTION;
|
||||
}
|
||||
old_item->copyViewerItem(item);
|
||||
mask |= LLInventoryObserver::INTERNAL;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
GESTURE = 64,
|
||||
REBUILD = 128, // Item UI changed (e.g. item type different)
|
||||
SORT = 256, // Folder needs to be resorted.
|
||||
DESCRIPTION = 0x10000, // Singu extension to keep track of description changes.
|
||||
ALL = 0xffffffff
|
||||
};
|
||||
LLInventoryObserver();
|
||||
|
||||
@@ -484,6 +484,17 @@ void LLInventoryPanel::modelChanged(U32 mask)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// DESCRIPTION Operation (singu only)
|
||||
// Alert listener.
|
||||
if ((mask & LLInventoryObserver::DESCRIPTION))
|
||||
{
|
||||
if (view_item)
|
||||
{
|
||||
view_item->descriptionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// REBUILD Operation
|
||||
// Destroy and regenerate the UI.
|
||||
|
||||
@@ -123,6 +123,7 @@ public:
|
||||
virtual void selectItem() {}
|
||||
virtual BOOL isItemRenameable() const;
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
virtual BOOL isItemMovable() const;
|
||||
virtual BOOL isItemRemovable() const;
|
||||
virtual BOOL removeItem();
|
||||
@@ -430,6 +431,11 @@ BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLTaskInvFVBridge::descriptionChanged(void) const
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
BOOL LLTaskInvFVBridge::isItemMovable() const
|
||||
{
|
||||
//LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
|
||||
@@ -814,6 +820,7 @@ public:
|
||||
virtual BOOL isItemRenameable() const;
|
||||
// virtual BOOL isItemCopyable() const { return FALSE; }
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
virtual BOOL isItemRemovable() const;
|
||||
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
|
||||
virtual BOOL hasChildren() const;
|
||||
@@ -854,6 +861,12 @@ BOOL LLTaskCategoryBridge::renameItem(const std::string& new_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLTaskCategoryBridge::descriptionChanged(void) const
|
||||
{
|
||||
// A category has no description.
|
||||
llerrs << "Calling LLTaskCategoryBridge::descriptionChanged" << llendl;
|
||||
}
|
||||
|
||||
BOOL LLTaskCategoryBridge::isItemRemovable() const
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1169,6 +1182,7 @@ public:
|
||||
|
||||
virtual BOOL isItemRenameable() const;
|
||||
virtual BOOL renameItem(const std::string& new_name);
|
||||
virtual void descriptionChanged(void) const;
|
||||
};
|
||||
|
||||
BOOL LLTaskCallingCardBridge::isItemRenameable() const
|
||||
@@ -1181,6 +1195,10 @@ BOOL LLTaskCallingCardBridge::renameItem(const std::string& new_name)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLTaskCallingCardBridge::descriptionChanged(void) const
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLTaskScriptBridge
|
||||
|
||||
@@ -554,13 +554,14 @@ void LLViewerWearable::setUpdated() const
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
|
||||
}
|
||||
|
||||
void LLViewerWearable::refreshName()
|
||||
void LLViewerWearable::refreshNameAndDescription()
|
||||
{
|
||||
LLUUID item_id = getItemID();
|
||||
LLInventoryItem* item = gInventory.getItem(item_id);
|
||||
if( item )
|
||||
{
|
||||
mName = item->getName();
|
||||
mDescription = item->getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,9 @@ public:
|
||||
// Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
|
||||
void setUpdated() const;
|
||||
|
||||
// the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
|
||||
// the wearable was worn. make sure the name and description of the wearable object matches the LLViewerInventoryItem,
|
||||
// not the wearable asset itself.
|
||||
void refreshName();
|
||||
void refreshNameAndDescription();
|
||||
|
||||
// Update the baked texture hash.
|
||||
/*virtual*/void addToBakedTextureHash(LLMD5& hash) const;
|
||||
|
||||
@@ -215,7 +215,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
|
||||
}
|
||||
|
||||
|
||||
LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name)
|
||||
LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name, const std::string& new_description)
|
||||
{
|
||||
lldebugs << "LLWearableList::createCopy()" << llendl;
|
||||
|
||||
@@ -227,6 +227,7 @@ LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearabl
|
||||
wearable->setPermissions(perm);
|
||||
|
||||
if (!new_name.empty()) wearable->setName(new_name);
|
||||
if (!new_description.empty()) wearable->setDescription(new_description);
|
||||
|
||||
// Send to the dataserver
|
||||
wearable->saveNewAsset();
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
|
||||
void* userdata);
|
||||
|
||||
LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string());
|
||||
LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string(), const std::string& new_description = std::string());
|
||||
LLViewerWearable* createNewWearable(LLWearableType::EType type, LLAvatarAppearance *avatarp);
|
||||
|
||||
// Callback
|
||||
|
||||
Reference in New Issue
Block a user