summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorcallum_linden <none@none>2015-05-18 12:00:36 -0700
committercallum_linden <none@none>2015-05-18 12:00:36 -0700
commit80aa29eaec78d267b4fa1822cfbd3a33b268066a (patch)
tree1ce0483bd490750e367bfe53a19ec312cdc0bd27 /indra/newview/llselectmgr.cpp
parentd214c2854110520d5574f675bcc12f64bfd42090 (diff)
parentfde0868231a25b8c9ce03a86cb53f1738d35688d (diff)
Merge with Viewer Release (after Viewer Release updated with Viewer Tools Update)
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rwxr-xr-xindra/newview/llselectmgr.cpp109
1 files changed, 96 insertions, 13 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 9e0bd9b6ed..fdc95c7784 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -365,7 +365,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3
//-----------------------------------------------------------------------------
// Select the object, parents and children.
//-----------------------------------------------------------------------------
-LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end)
+LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end, BOOL ignore_select_owned)
{
llassert( obj );
@@ -382,7 +382,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj,
return NULL;
}
- if (!canSelectObject(obj))
+ if (!canSelectObject(obj,ignore_select_owned))
{
//make_ui_sound("UISndInvalidOp");
return NULL;
@@ -1763,6 +1763,40 @@ void LLSelectMgr::selectionRevertColors()
getSelection()->applyToObjects(&sendfunc);
}
+void LLSelectMgr::selectionRevertShinyColors()
+{
+ struct f : public LLSelectedTEFunctor
+ {
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->permModify())
+ {
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedShinyColors.size())
+ {
+ LLColor4 color = nodep->mSavedShinyColors[te];
+ // update viewer side color in anticipation of update from simulator
+ LLMaterialPtr old_mat = object->getTE(te)->getMaterialParams();
+ if (!old_mat.isNull())
+ {
+ LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
+ new_mat->setSpecularLightColor(color);
+ object->getTE(te)->setMaterialParams(new_mat);
+ LLMaterialMgr::getInstance()->put(object->getID(), te, *new_mat);
+ }
+ }
+ }
+ return true;
+ }
+ } setfunc(mSelectedObjects);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
+}
+
BOOL LLSelectMgr::selectionRevertTextures()
{
struct f : public LLSelectedTEFunctor
@@ -4498,6 +4532,19 @@ void LLSelectMgr::saveSelectedObjectColors()
getSelection()->applyToNodes(&func);
}
+void LLSelectMgr::saveSelectedShinyColors()
+{
+ struct f : public LLSelectedNodeFunctor
+ {
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->saveShinyColors();
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
+}
+
void LLSelectMgr::saveSelectedObjectTextures()
{
// invalidate current selection so we update saved textures
@@ -4593,11 +4640,18 @@ struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor
BOOL mState;
virtual bool apply(LLViewerObject* object)
{
- if ( object->permModify() && // preemptive permissions check
- object->isRoot()) // don't send for child objects
+ if ( object->permModify())
{
- object->setFlags( mFlags, mState);
- }
+ if (object->isRoot()) // don't send for child objects
+ {
+ object->setFlags( mFlags, mState);
+ }
+ else if (FLAGS_WORLD & mFlags && ((LLViewerObject*)object->getRoot())->isSelected())
+ {
+ // FLAGS_WORLD are shared by all items in linkset
+ object->setFlagsWithoutUpdate(FLAGS_WORLD & mFlags, mState);
+ }
+ };
return true;
}
};
@@ -5749,6 +5803,7 @@ LLSelectNode::LLSelectNode(LLViewerObject* object, BOOL glow)
mCreationDate(0)
{
saveColors();
+ saveShinyColors();
}
LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
@@ -5794,6 +5849,11 @@ LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
{
mSavedColors.push_back(*color_iter);
}
+ mSavedShinyColors.clear();
+ for (color_iter = nodep.mSavedShinyColors.begin(); color_iter != nodep.mSavedShinyColors.end(); ++color_iter)
+ {
+ mSavedShinyColors.push_back(*color_iter);
+ }
saveTextures(nodep.mSavedTextures);
}
@@ -5877,6 +5937,26 @@ void LLSelectNode::saveColors()
}
}
+void LLSelectNode::saveShinyColors()
+{
+ if (mObject.notNull())
+ {
+ mSavedShinyColors.clear();
+ for (S32 i = 0; i < mObject->getNumTEs(); i++)
+ {
+ const LLMaterialPtr mat = mObject->getTE(i)->getMaterialParams();
+ if (!mat.isNull())
+ {
+ mSavedShinyColors.push_back(mat->getSpecularLightColor());
+ }
+ else
+ {
+ mSavedShinyColors.push_back(LLColor4::white);
+ }
+ }
+ }
+}
+
void LLSelectNode::saveTextures(const uuid_vec_t& textures)
{
if (mObject.notNull())
@@ -6695,29 +6775,32 @@ void LLSelectMgr::validateSelection()
getSelection()->applyToObjects(&func);
}
-BOOL LLSelectMgr::canSelectObject(LLViewerObject* object)
+BOOL LLSelectMgr::canSelectObject(LLViewerObject* object, BOOL ignore_select_owned)
{
// Never select dead objects
if (!object || object->isDead())
{
return FALSE;
}
-
+
if (mForceSelection)
{
return TRUE;
}
- if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) ||
- (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced())))
+ if(!ignore_select_owned)
{
- // only select my own objects
- return FALSE;
+ if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) ||
+ (gSavedSettings.getBOOL("SelectMovableOnly") && (!object->permMove() || object->isPermanentEnforced())))
+ {
+ // only select my own objects
+ return FALSE;
+ }
}
// Can't select orphans
if (object->isOrphaned()) return FALSE;
-
+
// Can't select avatars
if (object->isAvatar()) return FALSE;