diff options
| author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-07-15 14:23:44 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-15 14:23:44 +0300 |
| commit | d573bc2f926fb6ff473d9b346cdeb4d73e3b0ab3 (patch) | |
| tree | 27bf21e9b200dc59a870bbc17c293aa0233761ca /indra/newview/llvoavatarself.cpp | |
| parent | 8b89a721950d00bfc1617181e42e745c81cc9d5d (diff) | |
SL-20011 Restrict 'Empty Trash' if objects are attached
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
| -rw-r--r-- | indra/newview/llvoavatarself.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8fc1dcd81f..914376f5d1 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1247,6 +1247,27 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) return FALSE; } +bool LLVOAvatarSelf::hasAttachmentsInTrash() +{ + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment *attachment = iter->second; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject *attached_object = attachment_iter->get(); + if (attached_object && gInventory.isObjectDescendentOf(attached_object->getAttachmentItemID(), trash_id)) + { + return true; + } + } + } + return false; +} + // static BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id) { |
