aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llinventorybridge.cpp')
-rw-r--r--linden/indra/newview/llinventorybridge.cpp159
1 files changed, 114 insertions, 45 deletions
diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp
index 5060d21..f706ad6 100644
--- a/linden/indra/newview/llinventorybridge.cpp
+++ b/linden/indra/newview/llinventorybridge.cpp
@@ -488,6 +488,20 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
488 items.push_back(std::string("Open")); 488 items.push_back(std::string("Open"));
489 items.push_back(std::string("Properties")); 489 items.push_back(std::string("Properties"));
490 490
491// [RLVa:KB] - Checked: 2009-10-13 (RLVa-1.0.5c) | Modified: RLVa-1.0.5c
492 if (rlv_handler_t::isEnabled())
493 {
494 LLInventoryObject* pItem = (mInventoryPanel->getModel()) ? mInventoryPanel->getModel()->getObject(mUUID) : NULL;
495 if ( (pItem) &&
496 ( ((LLAssetType::AT_NOTECARD == pItem->getType()) && (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE))) ||
497 ((LLAssetType::AT_LSL_TEXT == pItem->getType()) && (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT))) ||
498 ((LLAssetType::AT_NOTECARD == pItem->getType()) && (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE))) ) )
499 {
500 disabled_items.push_back(std::string("Open"));
501 }
502 }
503// [/RLVa:KB]
504
491 getClipboardEntries(true, items, disabled_items, flags); 505 getClipboardEntries(true, items, disabled_items, flags);
492 } 506 }
493 hideContextEntries(menu, items, disabled_items); 507 hideContextEntries(menu, items, disabled_items);
@@ -2446,6 +2460,13 @@ void open_texture(const LLUUID& item_id,
2446 const LLUUID& source_id, 2460 const LLUUID& source_id,
2447 BOOL take_focus) 2461 BOOL take_focus)
2448{ 2462{
2463// [RLVa:KB] - Checked: 2009-10-13 (RLVa-1.0.5c) | Added: RLVa-1.0.5c
2464 if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE))
2465 {
2466 return;
2467 }
2468// [/RLVa:KB]
2469
2449 // See if we can bring an exiting preview to the front 2470 // See if we can bring an exiting preview to the front
2450 if( !LLPreview::show( item_id, take_focus ) ) 2471 if( !LLPreview::show( item_id, take_focus ) )
2451 { 2472 {
@@ -3274,11 +3295,11 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
3274 item = (LLViewerInventoryItem*)gInventory.getItem(object_id); 3295 item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
3275 if(item && gInventory.isObjectDescendentOf(object_id, gAgent.getInventoryRootID())) 3296 if(item && gInventory.isObjectDescendentOf(object_id, gAgent.getInventoryRootID()))
3276 { 3297 {
3277// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 3298// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
3278 // User picked "Wear" so either nothing is locked, or we need to look up the specific attach point from its name 3299 // User picked "Wear" so either nothing is locked, or we need to look up the specific attach point from its name
3279 // (NOTE: rez_attachment will take care of deciding whether or not we *can* attach) 3300 // (NOTE: rez_attachment will take care of deciding whether or not we *can* attach)
3280 rez_attachment(item, 3301 rez_attachment(item,
3281 ((!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedAttachment()) || (RlvSettings::getEnableWear())) 3302 ((!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) || (RlvSettings::getEnableWear()))
3282 ? NULL : gRlvHandler.getAttachPoint(item, true)); 3303 ? NULL : gRlvHandler.getAttachPoint(item, true));
3283// [/RLVa:KB] 3304// [/RLVa:KB]
3284// rez_attachment(item, NULL); 3305// rez_attachment(item, NULL);
@@ -3301,9 +3322,9 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
3301 { 3322 {
3302 LLInventoryItem* item = gInventory.getItem(mUUID); 3323 LLInventoryItem* item = gInventory.getItem(mUUID);
3303 3324
3304// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 3325// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
3305 // Fall-through: if there's a "Detach from yourself" code path we missed then we'll still disallow the detach here 3326 // Fall-through: if there's a "Detach from yourself" code path we missed then we'll still disallow the detach here
3306 if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(item)) ) 3327 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.isLockedAttachment(item, RLV_LOCK_REMOVE)) )
3307 { 3328 {
3308 return; 3329 return;
3309 } 3330 }
@@ -3398,24 +3419,38 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
3398 rez_action->mAttachPt = attach_pt; 3419 rez_action->mAttachPt = attach_pt;
3399 if (attachment && attachment->getObject()) 3420 if (attachment && attachment->getObject())
3400 { 3421 {
3401// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) 3422// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
3402 if ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.isDetachable(attach_pt)) ) 3423 if ( (rlv_handler_t::isEnabled()) && // Can't replace an existing object if it's undetachable
3403 gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action); 3424 (gRlvHandler.isLockedAttachment(attach_pt, RLV_LOCK_ANY)) ) // or if we're not allowed to attach to that attach point
3404 else 3425 {
3405 delete rez_action; 3426 delete rez_action;
3406// [/RLVa] 3427 return;
3407// gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action); 3428 }
3429// [/RLVa:KB]
3430 gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action);
3408 } 3431 }
3409 else 3432 else
3410 { 3433 {
3411// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) 3434// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-10-10 (RLVa-1.0.5) | Modified: RLVa-1.0.5
3412 // Don't allow wear to default attach point if there are any locked attachments 3435 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) )
3413 if ( (!rlv_handler_t::isEnabled()) || (0 != attach_pt) || (!gRlvHandler.hasLockedAttachment()) || (RlvSettings::getEnableWear()) ) 3436 {
3414 confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action); 3437 if (0 == attach_pt) // Can't wear on the default attachment point
3415 else 3438 {
3416 delete rez_action; 3439 if (!RlvSettings::getEnableWear()) // (unless "Enable Wear" is enabled)
3417// [/RLVa] 3440 {
3418// confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action); 3441 delete rez_action;
3442 return;
3443 }
3444 gRlvHandler.onWearAttachment(item->getUUID());
3445 }
3446 else if (gRlvHandler.isLockedAttachment(attach_pt, RLV_LOCK_ADD)) // and we can never wear on a non-attachable attach point
3447 {
3448 delete rez_action;
3449 return;
3450 }
3451 }
3452// [/RLVa:KB]
3453 confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action);
3419 } 3454 }
3420} 3455}
3421 3456
@@ -3485,9 +3520,12 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
3485 { 3520 {
3486 items.push_back(std::string("Detach From Yourself")); 3521 items.push_back(std::string("Detach From Yourself"));
3487 3522
3488// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) 3523// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
3489 if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(item)) ) 3524 if ( (rlv_handler_t::isEnabled()) &&
3525 (gRlvHandler.hasLockedAttachment(RLV_LOCK_REMOVE)) && (gRlvHandler.isLockedAttachment(item, RLV_LOCK_REMOVE)) )
3526 {
3490 disabled_items.push_back(std::string("Detach From Yourself")); 3527 disabled_items.push_back(std::string("Detach From Yourself"));
3528 }
3491// [/RLVa:KB] 3529// [/RLVa:KB]
3492 } 3530 }
3493 else 3531 else
@@ -3500,13 +3538,16 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
3500 items.push_back(std::string("RestoreToWorld Separator")); 3538 items.push_back(std::string("RestoreToWorld Separator"));
3501 items.push_back(std::string("Restore to Last Position")); 3539 items.push_back(std::string("Restore to Last Position"));
3502 3540
3503// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0c 3541// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
3504 // Only enable "Wear" if there is an attach point name *and* there isn't a worn attachment there that's currently locked 3542 if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getEnableWear()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) )
3505 if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getEnableWear()) && (gRlvHandler.hasLockedAttachment()) )
3506 { 3543 {
3507 LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(item, true); 3544 LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(item, true); // The item's name should specify
3508 if ( (!pAttachPt) || (!gRlvHandler.isDetachable(pAttachPt)) ) 3545 if ( (!pAttachPt) || // an attachment point that
3546 (gRlvHandler.isLockedAttachment(pAttachPt->getObject(), RLV_LOCK_REMOVE)) || // doesn't have an undetachable object
3547 (gRlvHandler.isLockedAttachment(pAttachPt, RLV_LOCK_ADD)) ) // and that can be attached to
3548 {
3509 disabled_items.push_back(std::string("Object Wear")); 3549 disabled_items.push_back(std::string("Object Wear"));
3550 }
3510 } 3551 }
3511// [/RLVa:KB] 3552// [/RLVa:KB]
3512 3553
@@ -3609,6 +3650,13 @@ LLUIImagePtr LLLSLTextBridge::getIcon() const
3609 3650
3610void LLLSLTextBridge::openItem() 3651void LLLSLTextBridge::openItem()
3611{ 3652{
3653// [RLVa:KB] - Checked: 2009-10-13 (RLVa-1.0.5c) | Modified: RLVa-1.0.5c
3654 if (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT))
3655 {
3656 return;
3657 }
3658// [/RLVa:KB]
3659
3612 // See if we can bring an exiting preview to the front 3660 // See if we can bring an exiting preview to the front
3613 if(!LLPreview::show(mUUID)) 3661 if(!LLPreview::show(mUUID))
3614 { 3662 {
@@ -4050,15 +4098,26 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata )
4050 is_gesture); 4098 is_gesture);
4051 S32 gest_count = gest_item_array.count(); 4099 S32 gest_count = gest_item_array.count();
4052 4100
4053// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-1.0.0c 4101// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
4054 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) && (!RlvSettings::getEnableWear()) ) 4102 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) )
4055 { 4103 {
4056 // Filter anything that doesn't specify an attachment point (or that specifies one that's currently locked) 4104 // Filter anything that we shouldn't be attaching
4057 for (S32 idxObj = obj_item_array.count() - 1; idxObj >= 0; idxObj--) 4105 for (S32 idxObj = obj_item_array.count() - 1; idxObj >= 0; idxObj--)
4058 { 4106 {
4059 LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(obj_item_array.get(idxObj).get(), true); 4107 if (!RlvSettings::getEnableWear())
4060 if ( ((!pAttachPt) || (!gRlvHandler.isDetachable(pAttachPt))) ) 4108 {
4061 obj_item_array.remove(idxObj); 4109 LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(obj_item_array.get(idxObj).get(), true);
4110 if ( (!pAttachPt) || // Item should specify attachpt that
4111 (gRlvHandler.isLockedAttachment(pAttachPt->getObject(), RLV_LOCK_REMOVE)) || // doesn't have an undetachable object
4112 (gRlvHandler.isLockedAttachment(pAttachPt, RLV_LOCK_ADD)) ) // and that is attachable
4113 {
4114 obj_item_array.remove(idxObj);
4115 }
4116 }
4117 else
4118 {
4119 gRlvHandler.onWearAttachment(obj_item_array.get(idxObj)->getUUID());
4120 }
4062 } 4121 }
4063 obj_count = obj_item_array.count(); 4122 obj_count = obj_item_array.count();
4064 } 4123 }
@@ -4241,15 +4300,26 @@ void wear_attachments_on_avatar(const std::set<LLUUID>& item_ids, BOOL remove)
4241 { 4300 {
4242 if ( (gInventory.isObjectDescendentOf(*it, gAgent.getInventoryRootID())) ) 4301 if ( (gInventory.isObjectDescendentOf(*it, gAgent.getInventoryRootID())) )
4243 { 4302 {
4244// items.put(item); 4303// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-10-15 (RLVa-1.0.5e) | Modified: RLVa-1.0.5e
4245// [RLVa:KB] - Checked: 2009-09-11 (RLVa-1.0.2c) | Modified: RLVa-1.0.2c 4304 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) )
4246 LLViewerJointAttachment* pAttachPt = NULL;
4247 if ( (!rlv_handler_t::isEnabled()) || (RlvSettings::getEnableWear()) || (!gRlvHandler.hasLockedAttachment()) ||
4248 (((pAttachPt = gRlvHandler.getAttachPoint(item, true)) != NULL) && (gRlvHandler.isDetachable(pAttachPt))) )
4249 { 4305 {
4250 items.put(item); 4306 if (!RlvSettings::getEnableWear())
4307 {
4308 LLViewerJointAttachment* pAttachPt = NULL;
4309 if ( ((pAttachPt = gRlvHandler.getAttachPoint(item, true)) == NULL) || // Item should specify attachpt that
4310 (gRlvHandler.isLockedAttachment(pAttachPt->getObject(), RLV_LOCK_REMOVE)) || // doesn't have an undetachable object
4311 (gRlvHandler.isLockedAttachment(pAttachPt, RLV_LOCK_ADD)) ) // and that is attachable
4312 {
4313 continue;
4314 }
4315 }
4316 else
4317 {
4318 gRlvHandler.onWearAttachment(item->getUUID());
4319 }
4251 } 4320 }
4252// [/RLVa:KB] 4321// [/RLVa:KB]
4322 items.put(item);
4253 } 4323 }
4254 else if ( (item->isComplete()) ) 4324 else if ( (item->isComplete()) )
4255 { 4325 {
@@ -4309,9 +4379,9 @@ void wear_attachments_on_avatar(const LLInventoryModel::item_array_t& items, BOO
4309 msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); 4379 msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id );
4310 msg->addU8Fast(_PREHASH_TotalObjects, count ); 4380 msg->addU8Fast(_PREHASH_TotalObjects, count );
4311// msg->addBOOLFast(_PREHASH_FirstDetachAll, remove ); 4381// msg->addBOOLFast(_PREHASH_FirstDetachAll, remove );
4312// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a 4382// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Added: RLVa-1.0.5a
4313 // This really should just *always* be FALSE since TRUE can result in loss of the current asset state 4383 // This really should just *always* be FALSE since TRUE can result in loss of the current asset state
4314 msg->addBOOLFast(_PREHASH_FirstDetachAll, remove && (!gRlvHandler.hasLockedAttachment()) ); 4384 msg->addBOOLFast(_PREHASH_FirstDetachAll, remove && (!gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) );
4315// [/RLVa:KB] 4385// [/RLVa:KB]
4316 } 4386 }
4317 4387
@@ -4320,9 +4390,9 @@ void wear_attachments_on_avatar(const LLInventoryModel::item_array_t& items, BOO
4320 msg->addUUIDFast(_PREHASH_ItemID, item->getUUID() ); 4390 msg->addUUIDFast(_PREHASH_ItemID, item->getUUID() );
4321 msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); 4391 msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
4322// msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point 4392// msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point
4323// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a 4393// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Added: RLVa-1.0.5a
4324 msg->addU8Fast(_PREHASH_AttachmentPt, 4394 msg->addU8Fast(_PREHASH_AttachmentPt,
4325 ( (!rlv_handler_t::isEnabled()) || (RlvSettings::getEnableWear()) || (!gRlvHandler.hasLockedAttachment()) ) 4395 ( (!rlv_handler_t::isEnabled()) || (RlvSettings::getEnableWear()) || (!gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY)) )
4326 ? 0 4396 ? 0
4327 : gRlvHandler.getAttachPointIndex(gRlvHandler.getAttachPoint(item, true))); 4397 : gRlvHandler.getAttachPointIndex(gRlvHandler.getAttachPoint(item, true)));
4328// [/RLVa:KB] 4398// [/RLVa:KB]
@@ -4428,13 +4498,12 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
4428 { 4498 {
4429 for(i = 0; i < obj_count; ++i) 4499 for(i = 0; i < obj_count; ++i)
4430 { 4500 {
4431// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.2a 4501// [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a
4432 // TODO-RLVa: is there a reason why LL doesn't bother checking to see if you're actually wearing the object? 4502 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment(RLV_LOCK_REMOVE)) )
4433 if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) )
4434 { 4503 {
4435 LLVOAvatar* pAvatar = gAgent.getAvatarObject(); 4504 LLVOAvatar* pAvatar = gAgent.getAvatarObject();
4436 if ( (!pAvatar) || (!pAvatar->isWearingAttachment(obj_item_array.get(i)->getUUID())) || 4505 if ( (!pAvatar) || (!pAvatar->isWearingAttachment(obj_item_array.get(i)->getUUID())) ||
4437 (!gRlvHandler.isDetachable(obj_item_array.get(i).get())) ) // Why does LLPointer have a cast to BOOL aka S32??? 4506 (gRlvHandler.isLockedAttachment(obj_item_array.get(i).get(), RLV_LOCK_REMOVE)) )
4438 { 4507 {
4439 continue; 4508 continue;
4440 } 4509 }