diff options
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 353 |
1 files changed, 193 insertions, 160 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index abf9748db3..6d0704a469 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) @@ -352,16 +363,13 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - folder_ids.push_back(cats.at(i)->getUUID()); + folder_ids.emplace_back(cat->getUUID()); } - count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - item_ids.push_back(items.at(i)->getUUID()); + item_ids.emplace_back(item->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -396,16 +404,16 @@ 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)) { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; - S32 count = llmin(cargo_ids.size(), types.size()); - std::set<LLUUID> cat_ids; - for(S32 i = 0; i < count; ++i) + auto count = llmin(cargo_ids.size(), types.size()); + uuid_set_t cat_ids; + for (size_t i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); if (cat) @@ -423,10 +431,9 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.size(); - for(S32 i = 0; i < cat_count; ++i) + for (auto& cat : cats) { - cat_ids.insert(cat->getUUID()); + cat_ids.emplace(cat->getUUID()); } } } @@ -445,7 +452,7 @@ void LLToolDragAndDrop::endDrag() { mEndDragSignal(); LLSelectMgr::getInstance()->unhighlightAll(); - setMouseCapture(FALSE); + setMouseCapture(false); } void LLToolDragAndDrop::onMouseCaptureLost() @@ -460,15 +467,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 +542,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 +594,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 +619,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 +630,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 +638,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 +671,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 +679,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 +695,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 +708,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 +716,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 +746,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 +754,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 +790,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 +884,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 +899,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 +930,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 +943,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 +964,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 +974,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 +983,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 +1006,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 +1032,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 +1059,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 +1073,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, @@ -1167,7 +1173,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; @@ -1272,7 +1278,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; @@ -1307,7 +1313,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) { @@ -1338,7 +1344,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; @@ -1346,7 +1352,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(); } @@ -1489,7 +1495,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; @@ -1559,7 +1565,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) { @@ -1605,7 +1611,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); @@ -1614,9 +1620,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) @@ -1644,7 +1650,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. @@ -1672,7 +1678,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); @@ -1680,7 +1686,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; @@ -1715,7 +1721,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); @@ -1767,7 +1773,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); @@ -1830,7 +1836,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); @@ -1843,7 +1849,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)) @@ -1854,36 +1862,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: @@ -1891,33 +1900,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; } @@ -1938,7 +1951,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; @@ -1997,7 +2010,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, @@ -2075,7 +2088,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ break; } - return TRUE; + return true; } @@ -2085,14 +2098,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 @@ -2151,7 +2164,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) { @@ -2171,21 +2184,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 @@ -2193,7 +2206,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. @@ -2205,14 +2218,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) @@ -2249,20 +2262,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 @@ -2270,7 +2283,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. @@ -2278,19 +2291,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; @@ -2310,7 +2323,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()) @@ -2328,7 +2341,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; @@ -2447,7 +2460,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); @@ -2460,25 +2473,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; @@ -2511,7 +2541,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; @@ -2560,7 +2590,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; @@ -2590,46 +2620,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; @@ -2643,7 +2673,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()) { @@ -2655,21 +2687,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) @@ -2785,7 +2818,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)) { @@ -2798,15 +2831,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; @@ -2844,7 +2877,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. @@ -2867,7 +2900,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) @@ -2885,7 +2918,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; @@ -2900,13 +2933,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; @@ -2935,13 +2968,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; /* @@ -2979,7 +3012,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; /* |