From fcda925072c51de749e6b35b3863f29d8be3eaa6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 29 Mar 2012 18:07:40 -0700 Subject: PATH-450: BUGFIX Ensuring that permanent objects cannot be linked in frozen mode. Displaying a modal notification if user attempts. --- indra/newview/llpanelpermissions.cpp | 11 ++++- indra/newview/llselectmgr.cpp | 54 ++++++++++++++++++++++ indra/newview/llselectmgr.h | 4 ++ indra/newview/llsidepaneltaskinfo.cpp | 10 +++- .../newview/skins/default/xui/en/floater_tools.xml | 8 ++++ .../newview/skins/default/xui/en/notifications.xml | 10 ++++ .../skins/default/xui/en/sidepanel_task_info.xml | 8 ++++ 7 files changed, 103 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 59130236f2..f3a16dbbf1 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -299,6 +299,9 @@ void LLPanelPermissions::refresh() BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); + BOOL is_nonpermanent = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) + || LLSelectMgr::getInstance()->selectGetNonPermanent(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; @@ -307,12 +310,18 @@ void LLPanelPermissions::refresh() getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), - getString("text modify info 4") + getString("text modify info 4"), + getString("text modify info 5"), + getString("text modify info 6") }; if (!is_perm_modify) { string_index += 2; } + else if (!is_nonpermanent) + { + string_index += 4; + } if (!is_one_object) { ++string_index; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index b0aae89a85..44a0b3adc4 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -593,6 +593,12 @@ bool LLSelectMgr::linkObjects() return true; } + if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanent()) + { + LLNotificationsUtil::add("CannotLinkPermanent"); + return true; + } + LLUUID owner_id; std::string owner_name; if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) @@ -2498,6 +2504,54 @@ BOOL LLSelectMgr::selectGetRootsModify() } +//----------------------------------------------------------------------------- +// selectGetPermanent() - return TRUE if current agent can modify all +// selected objects. +//----------------------------------------------------------------------------- +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->isPermanentEnforced()) + { + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +// selectGetRootsModify() - return TRUE if current agent can modify all +// selected root objects. +//----------------------------------------------------------------------------- +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->isPermanentEnforced()) + { + return FALSE; + } + } + + return TRUE; +} + + //----------------------------------------------------------------------------- // selectGetRootsTransfer() - return TRUE if current agent can transfer all // selected root objects. diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 9a066799fe..07eb62a8fa 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -560,6 +560,10 @@ public: BOOL selectGetRootsModify(); BOOL selectGetModify(); + // returns TRUE if is all objects are non-permanent + BOOL selectGetRootsNonPermanent(); + BOOL selectGetNonPermanent(); + // returns TRUE if selected objects can be transferred. BOOL selectGetRootsTransfer(); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 24cb559fd0..4b49ae9f43 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -301,6 +301,8 @@ 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()->selectGetRootsNonPermanent()) || + LLSelectMgr::getInstance()->selectGetNonPermanent(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = @@ -308,12 +310,18 @@ void LLSidepanelTaskInfo::refresh() getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), - getString("text modify info 4") + getString("text modify info 4"), + getString("text modify info 5"), + getString("text modify info 6") }; if (!is_perm_modify) { string_index += 2; } + else if (!is_nonpermanent) + { + string_index += 4; + } if (!is_one_object) { ++string_index; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 528d2a7064..0a90cea886 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -876,6 +876,14 @@ name="text modify info 4"> You can't modify these objects + + You can't modify this object in frozen mode + + + You can't modify these objects in frozen mode + You must select entire object to set permissions diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f6c29cc191..e1a7c6309d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1488,6 +1488,16 @@ Please make sure none are locked, and that you own all of them. fail + +Unable to link permanent objects in frozen mode. + +Please switch to unfrozen mode from the menu option Build->Pathfinding->Basic Setup. + fail + + You can't modify these objects + + You can't modify this object in frozen mode + + + You can't modify these objects in frozen mode + This object has linked parts -- cgit v1.2.3