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.cpp331
1 files changed, 184 insertions, 147 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index bd4064a173..c561f43ca0 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -47,6 +47,7 @@
#include "llinventorybridge.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
#include "llpreviewnotecard.h"
#include "llrootview.h"
#include "llselectmgr.h"
@@ -102,7 +103,7 @@ public:
class LLDroppableItem : public LLInventoryCollectFunctor
{
public:
- LLDroppableItem(BOOL is_transfer) :
+ LLDroppableItem(bool is_transfer) :
mCountLosing(0), mIsTransfer(is_transfer) {}
virtual ~LLDroppableItem() {}
virtual bool operator()(LLInventoryCategory* cat,
@@ -111,7 +112,7 @@ public:
protected:
S32 mCountLosing;
- BOOL mIsTransfer;
+ bool mIsTransfer;
};
bool LLDroppableItem::operator()(LLInventoryCategory* cat,
@@ -287,7 +288,7 @@ LLToolDragAndDrop::LLToolDragAndDrop()
mSource(SOURCE_AGENT),
mCursor(UI_CURSOR_NO),
mLastAccept(ACCEPT_NO),
- mDrop(FALSE),
+ mDrop(false),
mCurItemIndex(0)
{
@@ -299,7 +300,7 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y)
mDragStartY = y;
}
-BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
+bool LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
{
S32 mouse_delta_x = x - mDragStartX;
S32 mouse_delta_y = y - mDragStartY;
@@ -318,6 +319,16 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL;
return;
}
+
+ if (type != DAD_CATEGORY)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(cargo_id);
+ if (item && !item->isFinished())
+ {
+ LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
+ }
+ }
+
mCargoTypes.clear();
mCargoTypes.push_back(type);
mCargoIDs.clear();
@@ -326,7 +337,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
mSourceID = source_id;
mObjectID = object_id;
- setMouseCapture( TRUE );
+ setMouseCapture( true );
LLToolMgr::getInstance()->setTransientTool( this );
mCursor = UI_CURSOR_NO;
if ((mCargoTypes[0] == DAD_CATEGORY)
@@ -396,7 +407,7 @@ void LLToolDragAndDrop::beginMultiDrag(
mSource = source;
mSourceID = source_id;
- setMouseCapture( TRUE );
+ setMouseCapture( true );
LLToolMgr::getInstance()->setTransientTool( this );
mCursor = UI_CURSOR_NO;
if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
@@ -445,7 +456,7 @@ void LLToolDragAndDrop::endDrag()
{
mEndDragSignal();
LLSelectMgr::getInstance()->unhighlightAll();
- setMouseCapture(FALSE);
+ setMouseCapture(false);
}
void LLToolDragAndDrop::onMouseCaptureLost()
@@ -460,15 +471,15 @@ void LLToolDragAndDrop::onMouseCaptureLost()
mCustomMsg.clear();
}
-BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
+bool LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
{
if (hasMouseCapture())
{
EAcceptance acceptance = ACCEPT_NO;
- dragOrDrop( x, y, mask, TRUE, &acceptance );
+ dragOrDrop( x, y, mask, true, &acceptance );
endDrag();
}
- return TRUE;
+ return true;
}
ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance )
@@ -535,48 +546,47 @@ ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance )
case ACCEPT_POSTPONED:
break;
default:
- llassert( FALSE );
+ llassert( false );
}
return mCursor;
}
-BOOL LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask )
+bool LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask )
{
EAcceptance acceptance = ACCEPT_NO;
- dragOrDrop( x, y, mask, FALSE, &acceptance );
+ dragOrDrop( x, y, mask, false, &acceptance );
ECursorType cursor = acceptanceToCursor(acceptance);
gViewerWindow->getWindow()->setCursor( cursor );
LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << LL_ENDL;
- return TRUE;
+ return true;
}
-BOOL LLToolDragAndDrop::handleKey(KEY key, MASK mask)
+bool LLToolDragAndDrop::handleKey(KEY key, MASK mask)
{
if (key == KEY_ESCAPE)
{
// cancel drag and drop operation
endDrag();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask)
+bool LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask)
{
- const F32 DRAG_N_DROP_TOOLTIP_DELAY = 0.10000000149f;
if (!mToolTipMsg.empty())
{
LLToolTipMgr::instance().unblockToolTips();
LLToolTipMgr::instance().show(LLToolTip::Params()
.message(mToolTipMsg)
- .delay_time(DRAG_N_DROP_TOOLTIP_DELAY));
- return TRUE;
+ .delay_time(gSavedSettings.getF32( "DragAndDropToolTipDelay" )));
+ return true;
}
- return FALSE;
+ return false;
}
void LLToolDragAndDrop::handleDeselect()
@@ -588,12 +598,12 @@ void LLToolDragAndDrop::handleDeselect()
}
// protected
-void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
+void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, bool drop,
EAcceptance* acceptance)
{
*acceptance = ACCEPT_YES_MULTI;
- BOOL handled = FALSE;
+ bool handled = false;
LLView* top_view = gFocusMgr.getTopCtrl();
LLViewerInventoryItem* item;
@@ -613,7 +623,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
if (top_view)
{
- handled = TRUE;
+ handled = true;
for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++)
{
@@ -624,7 +634,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
@@ -632,7 +642,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
else if (is_uuid_dragged)
{
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false,
mCargoTypes[mCurItemIndex],
(void*)&mCargoIDs[mCurItemIndex],
&item_acceptance,
@@ -665,7 +675,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, TRUE,
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, true,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
@@ -673,7 +683,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
else if (is_uuid_dragged)
{
- handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, FALSE,
+ handled = handled && top_view->handleDragAndDrop(local_x, local_y, mask, false,
mCargoTypes[mCurItemIndex],
(void*)&mCargoIDs[mCurItemIndex],
&item_acceptance,
@@ -689,7 +699,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
if (!handled)
{
- handled = TRUE;
+ handled = true;
LLRootView* root_view = gViewerWindow->getRootView();
@@ -702,7 +712,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
// fix for EXT-3191
if (cargo)
{
- handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, false,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
@@ -710,7 +720,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
else if (is_uuid_dragged)
{
- handled = handled && root_view->handleDragAndDrop(x, y, mask, FALSE,
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, false,
mCargoTypes[mCurItemIndex],
(void*)&mCargoIDs[mCurItemIndex],
&item_acceptance,
@@ -740,7 +750,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
LLInventoryObject* cargo = locateInventory(item, cat);
if (cargo)
{
- handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, true,
mCargoTypes[mCurItemIndex],
(void*)cargo,
&item_acceptance,
@@ -748,7 +758,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
else if (is_uuid_dragged)
{
- handled = handled && root_view->handleDragAndDrop(x, y, mask, TRUE,
+ handled = handled && root_view->handleDragAndDrop(x, y, mask, true,
mCargoTypes[mCurItemIndex],
(void*)&mCargoIDs[mCurItemIndex],
&item_acceptance,
@@ -784,18 +794,18 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
}
}
-void LLToolDragAndDrop::dragOrDrop3D( S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* acceptance )
+void LLToolDragAndDrop::dragOrDrop3D( S32 x, S32 y, MASK mask, bool drop, EAcceptance* acceptance )
{
mDrop = drop;
if (mDrop)
{
// don't allow drag and drop onto rigged or transparent objects
- pick(gViewerWindow->pickImmediate(x, y, FALSE, FALSE));
+ pick(gViewerWindow->pickImmediate(x, y, false, false));
}
else
{
// don't allow drag and drop onto transparent objects
- gViewerWindow->pickAsync(x, y, mask, pickCallback, FALSE, FALSE);
+ gViewerWindow->pickAsync(x, y, mask, pickCallback, false, false);
}
*acceptance = mLastAccept;
@@ -878,7 +888,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
(U32)mLastAccept,
(U32)callMemberFunction(*this,
LLDragAndDropDictionary::instance().get(dad_type, target))
- (hit_obj, hit_face, pick_info.mKeyMask, FALSE));
+ (hit_obj, hit_face, pick_info.mKeyMask, false));
}
if (mDrop && ((U32)mLastAccept >= ACCEPT_YES_COPY_SINGLE))
@@ -893,7 +903,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
const EDragAndDropType dad_type = mCargoTypes[item_index];
// Call the right implementation function
callMemberFunction(*this, LLDragAndDropDictionary::instance().get(dad_type, target))
- (hit_obj, hit_face, pick_info.mKeyMask, TRUE);
+ (hit_obj, hit_face, pick_info.mKeyMask, true);
}
}
else
@@ -924,12 +934,12 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
}
// static
-BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
+bool LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
LLInventoryItem* item,
LLToolDragAndDrop::ESource source,
const LLUUID& src_id)
{
- if (!item) return FALSE;
+ if (!item) return false;
// Always succeed if....
// material is from the library
@@ -937,7 +947,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
if (SOURCE_LIBRARY == source)
{
// dropping a material from the library always just works.
- return TRUE;
+ return true;
}
// In case the inventory has not been loaded (e.g. due to some recent operation
@@ -958,7 +968,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
args["ERROR_MESSAGE"] = "Unable to add texture.\nPlease wait a few seconds and try again.";
}
LLNotificationsUtil::add("ErrorMessage", args);
- return FALSE;
+ return false;
}
// Make sure to verify both id and type since 'null'
// is a shared default for some asset types.
@@ -968,7 +978,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// then it can always be added to a side.
// This saves some work if the task's inventory is already loaded
// and ensures that the asset item is only added once.
- return TRUE;
+ return true;
}
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
@@ -977,7 +987,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// Check that we can add the material as inventory to the object
if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
{
- return FALSE;
+ return false;
}
// make sure the object has the material in it's inventory.
if (SOURCE_AGENT == source)
@@ -1000,7 +1010,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
else
{
LL_WARNS() << "Unable to find source object." << LL_ENDL;
- return FALSE;
+ return false;
}
}
// Add the asset item to the target object's inventory.
@@ -1026,7 +1036,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// Check that we can add the asset as inventory to the object
if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
{
- return FALSE;
+ return false;
}
// *FIX: may want to make sure agent can paint hit_obj.
@@ -1053,7 +1063,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// Check that we can add the material as inventory to the object
if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
{
- return FALSE;
+ return false;
}
// *FIX: may want to make sure agent can paint hit_obj.
@@ -1067,7 +1077,7 @@ BOOL LLToolDragAndDrop::handleDropMaterialProtections(LLViewerObject* hit_obj,
// we should return false here. This will requre a separate listener
// since without listener, we have no way to receive update
}
- return TRUE;
+ return true;
}
void set_texture_to_material(LLViewerObject* hit_obj,
@@ -1147,7 +1157,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
if (has_non_pbr_faces || remove_pbr)
{
- BOOL res = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ bool res = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!res)
{
return;
@@ -1252,7 +1262,7 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj,
// SL-20013 must save asset_id before handleDropMaterialProtections since our item instance
// may be deleted if it is moved into task inventory
LLUUID asset_id = item->getAssetUUID();
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ bool success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!success)
{
return;
@@ -1287,7 +1297,7 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj,
// SL-20013 must save asset_id before handleDropMaterialProtections since our item instance
// may be deleted if it is moved into task inventory
LLUUID asset_id = item->getAssetUUID();
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ bool success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!success)
{
@@ -1318,7 +1328,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,
return;
}
LLUUID asset_id = item->getAssetUUID();
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ bool success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if(!success)
{
return;
@@ -1326,7 +1336,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj,
LLSculptParams sculpt_params;
sculpt_params.setSculptTexture(asset_id, LL_SCULPT_TYPE_MESH);
- hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
+ hit_obj->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, true);
dialog_refresh_all();
}
@@ -1469,7 +1479,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
}
return;
}
- BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
+ bool success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!success)
{
return;
@@ -1539,7 +1549,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
LLInventoryItem* item,
- BOOL active,
+ bool active,
ESource source,
const LLUUID& src_id)
{
@@ -1585,7 +1595,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
gFloaterTools->dirty();
// VEFFECT: SetScript
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true);
effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(hit_obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
@@ -1594,9 +1604,9 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
}
void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
- BOOL bypass_sim_raycast,
- BOOL from_task_inventory,
- BOOL remove_from_inventory)
+ bool bypass_sim_raycast,
+ bool from_task_inventory,
+ bool remove_from_inventory)
{
LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos);
if (!regionp)
@@ -1624,7 +1634,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
if (!remove_from_inventory
&& !item->getPermissions().allowCopyBy(gAgent.getID()))
{
- remove_from_inventory = TRUE;
+ remove_from_inventory = true;
}
// Limit raycast to a single object.
@@ -1652,7 +1662,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
LLUUID source_id = from_task_inventory ? mSourceID : LLUUID::null;
// Select the object only if we're editing.
- BOOL rez_selected = LLToolMgr::getInstance()->inEdit();
+ bool rez_selected = LLToolMgr::getInstance()->inEdit();
LLVector3 ray_start = regionp->getPosRegionFromGlobal(mLastCameraPos);
@@ -1660,7 +1670,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
// currently the ray's end point is an approximation,
// and is sometimes too short (causing failure.) so we
// double the ray's length:
- if (bypass_sim_raycast == FALSE)
+ if (!bypass_sim_raycast)
{
LLVector3 ray_direction = ray_start - ray_end;
ray_end = ray_end - ray_direction;
@@ -1695,7 +1705,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
msg->addVector3Fast(_PREHASH_RayStart, ray_start);
msg->addVector3Fast(_PREHASH_RayEnd, ray_end);
msg->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
- msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
+ msg->addBOOLFast(_PREHASH_RayEndIsIntersection, false);
msg->addBOOLFast(_PREHASH_RezSelected, rez_selected);
msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
@@ -1747,7 +1757,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
}
// VEFFECT: DropObject
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true);
effectp->setSourceObject(gAgentAvatarp);
effectp->setPositionGlobal(mLastHitPos);
effectp->setDuration(LL_HUD_DUR_SHORT);
@@ -1810,7 +1820,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
}
// VEFFECT: AddToInventory
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true);
effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(hit_obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
@@ -1823,7 +1833,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type)
{
// check the basics
- if (!item || !obj) return ACCEPT_NO;
+ if (!item || !obj)
+ return ACCEPT_NO;
+
// HACK: downcast
LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
if (!vitem->isFinished() && (type != DAD_CATEGORY))
@@ -1834,36 +1846,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// Library or agent inventory only.
return ACCEPT_NO;
}
- if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
+ 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;
}
- //BOOL copy = (perm.allowCopyBy(gAgent.getID(),
+ //bool copy = (perm.allowCopyBy(gAgent.getID(),
// gAgent.getGroupID())
// && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
- BOOL worn = FALSE;
+ bool worn = false;
LLVOAvatarSelf* my_avatar = NULL;
- switch(item->getType())
+ switch (item->getType())
{
case LLAssetType::AT_OBJECT:
my_avatar = gAgentAvatarp;
if(my_avatar && my_avatar->isWearingAttachment(item->getUUID()))
{
- worn = TRUE;
+ worn = true;
}
break;
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
- if(gAgentWearables.isWearingItem(item->getUUID()))
+ if (gAgentWearables.isWearingItem(item->getUUID()))
{
- worn = TRUE;
+ worn = true;
}
break;
case LLAssetType::AT_CALLINGCARD:
@@ -1871,33 +1884,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// because of incomplete LSL support. See STORM-1117.
return ACCEPT_NO;
default:
- break;
+ break;
}
const LLPermissions& perm = item->getPermissions();
- BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
- BOOL transfer = FALSE;
- if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
+ bool modify = (obj->permModify() || obj->flagAllowInventoryAdd());
+ bool transfer = false;
+ if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
|| perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
- transfer = TRUE;
+ transfer = true;
}
- 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)
+ bool volume = (LL_PCODE_VOLUME == obj->getPCode());
+ bool attached = obj->isAttachment();
+ bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED;
+
+ if (attached && !unrestricted)
{
// Attachments are in world and in inventory simultaneously,
// at the moment server doesn't support such a situation.
return ACCEPT_NO_LOCKED;
}
- else if(modify && transfer && volume && !worn)
+
+ if (modify && transfer && volume && !worn)
{
return ACCEPT_YES_MULTI;
}
- else if(!modify)
+
+ if (!modify)
{
return ACCEPT_NO_LOCKED;
}
+
return ACCEPT_NO;
}
@@ -1918,7 +1935,7 @@ static void give_inventory_cb(const LLSD& notification, const LLSD& response)
LLViewerInventoryCategory * inv_cat = gInventory.getCategory(payload["item_id"]);
if (NULL == inv_item && NULL == inv_cat)
{
- llassert( FALSE );
+ llassert( false );
return;
}
bool successfully_shared;
@@ -1977,7 +1994,7 @@ static void get_name_cb(const LLUUID& id,
// function used as drag-and-drop handler for simple agent give inventory requests
//static
-bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, BOOL drop,
+bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
@@ -2055,7 +2072,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
break;
}
- return TRUE;
+ return true;
}
@@ -2065,14 +2082,14 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
///
EAcceptance LLToolDragAndDrop::dad3dNULL(
- LLViewerObject*, S32, MASK, BOOL)
+ LLViewerObject*, S32, MASK, bool)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL;
return ACCEPT_NO;
}
EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << LL_ENDL;
// must be in the user's inventory
@@ -2131,7 +2148,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
if (mSource == SOURCE_WORLD)
{
@@ -2151,21 +2168,21 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
}
EAcceptance accept;
- BOOL remove_inventory;
+ bool remove_inventory;
// Get initial settings based on shift key
if (mask & MASK_SHIFT)
{
// For now, always make copy
//accept = ACCEPT_YES_SINGLE;
- //remove_inventory = TRUE;
+ //remove_inventory = true;
accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
+ remove_inventory = false;
}
else
{
accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
+ remove_inventory = false;
}
// check if the item can be copied. If not, send that to the sim
@@ -2173,7 +2190,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
if(!item->getPermissions().allowCopyBy(gAgent.getID()))
{
accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
+ remove_inventory = true;
}
// Check if it's in the trash.
@@ -2185,14 +2202,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
if(drop)
{
- dropObject(obj, TRUE, FALSE, remove_inventory);
+ dropObject(obj, true, false, remove_inventory);
}
return accept;
}
EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
// handle objects coming from object inventory
if (mSource == SOURCE_WORLD)
@@ -2229,20 +2246,20 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
}
EAcceptance accept;
- BOOL remove_inventory;
+ bool remove_inventory;
if (mask & MASK_SHIFT)
{
// For now, always make copy
//accept = ACCEPT_YES_SINGLE;
- //remove_inventory = TRUE;
+ //remove_inventory = true;
accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
+ remove_inventory = false;
}
else
{
accept = ACCEPT_YES_COPY_SINGLE;
- remove_inventory = FALSE;
+ remove_inventory = false;
}
// check if the item can be copied. If not, send that to the sim
@@ -2250,7 +2267,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
if(!item->getPermissions().allowCopyBy(gAgent.getID()))
{
accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
+ remove_inventory = true;
}
// Check if it's in the trash.
@@ -2258,19 +2275,19 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
{
accept = ACCEPT_YES_SINGLE;
- remove_inventory = TRUE;
+ remove_inventory = true;
}
if(drop)
{
- dropObject(obj, FALSE, FALSE, remove_inventory);
+ dropObject(obj, false, false, remove_inventory);
}
return accept;
}
EAcceptance LLToolDragAndDrop::dad3dRezScript(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezScript()" << LL_ENDL;
@@ -2290,7 +2307,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
{
// rez in the script active by default, rez in inactive if the
// control key is being held down.
- BOOL active = ((mask & MASK_CONTROL) == 0);
+ bool active = ((mask & MASK_CONTROL) == 0);
LLViewerObject* root_object = obj;
if (obj && obj->getParent())
@@ -2308,7 +2325,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
}
EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop, EDragAndDropType cargo_type)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dApplyToObject()" << LL_ENDL;
@@ -2427,7 +2444,7 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
}
// VEFFECT: SetTexture
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, true);
effectp->setSourceObject(gAgentAvatarp);
effectp->setTargetObject(obj);
effectp->setDuration(LL_HUD_DUR_SHORT);
@@ -2440,25 +2457,42 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
EAcceptance LLToolDragAndDrop::dad3dTextureObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
return dad3dApplyToObject(obj, face, mask, drop, DAD_TEXTURE);
}
EAcceptance LLToolDragAndDrop::dad3dMaterialObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
return dad3dApplyToObject(obj, face, mask, drop, DAD_MATERIAL);
}
EAcceptance LLToolDragAndDrop::dad3dMeshObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
return dad3dApplyToObject(obj, face, mask, drop, DAD_MESH);
}
+
+/*
+EAcceptance LLToolDragAndDrop::dad3dTextureSelf(
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
+{
+ LL_DEBUGS() << "LLToolDragAndDrop::dad3dTextureAvatar()" << LL_ENDL;
+ if(drop)
+ {
+ if( !(mask & MASK_SHIFT) )
+ {
+ dropTextureOneFaceAvatar( (LLVOAvatar*)obj, face, (LLInventoryItem*)mCargoData);
+ }
+ }
+ return (mask & MASK_SHIFT) ? ACCEPT_NO : ACCEPT_YES_SINGLE;
+}
+*/
+
EAcceptance LLToolDragAndDrop::dad3dWearItem(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL;
LLViewerInventoryItem* item;
@@ -2491,7 +2525,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
}
EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dActivateGesture()" << LL_ENDL;
LLViewerInventoryItem* item;
@@ -2540,7 +2574,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
}
EAcceptance LLToolDragAndDrop::dad3dWearCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearCategory()" << LL_ENDL;
LLViewerInventoryItem* item;
@@ -2570,46 +2604,46 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
return ACCEPT_NO_CUSTOM;
}
- 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;
}
const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX);
- if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
+ if (outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id))
{
// Legacy
return ACCEPT_NO;
}
- if(drop)
+ if (drop)
{
- BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
- LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, false, mask & MASK_SHIFT);
}
+
return ACCEPT_YES_MULTI;
}
- else if(mSource == SOURCE_LIBRARY)
+
+ if (mSource == SOURCE_LIBRARY)
{
- if(drop)
+ if (drop)
{
LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
}
+
return ACCEPT_YES_MULTI;
}
- else
- {
- // TODO: copy/move category to avatar's inventory and then wear it.
- return ACCEPT_NO;
- }
+
+ // TODO: copy/move category to avatar's inventory and then wear it.
+ return ACCEPT_NO;
}
EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dadUpdateInventory()" << LL_ENDL;
@@ -2623,7 +2657,9 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
LLViewerInventoryItem* item;
LLViewerInventoryCategory* cat;
locateInventory(item, cat);
- if (!item || !item->isFinished()) return ACCEPT_NO;
+ if (!item || !item->isFinished())
+ return ACCEPT_NO;
+
LLViewerObject* root_object = obj;
if (obj && obj->getParent())
{
@@ -2635,21 +2671,22 @@ 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);
}
+
return rv;
}
-BOOL LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, BOOL drop)
+bool LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, bool drop)
{
EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop);
- return (rv >= ACCEPT_YES_COPY_SINGLE);
+ return rv >= ACCEPT_YES_COPY_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << LL_ENDL;
if (obj == NULL)
@@ -2765,7 +2802,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
EAcceptance LLToolDragAndDrop::dad3dRezCategoryOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
if ((mask & MASK_CONTROL))
{
@@ -2778,15 +2815,15 @@ EAcceptance LLToolDragAndDrop::dad3dRezCategoryOnObject(
}
-BOOL LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj,
- BOOL drop)
+bool LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj,
+ bool drop)
{
EAcceptance rv = dad3dUpdateInventoryCategory(obj, -1, MASK_NONE, drop);
return (rv >= ACCEPT_YES_COPY_SINGLE);
}
EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << LL_ENDL;
@@ -2824,7 +2861,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventory()" << LL_ENDL;
// item has to be in agent inventory.
@@ -2847,7 +2884,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
}
EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << LL_ENDL;
if(drop && obj)
@@ -2865,7 +2902,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << LL_ENDL;
LLViewerInventoryItem* item = NULL;
@@ -2880,13 +2917,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
}
if(drop)
{
- dropObject(obj, TRUE, TRUE, FALSE);
+ dropObject(obj, true, true, false);
}
return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
- LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject* obj, S32 face, MASK mask, bool drop)
{
LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << LL_ENDL;
LLViewerInventoryItem* item;
@@ -2915,13 +2952,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
}
if(drop)
{
- dropObject(obj, FALSE, TRUE, FALSE);
+ dropObject(obj, false, true, false);
}
return ACCEPT_YES_SINGLE;
}
EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
- LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject *obj, S32 face, MASK mask, bool drop)
{
return ACCEPT_NO;
/*
@@ -2959,7 +2996,7 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
// This shortcuts alot of steps to make a basic object
// w/ an inventory and a special permissions set
EAcceptance LLToolDragAndDrop::dad3dAssetOnLand(
- LLViewerObject *obj, S32 face, MASK mask, BOOL drop)
+ LLViewerObject *obj, S32 face, MASK mask, bool drop)
{
return ACCEPT_NO;
/*