From 328322436c046bf229de83041b29ebe5ce7c4029 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 16:12:32 -0700 Subject: PATH-764,PATH-765: Adding in a context menu option on right-click of an object to show in the linksets floater if all objects are non-characters, or to show in the characters floater if all objects are characters. --- indra/newview/llfloaterpathfindingcharacters.cpp | 5 +- indra/newview/llfloaterpathfindingcharacters.h | 2 +- indra/newview/llfloaterpathfindinglinksets.cpp | 5 +- indra/newview/llfloaterpathfindinglinksets.h | 2 +- indra/newview/llfloaterpathfindingobjects.cpp | 75 ++++- indra/newview/llfloaterpathfindingobjects.h | 6 + indra/newview/llviewermenu.cpp | 16 + indra/newview/skins/default/xui/en/menu_object.xml | 334 +++++++++++---------- 8 files changed, 271 insertions(+), 174 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 09fd17855c..caf9fe382b 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -74,9 +74,10 @@ BOOL LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVecto return (isShowPhysicsCapsule() && getCapsuleRenderData(pos, rot )); } -void LLFloaterPathfindingCharacters::openCharactersViewer() +void LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects() { - LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_characters"); + LLFloaterPathfindingCharacters *charactersFloater = LLFloaterReg::getTypedInstance("pathfinding_characters"); + charactersFloater->showFloaterWithSelectionObjects(); } LLHandle LLFloaterPathfindingCharacters::getInstanceHandle() diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index a181a66ebd..56e08b7603 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -46,7 +46,7 @@ public: BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot ) const; - static void openCharactersViewer(); + static void openCharactersWithSelectedObjects(); static LLHandle getInstanceHandle(); protected: diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index a7b856b271..ae814b0087 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -60,9 +60,10 @@ // LLFloaterPathfindingLinksets //--------------------------------------------------------------------------- -void LLFloaterPathfindingLinksets::openLinksetsEditor() +void LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects() { - LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_linksets"); + LLFloaterPathfindingLinksets *linksetsFloater = LLFloaterReg::getTypedInstance("pathfinding_linksets"); + linksetsFloater->showFloaterWithSelectionObjects(); } LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index c9ae5a059a..8e82992dbf 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -46,7 +46,7 @@ class LLVector3; class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects { public: - static void openLinksetsEditor(); + static void openLinksetsWithSelectedObjects(); protected: friend class LLFloaterReg; diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 14fa0ac428..cd6d0851b9 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -173,6 +173,8 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mMessagingRequestId(0U), mObjectList(), mObjectsSelection(), + mHasObjectsToBeSelected(false), + mObjectsToBeSelected(), mSelectionUpdateSlot(), mRegionBoundaryCrossingSlot() { @@ -318,17 +320,19 @@ void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::r void LLFloaterPathfindingObjects::rebuildObjectsScrollList() { - std::vector selectedItems = mObjectsScrollList->getAllSelected(); - int numSelectedItems = selectedItems.size(); - uuid_vec_t selectedUUIDs; - if (numSelectedItems > 0) + if (!mHasObjectsToBeSelected) { - selectedUUIDs.reserve(selectedItems.size()); - for (std::vector::const_iterator itemIter = selectedItems.begin(); - itemIter != selectedItems.end(); ++itemIter) + std::vector selectedItems = mObjectsScrollList->getAllSelected(); + int numSelectedItems = selectedItems.size(); + if (numSelectedItems > 0) { - const LLScrollListItem *listItem = *itemIter; - selectedUUIDs.push_back(listItem->getUUID()); + mObjectsToBeSelected.reserve(selectedItems.size()); + for (std::vector::const_iterator itemIter = selectedItems.begin(); + itemIter != selectedItems.end(); ++itemIter) + { + const LLScrollListItem *listItem = *itemIter; + mObjectsToBeSelected.push_back(listItem->getUUID()); + } } } @@ -346,8 +350,19 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList() } } - mObjectsScrollList->selectMultiple(selectedUUIDs); - mObjectsScrollList->setScrollPos(origScrollPosition); + mObjectsScrollList->selectMultiple(mObjectsToBeSelected); + if (mHasObjectsToBeSelected) + { + mObjectsScrollList->scrollToShowSelected(); + } + else + { + mObjectsScrollList->setScrollPos(origScrollPosition); + } + + mObjectsToBeSelected.clear(); + mHasObjectsToBeSelected = false; + updateControlsOnScrollListChange(); } @@ -401,6 +416,44 @@ S32 LLFloaterPathfindingObjects::getBeaconWidth() const return DEFAULT_BEACON_WIDTH; } +void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects() +{ + mObjectsToBeSelected.clear(); + + LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection(); + if (selectedObjectsHandle.notNull()) + { + LLObjectSelection *selectedObjects = selectedObjectsHandle.get(); + if (!selectedObjects->isEmpty()) + { + for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin(); + objectIter != selectedObjects->valid_end(); ++objectIter) + { + LLSelectNode *object = *objectIter; + LLViewerObject *viewerObject = object->getObject(); + mObjectsToBeSelected.push_back(viewerObject->getID()); + } + } + } + mHasObjectsToBeSelected = true; + + if (!isShown()) + { + openFloater(); + setVisibleAndFrontmost(); + } + else + { + rebuildObjectsScrollList(); + if (isMinimized()) + { + setMinimized(FALSE); + } + setVisibleAndFrontmost(); + } + setFocus(TRUE); +} + BOOL LLFloaterPathfindingObjects::isShowBeacons() const { return mShowBeaconCheckBox->get(); diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 88790db12d..6d5d6d24b2 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -36,6 +36,7 @@ #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" #include "llselectmgr.h" +#include "lluuid.h" #include "v4color.h" class LLAvatarName; @@ -90,6 +91,8 @@ protected: virtual const LLColor4 &getBeaconTextColor() const; virtual S32 getBeaconWidth() const; + void showFloaterWithSelectionObjects(); + BOOL isShowBeacons() const; void clearAllObjects(); void selectAllObjects(); @@ -158,6 +161,9 @@ private: LLObjectSelectionHandle mObjectsSelection; + bool mHasObjectsToBeSelected; + uuid_vec_t mObjectsToBeSelected; + boost::signals2::connection mSelectionUpdateSlot; boost::signals2::connection mRegionBoundaryCrossingSlot; LLAgent::god_level_change_slot_t mGodLevelChangeSlot; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d244b19b4f..020de5a255 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -60,6 +60,8 @@ #include "llfloatergodtools.h" #include "llfloaterinventory.h" #include "llfloaterland.h" +#include "llfloaterpathfindingcharacters.h" +#include "llfloaterpathfindinglinksets.h" #include "llfloaterpay.h" #include "llfloaterreporter.h" #include "llfloatersearch.h" @@ -2735,6 +2737,16 @@ bool enable_object_build() return !enable_object_edit(); } +bool enable_object_select_in_pathfinding_linksets() +{ + return LLSelectMgr::getInstance()->selectGetNonCharacter(); +} + +bool enable_object_select_in_pathfinding_characters() +{ + return LLSelectMgr::getInstance()->selectGetCharacter(); +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8485,6 +8497,10 @@ void initialize_menus() enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); enable.add("EnableEdit", boost::bind(&enable_object_edit)); enable.add("VisibleBuild", boost::bind(&enable_object_build)); + commit.add("Pathfinding.Linksets.Select", boost::bind(&LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects)); + enable.add("EnableSelectInPathfindingLinksets", boost::bind(&enable_object_select_in_pathfinding_linksets)); + commit.add("Pathfinding.Characters.Select", boost::bind(&LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects)); + enable.add("EnableSelectInPathfindingCharacters", boost::bind(&enable_object_select_in_pathfinding_characters)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 719509301b..52b9524b11 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -1,179 +1,199 @@ - - - - - - + layout="topleft" + name="Object Pie"> + + - - + + + + + + - - - - - - - - - - - - - - - - - - - + + + label="Show in linksets" + name="show_in_linksets"> + function="Pathfinding.Linksets.Select" /> + + + + + + + - - - - - - - + + + + - - - - - - - - - - - - - - - - + + + + - - - - - - + label="Stand Up" + name="Object Stand Up"> + + + + + + + + + + + + + + function="Object.AttachToAvatar" /> - - + function="Object.EnableWear" /> + + + function="Object.AttachAddToAvatar" /> - - - - - - + function="Object.EnableWear" /> + + + + + + + + + + + function="Object.Mute" /> - - + function="Object.EnableMute" /> + + + function="Object.Return" /> + function="Object.EnableReturn" /> + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3