From 84dd347ae782b5152fdb0fc3b964e88b1c9975c0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 13 Mar 2017 20:48:44 +0200 Subject: MAINT-1324 Warning should appear that objects in different regions can't be linked --- indra/newview/llselectmgr.cpp | 35 ++++++++++++++++++++++ indra/newview/llselectmgr.h | 3 ++ .../newview/skins/default/xui/en/notifications.xml | 8 +++++ 3 files changed, 46 insertions(+) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 353c61da0c..983a7ca1ae 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -614,6 +614,12 @@ bool LLSelectMgr::linkObjects() return true; } + if (!LLSelectMgr::getInstance()->selectGetSameRegion()) + { + LLNotificationsUtil::add("CannotLinkAcrossRegions"); + return true; + } + LLSelectMgr::getInstance()->sendLink(); return true; @@ -2778,6 +2784,35 @@ BOOL LLSelectMgr::selectGetRootsModify() return TRUE; } +//----------------------------------------------------------------------------- +// selectGetSameRegion() - return TRUE if all objects are in same region +//----------------------------------------------------------------------------- +BOOL LLSelectMgr::selectGetSameRegion() +{ + if (getSelection()->isEmpty()) + { + return TRUE; + } + LLViewerObject* object = getSelection()->getFirstObject(); + if (!object) + { + return FALSE; + } + LLViewerRegion* current_region = object->getRegion(); + + for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); + iter != getSelection()->root_end(); iter++) + { + LLSelectNode* node = *iter; + object = node->getObject(); + if (!node->mValid || !object || current_region != object->getRegion()) + { + return FALSE; + } + } + + return TRUE; +} //----------------------------------------------------------------------------- // selectGetNonPermanentEnforced() - return TRUE if all objects are not diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 2a893af266..7ef0032645 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -624,6 +624,9 @@ public: BOOL selectGetRootsModify(); BOOL selectGetModify(); + // returns TRUE if all objects are in same region + BOOL selectGetSameRegion(); + // returns TRUE if is all objects are non-permanent-enforced BOOL selectGetRootsNonPermanentEnforced(); BOOL selectGetNonPermanentEnforced(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a509adfcbc..bcdd182627 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1938,6 +1938,14 @@ Please make sure none are locked, and that you own all of them. fail + +Objects cannot be linked across region boundaries. + fail + +