summaryrefslogtreecommitdiff
path: root/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rw-r--r--indra/newview/lltooldraganddrop.cpp507
1 files changed, 252 insertions, 255 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 47e60a966e..774626f19d 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -37,6 +37,7 @@
#include "llnotificationsutil.h"
// project headers
#include "llagent.h"
+#include "llagentcamera.h"
#include "llagentui.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
@@ -49,6 +50,8 @@
#include "llhudeffecttrail.h"
#include "llimview.h"
#include "llinventorybridge.h"
+#include "llinventorydefines.h"
+#include "llinventoryfunctions.h"
#include "llmutelist.h"
#include "llpreviewnotecard.h"
#include "llrecentpeople.h"
@@ -79,7 +82,7 @@ public:
virtual bool operator()(LLInventoryCategory* cat,
LLInventoryItem* item)
{
- if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+ if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
{
return true;
}
@@ -95,8 +98,8 @@ public:
virtual bool operator()(LLInventoryCategory* cat,
LLInventoryItem* item)
{
- if(item) return true;
- if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+ if (item) return true;
+ if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
{
return true;
}
@@ -123,18 +126,18 @@ bool LLDroppableItem::operator()(LLInventoryCategory* cat,
LLInventoryItem* item)
{
bool allowed = false;
- if(item)
+ if (item)
{
allowed = itemTransferCommonlyAllowed(item);
- if(allowed
+ if (allowed
&& mIsTransfer
&& !item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID()))
{
allowed = false;
}
- if(allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
{
++mCountLosing;
}
@@ -154,7 +157,7 @@ bool LLUncopyableItems::operator()(LLInventoryCategory* cat,
LLInventoryItem* item)
{
bool uncopyable = false;
- if(item)
+ if (item)
{
if (itemTransferCommonlyAllowed(item) &&
!item->getPermissions().allowCopyBy(gAgent.getID()))
@@ -179,10 +182,10 @@ bool LLDropCopyableItems::operator()(
LLInventoryItem* item)
{
bool allowed = false;
- if(item)
+ if (item)
{
allowed = itemTransferCommonlyAllowed(item);
- if(allowed &&
+ if (allowed &&
!item->getPermissions().allowCopyBy(gAgent.getID()))
{
// whoops, can't copy it - don't allow it.
@@ -211,16 +214,16 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
return true;
bool allowed = false;
- if(item)
+ if (item)
{
allowed = itemTransferCommonlyAllowed(item);
- if(allowed &&
+ if (allowed &&
!item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID()))
{
allowed = FALSE;
}
- if(allowed &&
+ if (allowed &&
!item->getPermissions().allowCopyBy(gAgent.getID()))
{
++mCountLosing;
@@ -229,10 +232,16 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
return allowed;
}
+// Starts a fetch on folders and items. This is really not used
+// as an observer in the traditional sense; we're just using it to
+// request a fetch and we don't care about when/if the response arrives.
class LLCategoryFireAndForget : public LLInventoryFetchComboObserver
{
public:
- LLCategoryFireAndForget() {}
+ LLCategoryFireAndForget(const uuid_vec_t& folder_ids,
+ const uuid_vec_t& item_ids) :
+ LLInventoryFetchComboObserver(folder_ids, item_ids)
+ {}
~LLCategoryFireAndForget() {}
virtual void done()
{
@@ -241,11 +250,13 @@ public:
}
};
-class LLCategoryDropObserver : public LLInventoryFetchObserver
+class LLCategoryDropObserver : public LLInventoryFetchItemsObserver
{
public:
LLCategoryDropObserver(
+ const uuid_vec_t& ids,
const LLUUID& obj_id, LLToolDragAndDrop::ESource src) :
+ LLInventoryFetchItemsObserver(ids),
mObjectID(obj_id),
mSource(src)
{}
@@ -261,16 +272,16 @@ void LLCategoryDropObserver::done()
{
gInventory.removeObserver(this);
LLViewerObject* dst_obj = gObjectList.findObject(mObjectID);
- if(dst_obj)
+ if (dst_obj)
{
// *FIX: coalesce these...
LLInventoryItem* item = NULL;
- item_ref_t::iterator it = mComplete.begin();
- item_ref_t::iterator end = mComplete.end();
+ uuid_vec_t::iterator it = mComplete.begin();
+ uuid_vec_t::iterator end = mComplete.end();
for(; it < end; ++it)
{
item = gInventory.getItem(*it);
- if(item)
+ if (item)
{
LLToolDragAndDrop::dropInventory(
dst_obj,
@@ -282,7 +293,7 @@ void LLCategoryDropObserver::done()
}
delete this;
}
-
+/* Doesn't seem to be used anymore.
class LLCategoryDropDescendentsObserver : public LLInventoryFetchDescendentsObserver
{
public:
@@ -303,8 +314,8 @@ void LLCategoryDropDescendentsObserver::done()
{
gInventory.removeObserver(this);
- folder_ref_t::iterator it = mCompleteFolders.begin();
- folder_ref_t::iterator end = mCompleteFolders.end();
+ uuid_vec_t::iterator it = mComplete.begin();
+ uuid_vec_t::iterator end = mComplete.end();
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
for(; it != end; ++it)
@@ -317,20 +328,20 @@ void LLCategoryDropDescendentsObserver::done()
}
S32 count = items.count();
- if(count)
+ if (count)
{
std::set<LLUUID> unique_ids;
for(S32 i = 0; i < count; ++i)
{
unique_ids.insert(items.get(i)->getUUID());
}
- LLInventoryFetchObserver::item_ref_t ids;
- std::back_insert_iterator<LLInventoryFetchObserver::item_ref_t> copier(ids);
+ uuid_vec_t ids;
+ std::back_insert_iterator<uuid_vec_t> copier(ids);
std::copy(unique_ids.begin(), unique_ids.end(), copier);
LLCategoryDropObserver* dropper;
- dropper = new LLCategoryDropObserver(mObjectID, mSource);
- dropper->fetchItems(ids);
- if(dropper->isEverythingComplete())
+ dropper = new LLCategoryDropObserver(ids, mObjectID, mSource);
+ dropper->startFetch();
+ if (dropper->isDone())
{
dropper->done();
}
@@ -341,6 +352,7 @@ void LLCategoryDropDescendentsObserver::done()
}
delete this;
}
+*/
LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none,
dragOrDrop3dImpl f_self,
@@ -410,9 +422,12 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y)
BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
{
- const S32 MIN_MANHATTAN_DIST = 3;
- S32 manhattan_dist = llabs( x - mDragStartX ) + llabs( y - mDragStartY );
- return manhattan_dist >= MIN_MANHATTAN_DIST;
+ static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold");
+
+ S32 mouse_delta_x = x - mDragStartX;
+ S32 mouse_delta_y = y - mDragStartY;
+
+ return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold;
}
void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
@@ -421,7 +436,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
const LLUUID& source_id,
const LLUUID& object_id)
{
- if(type == DAD_NONE)
+ if (type == DAD_NONE)
{
llwarns << "Attempted to start drag without a cargo type" << llendl;
return;
@@ -437,24 +452,24 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
setMouseCapture( TRUE );
LLToolMgr::getInstance()->setTransientTool( this );
mCursor = UI_CURSOR_NO;
- if((mCargoTypes[0] == DAD_CATEGORY)
+ if ((mCargoTypes[0] == DAD_CATEGORY)
&& ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)))
{
LLInventoryCategory* cat = gInventory.getCategory(cargo_id);
// go ahead and fire & forget the descendents if we are not
// dragging a protected folder.
- if(cat)
+ if (cat)
{
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLNoPreferredTypeOrItem is_not_preferred;
- LLInventoryFetchComboObserver::folder_ref_t folder_ids;
- LLInventoryFetchComboObserver::item_ref_t item_ids;
- if(is_not_preferred(cat, NULL))
+ uuid_vec_t folder_ids;
+ uuid_vec_t item_ids;
+ if (is_not_preferred(cat, NULL))
{
folder_ids.push_back(cargo_id);
}
- gInventory.collectDescendentsIf(
+ gInventory.collectDescendentsIf (
cargo_id,
cats,
items,
@@ -471,10 +486,11 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
{
item_ids.push_back(items.get(i)->getUUID());
}
- if(!folder_ids.empty() || !item_ids.empty())
+ if (!folder_ids.empty() || !item_ids.empty())
{
- LLCategoryFireAndForget fetcher;
- fetcher.fetch(folder_ids, item_ids);
+ LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids);
+ fetcher->startFetch();
+ delete fetcher;
}
}
}
@@ -482,7 +498,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
void LLToolDragAndDrop::beginMultiDrag(
const std::vector<EDragAndDropType> types,
- const std::vector<LLUUID>& cargo_ids,
+ const uuid_vec_t& cargo_ids,
ESource source,
const LLUUID& source_id)
{
@@ -492,7 +508,7 @@ void LLToolDragAndDrop::beginMultiDrag(
std::vector<EDragAndDropType>::const_iterator types_it;
for (types_it = types.begin(); types_it != types.end(); ++types_it)
{
- if(DAD_NONE == *types_it)
+ if (DAD_NONE == *types_it)
{
llwarns << "Attempted to start drag without a cargo type" << llendl;
return;
@@ -506,7 +522,7 @@ void LLToolDragAndDrop::beginMultiDrag(
setMouseCapture( TRUE );
LLToolMgr::getInstance()->setTransientTool( this );
mCursor = UI_CURSOR_NO;
- if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
{
// find categories (i.e. inventory folders) in the cargo.
LLInventoryCategory* cat = NULL;
@@ -515,16 +531,16 @@ void LLToolDragAndDrop::beginMultiDrag(
for(S32 i = 0; i < count; ++i)
{
cat = gInventory.getCategory(cargo_ids[i]);
- if(cat)
+ if (cat)
{
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLNoPreferredType is_not_preferred;
- if(is_not_preferred(cat, NULL))
+ if (is_not_preferred(cat, NULL))
{
cat_ids.insert(cat->getUUID());
}
- gInventory.collectDescendentsIf(
+ gInventory.collectDescendentsIf (
cat->getUUID(),
cats,
items,
@@ -537,14 +553,13 @@ void LLToolDragAndDrop::beginMultiDrag(
}
}
}
- if(!cat_ids.empty())
+ if (!cat_ids.empty())
{
- LLInventoryFetchComboObserver::folder_ref_t folder_ids;
- LLInventoryFetchComboObserver::item_ref_t item_ids;
- std::back_insert_iterator<LLInventoryFetchDescendentsObserver::folder_ref_t> copier(folder_ids);
+ uuid_vec_t folder_ids;
+ uuid_vec_t item_ids;
+ std::back_insert_iterator<uuid_vec_t> copier(folder_ids);
std::copy(cat_ids.begin(), cat_ids.end(), copier);
- LLCategoryFireAndForget fetcher;
- fetcher.fetch(folder_ids, item_ids);
+ LLCategoryFireAndForget fetcher(folder_ids, item_ids);
}
}
}
@@ -569,7 +584,7 @@ void LLToolDragAndDrop::onMouseCaptureLost()
BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
{
- if( hasMouseCapture() )
+ if (hasMouseCapture())
{
EAcceptance acceptance = ACCEPT_NO;
dragOrDrop( x, y, mask, TRUE, &acceptance );
@@ -580,7 +595,7 @@ BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance )
{
- switch( acceptance )
+ switch (acceptance)
{
case ACCEPT_YES_MULTI:
if (mCargoIDs.size() > 1)
@@ -697,7 +712,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
mToolTipMsg.clear();
- if(top_view)
+ if (top_view)
{
handled = TRUE;
@@ -762,7 +777,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
}
- if(!handled)
+ if (!handled)
{
handled = TRUE;
@@ -820,7 +835,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
}
- if ( !handled )
+ if (!handled)
{
dragOrDrop3D( x, y, mask, drop, acceptance );
}
@@ -873,7 +888,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
{
LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj );
- if( !avatar )
+ if (!avatar)
{
mLastAccept = ACCEPT_NO;
mCursor = UI_CURSOR_NO;
@@ -885,7 +900,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
if (hit_obj->isAvatar())
{
- if(((LLVOAvatar*) hit_obj)->isSelf())
+ if (((LLVOAvatar*) hit_obj)->isSelf())
{
target = DT_SELF;
hit_face = -1;
@@ -959,7 +974,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
gViewerWindow->getWindow()->setCursor( cursor );
mLastHitPos = pick_info.mPosGlobal;
- mLastCameraPos = gAgent.getCameraPositionGlobal();
+ mLastCameraPos = gAgentCamera.getCameraPositionGlobal();
}
// static
@@ -971,7 +986,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
// Always succeed if....
// texture is from the library
// or already in the contents of the object
- if(SOURCE_LIBRARY == source)
+ if (SOURCE_LIBRARY == source)
{
// dropping a texture from the library always just works.
return TRUE;
@@ -999,7 +1014,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
if (!item) return FALSE;
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- if(!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
+ if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
{
// Check that we can add the texture as inventory to the object
if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
@@ -1007,20 +1022,20 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
return FALSE;
}
// make sure the object has the texture in it's inventory.
- if(SOURCE_AGENT == source)
+ if (SOURCE_AGENT == source)
{
// Remove the texture from local inventory. The server
// will actually remove the item from agent inventory.
gInventory.deleteObject(item->getUUID());
gInventory.notifyObservers();
}
- else if(SOURCE_WORLD == source)
+ else if (SOURCE_WORLD == source)
{
// *FIX: if the objects are in different regions, and the
// source region has crashed, you can bypass these
// permissions.
LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if(src_obj)
+ if (src_obj)
{
src_obj->removeInventory(item->getUUID());
}
@@ -1035,7 +1050,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
// TODO: Check to see if adding the item was successful; if not, then
// we should return false here.
}
- else if(!item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ else if (!item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID()))
{
// Check that we can add the texture as inventory to the object
@@ -1067,7 +1082,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
}
LLUUID asset_id = item->getAssetUUID();
BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id);
- if(!success)
+ if (!success)
{
return;
}
@@ -1109,7 +1124,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
}
LLUUID asset_id = item->getAssetUUID();
BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id);
- if(!success)
+ if (!success)
{
return;
}
@@ -1132,32 +1147,32 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
{
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+ if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
|| (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
{
llwarns << "Call to LLToolDragAndDrop::dropScript() from world"
<< " or notecard." << llendl;
return;
}
- if(hit_obj && item)
+ if (hit_obj && item)
{
LLPointer<LLViewerInventoryItem> new_script = new LLViewerInventoryItem(item);
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
- if(SOURCE_AGENT == source)
+ if (SOURCE_AGENT == source)
{
// Remove the script from local inventory. The server
// will actually remove the item from agent inventory.
gInventory.deleteObject(item->getUUID());
gInventory.notifyObservers();
}
- else if(SOURCE_WORLD == source)
+ else if (SOURCE_WORLD == source)
{
// *FIX: if the objects are in different regions, and
// the source region has crashed, you can bypass
// these permissions.
LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if(src_obj)
+ if (src_obj)
{
src_obj->removeInventory(item->getUUID());
}
@@ -1173,7 +1188,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
// VEFFECT: SetScript
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(hit_obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1197,7 +1212,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return;
+ if (!item || !item->isFinished()) return;
//if (regionp
// && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
@@ -1208,7 +1223,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// this will remove the object from inventory after rez. Only
// bother with this check if we would not normally remove from
// inventory.
- if(!remove_from_inventory
+ if (!remove_from_inventory
&& !item->getPermissions().allowCopyBy(gAgent.getID()))
{
remove_from_inventory = TRUE;
@@ -1219,7 +1234,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// hitting objects that were clipped by the near plane or culled
// on the viewer.
LLUUID ray_target_id;
- if( raycast_target )
+ if (raycast_target)
{
ray_target_id = raycast_target->getID();
}
@@ -1231,7 +1246,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// Check if it's in the trash.
bool is_in_trash = false;
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
is_in_trash = true;
remove_from_inventory = TRUE;
@@ -1289,7 +1304,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
LLUUID folder_id = item->getParentUUID();
- if((SOURCE_LIBRARY == mSource) || (is_in_trash))
+ if ((SOURCE_LIBRARY == mSource) || (is_in_trash))
{
// since it's coming from the library or trash, we want to not
// 'take' it back to the same place.
@@ -1323,7 +1338,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
gViewerWindow->getWindow()->incBusyCount();
}
- if(remove_from_inventory)
+ if (remove_from_inventory)
{
// Delete it from inventory immediately so that users cannot
// easily bypass copy protection in laggy situations. If the
@@ -1334,7 +1349,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// VEFFECT: DropObject
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setPositionGlobal(mLastHitPos);
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1349,7 +1364,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
{
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+ if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
|| (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
{
llwarns << "Call to LLToolDragAndDrop::dropInventory() from world"
@@ -1361,9 +1376,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
time_t creation_date = time_corrected();
new_item->setCreationDate(creation_date);
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
- if(SOURCE_AGENT == source)
+ if (SOURCE_AGENT == source)
{
// Remove the inventory item from local inventory. The
// server will actually remove the item from agent
@@ -1371,13 +1386,13 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
gInventory.deleteObject(item->getUUID());
gInventory.notifyObservers();
}
- else if(SOURCE_WORLD == source)
+ else if (SOURCE_WORLD == source)
{
// *FIX: if the objects are in different regions, and the
// source region has crashed, you can bypass these
// permissions.
LLViewerObject* src_obj = gObjectList.findObject(src_id);
- if(src_obj)
+ if (src_obj)
{
src_obj->removeInventory(item->getUUID());
}
@@ -1397,7 +1412,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
// VEFFECT: AddToInventory
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(hit_obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1410,11 +1425,11 @@ void LLToolDragAndDrop::giveInventory(const LLUUID& to_agent,
{
llinfos << "LLToolDragAndDrop::giveInventory()" << llendl;
- if(!isInventoryGiveAcceptable(item))
+ if (!isInventoryGiveAcceptable(item))
{
return;
}
- if(item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (item->getPermissions().allowCopyBy(gAgent.getID()))
{
// just give it away.
LLToolDragAndDrop::commitGiveInventoryItem(to_agent, item, im_session_id);
@@ -1438,7 +1453,7 @@ bool LLToolDragAndDrop::handleCopyProtectedItem(const LLSD& notification, const
{
case 0: // "Yes"
item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
- if(item)
+ if (item)
{
LLToolDragAndDrop::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
item);
@@ -1465,7 +1480,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
LLInventoryItem* item,
const LLUUID& im_session_id)
{
- if(!item) return;
+ if (!item) return;
std::string name;
LLAgentUI::buildFullname(name);
LLUUID transaction_id;
@@ -1495,7 +1510,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
// VEFFECT: giveInventory
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(gObjectList.findObject(to_agent));
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1542,21 +1557,17 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
const LLUUID& im_session_id)
{
- if(!cat) return;
+ if (!cat) return;
llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
<< cat->getUUID() << llendl;
- LLVOAvatar* my_avatar = gAgent.getAvatarObject();
- if( !my_avatar )
- {
- return;
- }
+ if (!isAgentAvatarValid()) return;
// Test out how many items are being given.
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLGiveable giveable;
- gInventory.collectDescendentsIf(cat->getUUID(),
+ gInventory.collectDescendentsIf (cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
@@ -1565,31 +1576,31 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
bool complete = true;
for(S32 i = 0; i < count; ++i)
{
- if(!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
+ if (!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
{
complete = false;
break;
}
}
- if(!complete)
+ if (!complete)
{
LLNotificationsUtil::add("IncompleteInventory");
return;
}
count = items.count() + cats.count();
- if(count > MAX_ITEMS)
+ if (count > MAX_ITEMS)
{
LLNotificationsUtil::add("TooManyItems");
return;
}
- else if(count == 0)
+ else if (count == 0)
{
LLNotificationsUtil::add("NoItems");
return;
}
else
{
- if(0 == giveable.countNoCopy())
+ if (0 == giveable.countNoCopy())
{
LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat, im_session_id);
}
@@ -1615,14 +1626,14 @@ bool LLToolDragAndDrop::handleCopyProtectedCategory(const LLSD& notification, co
{
case 0: // "Yes"
cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID());
- if(cat)
+ if (cat)
{
LLToolDragAndDrop::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(),
cat);
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLUncopyableItems remove;
- gInventory.collectDescendentsIf(cat->getUUID(),
+ gInventory.collectDescendentsIf (cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
@@ -1653,7 +1664,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
const LLUUID& im_session_id)
{
- if(!cat) return;
+ if (!cat) return;
llinfos << "LLToolDragAndDrop::commitGiveInventoryCategory() - "
<< cat->getUUID() << llendl;
@@ -1664,7 +1675,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLGiveable giveable;
- gInventory.collectDescendentsIf(cat->getUUID(),
+ gInventory.collectDescendentsIf (cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
@@ -1674,12 +1685,12 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
// MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
// 66. I've cut it down a bit from there to give some pad.
S32 count = items.count() + cats.count();
- if(count > MAX_ITEMS)
+ if (count > MAX_ITEMS)
{
LLNotificationsUtil::add("TooManyItems");
return;
}
- else if(count == 0)
+ else if (count == 0)
{
LLNotificationsUtil::add("NoItems");
return;
@@ -1738,7 +1749,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
// VEFFECT: giveInventoryCategory
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(gObjectList.findObject(to_agent));
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1753,35 +1764,31 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
// static
BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
{
- if(!item)
+ if (!item)
{
return FALSE;
}
- if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
return FALSE;
}
BOOL copyable = FALSE;
- if(item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
+ if (item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
- LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
- if(!my_avatar)
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
BOOL acceptable = TRUE;
switch(item->getType())
{
case LLAssetType::AT_OBJECT:
- if(my_avatar->isWearingAttachment(item->getUUID()))
+ if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
acceptable = FALSE;
}
break;
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
- if(!copyable && gAgentWearables.isWearingItem(item->getUUID()))
+ if (!copyable && gAgentWearables.isWearingItem(item->getUUID()))
{
acceptable = FALSE;
}
@@ -1795,33 +1802,29 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
// Static
BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
{
- if(!item)
+ if (!item)
{
return FALSE;
}
// These permissions are double checked in the simulator in
// LLGroupNoticeInventoryItemFetch::result().
- if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
return FALSE;
}
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
return FALSE;
}
- LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
- if(!my_avatar)
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
BOOL acceptable = TRUE;
switch(item->getType())
{
case LLAssetType::AT_OBJECT:
- if(my_avatar->isWearingAttachment(item->getUUID()))
+ if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
acceptable = FALSE;
}
@@ -1840,14 +1843,14 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
if (!item || !obj) return ACCEPT_NO;
// HACK: downcast
LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
- if (!vitem->isComplete()) return ACCEPT_NO;
+ if (!vitem->isFinished()) return ACCEPT_NO;
if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
// deny attempts to drop from an object onto itself. This is to
// help make sure that drops that are from an object to an object
// don't have to worry about order of evaluation. Think of this
// like check for self in assignment.
- if(obj->getID() == item->getParentUUID())
+ if (obj->getID() == item->getParentUUID())
{
return ACCEPT_NO;
}
@@ -1856,19 +1859,17 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// gAgent.getGroupID())
// && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
BOOL worn = FALSE;
- LLVOAvatarSelf* my_avatar = NULL;
switch(item->getType())
{
case LLAssetType::AT_OBJECT:
- my_avatar = gAgent.getAvatarObject();
- if(my_avatar && my_avatar->isWearingAttachment(item->getUUID()))
+ if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
worn = TRUE;
}
break;
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getUUID()))
+ if (gAgentWearables.isWearingItem(item->getUUID()))
{
worn = TRUE;
}
@@ -1879,7 +1880,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
const LLPermissions& perm = item->getPermissions();
BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
BOOL transfer = FALSE;
- if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
+ if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
|| perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
transfer = TRUE;
@@ -1887,15 +1888,15 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
BOOL volume = (LL_PCODE_VOLUME == obj->getPCode());
BOOL attached = obj->isAttachment();
BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE;
- if(attached && !unrestricted)
+ if (attached && !unrestricted)
{
return ACCEPT_NO_LOCKED;
}
- else if(modify && transfer && volume && !worn)
+ else if (modify && transfer && volume && !worn)
{
return ACCEPT_YES_MULTI;
}
- else if(!modify)
+ else if (!modify)
{
return ACCEPT_NO_LOCKED;
}
@@ -1926,12 +1927,12 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
case DAD_CALLINGCARD:
{
LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
- if(gInventory.getItem(inv_item->getUUID())
+ if (gInventory.getItem(inv_item->getUUID())
&& LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
{
// *TODO: get multiple object transfers working
*accept = ACCEPT_YES_COPY_SINGLE;
- if(drop)
+ if (drop)
{
LLToolDragAndDrop::giveInventory(dest_agent, inv_item, session_id);
}
@@ -1949,11 +1950,11 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
case DAD_CATEGORY:
{
LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data;
- if( gInventory.getCategory( inv_cat->getUUID() ) )
+ if (gInventory.getCategory(inv_cat->getUUID()))
{
// *TODO: get multiple object transfers working
*accept = ACCEPT_YES_COPY_SINGLE;
- if(drop)
+ if (drop)
{
LLToolDragAndDrop::giveInventoryCategory(dest_agent, inv_cat, session_id);
}
@@ -1994,7 +1995,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
{
lldebugs << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << llendl;
// must be in the user's inventory
- if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
+ if (mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
{
return ACCEPT_NO;
}
@@ -2002,25 +2003,24 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
// must not be in the trash
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
return ACCEPT_NO;
}
// must not be already wearing it
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( !avatar || avatar->isWearingAttachment(item->getUUID()) )
+ if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
return ACCEPT_NO;
}
- if( drop )
+ if (drop)
{
- if(mSource == SOURCE_LIBRARY)
+ if (mSource == SOURCE_LIBRARY)
{
LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
copy_inventory_item(
@@ -2052,10 +2052,9 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
- LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
- if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+ if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
return ACCEPT_NO;
}
@@ -2080,7 +2079,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
// check if the item can be copied. If not, send that to the sim
// which will remove the inventory item.
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
accept = ACCEPT_YES_SINGLE;
remove_inventory = TRUE;
@@ -2088,13 +2087,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
// Check if it's in the trash.
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
accept = ACCEPT_YES_SINGLE;
remove_inventory = TRUE;
}
- if(drop)
+ if (drop)
{
dropObject(obj, TRUE, FALSE, remove_inventory);
}
@@ -2115,24 +2114,23 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
- LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
- if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
return ACCEPT_NO;
}
- if((mask & MASK_CONTROL))
+ if ((mask & MASK_CONTROL))
{
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if(mSource == SOURCE_NOTECARD)
+ if (mSource == SOURCE_NOTECARD)
{
return ACCEPT_NO;
}
EAcceptance rv = willObjectAcceptInventory(obj, item);
- if(drop && (ACCEPT_YES_SINGLE <= rv))
+ if (drop && (ACCEPT_YES_SINGLE <= rv))
{
dropInventory(obj, item, mSource, mSourceID);
}
@@ -2158,7 +2156,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
// check if the item can be copied. If not, send that to the sim
// which will remove the inventory item.
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
accept = ACCEPT_YES_SINGLE;
remove_inventory = TRUE;
@@ -2166,13 +2164,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
// Check if it's in the trash.
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
accept = ACCEPT_YES_SINGLE;
remove_inventory = TRUE;
}
- if(drop)
+ if (drop)
{
dropObject(obj, FALSE, FALSE, remove_inventory);
}
@@ -2187,7 +2185,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
{
return ACCEPT_NO;
}
@@ -2195,9 +2193,9 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
EAcceptance rv = willObjectAcceptInventory(obj, item);
- if(drop && (ACCEPT_YES_SINGLE <= rv))
+ if (drop && (ACCEPT_YES_SINGLE <= rv))
{
// rez in the script active by default, rez in inactive if the
// control key is being held down.
@@ -2225,7 +2223,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
{
return ACCEPT_NO;
}
@@ -2233,29 +2231,29 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
EAcceptance rv = willObjectAcceptInventory(obj, item);
- if((mask & MASK_CONTROL))
+ if ((mask & MASK_CONTROL))
{
- if((ACCEPT_YES_SINGLE <= rv) && drop)
+ if ((ACCEPT_YES_SINGLE <= rv) && drop)
{
dropInventory(obj, item, mSource, mSourceID);
}
return rv;
}
- if(!obj->permModify())
+ if (!obj->permModify())
{
return ACCEPT_NO_LOCKED;
}
//If texture !copyable don't texture or you'll never get it back.
- if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (!item->getPermissions().allowCopyBy(gAgent.getID()))
{
return ACCEPT_NO;
}
- if(drop && (ACCEPT_YES_SINGLE <= rv))
+ if (drop && (ACCEPT_YES_SINGLE <= rv))
{
- if((mask & MASK_SHIFT))
+ if ((mask & MASK_SHIFT))
{
dropTextureAllFaces(obj, item, mSource, mSourceID);
}
@@ -2266,7 +2264,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
// VEFFECT: SetTexture
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -2280,9 +2278,9 @@ EAcceptance LLToolDragAndDrop::dad3dTextureSelf(
LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
lldebugs << "LLToolDragAndDrop::dad3dTextureAvatar()" << llendl;
- if(drop)
+ if (drop)
{
- if( !(mask & MASK_SHIFT) )
+ if (!(mask & MASK_SHIFT))
{
dropTextureOneFaceAvatar( (LLVOAvatar*)obj, face, (LLInventoryItem*)mCargoData);
}
@@ -2298,18 +2296,18 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
- if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+ if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
{
// it's in the agent inventory
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
return ACCEPT_NO;
}
- if( drop )
+ if (drop)
{
// Don't wear anything until initial wearables are loaded, can
// destroy clothing items.
@@ -2319,7 +2317,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
return ACCEPT_NO;
}
- if(mSource == SOURCE_LIBRARY)
+ if (mSource == SOURCE_LIBRARY)
{
// create item based on that one, and put it on if that
// was a success.
@@ -2353,21 +2351,21 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
- if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+ if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
{
// it's in the agent inventory
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+ if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
return ACCEPT_NO;
}
- if( drop )
+ if (drop)
{
LLUUID item_id;
- if(mSource == SOURCE_LIBRARY)
+ if (mSource == SOURCE_LIBRARY)
{
// create item based on that one, and put it on if that
// was a success.
@@ -2382,7 +2380,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
}
else
{
- LLGestureManager::instance().activateGesture(item->getUUID());
+ LLGestureMgr::instance().activateGesture(item->getUUID());
gInventory.updateItem(item);
gInventory.notifyObservers();
}
@@ -2402,7 +2400,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* category;
locateInventory(item, category);
- if(!category) return ACCEPT_NO;
+ if (!category) return ACCEPT_NO;
if (drop)
{
@@ -2415,26 +2413,26 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
}
}
- if(mSource == SOURCE_AGENT)
+ if (mSource == SOURCE_AGENT)
{
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) )
+ if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id))
{
return ACCEPT_NO;
}
- if(drop)
+ if (drop)
{
BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
- LLAppearanceManager::instance().wearInventoryCategory(category, false, append);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
}
return ACCEPT_YES_MULTI;
}
- else if(mSource == SOURCE_LIBRARY)
+ else if (mSource == SOURCE_LIBRARY)
{
- if(drop)
+ if (drop)
{
- LLAppearanceManager::instance().wearInventoryCategory(category, true, false);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
}
return ACCEPT_YES_MULTI;
}
@@ -2453,7 +2451,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
- if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+ if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
{
return ACCEPT_NO;
}
@@ -2461,7 +2459,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
LLViewerObject* root_object = obj;
if (obj && obj->getParent())
{
@@ -2473,7 +2471,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
}
EAcceptance rv = willObjectAcceptInventory(root_object, item);
- if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
+ if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
{
dropInventory(root_object, item, mSource, mSourceID);
}
@@ -2517,7 +2515,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
LLDroppableItem droppable(!obj->permYouOwner());
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- gInventory.collectDescendentsIf(cat->getUUID(),
+ gInventory.collectDescendentsIf (cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
@@ -2546,7 +2544,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
{
const LLViewerInventoryCategory *cat = (*cat_iter);
rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO;
- if(rv < ACCEPT_YES_SINGLE)
+ if (rv < ACCEPT_YES_SINGLE)
{
lldebugs << "Category " << cat->getUUID() << "is not complete." << llendl;
break;
@@ -2579,7 +2577,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
// If every item is accepted, send it on
if (drop && (ACCEPT_YES_COPY_SINGLE <= rv))
{
- LLInventoryFetchObserver::item_ref_t ids;
+ uuid_vec_t ids;
for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
item_iter != items.end();
++item_iter)
@@ -2587,9 +2585,9 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
const LLViewerInventoryItem *item = (*item_iter);
ids.push_back(item->getUUID());
}
- LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource);
- dropper->fetchItems(ids);
- if(dropper->isEverythingComplete())
+ LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource);
+ dropper->startFetch();
+ if (dropper->isFinished())
{
dropper->done();
}
@@ -2614,27 +2612,26 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << llendl;
// item has to be in agent inventory.
- if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+ if (mSource != SOURCE_AGENT) return ACCEPT_NO;
// find the item now.
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
- if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
// cannot give away no-transfer objects
return ACCEPT_NO;
}
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if(avatar && avatar->isWearingAttachment( item->getUUID() ) )
+ if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
// You can't give objects that are attached to you
return ACCEPT_NO;
}
- if( obj && avatar )
+ if (obj && isAgentAvatarValid())
{
- if(drop)
+ if (drop)
{
giveInventory(obj->getID(), item );
}
@@ -2651,16 +2648,16 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
{
lldebugs << "LLToolDragAndDrop::dad3dGiveInventory()" << llendl;
// item has to be in agent inventory.
- if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+ if (mSource != SOURCE_AGENT) return ACCEPT_NO;
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
- if(!isInventoryGiveAcceptable(item))
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!isInventoryGiveAcceptable(item))
{
return ACCEPT_NO;
}
- if(drop && obj)
+ if (drop && obj)
{
giveInventory(obj->getID(), item);
}
@@ -2673,12 +2670,12 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
{
lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << llendl;
- if(drop && obj)
+ if (drop && obj)
{
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!cat) return ACCEPT_NO;
+ if (!cat) return ACCEPT_NO;
giveInventoryCategory(obj->getID(), cat);
}
// *TODO: deal with all the issues surrounding multi-object
@@ -2694,14 +2691,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
LLViewerInventoryItem* item = NULL;
LLViewerInventoryCategory* cat = NULL;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
+ if (!item || !item->isFinished()) return ACCEPT_NO;
- if(!gAgent.allowOperation(PERM_COPY, item->getPermissions())
+ if (!gAgent.allowOperation(PERM_COPY, item->getPermissions())
|| !item->getPermissions().allowTransferTo(LLUUID::null))
{
return ACCEPT_NO_LOCKED;
}
- if(drop)
+ if (drop)
{
dropObject(obj, TRUE, TRUE, FALSE);
}
@@ -2715,8 +2712,8 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if(!item || !item->isComplete()) return ACCEPT_NO;
- if((mask & MASK_CONTROL))
+ if (!item || !item->isFinished()) return ACCEPT_NO;
+ if ((mask & MASK_CONTROL))
{
// *HACK: In order to resolve SL-22177, we need to block drags
// from notecards and objects onto other objects.
@@ -2724,19 +2721,19 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
// *HACK: uncomment this when appropriate
//EAcceptance rv = willObjectAcceptInventory(obj, item);
- //if(drop && (ACCEPT_YES_SINGLE <= rv))
+ //if (drop && (ACCEPT_YES_SINGLE <= rv))
//{
// dropInventory(obj, item, mSource, mSourceID);
//}
//return rv;
}
- if(!item->getPermissions().allowCopyBy(gAgent.getID(),
+ if (!item->getPermissions().allowCopyBy(gAgent.getID(),
gAgent.getGroupID())
|| !item->getPermissions().allowTransferTo(LLUUID::null))
{
return ACCEPT_NO_LOCKED;
}
- if(drop)
+ if (drop)
{
dropObject(obj, FALSE, TRUE, FALSE);
}
@@ -2752,23 +2749,23 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
LLInventoryItem* item;
LLInventoryCategory* cat;
locateInventory(item, cat);
- if(!cat) return ACCEPT_NO;
+ if (!cat) return ACCEPT_NO;
EAcceptance rv = ACCEPT_NO;
// find all the items in the category
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLDropCopyableItems droppable;
- gInventory.collectDescendentsIf(cat->getUUID(),
+ gInventory.collectDescendentsIf (cat->getUUID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
droppable);
- if(items.count() > 0)
+ if (items.count() > 0)
{
rv = ACCEPT_YES_SINGLE;
}
- if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+ if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
{
createContainer(items, cat->getName());
return ACCEPT_NO;
@@ -2791,19 +2788,19 @@ EAcceptance LLToolDragAndDrop::dad3dAssetOnLand(
LLViewerInventoryItem::item_array_t items;
LLViewerInventoryItem::item_array_t copyable_items;
locateMultipleInventory(items, cats);
- if(!items.count()) return ACCEPT_NO;
+ if (!items.count()) return ACCEPT_NO;
EAcceptance rv = ACCEPT_NO;
for (S32 i = 0; i < items.count(); i++)
{
LLInventoryItem* item = items[i];
- if(item->getPermissions().allowCopyBy(gAgent.getID()))
+ if (item->getPermissions().allowCopyBy(gAgent.getID()))
{
copyable_items.put(item);
rv = ACCEPT_YES_SINGLE;
}
}
- if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+ if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
{
createContainer(copyable_items, NULL);
}
@@ -2818,20 +2815,20 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
{
item = NULL;
cat = NULL;
- if(mCargoIDs.empty()) return NULL;
- if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ if (mCargoIDs.empty()) return NULL;
+ if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
{
// The object should be in user inventory.
item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]);
cat = (LLViewerInventoryCategory*)gInventory.getCategory(mCargoIDs[mCurItemIndex]);
}
- else if(mSource == SOURCE_WORLD)
+ else if (mSource == SOURCE_WORLD)
{
// This object is in some task inventory somewhere.
LLViewerObject* obj = gObjectList.findObject(mSourceID);
- if(obj)
+ if (obj)
{
- if((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
+ if ((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
|| (mCargoTypes[mCurItemIndex] == DAD_ROOT_CATEGORY))
{
cat = (LLViewerInventoryCategory*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
@@ -2842,16 +2839,16 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
}
}
}
- else if(mSource == SOURCE_NOTECARD)
+ else if (mSource == SOURCE_NOTECARD)
{
LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", mSourceID);
- if(preview)
+ if (preview)
{
item = (LLViewerInventoryItem*)preview->getDragItem();
}
}
- if(item) return item;
- if(cat) return cat;
+ if (item) return item;
+ if (cat) return cat;
return NULL;
}
@@ -2859,8 +2856,8 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats,
LLViewerInventoryItem::item_array_t& items)
{
- if(mCargoIDs.count() == 0) return NULL;
- if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+ if (mCargoIDs.count() == 0) return NULL;
+ if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
{
// The object should be in user inventory.
for (S32 i = 0; i < mCargoIDs.count(); i++)
@@ -2877,13 +2874,13 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
}
}
}
- else if(mSource == SOURCE_WORLD)
+ else if (mSource == SOURCE_WORLD)
{
// This object is in some task inventory somewhere.
LLViewerObject* obj = gObjectList.findObject(mSourceID);
- if(obj)
+ if (obj)
{
- if((mCargoType == DAD_CATEGORY)
+ if ((mCargoType == DAD_CATEGORY)
|| (mCargoType == DAD_ROOT_CATEGORY))
{
// The object should be in user inventory.
@@ -2909,17 +2906,17 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
}
}
}
- else if(mSource == SOURCE_NOTECARD)
+ else if (mSource == SOURCE_NOTECARD)
{
LLPreviewNotecard* card;
card = (LLPreviewNotecard*)LLPreview::find(mSourceID);
- if(card)
+ if (card)
{
items.put((LLInventoryItem*)card->getDragItem());
}
}
- if(items.count()) return items[0];
- if(cats.count()) return cats[0];
+ if (items.count()) return items[0];
+ if (cats.count()) return cats[0];
return NULL;
}
*/