From dc8365ff00c5ae33f31d779efa23f7872ec368a7 Mon Sep 17 00:00:00 2001 From: "Eric M. Tulla (BigPapi)" Date: Wed, 9 Dec 2009 16:27:39 -0500 Subject: Fix for EXT-2703 & EXT-2708 - save texture as issues Added save as to texture preview floater. Fixed behavior of save as (was only working for textures, not snapshots). Removed advanced menu entry for save texture as (refused to work after multiple implementations). --- indra/newview/llpreviewtexture.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llpreviewtexture.cpp') diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 698f6152b4..8fa147f201 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -145,6 +145,8 @@ BOOL LLPreviewTexture::postBuild() childSetVisible("Discard", false); } + childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this); + if (!mCopyToInv) { const LLInventoryItem* item = getItem(); @@ -164,6 +166,13 @@ BOOL LLPreviewTexture::postBuild() return LLPreview::postBuild(); } +// static +void LLPreviewTexture::onSaveAsBtn(void* data) +{ + LLPreviewTexture* self = (LLPreviewTexture*)data; + self->saveAs(); +} + void LLPreviewTexture::draw() { if (mUpdateDimensions) -- cgit v1.3 From 272bb744af3dd942369f4c378db316e182a1ab87 Mon Sep 17 00:00:00 2001 From: "Eric M. Tulla (BigPapi)" Date: Wed, 9 Dec 2009 20:24:37 -0500 Subject: Fix for save texture functionality no longer respecting permissions --- indra/newview/llpanelmaininventory.cpp | 28 ++++++++++++++++++++-- indra/newview/llpreviewtexture.cpp | 1 + .../default/xui/en/floater_preview_texture.xml | 4 ++-- 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpreviewtexture.cpp') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 8f71c6f1ee..9d73fbf21a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" #include "llpanelmaininventory.h" +#include "llagent.h" #include "lldndbutton.h" #include "llfilepicker.h" #include "llfloaterinventory.h" @@ -1017,8 +1018,31 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (current_item) { - LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType(); - return (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT); + bool can_save = false; + LLInventoryItem *item = gInventory.getItem(current_item->getListener()->getUUID()); + if(item) + { + const LLPermissions& perm = item->getPermissions(); + U32 mask = PERM_NONE; + if(perm.getOwner() == gAgent.getID()) + { + mask = perm.getMaskBase(); + } + else if(gAgent.isInGroup(perm.getGroup())) + { + mask = perm.getMaskGroup(); + } + else + { + mask = perm.getMaskEveryone(); + } + if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) + { + can_save = true; + } + LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType(); + return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT); + } } return false; } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 8fa147f201..86475fe2dc 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -146,6 +146,7 @@ BOOL LLPreviewTexture::postBuild() } childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this); + childSetVisible("save_tex_btn", canSaveAs()); if (!mCopyToInv) { diff --git a/indra/newview/skins/default/xui/en/floater_preview_texture.xml b/indra/newview/skins/default/xui/en/floater_preview_texture.xml index 054f3be70a..602a18ea56 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_texture.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_texture.xml @@ -61,7 +61,7 @@ name="Discard" top_delta="0" width="100" /> -