summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp1487
1 files changed, 643 insertions, 844 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 3ae4ba9107..b1c6ea7213 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -103,6 +103,10 @@ LLColor4 LLSelectMgr::sHighlightParentColor;
LLColor4 LLSelectMgr::sHighlightChildColor;
LLColor4 LLSelectMgr::sContextSilhouetteColor;
+static LLObjectSelection* get_null_object_selection();
+template<>
+ const LLHandle<LLObjectSelection>::NullFunc
+ LLHandle<LLObjectSelection>::sNullFunc = get_null_object_selection;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// struct LLDeRezInfo
@@ -127,6 +131,13 @@ struct LLDeRezInfo
// Functions
//
+LLObjectSelection* get_null_object_selection()
+{
+ static LLObjectSelectionHandle null_ptr(new LLObjectSelection());
+ return (LLObjectSelection*)null_ptr;
+}
+
+
//-----------------------------------------------------------------------------
// LLSelectMgr()
//-----------------------------------------------------------------------------
@@ -158,7 +169,9 @@ LLSelectMgr::LLSelectMgr()
gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD);
mGridValid = FALSE;
- mSelectType = SELECT_TYPE_WORLD;
+ mSelectedObjects = new LLObjectSelection();
+ mHoverObjects = new LLObjectSelection();
+ mHighlightedObjects = new LLObjectSelection();
}
@@ -167,55 +180,18 @@ LLSelectMgr::LLSelectMgr()
//-----------------------------------------------------------------------------
LLSelectMgr::~LLSelectMgr()
{
- mHoverObjects.deleteAllNodes();
- mSelectedObjects.deleteAllNodes();
- mHighlightedObjects.deleteAllNodes();
+ mHoverObjects->deleteAllNodes();
+ mSelectedObjects->deleteAllNodes();
+ mHighlightedObjects->deleteAllNodes();
mRectSelectedObjects.clear();
mGridObjects.deleteAllNodes();
- mUndoQueue.clear();
- mRedoQueue.clear();
-}
-
-bool LLSelectMgr::applyToObjects(LLSelectedObjectFunctor* func)
-{
- bool result = true;
- LLViewerObject* object;
- for (object = getFirstObject(); object != NULL; object = getNextObject())
- {
- result = result && func->apply(object);
- }
- return result;
-}
-
-bool LLSelectMgr::applyToRootObjects(LLSelectedObjectFunctor* func)
-{
- bool result = true;
- LLViewerObject* object;
- for (object = getFirstRootObject();
- object != NULL;
- object = getNextRootObject())
- {
- result = result && func->apply(object);
- }
- return result;
-}
-
-bool LLSelectMgr::applyToNodes(LLSelectedNodeFunctor *func)
-{
- bool result = true;
- LLSelectNode* node;
- for (node = getFirstNode(); node != NULL; node = getNextNode())
- {
- result = result && func->apply(node);
- }
- return result;
}
void LLSelectMgr::updateEffects()
{
if (mEffectsTimer.getElapsedTimeF32() > 1.f)
{
- mSelectedObjects.updateEffects();
+ mSelectedObjects->updateEffects();
mEffectsTimer.reset();
}
}
@@ -223,7 +199,7 @@ void LLSelectMgr::updateEffects()
//-----------------------------------------------------------------------------
// Select just the object, not any other group members.
//-----------------------------------------------------------------------------
-void LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face)
+LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face)
{
llassert( object );
@@ -232,13 +208,13 @@ void LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face)
// make sure point at position is updated
updatePointAt();
gEditMenuHandler = this;
- return;
+ return NULL;
}
if (!canSelectObject(object))
{
//make_ui_sound("UISndInvalidOp");
- return;
+ return NULL;
}
// llinfos << "Adding object to selected object list" << llendl;
@@ -272,16 +248,18 @@ void LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face)
// have selection manager handle edit menu immediately after
// user selects an object
- if (getObjectCount())
+ if (mSelectedObjects->getObjectCount())
{
gEditMenuHandler = this;
}
+
+ return mSelectedObjects;
}
//-----------------------------------------------------------------------------
// Select the object, parents and children.
//-----------------------------------------------------------------------------
-void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end)
+LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end)
{
llassert( obj );
@@ -292,13 +270,13 @@ void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end)
// make sure pointat position is updated
updatePointAt();
gEditMenuHandler = this;
- return;
+ return NULL;
}
if (!canSelectObject(obj))
{
//make_ui_sound("UISndInvalidOp");
- return;
+ return NULL;
}
// Since we're selecting a family, start at the root, but
@@ -347,16 +325,18 @@ void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end)
// have selection manager handle edit menu immediately after
// user selects an object
- if (getObjectCount())
+ if (mSelectedObjects->getObjectCount())
{
gEditMenuHandler = this;
}
+
+ return mSelectedObjects;
}
//-----------------------------------------------------------------------------
// Select the object, parents and children.
//-----------------------------------------------------------------------------
-void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list,
+LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list,
BOOL send_to_sim)
{
// Collect all of the objects, children included
@@ -364,7 +344,7 @@ void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& o
LLViewerObject *object;
S32 i;
- if (object_list.count() < 1) return;
+ if (object_list.count() < 1) return NULL;
// NOTE -- we add the objects in REVERSE ORDER
// to preserve the order in the mSelectedObjects list
@@ -410,25 +390,25 @@ void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& o
// have selection manager handle edit menu immediately after
// user selects an object
- if (getObjectCount())
+ if (mSelectedObjects->getObjectCount())
{
gEditMenuHandler = this;
}
+
+ return mSelectedObjects;
}
// Use for when the simulator kills an object. This version also
// handles informing the current tool of the object's deletion.
//
// Caller needs to call dialog_refresh_all if necessary.
-BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id)
+BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id)
{
-
-
BOOL object_found = FALSE;
LLTool *tool = NULL;
if (!gNoRender)
{
- tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
+ tool = gToolMgr->getCurrentTool();
// It's possible that the tool is editing an object that is not selected
LLViewerObject* tool_editing_object = tool->getEditingObject();
@@ -443,13 +423,13 @@ BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id)
if( !object_found )
{
LLViewerObject* prevobjp = NULL;
- for( LLViewerObject* tobjp = getFirstObject(); tobjp != NULL; tobjp = getNextObject() )
+ for( LLViewerObject* tobjp = mSelectedObjects->getFirstObject(); tobjp != NULL; tobjp = mSelectedObjects->getNextObject() )
{
if (tobjp == prevobjp)
{
// Somehow we got stuck in an infinite loop... (DaveP)
// this logic is kind of twisted, not sure how this is happening, so...
- llwarns << "Detected infinite loop #1 in LLSelectMgr::selectionRemoveObject:|" << llendl;
+ llwarns << "Detected infinite loop #1 in LLSelectMgr::removeObjectFromSelections:|" << llendl;
//MikeS. adding warning and comment...
//These infinite loops happen because the LLSelectMgr iteration routines are non-reentrant.
//deselectObjectAndFamily uses getFirstObject and getNextObject to mess with the array,
@@ -473,7 +453,7 @@ BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id)
if(object_found == TRUE){
//MikeS. adding warning... This happens when removing a linked attachment while sitting on an object..
//I think the selection manager needs to be rewritten. BAD.
- llwarns << "Detected infinite loop #2 in LLSelectMgr::selectionRemoveObject:|" << llendl;
+ llwarns << "Detected infinite loop #2 in LLSelectMgr::removeObjectFromSelections:|" << llendl;
break;
}
object_found = TRUE;
@@ -594,11 +574,11 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add
nodep = new LLSelectNode(objectp, TRUE);
if (add_to_end)
{
- mSelectedObjects.addNodeAtEnd(nodep);
+ mSelectedObjects->addNodeAtEnd(nodep);
}
else
{
- mSelectedObjects.addNode(nodep);
+ mSelectedObjects->addNode(nodep);
}
objectp->setSelected(TRUE);
@@ -615,7 +595,7 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add
{
// we want this object to be selected for real
// so clear transient flag
- LLSelectNode* select_node = findSelectNode(objectp);
+ LLSelectNode* select_node = mSelectedObjects->findNode(objectp);
if (select_node)
{
select_node->setTransient(FALSE);
@@ -631,21 +611,21 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add
void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoable)
{
// check to see if object is already in list
- LLSelectNode *nodep = findSelectNode(objectp);
+ LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
// if not in list, add it
if (!nodep)
{
nodep = new LLSelectNode(objectp, TRUE);
- mSelectedObjects.addNode(nodep);
+ mSelectedObjects->addNode(nodep);
}
else
{
// make this a full-fledged selection
nodep->setTransient(FALSE);
// Move it to the front of the list
- mSelectedObjects.removeNode(nodep);
- mSelectedObjects.addNode(nodep);
+ mSelectedObjects->removeNode(nodep);
+ mSelectedObjects->addNode(nodep);
}
// Make sure the object is tagged as selected
@@ -679,26 +659,26 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab
}
-void LLSelectMgr::setHoverObject(LLViewerObject *objectp)
+LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp)
{
// Always blitz hover list when setting
- mHoverObjects.deleteAllNodes();
+ mHoverObjects->deleteAllNodes();
if (!objectp)
{
- return;
+ return NULL;
}
// Can't select yourself
if (objectp->mID == gAgentID)
{
- return;
+ return NULL;
}
// Can't select land
if (objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH)
{
- return;
+ return NULL;
}
// Collect all of the objects
@@ -714,15 +694,16 @@ void LLSelectMgr::setHoverObject(LLViewerObject *objectp)
{
cur_objectp = objects[i];
nodep = new LLSelectNode(cur_objectp, FALSE);
- mHoverObjects.addNodeAtEnd(nodep);
+ mHoverObjects->addNodeAtEnd(nodep);
}
requestObjectPropertiesFamily(objectp);
+ return mHoverObjects;
}
LLSelectNode *LLSelectMgr::getHoverNode()
{
- return getHoverObjects().getFirstRootNode();
+ return getHoverObjects()->getFirstRootNode();
}
void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp)
@@ -823,20 +804,20 @@ void LLSelectMgr::unhighlightObjectAndFamily(LLViewerObject* objectp)
void LLSelectMgr::unhighlightAll()
{
mRectSelectedObjects.clear();
- mHighlightedObjects.deleteAllNodes();
+ mHighlightedObjects->deleteAllNodes();
}
-void LLSelectMgr::selectHighlightedObjects()
+LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects()
{
- if (!mHighlightedObjects.getNumNodes())
+ if (!mHighlightedObjects->getNumNodes())
{
- return;
+ return NULL;
}
LLSelectNode *nodep;
- for (nodep = mHighlightedObjects.getFirstNode();
+ for (nodep = mHighlightedObjects->getFirstNode();
nodep;
- nodep = mHighlightedObjects.getNextNode())
+ nodep = mHighlightedObjects->getNextNode())
{
LLViewerObject* objectp = nodep->getObject();
@@ -852,12 +833,12 @@ void LLSelectMgr::selectHighlightedObjects()
}
LLSelectNode* new_nodep = new LLSelectNode(*nodep);
- mSelectedObjects.addNode(new_nodep);
+ mSelectedObjects->addNode(new_nodep);
// flag this object as selected
objectp->setSelected(TRUE);
- mSelectType = getSelectTypeForObject(objectp);
+ mSelectedObjects->mSelectType = getSelectTypeForObject(objectp);
// request properties on root objects
if (objectp->isRootEdit())
@@ -873,10 +854,12 @@ void LLSelectMgr::selectHighlightedObjects()
saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
updatePointAt();
- if (getObjectCount())
+ if (mSelectedObjects->getObjectCount())
{
gEditMenuHandler = this;
}
+
+ return mSelectedObjects;
}
void LLSelectMgr::deselectHighlightedObjects()
@@ -938,7 +921,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
grid_object = NULL;
}
- if (mGridMode == GRID_MODE_LOCAL && gSelectMgr->getObjectCount())
+ if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount())
{
LLBBox bbox = mSavedSelectionBBox;
mGridOrigin = mSavedSelectionBBox.getCenterAgent();
@@ -992,18 +975,18 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
}
else // GRID_MODE_WORLD or just plain default
{
- LLViewerObject* first_object = gSelectMgr->getFirstRootObject();
+ LLViewerObject* first_object = mSelectedObjects->getFirstRootObject();
if (!first_object)
{
- first_object = gSelectMgr->getFirstObject();
+ first_object = mSelectedObjects->getFirstObject();
}
mGridOrigin.clearVec();
mGridRotation.loadIdentity();
- mSelectType = getSelectTypeForObject( first_object );
+ mSelectedObjects->mSelectType = getSelectTypeForObject( first_object );
- switch (mSelectType)
+ switch (mSelectedObjects->mSelectType)
{
case SELECT_TYPE_ATTACHMENT:
if (first_object)
@@ -1032,59 +1015,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
mGridValid = TRUE;
}
-
-
-LLSelectNode* LLSelectMgr::findSelectNode(LLViewerObject *object)
-{
- return mSelectedObjects.findNode(object);
-}
-
-//-----------------------------------------------------------------------------
-// contains()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::contains(LLViewerObject* object)
-{
- return mSelectedObjects.findNode(object) != NULL;
-}
-
-
-//-----------------------------------------------------------------------------
-// contains()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::contains(LLViewerObject* object, S32 te)
-{
- LLSelectNode *nodep;
- if (te == SELECT_ALL_TES)
- {
- // ...all faces
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() )
- {
- if (nodep->getObject() == object)
- {
- BOOL all_selected = TRUE;
- for (S32 i = 0; i < SELECT_MAX_TES; i++)
- {
- all_selected = all_selected && nodep->isTESelected(i);
- }
- return all_selected;
- }
- }
- return FALSE;
- }
- else
- {
- // ...one face
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() )
- {
- if (nodep->getObject() == object && nodep->isTESelected(te))
- {
- return TRUE;
- }
- }
- return FALSE;
- }
-}
-
//-----------------------------------------------------------------------------
// remove() - an array of objects
//-----------------------------------------------------------------------------
@@ -1097,14 +1027,14 @@ void LLSelectMgr::remove(LLDynamicArray<LLViewerObject*>& objects)
for(S32 i = 0; i < count; i++)
{
objectp = objects.get(i);
- for(nodep = mSelectedObjects.getFirstNode();
+ for(nodep = mSelectedObjects->getFirstNode();
nodep != NULL;
- nodep = mSelectedObjects.getNextNode())
+ nodep = mSelectedObjects->getNextNode())
{
if(nodep->getObject() == objectp)
{
objectp->setSelected(FALSE);
- mSelectedObjects.removeNode(nodep);
+ mSelectedObjects->removeNode(nodep);
break;
}
}
@@ -1121,7 +1051,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
{
// check if object already in list
// *FIX: can we just check isSelected()?
- LLSelectNode *nodep = findSelectNode(objectp);
+ LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
if (!nodep)
{
@@ -1133,12 +1063,12 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
if (objectp->getNumTEs() <= 0)
{
// object doesn't have faces, so blow it away
- mSelectedObjects.removeNode(nodep);
+ mSelectedObjects->removeNode(nodep);
objectp->setSelected( FALSE );
}
else if (te == SELECT_ALL_TES)
{
- mSelectedObjects.removeNode(nodep);
+ mSelectedObjects->removeNode(nodep);
objectp->setSelected( FALSE );
}
else if (0 <= te && te < SELECT_MAX_TES)
@@ -1164,7 +1094,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
// ...all faces now turned off, so remove
if (!found)
{
- mSelectedObjects.removeNode(nodep);
+ mSelectedObjects->removeNode(nodep);
objectp->setSelected( FALSE );
// BUG: Doesn't update simulator that object is gone.
@@ -1187,12 +1117,12 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
void LLSelectMgr::removeAll()
{
LLViewerObject *objectp;
- for (objectp = mSelectedObjects.getFirstObject(); objectp; objectp = mSelectedObjects.getNextObject() )
+ for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject() )
{
objectp->setSelected( FALSE );
}
- mSelectedObjects.deleteAllNodes();
+ mSelectedObjects->deleteAllNodes();
updateSelectionCenter();
dialog_refresh_all();
@@ -1209,9 +1139,9 @@ void LLSelectMgr::promoteSelectionToRoot()
LLSelectNode* nodep;
LLViewerObject *objectp;
- for (nodep = mSelectedObjects.getFirstNode();
+ for (nodep = mSelectedObjects->getFirstNode();
nodep;
- nodep = mSelectedObjects.getNextNode() )
+ nodep = mSelectedObjects->getNextNode() )
{
if (nodep->mIndividualSelection)
{
@@ -1247,9 +1177,9 @@ void LLSelectMgr::demoteSelectionToIndividuals()
{
LLDynamicArray<LLViewerObject*> objects;
- for (LLViewerObject* root_objectp = mSelectedObjects.getFirstRootObject();
+ for (LLViewerObject* root_objectp = mSelectedObjects->getFirstRootObject();
root_objectp;
- root_objectp = mSelectedObjects.getNextRootObject())
+ root_objectp = mSelectedObjects->getNextRootObject())
{
root_objectp->addThisAndNonJointChildren(objects);
}
@@ -1265,71 +1195,20 @@ void LLSelectMgr::demoteSelectionToIndividuals()
}
//-----------------------------------------------------------------------------
-// getObjectCount()
-//-----------------------------------------------------------------------------
-S32 LLSelectMgr::getObjectCount()
-{
- return mSelectedObjects.getNumNodes();
-}
-
-
-//-----------------------------------------------------------------------------
-// getTECount()
-//-----------------------------------------------------------------------------
-S32 LLSelectMgr::getTECount()
-{
- S32 count = 0;
-
- LLSelectNode* nodep;
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() )
- {
- if (nodep->getObject())
- {
- S32 num_tes = nodep->getObject()->getNumTEs();
- for (S32 te = 0; te < num_tes; te++)
- {
- if (nodep->isTESelected(te))
- {
- count++;
- }
- }
- }
- }
-
- return count;
-}
-
-//-----------------------------------------------------------------------------
-// getRootObjectCount()
-//-----------------------------------------------------------------------------
-S32 LLSelectMgr::getRootObjectCount()
-{
- LLSelectNode *nodep;
-
- S32 count = 0;
- for(nodep = mSelectedObjects.getFirstRootNode(); nodep; nodep = mSelectedObjects.getNextRootNode())
- {
- ++count;
- }
- return count;
-}
-
-
-//-----------------------------------------------------------------------------
// dump()
//-----------------------------------------------------------------------------
void LLSelectMgr::dump()
{
- llinfos << "Selection Manager: " << mSelectedObjects.getNumNodes() << " items" << llendl;
+ llinfos << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << llendl;
llinfos << "TE mode " << mTEMode << llendl;
S32 i = 0;
LLViewerObject *objectp;
- for (objectp = mSelectedObjects.getFirstObject();
+ for (objectp = mSelectedObjects->getFirstObject();
objectp;
- objectp = mSelectedObjects.getNextObject())
+ objectp = mSelectedObjects->getNextObject())
{
llinfos << "Object " << i << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl;
llinfos << " hasLSL " << objectp->flagScripted() << llendl;
@@ -1347,14 +1226,14 @@ void LLSelectMgr::dump()
// Face iterator
S32 te;
- for (mSelectedObjects.getFirstTE(&objectp, &te);
+ for (mSelectedObjects->getFirstTE(&objectp, &te);
objectp;
- mSelectedObjects.getNextTE(&objectp, &te))
+ mSelectedObjects->getNextTE(&objectp, &te))
{
llinfos << "Object " << objectp << " te " << te << llendl;
}
- llinfos << mHighlightedObjects.getNumNodes() << " objects currently highlighted." << llendl;
+ llinfos << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << llendl;
llinfos << "Center global " << mSelectionCenterGlobal << llendl;
}
@@ -1383,7 +1262,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
if(item
&& !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
- && (mSelectedObjects.getNumNodes() > 1) )
+ && (mSelectedObjects->getNumNodes() > 1) )
{
llwarns << "Attempted to apply no-copy texture to multiple objects"
<< llendl;
@@ -1394,7 +1273,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
S32 te;
// Apply the texture to each side
- for (mSelectedObjects.getFirstTE(&objectp, &te); objectp; mSelectedObjects.getNextTE(&objectp, &te))
+ for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te))
{
if (item)
@@ -1405,14 +1284,14 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
// *TODO: Replace mSelectedObjects with a REAL container class!
LLViewerObject* tmp_object;
S32 tmp_te;
- mSelectedObjects.getCurrentTE(&tmp_object,&tmp_te);
+ mSelectedObjects->getCurrentTE(&tmp_object,&tmp_te);
if ((tmp_object != objectp) || (tmp_te != te) )
{
//AAARG someone has moved our list around!
- mSelectedObjects.getFirstTE(&tmp_object, &tmp_te);
+ mSelectedObjects->getFirstTE(&tmp_object, &tmp_te);
while ((tmp_object != objectp) || (tmp_te != te))
{
- mSelectedObjects.getNextTE(&tmp_object, &tmp_te);
+ mSelectedObjects->getNextTE(&tmp_object, &tmp_te);
}
}
}
@@ -1427,9 +1306,9 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
}
// 1 particle effect per object
- if (mSelectType != SELECT_TYPE_HUD)
+ if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
{
- for (objectp = mSelectedObjects.getFirstObject(); objectp; objectp = mSelectedObjects.getNextObject())
+ for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject())
{
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
effectp->setSourceObject(gAgent.getAvatarObject());
@@ -1447,7 +1326,7 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1456,7 +1335,7 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1473,7 +1352,7 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
LLViewerObject* object;
LLColor4 new_color = color;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1484,7 +1363,7 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1500,7 +1379,7 @@ void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1511,7 +1390,7 @@ void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1525,11 +1404,11 @@ void LLSelectMgr::selectionRevertColors()
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
- LLSelectNode* nodep = mSelectedObjects.findNode(object);
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
if (nodep && te < (S32)nodep->mSavedColors.size())
{
LLColor4 color = nodep->mSavedColors[te];
@@ -1539,7 +1418,7 @@ void LLSelectMgr::selectionRevertColors()
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1554,11 +1433,11 @@ BOOL LLSelectMgr::selectionRevertTextures()
S32 te;
BOOL revert_successful = TRUE;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
- LLSelectNode* nodep = mSelectedObjects.findNode(object);
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
if (nodep && te < (S32)nodep->mSavedTextures.size())
{
LLUUID id = nodep->mSavedTextures[te];
@@ -1577,7 +1456,7 @@ BOOL LLSelectMgr::selectionRevertTextures()
}
// propagate texture changes to server
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1592,7 +1471,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1601,7 +1480,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1614,7 +1493,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1623,7 +1502,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1637,7 +1516,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1646,7 +1525,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1659,7 +1538,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1668,7 +1547,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright)
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1699,7 +1578,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string&
media_flags = LLTextureEntry::MF_WEB_PAGE;
}
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) )
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
{
if (object->permModify())
{
@@ -1708,7 +1587,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string&
}
}
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -1730,7 +1609,7 @@ LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object)
{
LLSelectNode* nodep;
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() )
+ for (nodep = mSelectedObjects->getFirstNode(); nodep; nodep = mSelectedObjects->getNextNode() )
{
if((nodep->getObject() == object) && nodep->mValid)
{
@@ -1749,7 +1628,7 @@ BOOL LLSelectMgr::selectionGetTexUUID(LLUUID& id)
{
LLViewerObject* first_objectp;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_objectp, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_objectp, &first_te);
// nothing selected
if (!first_objectp)
@@ -1767,7 +1646,7 @@ BOOL LLSelectMgr::selectionGetTexUUID(LLUUID& id)
BOOL identical = TRUE;
LLViewerObject *objectp;
S32 te;
- for (mSelectedObjects.getFirstTE(&objectp, &te); objectp; mSelectedObjects.getNextTE(&objectp, &te) )
+ for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te) )
{
if (objectp->getTEImage(te) != first_imagep)
{
@@ -1787,7 +1666,7 @@ BOOL LLSelectMgr::selectionGetColor(LLColor4 &color)
{
LLViewerObject* first_object;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_object, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_object, &first_te);
// nothing selected
if (!first_object)
@@ -1808,7 +1687,7 @@ BOOL LLSelectMgr::selectionGetColor(LLColor4 &color)
BOOL identical = TRUE;
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->getTE(te) || (object->getTE(te)->getColor() != first_color))
{
@@ -1829,7 +1708,7 @@ BOOL LLSelectMgr::selectionGetBumpmap(U8 *bumpmap)
{
LLViewerObject* first_object;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_object, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_object, &first_te);
// nothing selected
if (!first_object)
@@ -1850,7 +1729,7 @@ BOOL LLSelectMgr::selectionGetBumpmap(U8 *bumpmap)
BOOL identical = TRUE;
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->getTE(te) || (object->getTE(te)->getBumpmap() != first_value))
{
@@ -1870,7 +1749,7 @@ BOOL LLSelectMgr::selectionGetShiny(U8 *shiny)
{
LLViewerObject* first_object;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_object, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_object, &first_te);
// nothing selected
if (!first_object)
@@ -1891,7 +1770,7 @@ BOOL LLSelectMgr::selectionGetShiny(U8 *shiny)
BOOL identical = TRUE;
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->getTE(te) || (object->getTE(te)->getShiny() != first_value))
{
@@ -1911,7 +1790,7 @@ BOOL LLSelectMgr::selectionGetFullbright(U8 *fullbright)
{
LLViewerObject* first_object;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_object, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_object, &first_te);
// nothing selected
if (!first_object)
@@ -1932,7 +1811,7 @@ BOOL LLSelectMgr::selectionGetFullbright(U8 *fullbright)
BOOL identical = TRUE;
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->getTE(te) || (object->getTE(te)->getFullbright() != first_value))
{
@@ -1950,7 +1829,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type)
{
LLViewerObject* first_object;
S32 first_te;
- mSelectedObjects.getPrimaryTE(&first_object, &first_te);
+ mSelectedObjects->getPrimaryTE(&first_object, &first_te);
// nothing selected
if (!first_object)
@@ -1971,7 +1850,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type)
bool identical = true;
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->getTE(te) || (object->getTE(te)->getMediaFlags() != first_value))
{
@@ -1992,7 +1871,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type)
void LLSelectMgr::selectionSetMaterial(U8 material)
{
LLViewerObject* object;
- for (object = mSelectedObjects.getFirstObject(); object != NULL; object = mSelectedObjects.getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object != NULL; object = mSelectedObjects->getNextObject() )
{
if (object->permModify())
{
@@ -2008,7 +1887,7 @@ void LLSelectMgr::selectionSetMaterial(U8 material)
BOOL LLSelectMgr::selectionAllPCode(LLPCode code)
{
LLViewerObject *object;
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if (object->getPCode() != code)
{
@@ -2023,13 +1902,13 @@ BOOL LLSelectMgr::selectionAllPCode(LLPCode code)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material)
{
- LLViewerObject *object = mSelectedObjects.getFirstObject();
+ LLViewerObject *object = mSelectedObjects->getFirstObject();
if (!object) return FALSE;
U8 material = object->getMaterial();
BOOL identical = TRUE;
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( material != object->getMaterial())
{
@@ -2044,13 +1923,13 @@ BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material)
BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action)
{
- LLViewerObject *object = mSelectedObjects.getFirstObject();
+ LLViewerObject *object = mSelectedObjects->getFirstObject();
if (!object) return FALSE;
U8 action = object->getClickAction();
BOOL identical = TRUE;
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( action != object->getClickAction())
{
@@ -2066,7 +1945,7 @@ BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action)
void LLSelectMgr::selectionSetClickAction(U8 action)
{
LLViewerObject* object = NULL;
- for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
object->setClickAction(action);
}
@@ -2099,7 +1978,7 @@ void LLSelectMgr::sendGodlikeRequest(const LLString& request, const LLString& pa
}
godlike_request_t data(request, param);
- if(!getRootObjectCount())
+ if(!mSelectedObjects->getRootObjectCount())
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage(message_type.c_str());
@@ -2153,7 +2032,7 @@ void LLSelectMgr::selectionResetRotation()
LLQuaternion identity(0.f, 0.f, 0.f, 1.f);
LLViewerObject* object;
- for (object = mSelectedObjects.getFirstRootObject(); object; object = mSelectedObjects.getNextRootObject() )
+ for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
{
object->setRotation(identity);
if (object->mDrawable.notNull())
@@ -2169,7 +2048,7 @@ void LLSelectMgr::selectionRotateAroundZ(F32 degrees)
LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) );
LLViewerObject* object;
- for (object = mSelectedObjects.getFirstRootObject(); object; object = mSelectedObjects.getNextRootObject() )
+ for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
{
object->setRotation( object->getRotationEdit() * rot );
if (object->mDrawable.notNull())
@@ -2188,7 +2067,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter)
{
LLViewerObject* object;
S32 te;
- for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te))
+ for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
{
if (!object->permModify())
{
@@ -2213,7 +2092,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter)
object->setTEScale(te, new_s, new_t);
}
- for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject())
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject())
{
if (object->permModify())
{
@@ -2280,7 +2159,7 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
BOOL send = FALSE;
- for (selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode())
+ for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode())
{
object = selectNode->getObject();
if (!object->permModify())
@@ -2338,7 +2217,7 @@ void LLSelectMgr::selectionResetTexInfo(S32 selected_face)
S32 start_face, end_face;
LLViewerObject* object;
- for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject())
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject())
{
if (!object->permModify())
{
@@ -2373,259 +2252,12 @@ void LLSelectMgr::selectionResetTexInfo(S32 selected_face)
}
//-----------------------------------------------------------------------------
-// getFirstEditableObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectMgr::getFirstEditableObject(BOOL get_root)
-{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject())
- {
- if( cur->permModify() )
- {
- object = cur;
- break;
- }
- }
-
- if (get_root && object)
- {
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
- {
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
- }
- }
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// getFirstMoveableObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectMgr::getFirstMoveableObject(BOOL get_root)
-{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject())
- {
- if( cur->permMove() )
- {
- object = cur;
- break;
- }
- }
-
- if (get_root && object && !object->isJointChild())
- {
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
- {
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
- }
- }
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// getFirstEditableNode()
-//-----------------------------------------------------------------------------
-LLSelectNode* LLSelectMgr::getFirstEditableNode(BOOL get_root)
-{
- LLSelectNode* selectNode = NULL;
-
- if (get_root)
- {
- for(selectNode = mSelectedObjects.getFirstRootNode(); selectNode; selectNode = mSelectedObjects.getNextRootNode())
- {
- if( selectNode->getObject()->permModify() )
- {
- return selectNode;
- break;
- }
- }
- }
- for(selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode())
- {
- if( selectNode->getObject()->permModify() )
- {
- return selectNode;
- break;
- }
- }
-
- return NULL;
-}
-
-//-----------------------------------------------------------------------------
-// getFirstMoveableNode()
-//-----------------------------------------------------------------------------
-LLSelectNode* LLSelectMgr::getFirstMoveableNode(BOOL get_root)
-{
- LLSelectNode* selectNode = NULL;
-
- if (get_root)
- {
- for(selectNode = mSelectedObjects.getFirstRootNode(); selectNode; selectNode = mSelectedObjects.getNextRootNode())
- {
- if( selectNode->getObject()->permMove() )
- {
- return selectNode;
- break;
- }
- }
- }
- for(selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode())
- {
- if( selectNode->getObject()->permMove() )
- {
- return selectNode;
- break;
- }
- }
-
- return NULL;
-}
-
-//-----------------------------------------------------------------------------
-// getFirstDeleteableObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectMgr::getFirstDeleteableObject(BOOL get_root)
-{
- //RN: don't currently support deletion of child objects, as that requires separating them first
- // then derezzing to trash
- get_root = TRUE;
-
- LLViewerObject* object = NULL;
- if (get_root)
- {
- for(LLViewerObject* current = getFirstRootObject();
- current != NULL;
- current = getNextRootObject())
- {
- // you can delete an object if permissions allow it, you are
- // the owner, you are an officer in the group that owns the
- // object, or you are not the owner but it is on land you own
- // or land owned by your group. (whew!)
- if( (current->permModify())
- || (current->permYouOwner())
- || (!current->permAnyOwner()) // public
- || (current->isOverAgentOwnedLand())
- || (current->isOverGroupOwnedLand())
- )
- {
-
- if( !current->isAttachment() )
- {
- object = current;
- break;
- }
- }
- }
- }
- else
- {
- for(LLViewerObject* current = getFirstObject();
- current != NULL;
- current = getNextObject())
- {
- // you can delete an object if permissions allow it, you are
- // the owner, you are an officer in the group that owns the
- // object, or you are not the owner but it is on land you own
- // or land owned by your group. (whew!)
- if( (current->permModify())
- || (current->permYouOwner())
- || (!current->permAnyOwner()) // public
- || (current->isOverAgentOwnedLand())
- || (current->isOverGroupOwnedLand())
- )
- {
- if( !current->isAttachment() )
- {
- object = current;
- break;
- }
- }
- }
- }
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// getFirstCopyableObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectMgr::getFirstCopyableObject(BOOL get_root)
-{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject())
- {
- if( cur->permCopy() && !cur->isAttachment())
- {
- object = cur;
- break;
- }
- }
-
- if (get_root && object)
- {
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
- {
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
- }
- }
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// areMultpleEditableObjectsSelected()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::areMultpleEditableObjectsSelected()
-{
- S32 count = 0;
- for( LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject() )
- {
- if( cur->permModify() )
- {
- count++;
- if( count > 1 )
- {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
// selectGetAllRootsValid()
// Returns true if the viewer has information on all selected objects
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllRootsValid()
{
- for( LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode() )
+ for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if( !node->mValid )
@@ -2648,7 +2280,7 @@ BOOL LLSelectMgr::selectGetAllRootsValid()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllValid()
{
- for( LLSelectNode* node = getFirstNode(); node; node = getNextNode() )
+ for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
{
if( !node->mValid )
@@ -2671,7 +2303,7 @@ BOOL LLSelectMgr::selectGetAllValid()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetModify()
{
- for( LLSelectNode* node = getFirstNode(); node; node = getNextNode() )
+ for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
{
if( !node->mValid )
{
@@ -2693,7 +2325,7 @@ BOOL LLSelectMgr::selectGetModify()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsModify()
{
- for( LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode() )
+ for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if( !node->mValid )
{
@@ -2716,7 +2348,7 @@ BOOL LLSelectMgr::selectGetRootsModify()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsTransfer()
{
- for(LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode())
+ for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
{
if(!node->mValid)
{
@@ -2737,7 +2369,7 @@ BOOL LLSelectMgr::selectGetRootsTransfer()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsCopy()
{
- for(LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode())
+ for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
{
if(!node->mValid)
{
@@ -2758,8 +2390,8 @@ BOOL LLSelectMgr::selectGetRootsCopy()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name)
{
- LLSelectNode* node = getFirstRootNode();
- if(!node) node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
+ if(!node) node = mSelectedObjects->getFirstNode();
if(!node) return FALSE;
if(!node->mValid) return FALSE;
LLViewerObject* obj = node->getObject();
@@ -2769,7 +2401,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name)
id = node->mPermissions->getCreator();
BOOL identical = TRUE;
- for ( node = getNextRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -2808,8 +2440,8 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
{
- LLSelectNode* node = getFirstRootNode();
- if(!node) node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
+ if(!node) node = mSelectedObjects->getFirstNode();
if(!node) return FALSE;
if(!node->mValid) return FALSE;
LLViewerObject* obj = node->getObject();
@@ -2821,7 +2453,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
node->mPermissions->getOwnership(id, group_owner);
BOOL identical = TRUE;
- for ( node = getNextRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -2876,8 +2508,8 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name)
{
- LLSelectNode* node = getFirstRootNode();
- if(!node) node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
+ if(!node) node = mSelectedObjects->getFirstNode();
if(!node) return FALSE;
if(!node->mValid) return FALSE;
LLViewerObject* obj = node->getObject();
@@ -2887,7 +2519,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name)
id = node->mPermissions->getLastOwner();
BOOL identical = TRUE;
- for ( node = getNextRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -2935,8 +2567,8 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetGroup(LLUUID& id)
{
- LLSelectNode* node = getFirstRootNode();
- if(!node) node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
+ if(!node) node = mSelectedObjects->getFirstNode();
if(!node) return FALSE;
if(!node->mValid) return FALSE;
LLViewerObject* obj = node->getObject();
@@ -2946,7 +2578,7 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& id)
id = node->mPermissions->getGroup();
BOOL identical = TRUE;
- for ( node = getNextRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -2971,8 +2603,8 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& id)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectIsGroupOwned()
{
- LLSelectNode* node = getFirstRootNode();
- if(!node) node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
+ if(!node) node = mSelectedObjects->getFirstNode();
if(!node) return FALSE;
if(!node->mValid) return FALSE;
LLViewerObject* obj = node->getObject();
@@ -2983,7 +2615,7 @@ BOOL LLSelectMgr::selectIsGroupOwned()
if(is_group_owned)
{
- for ( node = getNextRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -3012,7 +2644,7 @@ BOOL LLSelectMgr::selectIsGroupOwned()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
{
- LLSelectNode* node = getFirstRootNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
if (!node) return FALSE;
if (!node->mValid) return FALSE;
@@ -3021,7 +2653,7 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
U32 mask_or = 0x00000000;
BOOL all_valid = TRUE;
- for ( node = getFirstRootNode(); node; node = getNextRootNode() )
+ for ( node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (!node->mValid)
{
@@ -3075,17 +2707,17 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
BOOL LLSelectMgr::selectGetOwnershipCost(S32* out_cost)
{
- return mSelectedObjects.getOwnershipCost(*out_cost);
+ return mSelectedObjects->getOwnershipCost(*out_cost);
}
BOOL LLSelectMgr::selectGetPermissions(LLPermissions& perm)
{
- LLSelectNode* node = getFirstRootNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
if (!node) return FALSE;
if (!node->mValid) return FALSE;
BOOL valid = TRUE;
perm = *(node->mPermissions);
- for(node = getNextRootNode(); node != NULL; node = getNextRootNode())
+ for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode())
{
if(!node->mValid)
{
@@ -3105,9 +2737,9 @@ void LLSelectMgr::selectDelete()
BOOL locked_but_deleteable_object = FALSE;
BOOL no_copy_but_deleteable_object = FALSE;
BOOL all_owned_by_you = TRUE;
- for(LLViewerObject* obj = getFirstObject();
+ for(LLViewerObject* obj = mSelectedObjects->getFirstObject();
obj != NULL;
- obj = getNextObject())
+ obj = mSelectedObjects->getNextObject())
{
if( obj->isAttachment() )
{
@@ -3226,13 +2858,13 @@ void LLSelectMgr::confirmDelete(S32 option, void* data)
(void*)info,
SEND_ONLY_ROOTS);
// VEFFECT: Delete Object - one effect for all deletes
- if (self->mSelectType != SELECT_TYPE_HUD)
+ if (self->mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
{
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
effectp->setPositionGlobal( self->getSelectionCenterGlobal() );
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
F32 duration = 0.5f;
- duration += self->getObjectCount() / 64.f;
+ duration += self->mSelectedObjects->getObjectCount() / 64.f;
effectp->setDuration(duration);
}
@@ -3240,7 +2872,7 @@ void LLSelectMgr::confirmDelete(S32 option, void* data)
// Keep track of how many objects have been deleted.
F64 obj_delete_count = gViewerStats->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT);
- obj_delete_count += self->getObjectCount();
+ obj_delete_count += self->mSelectedObjects->getObjectCount();
gViewerStats->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count );
}
break;
@@ -3270,7 +2902,7 @@ BOOL LLSelectMgr::selectIsForSale(S32& price)
price = 0;
LLSelectNode *node;
- for (node = getFirstRootNode(); node; node = getNextRootNode() )
+ for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
{
if (node->mSaleInfo.isForSale())
{
@@ -3287,12 +2919,12 @@ BOOL LLSelectMgr::selectIsForSale(S32& price)
// accumulated sale info.
BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info)
{
- LLSelectNode* node = getFirstRootNode();
+ LLSelectNode* node = mSelectedObjects->getFirstRootNode();
if (!node) return FALSE;
if (!node->mValid) return FALSE;
BOOL valid = TRUE;
sale_info = node->mSaleInfo;
- for(node = getNextRootNode(); node != NULL; node = getNextRootNode())
+ for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode())
{
if(!node->mValid)
{
@@ -3306,12 +2938,12 @@ BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info)
BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm)
{
- LLSelectNode* node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstNode();
if (!node) return FALSE;
if (!node->mValid) return FALSE;
BOOL valid = TRUE;
ag_perm = node->mAggregatePerm;
- for(node = getNextNode(); node != NULL; node = getNextNode())
+ for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode())
{
if(!node->mValid)
{
@@ -3325,12 +2957,12 @@ BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm)
BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm)
{
- LLSelectNode* node = getFirstNode();
+ LLSelectNode* node = mSelectedObjects->getFirstNode();
if (!node) return FALSE;
if (!node->mValid) return FALSE;
BOOL valid = TRUE;
ag_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm;
- for(node = getNextNode(); node != NULL; node = getNextNode())
+ for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode())
{
if(!node->mValid)
{
@@ -3343,12 +2975,6 @@ BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& a
}
-// returns TRUE is any node is currenly worn as an attachment
-BOOL LLSelectMgr::selectionIsAttachment()
-{
- return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD);
-}
-
//--------------------------------------------------------------------
// Duplicate objects
//--------------------------------------------------------------------
@@ -3364,7 +2990,7 @@ struct LLDuplicateData
void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
{
- if (selectionIsAttachment())
+ if (mSelectedObjects->isAttachment())
{
//RN: do not duplicate attachments
make_ui_sound("UISndInvalidOp");
@@ -3384,7 +3010,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
}
else
{
- for (LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode())
+ for (LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
{
node->mDuplicated = TRUE;
node->mDuplicatePos = node->getObject()->getPositionGlobal();
@@ -3395,7 +3021,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
void LLSelectMgr::repeatDuplicate()
{
- if (selectionIsAttachment())
+ if (mSelectedObjects->isAttachment())
{
//RN: do not duplicate attachments
make_ui_sound("UISndInvalidOp");
@@ -3405,7 +3031,7 @@ void LLSelectMgr::repeatDuplicate()
LLSelectNode* node;
LLDynamicArray<LLViewerObject*> non_duplicated_objects;
- for (node = getFirstRootNode(); node; node = getNextRootNode())
+ for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
{
if (!node->mDuplicated)
{
@@ -3428,7 +3054,7 @@ void LLSelectMgr::repeatDuplicate()
sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS);
// move current selection based on delta from duplication position and update duplication position
- for (node = getFirstRootNode(); node; node = getNextRootNode())
+ for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
{
if (node->mDuplicated)
{
@@ -3483,7 +3109,7 @@ void LLSelectMgr::selectDuplicateOnRay(const LLVector3 &ray_start_region,
BOOL copy_rotates,
BOOL select_copy)
{
- if (selectionIsAttachment())
+ if (mSelectedObjects->isAttachment())
{
// do not duplicate attachments
make_ui_sound("UISndInvalidOp");
@@ -3695,7 +3321,7 @@ struct LLPermData
};
// TODO: Make this able to fail elegantly.
-void LLSelectMgr::setObjectPermissions(U8 field,
+void LLSelectMgr::selectionSetObjectPermissions(U8 field,
BOOL set,
U32 mask,
BOOL override)
@@ -3732,7 +3358,7 @@ void LLSelectMgr::sendSelect()
void LLSelectMgr::deselectAll()
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -3753,42 +3379,29 @@ void LLSelectMgr::deselectAll()
updateSelectionCenter();
}
-void LLSelectMgr::deselectTransient()
+void LLSelectMgr::deselectUnused()
{
- std::set<LLViewerObject*> objects_to_deselect;
- LLSelectNode *nodep;
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode())
+ // no more outstanding references to this selection
+ if (mSelectedObjects->getNumRefs() == 1)
{
- if (nodep->isTransient())
- {
- objects_to_deselect.insert(nodep->getObject());
- }
- }
-
- std::set<LLViewerObject*>::iterator iter;
- for (iter = objects_to_deselect.begin();
- iter != objects_to_deselect.end();
- ++iter)
- {
- deselectObjectOnly(*iter);
+ deselectAll();
}
-
- gHUDManager->clearJoints();
- updateSelectionCenter();
}
void LLSelectMgr::convertTransient()
{
- LLSelectNode *nodep;
- for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode())
+ // use STL-style iteration to avoid recursive iteration problems
+ LLObjectSelection::iterator node_it;
+ for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it)
{
+ LLSelectNode *nodep = *node_it;
nodep->setTransient(FALSE);
}
}
void LLSelectMgr::deselectAllIfTooFar()
{
- if (isEmpty() || mSelectType == SELECT_TYPE_HUD)
+ if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD)
{
return;
}
@@ -3825,10 +3438,10 @@ void LLSelectMgr::deselectAllIfTooFar()
}
-void LLSelectMgr::setObjectName(const LLString& name)
+void LLSelectMgr::selectionSetObjectName(const LLString& name)
{
// we only work correctly if 1 object is selected.
- if(getRootObjectCount() == 1)
+ if(mSelectedObjects->getRootObjectCount() == 1)
{
sendListToRegions("ObjectName",
packAgentAndSessionID,
@@ -3836,7 +3449,7 @@ void LLSelectMgr::setObjectName(const LLString& name)
(void*)name.c_str(),
SEND_ONLY_ROOTS);
}
- else if(getObjectCount() == 1)
+ else if(mSelectedObjects->getObjectCount() == 1)
{
sendListToRegions("ObjectName",
packAgentAndSessionID,
@@ -3846,10 +3459,10 @@ void LLSelectMgr::setObjectName(const LLString& name)
}
}
-void LLSelectMgr::setObjectDescription(const LLString& desc)
+void LLSelectMgr::selectionSetObjectDescription(const LLString& desc)
{
// we only work correctly if 1 object is selected.
- if(getRootObjectCount() == 1)
+ if(mSelectedObjects->getRootObjectCount() == 1)
{
sendListToRegions("ObjectDescription",
packAgentAndSessionID,
@@ -3857,7 +3470,7 @@ void LLSelectMgr::setObjectDescription(const LLString& desc)
(void*)desc.c_str(),
SEND_ONLY_ROOTS);
}
- else if(getObjectCount() == 1)
+ else if(mSelectedObjects->getObjectCount() == 1)
{
sendListToRegions("ObjectDescription",
packAgentAndSessionID,
@@ -3867,11 +3480,11 @@ void LLSelectMgr::setObjectDescription(const LLString& desc)
}
}
-void LLSelectMgr::setObjectCategory(const LLCategory& category)
+void LLSelectMgr::selectionSetObjectCategory(const LLCategory& category)
{
// for now, we only want to be able to set one root category at
// a time.
- if(getRootObjectCount() != 1) return;
+ if(mSelectedObjects->getRootObjectCount() != 1) return;
sendListToRegions("ObjectCategory",
packAgentAndSessionID,
packObjectCategory,
@@ -3879,10 +3492,10 @@ void LLSelectMgr::setObjectCategory(const LLCategory& category)
SEND_ONLY_ROOTS);
}
-void LLSelectMgr::setObjectSaleInfo(const LLSaleInfo& sale_info)
+void LLSelectMgr::selectionSetObjectSaleInfo(const LLSaleInfo& sale_info)
{
// Only one sale info at a time for now
- if(getRootObjectCount() != 1) return;
+ if(mSelectedObjects->getRootObjectCount() != 1) return;
sendListToRegions("ObjectSaleInfo",
packAgentAndSessionID,
packObjectSaleInfo,
@@ -3896,9 +3509,9 @@ void LLSelectMgr::setObjectSaleInfo(const LLSaleInfo& sale_info)
void LLSelectMgr::sendAttach(U8 attachment_point)
{
- LLViewerObject* attach_object = mSelectedObjects.getFirstRootObject();
+ LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject();
- if (!attach_object || !gAgent.getAvatarObject() || mSelectType != SELECT_TYPE_WORLD)
+ if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
{
return;
}
@@ -3964,7 +3577,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
void LLSelectMgr::sendDetach()
{
- if (!mSelectedObjects.getNumNodes() || mSelectType == SELECT_TYPE_WORLD)
+ if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
{
return;
}
@@ -3980,7 +3593,7 @@ void LLSelectMgr::sendDetach()
void LLSelectMgr::sendDropAttachment()
{
- if (!mSelectedObjects.getNumNodes() || mSelectType == SELECT_TYPE_WORLD)
+ if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD)
{
return;
}
@@ -3999,7 +3612,7 @@ void LLSelectMgr::sendDropAttachment()
void LLSelectMgr::sendLink()
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -4014,7 +3627,7 @@ void LLSelectMgr::sendLink()
void LLSelectMgr::sendDelink()
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -4036,7 +3649,7 @@ void LLSelectMgr::sendDelink()
void LLSelectMgr::sendHinge(U8 type)
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -4052,7 +3665,7 @@ void LLSelectMgr::sendHinge(U8 type)
void LLSelectMgr::sendDehinge()
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -4067,7 +3680,7 @@ void LLSelectMgr::sendDehinge()
void LLSelectMgr::sendSelect()
{
- if (!mSelectedObjects.getNumNodes())
+ if (!mSelectedObjects->getNumNodes())
{
return;
}
@@ -4097,7 +3710,7 @@ void LLSelectMgr::selectionDump()
{
LLViewerObject *object;
- for (object = getFirstObject(); object; object = getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
object->dump();
}
@@ -4106,7 +3719,7 @@ void LLSelectMgr::selectionDump()
void LLSelectMgr::saveSelectedObjectColors()
{
LLSelectNode* selectNode;
- for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() )
+ for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
{
selectNode->saveColors();
}
@@ -4117,7 +3730,7 @@ void LLSelectMgr::saveSelectedObjectTextures()
LLSelectNode* selectNode;
// invalidate current selection so we update saved textures
- for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() )
+ for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
{
selectNode->mValid = FALSE;
}
@@ -4133,13 +3746,13 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
{
LLSelectNode* selectNode;
- if (isEmpty())
+ if (mSelectedObjects->isEmpty())
{
// nothing selected, so nothing to save
return;
}
- for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() )
+ for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
{
LLViewerObject* object;
object = selectNode->getObject();
@@ -4170,42 +3783,6 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
selectNode->mSavedScale = object->getScale();
selectNode->saveTextureScaleRatios();
- if (object->isAttachment() &&
- action_type != SELECT_ACTION_TYPE_PICK)
- {
- LLSelectAction* selectAction = new LLSelectAction();
- selectAction->mActionType = action_type;
- selectAction->mPosition = object->getPosition();
- selectAction->mRotation = object->getRotation();
- selectAction->mScale = object->getScale();
- selectAction->mObjectID = object->getID();
- selectAction->mIndividualSelection = selectNode->mIndividualSelection;
-
- mUndoQueue.push_back(selectAction);
-
- while ((mUndoQueue.size() > (U32)MAX_ACTION_QUEUE_SIZE))
- {
- LLSelectAction* action = mUndoQueue.front();
- mUndoQueue.pop_front();
- delete action;
- }
-
- // remove this object from the redo queue
- std::deque<LLSelectAction*>::iterator it;
- for (it = mRedoQueue.begin(); it != mRedoQueue.end();)
- {
- if ((*it)->mObjectID == object->getID())
- {
- LLSelectAction* actionp = *it;
- it = mRedoQueue.erase(it);
- delete actionp;
- }
- else
- {
- ++it;
- }
- }
- }
}
mSavedSelectionBBox = getBBoxOfSelection();
}
@@ -4214,7 +3791,7 @@ void LLSelectMgr::selectionUpdatePhysics(BOOL physics)
{
LLViewerObject *object;
- for (object = getFirstObject(); object; object = getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( !object->permModify() // preemptive permissions check
|| !(object->isRoot() // don't send for child objects
@@ -4230,7 +3807,7 @@ void LLSelectMgr::selectionUpdateTemporary(BOOL is_temporary)
{
LLViewerObject *object;
- for (object = getFirstObject(); object; object = getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( !object->permModify() // preemptive permissions check
|| !(object->isRoot() // don't send for child objects
@@ -4246,7 +3823,7 @@ void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom)
{
LLViewerObject *object;
- for (object = getFirstObject(); object; object = getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( !object->permModify() // preemptive permissions check
|| !(object->isRoot() // don't send for child objects
@@ -4262,7 +3839,7 @@ void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows)
{
LLViewerObject *object;
- for (object = getFirstObject(); object; object = getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
if ( !object->permModify() // preemptive permissions check
|| object->isJointChild())
@@ -4491,65 +4068,65 @@ void LLSelectMgr::sendListToRegions(const LLString& message_name,
switch(send_type)
{
case SEND_ONLY_ROOTS:
- node = mSelectedObjects.getFirstRootNode();
+ node = mSelectedObjects->getFirstRootNode();
while(node)
{
nodes_to_send.push(node);
- node = mSelectedObjects.getNextRootNode();
+ node = mSelectedObjects->getNextRootNode();
}
break;
case SEND_INDIVIDUALS:
- node = mSelectedObjects.getFirstNode();
+ node = mSelectedObjects->getFirstNode();
while(node)
{
nodes_to_send.push(node);
- node = mSelectedObjects.getNextNode();
+ node = mSelectedObjects->getNextNode();
}
break;
case SEND_ROOTS_FIRST:
// first roots...
- node = mSelectedObjects.getFirstNode();
+ node = mSelectedObjects->getFirstNode();
while(node)
{
if (node->getObject()->isRootEdit())
{
nodes_to_send.push(node);
}
- node = mSelectedObjects.getNextNode();
+ node = mSelectedObjects->getNextNode();
}
// then children...
- node = mSelectedObjects.getFirstNode();
+ node = mSelectedObjects->getFirstNode();
while(node)
{
if (!node->getObject()->isRootEdit())
{
nodes_to_send.push(node);
}
- node = mSelectedObjects.getNextNode();
+ node = mSelectedObjects->getNextNode();
}
break;
case SEND_CHILDREN_FIRST:
// first children...
- node = mSelectedObjects.getFirstNode();
+ node = mSelectedObjects->getFirstNode();
while(node)
{
if (!node->getObject()->isRootEdit())
{
nodes_to_send.push(node);
}
- node = mSelectedObjects.getNextNode();
+ node = mSelectedObjects->getNextNode();
}
// ...then roots
- node = mSelectedObjects.getFirstNode();
+ node = mSelectedObjects->getFirstNode();
while(node)
{
if (node->getObject()->isRootEdit())
{
nodes_to_send.push(node);
}
- node = mSelectedObjects.getNextNode();
+ node = mSelectedObjects->getNextNode();
}
break;
@@ -4731,9 +4308,9 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
// Iterate through nodes at end, since it can be on both the regular AND hover list
BOOL found = FALSE;
LLSelectNode* node;
- for (node = gSelectMgr->mSelectedObjects.getFirstNode();
+ for (node = gSelectMgr->mSelectedObjects->getFirstNode();
node;
- node = gSelectMgr->mSelectedObjects.getNextNode())
+ node = gSelectMgr->mSelectedObjects->getNextNode())
{
if (node->getObject()->mID == id)
{
@@ -4881,9 +4458,9 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use
// Now look through all of the hovered nodes
BOOL found = FALSE;
LLSelectNode* node;
- for (node = gSelectMgr->mHoverObjects.getFirstNode();
+ for (node = gSelectMgr->mHoverObjects->getFirstNode();
node;
- node = gSelectMgr->mHoverObjects.getNextNode())
+ node = gSelectMgr->mHoverObjects->getNextNode())
{
if (node->getObject()->mID == id)
{
@@ -4966,7 +4543,7 @@ void LLSelectMgr::updateSilhouettes()
if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom)
{
- for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() )
+ for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
{
if (node->getObject())
{
@@ -4979,7 +4556,7 @@ void LLSelectMgr::updateSilhouettes()
LLDynamicArray<LLViewerObject*> changed_objects;
- if (mSelectedObjects.getNumNodes())
+ if (mSelectedObjects->getNumNodes())
{
//gGLSPipelineSelection.set();
@@ -4988,7 +4565,7 @@ void LLSelectMgr::updateSilhouettes()
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() )
+ for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
{
LLViewerObject* objectp = node->getObject();
@@ -5058,7 +4635,7 @@ void LLSelectMgr::updateSilhouettes()
// remove highlight nodes not in roots list
LLDynamicArray<LLSelectNode*> remove_these_nodes;
LLDynamicArray<LLViewerObject*> remove_these_roots;
- for (LLSelectNode* nodep = mHighlightedObjects.getFirstNode(); nodep; nodep = mHighlightedObjects.getNextNode())
+ for (LLSelectNode* nodep = mHighlightedObjects->getFirstNode(); nodep; nodep = mHighlightedObjects->getNextNode())
{
LLViewerObject* objectp = nodep->getObject();
if (objectp->isRoot() || !select_linked_set)
@@ -5087,7 +4664,7 @@ void LLSelectMgr::updateSilhouettes()
S32 i;
for (i = 0; i < remove_these_nodes.count(); i++)
{
- mHighlightedObjects.removeNode(remove_these_nodes[i]);
+ mHighlightedObjects->removeNode(remove_these_nodes[i]);
}
// remove all root objects already being highlighted
@@ -5109,7 +4686,7 @@ void LLSelectMgr::updateSilhouettes()
continue;
}
- mHighlightedObjects.addNode(rect_select_node);
+ mHighlightedObjects->addNode(rect_select_node);
if (!select_linked_set)
{
@@ -5128,7 +4705,7 @@ void LLSelectMgr::updateSilhouettes()
rect_select_node = new LLSelectNode(objectp->mChildList[i], TRUE);
rect_select_node->selectAllTEs(TRUE);
- mHighlightedObjects.addNode(rect_select_node);
+ mHighlightedObjects->addNode(rect_select_node);
}
}
}
@@ -5139,7 +4716,7 @@ void LLSelectMgr::updateSilhouettes()
//BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mHighlightedObjects.getFirstNode(); node; node = mHighlightedObjects.getNextNode() )
+ for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() )
{
LLViewerObject* objectp = node->getObject();
@@ -5188,7 +4765,7 @@ void LLSelectMgr::updateSilhouettes()
}
else
{
- mHighlightedObjects.deleteAllNodes();
+ mHighlightedObjects->deleteAllNodes();
}
for (S32 i = 0; i < changed_objects.count(); i++)
@@ -5235,13 +4812,13 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
glScalef(cur_zoom, cur_zoom, cur_zoom);
}
- if (mSelectedObjects.getNumNodes())
+ if (mSelectedObjects->getNumNodes())
{
glPushAttrib(GL_FOG_BIT);
LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID();
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() )
+ for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
{
LLViewerObject* objectp = node->getObject();
if (objectp->isHUDAttachment() != for_hud)
@@ -5272,13 +4849,13 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
glPopAttrib();
}
- if (mHighlightedObjects.getNumNodes())
+ if (mHighlightedObjects->getNumNodes())
{
// render silhouettes for highlighted objects
BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mHighlightedObjects.getFirstNode(); node; node = mHighlightedObjects.getNextNode() )
+ for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() )
{
LLViewerObject* objectp = node->getObject();
if (objectp->isHUDAttachment() != for_hud)
@@ -5889,7 +5466,7 @@ void LLSelectMgr::updateSelectionCenter()
const F32 MOVE_SELECTION_THRESHOLD = 1.f; // Movement threshold in meters for updating selection
// center (tractor beam)
- LLViewerObject* object = mSelectedObjects.getFirstObject();
+ LLViewerObject* object = mSelectedObjects->getFirstObject();
if (!object)
{
// nothing selected, probably grabbing
@@ -5906,9 +5483,9 @@ void LLSelectMgr::updateSelectionCenter()
}
else
{
- mSelectType = getSelectTypeForObject(object);
+ mSelectedObjects->mSelectType = getSelectTypeForObject(object);
- if (mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+ if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
{
mPauseRequest = gAgent.getAvatarObject()->requestPause();
}
@@ -5917,7 +5494,7 @@ void LLSelectMgr::updateSelectionCenter()
mPauseRequest = NULL;
}
- if (mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject())
+ if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject())
{
// reset hud ZOOM
gAgent.getAvatarObject()->mHUDTargetZoom = 1.f;
@@ -5933,11 +5510,11 @@ void LLSelectMgr::updateSelectionCenter()
gHUDManager->clearJoints();
LLDynamicArray < LLViewerObject *> jointed_objects;
- for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() )
+ for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
{
LLViewerObject *myAvatar = gAgent.getAvatarObject();
LLViewerObject *root = object->getRootEdit();
- if (mSelectType == SELECT_TYPE_WORLD && // not an attachment
+ if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
!root->isChild(myAvatar) && // not the object you're sitting on
!object->isAvatar()) // not another avatar
{
@@ -5964,7 +5541,7 @@ void LLSelectMgr::updateSelectionCenter()
if ( !(gAgentID == LLUUID::null) )
{
- LLTool *tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
+ LLTool *tool = gToolMgr->getCurrentTool();
if (mShowSelection)
{
LLVector3d select_center_global;
@@ -5991,7 +5568,7 @@ void LLSelectMgr::updateSelectionCenter()
}
// give up edit menu if no objects selected
- if (gEditMenuHandler == this && getObjectCount() == 0)
+ if (gEditMenuHandler == this && mSelectedObjects->getObjectCount() == 0)
{
gEditMenuHandler = NULL;
}
@@ -6001,7 +5578,7 @@ void LLSelectMgr::updatePointAt()
{
if (mShowSelection)
{
- if (getObjectCount())
+ if (mSelectedObjects->getObjectCount())
{
LLVector3 select_offset;
LLViewerObject *click_object = gObjectList.findObject(gLastHitObjectID);
@@ -6017,8 +5594,8 @@ void LLSelectMgr::updatePointAt()
else
{
// didn't click on an object this time, revert to pointing at center of first object
- gAgent.setPointAt(POINTAT_TARGET_SELECT, getFirstObject());
- gAgent.setLookAt(LOOKAT_TARGET_SELECT, getFirstObject());
+ gAgent.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
+ gAgent.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject());
}
}
else
@@ -6048,7 +5625,7 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canUndo()
{
- return getFirstEditableObject() != NULL;
+ return mSelectedObjects->getFirstEditableObject() != NULL;
}
//-----------------------------------------------------------------------------
@@ -6066,7 +5643,7 @@ void LLSelectMgr::undo()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canRedo()
{
- return getFirstEditableObject() != NULL;
+ return mSelectedObjects->getFirstEditableObject() != NULL;
}
//-----------------------------------------------------------------------------
@@ -6084,7 +5661,7 @@ void LLSelectMgr::redo()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDoDelete()
{
- return getFirstDeleteableObject() != NULL;
+ return mSelectedObjects->getFirstDeleteableObject() != NULL;
}
//-----------------------------------------------------------------------------
@@ -6100,7 +5677,7 @@ void LLSelectMgr::doDelete()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDeselect()
{
- return !isEmpty();
+ return !mSelectedObjects->isEmpty();
}
//-----------------------------------------------------------------------------
@@ -6115,7 +5692,7 @@ void LLSelectMgr::deselect()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDuplicate()
{
- return getFirstCopyableObject() != NULL;
+ return mSelectedObjects->getFirstCopyableObject() != NULL;
}
//-----------------------------------------------------------------------------
// duplicate()
@@ -6125,125 +5702,6 @@ void LLSelectMgr::duplicate()
LLVector3 offset(0.5f, 0.5f, 0.f);
selectDuplicate(offset, TRUE);
}
-//-----------------------------------------------------------------------------
-// undoRedo()
-//-----------------------------------------------------------------------------
-U32 LLSelectMgr::undoRedo(std::deque<LLSelectAction*> &queue_src, std::deque<LLSelectAction*> &queue_dst, const LLUUID &object_id)
-{
- if (queue_src.size() == 0)
- {
- return 0;
- }
-
- U32 update_type = 0;
- std::deque<LLSelectAction*> temp_queue;
- LLSelectAction* src_actionp = queue_src.back();
-
- while (src_actionp->mObjectID != object_id)
- {
- temp_queue.push_back(src_actionp);
- queue_src.pop_back();
- if (!queue_src.size())
- {
- // put everything back
- LLSelectAction* actionp;
- while (temp_queue.size())
- {
- actionp = temp_queue.back();
- temp_queue.pop_back();
- queue_src.push_back(actionp);
- }
- return 0;
- }
- src_actionp = queue_src.back();
- }
-
- if(src_actionp)
- {
- LLSelectAction* dst_actionp = new LLSelectAction();
- dst_actionp->mActionType = src_actionp->mActionType;
- dst_actionp->mObjectID = src_actionp->mObjectID;
- dst_actionp->mIndividualSelection = src_actionp->mIndividualSelection;
-
- LLViewerObject* object = gObjectList.findObject(src_actionp->mObjectID);
- if (object && object->mDrawable.notNull())
- {
- LLVector3 old_position_local = object->getPosition();
-
- switch(src_actionp->mActionType)
- {
- case SELECT_ACTION_TYPE_MOVE:
- dst_actionp->mPosition = object->mDrawable->getPosition();
- object->setPosition(src_actionp->mPosition, TRUE);
- if (object->isRootEdit() && src_actionp->mIndividualSelection)
- {
- // counter-translate children
- LLVector3 parent_offset = (src_actionp->mPosition - old_position_local) * ~object->getRotation();
-
- // counter-translate child objects if we are moving the root as an individual
- for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++)
- {
- LLViewerObject* childp = object->mChildList[child_num];
- childp->setPosition(childp->getPosition() - parent_offset);
- }
- }
- update_type |= UPD_POSITION;
- break;
- case SELECT_ACTION_TYPE_ROTATE:
- dst_actionp->mPosition = object->mDrawable->getPosition();
- dst_actionp->mRotation = object->mDrawable->getRotation();
- object->setRotation(src_actionp->mRotation, TRUE);
- object->setPosition(src_actionp->mPosition, TRUE);
- if (object->isRootEdit() && src_actionp->mIndividualSelection)
- {
- // counter-translate and rotate children
- LLVector3 parent_offset = (src_actionp->mPosition - old_position_local) * ~object->getRotation();
-
- for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++)
- {
- LLViewerObject* childp = object->mChildList[child_num];
- LLQuaternion delta_rot_inv = dst_actionp->mRotation * ~src_actionp->mRotation;
- childp->setPosition((childp->getPosition() * delta_rot_inv) - parent_offset);
- childp->setRotation(childp->getRotation() * delta_rot_inv );
- }
- }
- update_type |= UPD_ROTATION | UPD_POSITION;
- break;
- case SELECT_ACTION_TYPE_SCALE:
- dst_actionp->mPosition = object->mDrawable->getPosition();
- dst_actionp->mScale = object->getScale();
- object->setScale(src_actionp->mScale, TRUE);
- object->setPosition(src_actionp->mPosition, TRUE);
- update_type |= UPD_SCALE | UPD_POSITION;
- break;
- default:
- // do nothing
- break;
- }
- }
- queue_src.pop_back();
- delete src_actionp;
- queue_dst.push_back(dst_actionp);
- while (queue_dst.size() > (U32)MAX_ACTION_QUEUE_SIZE)
- {
- LLSelectAction* action = queue_dst.front();
- queue_dst.pop_front();
- delete action;
- }
-
- }
-
- // put everything back
- LLSelectAction* actionp;
- while (temp_queue.size())
- {
- actionp = temp_queue.back();
- temp_queue.pop_back();
- queue_src.push_back(actionp);
- }
-
- return update_type;
-}
ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object)
{
@@ -6268,7 +5726,7 @@ ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object)
void LLSelectMgr::validateSelection()
{
LLViewerObject* objectp;
- for (objectp = getFirstObject(); objectp; objectp = getNextObject())
+ for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject())
{
if (!canSelectObject(objectp))
{
@@ -6304,44 +5762,47 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object)
if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE;
ESelectType selection_type = getSelectTypeForObject(object);
- if (getObjectCount() > 0 && mSelectType != selection_type) return FALSE;
+ if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return FALSE;
return TRUE;
}
-LLSelectNodeList::LLSelectNodeList() : std::list<LLSelectNode*>()
+LLObjectSelection::LLObjectSelection() :
+ std::list<LLSelectNode*>(),
+ LLRefCount(),
+ mCurrentTE(-1),
+ mCurrentNode(end()),
+ mSelectType(SELECT_TYPE_WORLD)
{
- mCurrentTE = -1;
- mCurrentNode = end();
}
-LLSelectNodeList::~LLSelectNodeList()
+LLObjectSelection::~LLObjectSelection()
{
std::for_each(begin(), end(), DeletePointer());
}
-void LLSelectNodeList::updateEffects()
+void LLObjectSelection::updateEffects()
{
}
-S32 LLSelectNodeList::getNumNodes()
+S32 LLObjectSelection::getNumNodes()
{
return size();
}
-void LLSelectNodeList::addNode(LLSelectNode *nodep)
+void LLObjectSelection::addNode(LLSelectNode *nodep)
{
push_front(nodep);
mSelectNodeMap[nodep->getObject()] = nodep;
}
-void LLSelectNodeList::addNodeAtEnd(LLSelectNode *nodep)
+void LLObjectSelection::addNodeAtEnd(LLSelectNode *nodep)
{
push_back(nodep);
mSelectNodeMap[nodep->getObject()] = nodep;
}
-void LLSelectNodeList::removeNode(LLSelectNode *nodep)
+void LLObjectSelection::removeNode(LLSelectNode *nodep)
{
std::list<LLSelectNode*>::iterator iter = begin();
while(iter != end())
@@ -6358,14 +5819,14 @@ void LLSelectNodeList::removeNode(LLSelectNode *nodep)
}
}
-void LLSelectNodeList::deleteAllNodes()
+void LLObjectSelection::deleteAllNodes()
{
std::for_each(begin(), end(), DeletePointer());
clear();
mSelectNodeMap.clear();
}
-LLSelectNode* LLSelectNodeList::findNode(LLViewerObject* objectp)
+LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
{
std::map<LLViewerObject*, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp);
if (found_it != mSelectNodeMap.end())
@@ -6378,7 +5839,7 @@ LLSelectNode* LLSelectNodeList::findNode(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
// getFirstNode()
//-----------------------------------------------------------------------------
-LLSelectNode *LLSelectNodeList::getFirstNode()
+LLSelectNode *LLObjectSelection::getFirstNode()
{
mCurrentNode = begin();//getFirstData();
@@ -6399,7 +5860,7 @@ LLSelectNode *LLSelectNodeList::getFirstNode()
//-----------------------------------------------------------------------------
// getCurrentNode()
//-----------------------------------------------------------------------------
-LLSelectNode *LLSelectNodeList::getCurrentNode()
+LLSelectNode *LLObjectSelection::getCurrentNode()
{
while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
{
@@ -6417,7 +5878,7 @@ LLSelectNode *LLSelectNodeList::getCurrentNode()
//-----------------------------------------------------------------------------
// getNextNode()
//-----------------------------------------------------------------------------
-LLSelectNode *LLSelectNodeList::getNextNode()
+LLSelectNode *LLObjectSelection::getNextNode()
{
++mCurrentNode;
@@ -6439,7 +5900,7 @@ LLSelectNode *LLSelectNodeList::getNextNode()
//-----------------------------------------------------------------------------
// getFirstObject()
//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectNodeList::getFirstObject()
+LLViewerObject* LLObjectSelection::getFirstObject()
{
mCurrentNode = begin();
@@ -6461,7 +5922,7 @@ LLViewerObject* LLSelectNodeList::getFirstObject()
//-----------------------------------------------------------------------------
// getNextObject()
//-----------------------------------------------------------------------------
-LLViewerObject* LLSelectNodeList::getNextObject()
+LLViewerObject* LLObjectSelection::getNextObject()
{
++mCurrentNode;// = getNextData();
@@ -6484,7 +5945,7 @@ LLViewerObject* LLSelectNodeList::getNextObject()
//-----------------------------------------------------------------------------
// getPrimaryTE()
//-----------------------------------------------------------------------------
-void LLSelectNodeList::getPrimaryTE(LLViewerObject* *object, S32 *te)
+void LLObjectSelection::getPrimaryTE(LLViewerObject* *object, S32 *te)
{
// initialize object and te
*te = 0;
@@ -6539,7 +6000,7 @@ void LLSelectNodeList::getPrimaryTE(LLViewerObject* *object, S32 *te)
//-----------------------------------------------------------------------------
// getFirstTE()
//-----------------------------------------------------------------------------
-void LLSelectNodeList::getFirstTE(LLViewerObject* *object, S32 *te)
+void LLObjectSelection::getFirstTE(LLViewerObject* *object, S32 *te)
{
// start with first face
mCurrentTE = 0;
@@ -6593,7 +6054,7 @@ void LLSelectNodeList::getFirstTE(LLViewerObject* *object, S32 *te)
//-----------------------------------------------------------------------------
// getNextFace()
//-----------------------------------------------------------------------------
-void LLSelectNodeList::getNextTE(LLViewerObject* *object, S32 *te)
+void LLObjectSelection::getNextTE(LLViewerObject* *object, S32 *te)
{
// try next face
mCurrentTE++;
@@ -6636,7 +6097,7 @@ void LLSelectNodeList::getNextTE(LLViewerObject* *object, S32 *te)
return;
}
-void LLSelectNodeList::getCurrentTE(LLViewerObject* *object, S32 *te)
+void LLObjectSelection::getCurrentTE(LLViewerObject* *object, S32 *te)
{
if (mCurrentNode != end())
{
@@ -6652,7 +6113,7 @@ void LLSelectNodeList::getCurrentTE(LLViewerObject* *object, S32 *te)
//-----------------------------------------------------------------------------
// getFirstRootNode()
//-----------------------------------------------------------------------------
-LLSelectNode *LLSelectNodeList::getFirstRootNode()
+LLSelectNode *LLObjectSelection::getFirstRootNode()
{
LLSelectNode *cur_node = getFirstNode();
@@ -6671,7 +6132,7 @@ LLSelectNode *LLSelectNodeList::getFirstRootNode()
//-----------------------------------------------------------------------------
// getNextRootNode()
//-----------------------------------------------------------------------------
-LLSelectNode *LLSelectNodeList::getNextRootNode()
+LLSelectNode *LLObjectSelection::getNextRootNode()
{
LLSelectNode *cur_node = getNextNode();
@@ -6689,7 +6150,7 @@ LLSelectNode *LLSelectNodeList::getNextRootNode()
//-----------------------------------------------------------------------------
// getFirstRootObject()
//-----------------------------------------------------------------------------
-LLViewerObject *LLSelectNodeList::getFirstRootObject()
+LLViewerObject *LLObjectSelection::getFirstRootObject()
{
LLSelectNode *node = getFirstRootNode();
@@ -6707,7 +6168,7 @@ LLViewerObject *LLSelectNodeList::getFirstRootObject()
//-----------------------------------------------------------------------------
// getNextRootObject()
//-----------------------------------------------------------------------------
-LLViewerObject *LLSelectNodeList::getNextRootObject()
+LLViewerObject *LLObjectSelection::getNextRootObject()
{
LLSelectNode *node = getNextRootNode();
@@ -6724,7 +6185,7 @@ LLViewerObject *LLSelectNodeList::getNextRootObject()
//-----------------------------------------------------------------------------
// isEmpty()
//-----------------------------------------------------------------------------
-BOOL LLSelectNodeList::isEmpty()
+BOOL LLObjectSelection::isEmpty()
{
return (size() == 0);
}
@@ -6732,7 +6193,7 @@ BOOL LLSelectNodeList::isEmpty()
//-----------------------------------------------------------------------------
// getOwnershipCost()
//-----------------------------------------------------------------------------
-BOOL LLSelectNodeList::getOwnershipCost(S32 &cost)
+BOOL LLObjectSelection::getOwnershipCost(S32 &cost)
{
S32 count = 0;
for( LLSelectNode* nodep = getFirstNode(); nodep; nodep = getNextNode() )
@@ -6744,3 +6205,341 @@ BOOL LLSelectNodeList::getOwnershipCost(S32 &cost)
return (count > 0);
}
+
+
+
+//-----------------------------------------------------------------------------
+// getObjectCount()
+//-----------------------------------------------------------------------------
+S32 LLObjectSelection::getObjectCount()
+{
+ return getNumNodes();
+}
+
+
+//-----------------------------------------------------------------------------
+// getTECount()
+//-----------------------------------------------------------------------------
+S32 LLObjectSelection::getTECount()
+{
+ S32 count = 0;
+
+ LLSelectNode* nodep;
+ for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ {
+ if (nodep->getObject())
+ {
+ S32 num_tes = nodep->getObject()->getNumTEs();
+ for (S32 te = 0; te < num_tes; te++)
+ {
+ if (nodep->isTESelected(te))
+ {
+ count++;
+ }
+ }
+ }
+ }
+
+ return count;
+}
+
+//-----------------------------------------------------------------------------
+// getRootObjectCount()
+//-----------------------------------------------------------------------------
+S32 LLObjectSelection::getRootObjectCount()
+{
+ LLSelectNode *nodep;
+
+ S32 count = 0;
+ for(nodep = getFirstRootNode(); nodep; nodep = getNextRootNode())
+ {
+ ++count;
+ }
+ return count;
+}
+
+bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func)
+{
+ bool result = true;
+ LLViewerObject* object;
+ for (object = getFirstObject(); object != NULL; object = getNextObject())
+ {
+ result = result && func->apply(object);
+ }
+ return result;
+}
+
+bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func)
+{
+ bool result = true;
+ LLViewerObject* object;
+ for (object = getFirstRootObject();
+ object != NULL;
+ object = getNextRootObject())
+ {
+ result = result && func->apply(object);
+ }
+ return result;
+}
+
+bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func)
+{
+ bool result = true;
+ LLSelectNode* node;
+ for (node = getFirstNode(); node != NULL; node = getNextNode())
+ {
+ result = result && func->apply(node);
+ }
+ return result;
+}
+
+//-----------------------------------------------------------------------------
+// contains()
+//-----------------------------------------------------------------------------
+BOOL LLObjectSelection::contains(LLViewerObject* object)
+{
+ return findNode(object) != NULL;
+}
+
+
+//-----------------------------------------------------------------------------
+// contains()
+//-----------------------------------------------------------------------------
+BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te)
+{
+ LLSelectNode *nodep;
+ if (te == SELECT_ALL_TES)
+ {
+ // ...all faces
+ for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ {
+ if (nodep->getObject() == object)
+ {
+ BOOL all_selected = TRUE;
+ for (S32 i = 0; i < SELECT_MAX_TES; i++)
+ {
+ all_selected = all_selected && nodep->isTESelected(i);
+ }
+ return all_selected;
+ }
+ }
+ return FALSE;
+ }
+ else
+ {
+ // ...one face
+ for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ {
+ if (nodep->getObject() == object && nodep->isTESelected(te))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+}
+
+// returns TRUE is any node is currenly worn as an attachment
+BOOL LLObjectSelection::isAttachment()
+{
+ return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD);
+}
+
+//-----------------------------------------------------------------------------
+// getFirstMoveableNode()
+//-----------------------------------------------------------------------------
+LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root)
+{
+ LLSelectNode* selectNode = NULL;
+
+ if (get_root)
+ {
+ for(selectNode = getFirstRootNode(); selectNode; selectNode = getNextRootNode())
+ {
+ if( selectNode->getObject()->permMove() )
+ {
+ return selectNode;
+ break;
+ }
+ }
+ }
+ for(selectNode = getFirstNode(); selectNode; selectNode = getNextNode())
+ {
+ if( selectNode->getObject()->permMove() )
+ {
+ return selectNode;
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+// getFirstCopyableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_root)
+{
+ LLViewerObject* object = NULL;
+ for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
+ {
+ if( cur->permCopy() && !cur->isAttachment())
+ {
+ object = cur;
+ break;
+ }
+ }
+
+ if (get_root && object)
+ {
+ LLViewerObject *parent;
+ while ((parent = (LLViewerObject*)object->getParent()))
+ {
+ if (parent->isSelected())
+ {
+ object = parent;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ return object;
+}
+
+
+//-----------------------------------------------------------------------------
+// getFirstDeleteableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstDeleteableObject(BOOL get_root)
+{
+ //RN: don't currently support deletion of child objects, as that requires separating them first
+ // then derezzing to trash
+ get_root = TRUE;
+
+ LLViewerObject* object = NULL;
+ if (get_root)
+ {
+ for(LLViewerObject* current = getFirstRootObject();
+ current != NULL;
+ current = getNextRootObject())
+ {
+ // you can delete an object if permissions allow it, you are
+ // the owner, you are an officer in the group that owns the
+ // object, or you are not the owner but it is on land you own
+ // or land owned by your group. (whew!)
+ if( (current->permModify())
+ || (current->permYouOwner())
+ || (!current->permAnyOwner()) // public
+ || (current->isOverAgentOwnedLand())
+ || (current->isOverGroupOwnedLand())
+ )
+ {
+
+ if( !current->isAttachment() )
+ {
+ object = current;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ for(LLViewerObject* current = getFirstObject();
+ current != NULL;
+ current = getNextObject())
+ {
+ // you can delete an object if permissions allow it, you are
+ // the owner, you are an officer in the group that owns the
+ // object, or you are not the owner but it is on land you own
+ // or land owned by your group. (whew!)
+ if( (current->permModify())
+ || (current->permYouOwner())
+ || (!current->permAnyOwner()) // public
+ || (current->isOverAgentOwnedLand())
+ || (current->isOverGroupOwnedLand())
+ )
+ {
+ if( !current->isAttachment() )
+ {
+ object = current;
+ break;
+ }
+ }
+ }
+ }
+
+ return object;
+}
+
+
+//-----------------------------------------------------------------------------
+// getFirstEditableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_root)
+{
+ LLViewerObject* object = NULL;
+ for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
+ {
+ if( cur->permModify() )
+ {
+ object = cur;
+ break;
+ }
+ }
+
+ if (get_root && object)
+ {
+ LLViewerObject *parent;
+ while ((parent = (LLViewerObject*)object->getParent()))
+ {
+ if (parent->isSelected())
+ {
+ object = parent;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ return object;
+}
+
+//-----------------------------------------------------------------------------
+// getFirstMoveableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_root)
+{
+ LLViewerObject* object = NULL;
+ for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
+ {
+ if( cur->permMove() )
+ {
+ object = cur;
+ break;
+ }
+ }
+
+ if (get_root && object && !object->isJointChild())
+ {
+ LLViewerObject *parent;
+ while ((parent = (LLViewerObject*)object->getParent()))
+ {
+ if (parent->isSelected())
+ {
+ object = parent;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ return object;
+} \ No newline at end of file