From 1ca92d37ddac87c09df9716e09cd7c37d94f85e7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 11:24:23 -0700 Subject: PATH-760: Adding another pathfinding test method to the selection manager. --- indra/newview/llpanelpermissions.cpp | 15 +++++------- indra/newview/llselectmgr.cpp | 46 ++++++++++++++++++++++++++++++++++++ indra/newview/llselectmgr.h | 4 ++++ 3 files changed, 56 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 6076cb01fb..51ab7649a4 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -336,6 +336,12 @@ void LLPanelPermissions::refresh() std::string pfAttrName; if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding()) + || LLSelectMgr::getInstance()->selectGetNonPathfinding()) + { + pfAttrName = "Pathfinding_Object_Attr_None"; + } + else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsPermanent()) || LLSelectMgr::getInstance()->selectGetPermanent()) { @@ -347,15 +353,6 @@ void LLPanelPermissions::refresh() { pfAttrName = "Pathfinding_Object_Attr_Character"; } - else if (((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() - && LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) - || LLSelectMgr::getInstance()->selectGetNonPermanent()) && - ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() - && LLSelectMgr::getInstance()->selectGetRootsNonCharacter()) - || LLSelectMgr::getInstance()->selectGetNonCharacter())) - { - pfAttrName = "Pathfinding_Object_Attr_None"; - } else { pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 791342a555..34b889d8b9 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2647,6 +2647,52 @@ BOOL LLSelectMgr::selectGetRootsCharacter() return TRUE; } +//----------------------------------------------------------------------------- +// selectGetNonPathfinding() - return TRUE if all objects are not pathfinding +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonPathfinding() +{ + for (LLObjectSelection::iterator iter = getSelection()->begin(); + iter != getSelection()->end(); iter++ ) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if( !object || !node->mValid ) + { + return FALSE; + } + if( object->flagObjectPermanent() || object->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonPathfinding() - return TRUE if all root objects are not +// pathfinding +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonPathfinding() +{ + for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); + iter != getSelection()->root_end(); iter++ ) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if( !node->mValid ) + { + return FALSE; + } + if( object->flagObjectPermanent() || object->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + //----------------------------------------------------------------------------- // selectGetNonPermanent() - return TRUE if all objects are not permanent //----------------------------------------------------------------------------- diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 488f8f2efb..bf40ab458f 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -572,6 +572,10 @@ public: BOOL selectGetRootsCharacter(); BOOL selectGetCharacter(); + // returns TRUE if is all objects are not permanent + BOOL selectGetRootsNonPathfinding(); + BOOL selectGetNonPathfinding(); + // returns TRUE if is all objects are not permanent BOOL selectGetRootsNonPermanent(); BOOL selectGetNonPermanent(); -- cgit v1.2.3