diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-06-21 18:03:23 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-06-21 18:03:23 -0700 |
commit | f143da27bf09b0e7a9b73de80609b2326a7e672e (patch) | |
tree | 739255a2cfe1c1468cdb468afa83bdbbd4ae3c14 | |
parent | aea6b0c70ccb1a330c1ee2a0f66c3fa72d2700ca (diff) |
PATH-760: Ensuring that the pathfinding attribute field works correctly with multiple objects selected.
-rw-r--r-- | indra/newview/llfloatertools.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 50 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 184 | ||||
-rw-r--r-- | indra/newview/llselectmgr.h | 16 | ||||
-rw-r--r-- | indra/newview/llsidepaneltaskinfo.cpp | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 4 |
6 files changed, 240 insertions, 32 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 3eb0b484dd..99ebb0eb34 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -1198,10 +1198,10 @@ void LLFloaterTools::getMediaState() return; } - BOOL is_nonpermanent = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); - bool editable = is_nonpermanent && (first_object->permModify() || selectedMediaEditable()); + bool editable = is_nonpermanent_enforced && (first_object->permModify() || selectedMediaEditable()); // Check modify permissions and whether any selected objects are in // the process of being fetched. If they are, then we're not editable diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 3890bddfa5..6076cb01fb 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -303,7 +303,7 @@ void LLPanelPermissions::refresh() BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); - BOOL is_nonpermanent = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); @@ -322,7 +322,7 @@ void LLPanelPermissions::refresh() { string_index += 2; } - else if (!is_nonpermanent) + else if (!is_nonpermanent_enforced) { string_index += 4; } @@ -333,27 +333,35 @@ void LLPanelPermissions::refresh() getChildView("perm_modify")->setEnabled(TRUE); getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]); - getChildView("pathfinding_attributes_value")->setEnabled(TRUE); std::string pfAttrName; - if (is_one_object) + + if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsPermanent()) + || LLSelectMgr::getInstance()->selectGetPermanent()) { - if (objectp->flagObjectPermanent()) - { - pfAttrName = "Pathfinding_Object_Attr_Permanent"; - } - else if (objectp->flagCharacter()) - { - pfAttrName = "Pathfinding_Object_Attr_Character"; - } - else - { - pfAttrName = "Pathfinding_Object_Attr_None"; - } + pfAttrName = "Pathfinding_Object_Attr_Permanent"; + } + else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsCharacter()) + || LLSelectMgr::getInstance()->selectGetCharacter()) + { + 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"; } + + getChildView("pathfinding_attributes_value")->setEnabled(TRUE); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); getChildView("Permissions:")->setEnabled(TRUE); @@ -420,7 +428,7 @@ void LLPanelPermissions::refresh() } } - getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent); + getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); getChildView("Name:")->setEnabled(TRUE); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); @@ -630,12 +638,12 @@ void LLPanelPermissions::refresh() BOOL has_change_perm_ability = FALSE; BOOL has_change_sale_ability = FALSE; - if (valid_base_perms && is_nonpermanent && + if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = TRUE; } - if (valid_base_perms && is_nonpermanent && + if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = TRUE; @@ -848,8 +856,8 @@ void LLPanelPermissions::refresh() combo_click_action->setValue(LLSD(combo_value)); } } - getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent && all_volume); - getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent && all_volume); + getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); + getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index d8e6ed296f..791342a555 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2555,6 +2555,190 @@ BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced() return TRUE; } +//----------------------------------------------------------------------------- +// selectGetPermanent() - return TRUE if all objects are permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetPermanent() +{ + 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()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsPermanent() - return TRUE if all root objects are +// permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsPermanent() +{ + 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()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetCharacter() - return TRUE if all objects are character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsCharacter() - return TRUE if all root objects are +// character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetNonPermanent() - return TRUE if all objects are not permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonPermanent() +{ + 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()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonPermanent() - return TRUE if all root objects are not +// permanent +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonPermanent() +{ + 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()) + { + return FALSE; + } + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetNonCharacter() - return TRUE if all objects are not character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetNonCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsNonCharacter() - return TRUE if all root objects are not +// character +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetRootsNonCharacter() +{ + 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->flagCharacter()) + { + return FALSE; + } + } + + return TRUE; +} + //----------------------------------------------------------------------------- // selectGetRootsTransfer() - return TRUE if current agent can transfer all diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 9787493e43..488f8f2efb 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -564,6 +564,22 @@ public: BOOL selectGetRootsNonPermanentEnforced(); BOOL selectGetNonPermanentEnforced(); + // returns TRUE if is all objects are permanent + BOOL selectGetRootsPermanent(); + BOOL selectGetPermanent(); + + // returns TRUE if is all objects are character + BOOL selectGetRootsCharacter(); + BOOL selectGetCharacter(); + + // returns TRUE if is all objects are not permanent + BOOL selectGetRootsNonPermanent(); + BOOL selectGetNonPermanent(); + + // returns TRUE if is all objects are not character + BOOL selectGetRootsNonCharacter(); + BOOL selectGetNonCharacter(); + // returns TRUE if selected objects can be transferred. BOOL selectGetRootsTransfer(); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 8a1fa20a4e..d470554548 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -301,7 +301,7 @@ void LLSidepanelTaskInfo::refresh() // BUG: fails if a root and non-root are both single-selected. const BOOL is_perm_modify = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); - const BOOL is_nonpermanent = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || + const BOOL is_nonpermanent_enforced = (mObjectSelection->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); S32 string_index = 0; @@ -318,7 +318,7 @@ void LLSidepanelTaskInfo::refresh() { string_index += 2; } - else if (!is_nonpermanent) + else if (!is_nonpermanent_enforced) { string_index += 4; } @@ -393,7 +393,7 @@ void LLSidepanelTaskInfo::refresh() } } - getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent); + getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); getChildView("Name:")->setEnabled(TRUE); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); @@ -603,12 +603,12 @@ void LLSidepanelTaskInfo::refresh() BOOL has_change_perm_ability = FALSE; BOOL has_change_sale_ability = FALSE; - if (valid_base_perms && is_nonpermanent && + if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = TRUE; } - if (valid_base_perms && is_nonpermanent && + if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = TRUE; @@ -820,8 +820,8 @@ void LLSidepanelTaskInfo::refresh() ComboClickAction->setCurrentByIndex((S32)click_action); } } - getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent && all_volume); - getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent && all_volume); + getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); + getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); if (!getIsEditing()) { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 3c79fdfb73..b0b4de3a0f 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3890,10 +3890,10 @@ Try enclosing path to the editor with double quotes. <!-- Pathfinding --> <string name="Pathfinding_Wiki_URL">http://wiki.secondlife.com/wiki/Pathfinding_Tools_in_the_Second_Life_Viewer</string> - <string name="Pathfinding_Object_Attr_None"><none></string> + <string name="Pathfinding_Object_Attr_None">None</string> <string name="Pathfinding_Object_Attr_Permanent">Permanent</string> <string name="Pathfinding_Object_Attr_Character">Character</string> - <string name="Pathfinding_Object_Attr_MultiSelect"><multiple></string> + <string name="Pathfinding_Object_Attr_MultiSelect">(Multiple)</string> <!-- Snapshot image quality levels --> <string name="snapshot_quality_very_low">Very Low</string> |