From 553ab738b4e2d867e6c833596f5cbd35f48caf6c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 6 Sep 2010 00:51:26 -0700 Subject: Ported patch by Kitty Barnett for right clicking an inventory item and editing it --- linden/indra/newview/llinventorybridge.cpp | 61 +++++++++++++++++++++- linden/indra/newview/llinventoryview.cpp | 8 +-- .../skins/default/xui/en-us/menu_inventory.xml | 3 ++ 3 files changed, 67 insertions(+), 5 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index 4a5ad67..30b0a4a 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp @@ -53,6 +53,7 @@ #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterproperties.h" +#include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfocusmgr.h" #include "llfolderview.h" @@ -72,10 +73,14 @@ #include "llresmgr.h" #include "llscrollcontainer.h" #include "llimview.h" +#include "lltoolcomp.h" #include "lltooldraganddrop.h" +#include "lltoolmgr.h" #include "llviewerimagelist.h" #include "llviewerinventory.h" +#include "llviewerjoystick.h" #include "llviewerobjectlist.h" +#include "llviewerparcelmgr.h" #include "llviewerwindow.h" #include "llvoavatar.h" #include "llwaterparammanager.h" @@ -3493,6 +3498,55 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model llwarns << "object not found - ignoring" << llendl; } } + else if ("edit" == action) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + return; + LLVOAvatar* avatarp = gAgent.getAvatarObject(); + if (!avatarp) + return; + LLViewerObject* objectp = avatarp->getWornAttachment(mUUID); + if (!objectp) + return; + + // [Selective copy/paste from LLObjectEdit::handleEvent()] + LLViewerParcelMgr::getInstance()->deselectLand(); + LLSelectMgr::getInstance()->deselectAll(); + + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) + { + if (objectp->isHUDAttachment() || !gSavedSettings.getBOOL("EditCameraMovement")) + { + // always freeze camera in space, even if camera doesn't move + // so, for example, follow cam scripts can't affect you when in build mode + gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null); + gAgent.setFocusOnAvatar(FALSE, ANIMATE); + } + else + { + gAgent.setFocusOnAvatar(FALSE, ANIMATE); + + // zoom in on object center instead of where we clicked, as we need to see the manipulator handles + gAgent.setFocusGlobal(objectp->getPositionGlobal(), objectp->getID()); + gAgent.cameraZoomIn(0.666f); + gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + gViewerWindow->moveCursorToCenter(); + } + } + + gFloaterTools->open(); + + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); + + LLViewerJoystick::getInstance()->moveObjects(true); + LLViewerJoystick::getInstance()->setNeedsReset(true); + + LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); + + // Could be first use + LLFirstUse::useBuild(); + } else LLItemBridge::performAction(folder, model, action); } @@ -3654,9 +3708,15 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) return; } + items.push_back(std::string("Attach Separator")); if( avatarp->isWearingAttachment( mUUID ) ) { items.push_back(std::string("Detach From Yourself")); + items.push_back(std::string("Attachment Edit")); + if ( ( (flags & FIRST_SELECTED_ITEM) == 0) || (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) ) + { + disabled_items.push_back(std::string("Attachment Edit")); + } // [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a if ( (rlv_handler_t::isEnabled()) && @@ -3669,7 +3729,6 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if( !isInTrash() ) { - items.push_back(std::string("Attach Separator")); items.push_back(std::string("Object Wear")); items.push_back(std::string("Attach To")); items.push_back(std::string("Attach To HUD")); diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 952121f..939d50b 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -578,11 +578,11 @@ void LLInventoryView::init(LLInventoryModel* inventory) std::ostringstream filterSaveName; filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml"); llinfos << "LLInventoryView::init: reading from " << filterSaveName << llendl; - llifstream file(filterSaveName.str()); + llifstream file(filterSaveName.str()); LLSD savedFilterState; - if (file.is_open()) - { - LLSDSerialize::fromXML(savedFilterState, file); + if (file.is_open()) + { + LLSDSerialize::fromXML(savedFilterState, file); file.close(); // Load the persistent "Recent Items" settings. diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml index 78fc75e..81b4ce2 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml @@ -249,6 +249,9 @@ mouse_opaque="true" name="Detach From Yourself" width="128"> + + +