diff options
author | Jonathan Yap <none@none> | 2012-06-08 13:49:02 -0400 |
---|---|---|
committer | Jonathan Yap <none@none> | 2012-06-08 13:49:02 -0400 |
commit | fbb4e5fb0f7bba935ec9d0d466be12a346a6b149 (patch) | |
tree | 40b938b298efb8635a47297844d4c64719c13c52 /indra/newview/llagentwearables.cpp | |
parent | a519e34f02b4b2663fe082ba9ad12f1b423669cb (diff) |
STORM-68 As a Builder, I want that ability to set default permissions on creation of objects, clothing, scripts, notecards, etc.
First pass at implementation, debuggins lines still need to be removed and there is one known bug to be resolved.
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r-- | indra/newview/llagentwearables.cpp | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index dd02a74a38..7017357346 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -49,6 +49,7 @@ #include "llvoavatarself.h" #include "llwearable.h" #include "llwearablelist.h" +#include "llfloaterperms.h" #include <boost/scoped_ptr.hpp> @@ -65,8 +66,24 @@ class LLWearAndEditCallback : public LLInventoryCallback { void fire(const LLUUID& inv_item) { +llwarns << "DBG 1" << llendl; if (inv_item.isNull()) return; +llwarns << "DBG 2" << llendl; + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + +llwarns << "DBG 3" << llendl; + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + +llwarns << "DBG 4" << llendl; + gInventory.updateItem(item); + gInventory.notifyObservers(); + // Request editing the item after it gets worn. gAgentWearables.requestEditingWearable(inv_item); @@ -75,6 +92,27 @@ class LLWearAndEditCallback : public LLInventoryCallback } }; +class LLCreateWearableCallback : public LLInventoryCallback +{ + void fire(const LLUUID& inv_item) + { + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); + } +}; + /////////////////////////////////////////////////////////////////////////////// // HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look" @@ -1982,7 +2020,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLWearable* wearable = LLWearableList::instance().createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL; + LLPointer<LLInventoryCallback> cb; + if (wear) + { + cb = new LLWearAndEditCallback; + } + else + { + cb = new LLCreateWearableCallback; + } + LLUUID folder_id; if (parent_id.notNull()) @@ -1995,10 +2042,15 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con folder_id = gInventory.findCategoryUUIDForType(folder_type); } - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - folder_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + folder_id, + wearable->getTransactionID(), + wearable->getName(), + wearable->getDescription(), + asset_type, inv_type, + wearable->getType(), + LLFloaterPerms::getNextOwnerPerms("Wearables"), cb); } |