Conflicts:
	indra/newview/llvovolume.cpp
	indra/newview/skins/default/xui/fr/panel_overlaybar.xml
This commit is contained in:
Siana Gearz
2012-08-09 00:42:23 +02:00
74 changed files with 5078 additions and 562 deletions

View File

@@ -2,31 +2,25 @@
* @file llselectmgr.cpp
* @brief A manager for selected objects and faces.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -281,7 +275,7 @@ void LLSelectMgr::overrideObjectUpdates()
virtual bool apply(LLSelectNode* selectNode)
{
LLViewerObject* object = selectNode->getObject();
if (object && object->permMove())
if (object && object->permMove() && !object->isPermanentEnforced())
{
if (!selectNode->mLastPositionLocal.isExactlyZero())
{
@@ -600,6 +594,12 @@ bool LLSelectMgr::linkObjects()
return true;
}
if (!LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced())
{
LLNotificationsUtil::add("CannotLinkPermanent");
return true;
}
LLUUID owner_id;
std::string owner_name;
if (!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name))
@@ -645,7 +645,9 @@ bool LLSelectMgr::enableLinkObjects()
{
virtual bool apply(LLViewerObject* object)
{
return object->permModify();
LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit();
return object->permModify() && !object->isPermanentEnforced() &&
((root_object == NULL) || !root_object->isPermanentEnforced());
}
} func;
const bool firstonly = true;
@@ -668,10 +670,12 @@ bool LLSelectMgr::enableLinkObjects()
bool LLSelectMgr::enableUnlinkObjects()
{
LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject();
LLViewerObject *root_object = (first_editable_object == NULL) ? NULL : first_editable_object->getRootEdit();
bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
first_editable_object &&
!first_editable_object->isAttachment();
!first_editable_object->isAttachment() && !first_editable_object->isPermanentEnforced() &&
((root_object == NULL) || !root_object->isPermanentEnforced());
// [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g
if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) )
{
@@ -981,7 +985,7 @@ void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp)
}
if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !objectp->permYouOwner())
|| (gSavedSettings.getBOOL("SelectMovableOnly") && !objectp->permMove()))
|| (gSavedSettings.getBOOL("SelectMovableOnly") && (!objectp->permMove() || objectp->isPermanentEnforced())))
{
// only select my own objects
return;
@@ -2292,50 +2296,6 @@ void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)
gMessageSystem->addString("Parameter", buf);
}
//-----------------------------------------------------------------------------
// Rotation options
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionResetRotation()
{
struct f : public LLSelectedObjectFunctor
{
virtual bool apply(LLViewerObject* object)
{
LLQuaternion identity(0.f, 0.f, 0.f, 1.f);
object->setRotation(identity);
if (object->mDrawable.notNull())
{
gPipeline.markMoved(object->mDrawable, TRUE);
}
object->sendRotationUpdate();
return true;
}
} func;
getSelection()->applyToRootObjects(&func);
}
void LLSelectMgr::selectionRotateAroundZ(F32 degrees)
{
LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) );
struct f : public LLSelectedObjectFunctor
{
LLQuaternion mRot;
f(const LLQuaternion& rot) : mRot(rot) {}
virtual bool apply(LLViewerObject* object)
{
object->setRotation( object->getRotationEdit() * mRot );
if (object->mDrawable.notNull())
{
gPipeline.markMoved(object->mDrawable, TRUE);
}
object->sendRotationUpdate();
return true;
}
} func(rot);
getSelection()->applyToRootObjects(&func);
}
//-----------------------------------------------------------------------------
// selectionTexScaleAutofit()
//-----------------------------------------------------------------------------
@@ -2549,6 +2509,341 @@ BOOL LLSelectMgr::selectGetRootsModify()
}
//-----------------------------------------------------------------------------
// selectGetNonPermanentEnforced() - return TRUE if all objects are not
// permanent enforced
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetNonPermanentEnforced()
{
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;
}
//-----------------------------------------------------------------------------
// selectGetRootsNonPermanentEnforced() - return TRUE if all root objects are
// not permanent enforced
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsNonPermanentEnforced()
{
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;
}
//-----------------------------------------------------------------------------
// 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;
}
//-----------------------------------------------------------------------------
// 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
//-----------------------------------------------------------------------------
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;
}
//-----------------------------------------------------------------------------
// selectGetEditableLinksets() - return TRUE if all objects are editable
// pathfinding linksets
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetEditableLinksets()
{
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->flagUsePhysics() ||
object->flagTemporaryOnRez() ||
object->flagCharacter() ||
object->flagVolumeDetect() ||
object->flagAnimSource() ||
(object->getRegion() != gAgent.getRegion()) ||
(!gAgent.isGodlike() &&
!gAgent.canManageEstate() &&
!object->permYouOwner() &&
!object->permMove()))
{
return FALSE;
}
}
return TRUE;
}
//-----------------------------------------------------------------------------
// selectGetViewableCharacters() - return TRUE if all objects are characters
// viewable within the pathfinding characters floater
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetViewableCharacters()
{
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() ||
(object->getRegion() != gAgent.getRegion()))
{
return FALSE;
}
}
return TRUE;
}
//-----------------------------------------------------------------------------
// selectGetRootsTransfer() - return TRUE if current agent can transfer all
// selected root objects.
@@ -4200,13 +4495,6 @@ void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom)
getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows)
{
LLSelectMgrApplyFlags func( FLAGS_CAST_SHADOWS, cast_shadows);
getSelection()->applyToObjects(&func);
}
//----------------------------------------------------------------------
// Helpful packing functions for sendObjectMessage()
//----------------------------------------------------------------------
@@ -6284,7 +6572,7 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object)
}
if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) ||
(gSavedSettings.getBOOL("SelectMovableOnly") && !object->permMove()))
(gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced())))
{
// only select my own objects
return FALSE;
@@ -6978,7 +7266,7 @@ LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first)
bool apply(LLSelectNode* node)
{
LLViewerObject* obj = node->getObject();
return obj && obj->permMove();
return obj && obj->permMove() && !obj->isPermanentEnforced();
}
} func;
LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func);
@@ -7016,9 +7304,10 @@ LLViewerObject* LLObjectSelection::getFirstDeleteableObject()
LLViewerObject* obj = node->getObject();
// you can delete an object if you are the owner
// or you have permission to modify it.
if( obj && ( (obj->permModify()) ||
(obj->permYouOwner()) ||
(!obj->permAnyOwner()) )) // public
if( obj && !obj->isPermanentEnforced() &&
( (obj->permModify()) ||
(obj->permYouOwner()) ||
(!obj->permAnyOwner()) )) // public
{
if( !obj->isAttachment() )
{
@@ -7058,7 +7347,7 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent)
bool apply(LLSelectNode* node)
{
LLViewerObject* obj = node->getObject();
return obj && obj->permMove();
return obj && obj->permMove() && !obj->isPermanentEnforced();
}
} func;
return getFirstSelectedObject(&func, get_parent);
@@ -7127,7 +7416,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ,
{
obj = (*it)->getObject();
bool enable_pos = false, enable_rot = false;
bool perm_move = obj->permMove();
bool perm_move = obj->permMove() && !obj->isPermanentEnforced();
bool perm_mod = obj->permModify();
LLVector3d sel_center(getSelectionCenterGlobal());