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/llpanelmaininventory.cpp | 46 +++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'indra/newview/llpanelmaininventory.cpp') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 74c1420cf3..4cebe68152 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -863,7 +863,6 @@ void LLPanelMainInventory::initListCommandsHandlers() mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2)); mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - } void LLPanelMainInventory::updateListCommands() @@ -909,6 +908,22 @@ void LLPanelMainInventory::onClipboardAction(const LLSD& userdata) getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name); } +void LLPanelMainInventory::saveTexture(const LLSD& userdata) +{ + LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return; + } + + const LLUUID& item_id = current_item->getListener()->getUUID(); + LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); + if (preview_texture) + { + preview_texture->openToSave(); + } +} + void LLPanelMainInventory::onCustomAction(const LLSD& userdata) { if (!isActionEnabled(userdata)) @@ -953,19 +968,19 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } if (command_name == "save_texture") { - LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) - { - return; - } + saveTexture(userdata); + } +} - const LLUUID& item_id = current_item->getListener()->getUUID(); - LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); - if (preview_texture) - { - preview_texture->openToSave(); - } +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); } + return false; } BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) @@ -994,12 +1009,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) } if (command_name == "save_texture") { - LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (current_item) - { - return (current_item->getListener()->getInventoryType() == LLInventoryType::IT_TEXTURE); - } - return FALSE; + return isSaveTextureEnabled(userdata); } return TRUE; } -- cgit v1.2.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 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelmaininventory.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; } -- cgit v1.2.3 From 9db47b1d4bc9c24adf23f862c729464d9422e6a3 Mon Sep 17 00:00:00 2001 From: "Eric M. Tulla (BigPapi)" Date: Thu, 10 Dec 2009 16:07:54 -0500 Subject: Fix for EXT-3368 - "Save Texture" functionality was no longer respecting perms --- indra/newview/llpanelmaininventory.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'indra/newview/llpanelmaininventory.cpp') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 9d73fbf21a..cef21e85d6 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1018,28 +1018,10 @@ bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (current_item) { - bool can_save = false; - LLInventoryItem *item = gInventory.getItem(current_item->getListener()->getUUID()); - if(item) + LLViewerInventoryItem *inv_item = current_item->getInventoryItem(); + if(inv_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; - } + bool can_save = inv_item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED); LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType(); return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT); } -- cgit v1.2.3