diff options
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 368 |
1 files changed, 208 insertions, 160 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index bfa9386cd4..4b9f29bca8 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) { static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold", 3); @@ -320,6 +321,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(); @@ -328,7 +339,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) @@ -398,7 +409,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)) @@ -447,7 +458,7 @@ void LLToolDragAndDrop::endDrag() { mEndDragSignal(); LLSelectMgr::getInstance()->unhighlightAll(); - setMouseCapture(FALSE); + setMouseCapture(false); } void LLToolDragAndDrop::onMouseCaptureLost() @@ -462,15 +473,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 ) @@ -537,37 +548,37 @@ 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) { if (!mToolTipMsg.empty()) { @@ -575,9 +586,9 @@ BOOL LLToolDragAndDrop::handleToolTip(S32 x, S32 y, MASK mask) LLToolTipMgr::instance().show(LLToolTip::Params() .message(mToolTipMsg) .delay_time(gSavedSettings.getF32( "DragAndDropToolTipDelay" ))); - return TRUE; + return true; } - return FALSE; + return false; } void LLToolDragAndDrop::handleDeselect() @@ -589,12 +600,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; @@ -614,7 +625,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++) { @@ -625,7 +636,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, @@ -633,7 +644,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, @@ -666,7 +677,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, @@ -674,7 +685,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, @@ -690,7 +701,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, if (!handled) { - handled = TRUE; + handled = true; LLRootView* root_view = gViewerWindow->getRootView(); @@ -703,7 +714,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, @@ -711,7 +722,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, @@ -741,7 +752,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, @@ -749,7 +760,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, @@ -785,18 +796,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; @@ -879,7 +890,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)) @@ -894,7 +905,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 @@ -925,12 +936,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 @@ -938,7 +949,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 @@ -959,7 +970,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. @@ -969,7 +980,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); @@ -978,7 +989,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) @@ -1001,7 +1012,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. @@ -1027,7 +1038,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. @@ -1054,7 +1065,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. @@ -1068,7 +1079,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, @@ -1077,51 +1088,71 @@ void set_texture_to_material(LLViewerObject* hit_obj, LLGLTFMaterial::TextureInfo drop_channel) { LLTextureEntry* te = hit_obj->getTE(hit_face); - if (te) + if (!te) { - LLPointer<LLGLTFMaterial> material = te->getGLTFMaterialOverride(); + return; + } - // make a copy to not invalidate existing - // material for multiple objects - if (material.isNull()) - { - // Start with a material override which does not make any changes - material = new LLGLTFMaterial(); - } - else - { - material = new LLGLTFMaterial(*material); - } + const LLUUID base_mat_id = hit_obj->getRenderMaterialID(hit_face); + if (base_mat_id.isNull()) + { + return; + } - switch (drop_channel) - { - case LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR: - default: - { - material->setBaseColorId(asset_id); - } - break; + if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners()) + { + hit_obj->requestInventory(); + return; + } - case LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS: - { - material->setOcclusionRoughnessMetallicId(asset_id); - } - break; + LLViewerInventoryItem* mat_item = hit_obj->getInventoryItemByAsset(base_mat_id); + if (mat_item && !mat_item->getPermissions().allowModifyBy(gAgentID)) + { + return; + } - case LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE: - { - material->setEmissiveId(asset_id); - } - break; + LLPointer<LLGLTFMaterial> material = te->getGLTFMaterialOverride(); - case LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL: - { - material->setNormalId(asset_id); - } - break; - } - LLGLTFMaterialList::queueModify(hit_obj, hit_face, material); + // make a copy to not invalidate existing + // material for multiple objects + if (material.isNull()) + { + // Start with a material override which does not make any changes + material = new LLGLTFMaterial(); } + else + { + material = new LLGLTFMaterial(*material); + } + + switch (drop_channel) + { + case LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR: + default: + { + material->setBaseColorId(asset_id); + } + break; + + case LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS: + { + material->setOcclusionRoughnessMetallicId(asset_id); + } + break; + + case LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE: + { + material->setEmissiveId(asset_id); + } + break; + + case LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL: + { + material->setNormalId(asset_id); + } + break; + } + LLGLTFMaterialList::queueModify(hit_obj, hit_face, material); } void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, @@ -1148,7 +1179,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; @@ -1253,7 +1284,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; @@ -1262,7 +1293,7 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj, if (asset_id.isNull()) { // use blank material - asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + asset_id = BLANK_MATERIAL_ASSET_ID; } hit_obj->setRenderMaterialID(hit_face, asset_id); @@ -1288,7 +1319,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) { @@ -1298,7 +1329,7 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj, if (asset_id.isNull()) { // use blank material - asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + asset_id = BLANK_MATERIAL_ASSET_ID; } hit_obj->setRenderMaterialIDs(asset_id); @@ -1319,7 +1350,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; @@ -1327,7 +1358,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(); } @@ -1470,7 +1501,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; @@ -1540,7 +1571,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) { @@ -1586,7 +1617,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); @@ -1595,9 +1626,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) @@ -1625,7 +1656,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. @@ -1653,7 +1684,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); @@ -1661,7 +1692,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 == false) { LLVector3 ray_direction = ray_start - ray_end; ray_end = ray_end - ray_direction; @@ -1696,7 +1727,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); @@ -1748,7 +1779,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); @@ -1811,7 +1842,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); @@ -1846,10 +1877,10 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL 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()) { @@ -1857,14 +1888,14 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL 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())) { - worn = TRUE; + worn = true; } break; case LLAssetType::AT_CALLINGCARD: @@ -1875,16 +1906,16 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL break; } const LLPermissions& perm = item->getPermissions(); - BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd()); - BOOL transfer = FALSE; + 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; + 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) { // Attachments are in world and in inventory simultaneously, @@ -1919,7 +1950,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; @@ -1978,7 +2009,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, @@ -2056,7 +2087,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ break; } - return TRUE; + return true; } @@ -2066,14 +2097,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 @@ -2132,7 +2163,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) { @@ -2152,21 +2183,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 @@ -2174,7 +2205,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. @@ -2186,14 +2217,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) @@ -2230,20 +2261,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 @@ -2251,7 +2282,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. @@ -2259,19 +2290,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; @@ -2291,7 +2322,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()) @@ -2309,7 +2340,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; @@ -2428,7 +2459,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); @@ -2441,25 +2472,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; @@ -2492,7 +2540,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; @@ -2541,7 +2589,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; @@ -2588,7 +2636,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( if(drop) { - BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE ); + bool append = ( (mask & MASK_SHIFT) ? true : false ); LLAppearanceMgr::instance().wearInventoryCategory(category, false, append); } return ACCEPT_YES_MULTI; @@ -2610,7 +2658,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( 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,14 +2691,14 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( 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); } 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) @@ -2766,7 +2814,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)) { @@ -2779,15 +2827,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; @@ -2825,7 +2873,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. @@ -2848,7 +2896,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) @@ -2866,7 +2914,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; @@ -2881,13 +2929,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; @@ -2916,13 +2964,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; /* @@ -2960,7 +3008,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; /* |