diff options
-rwxr-xr-x | indra/newview/llselectmgr.cpp | 19 | ||||
-rwxr-xr-x | indra/newview/llselectmgr.h | 1 |
2 files changed, 19 insertions, 1 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4f63df1ea2..323689b788 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6746,7 +6746,8 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const //----------------------------------------------------------------------------- BOOL LLSelectMgr::canUndo() const { - return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG + // Can edit or can move + return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstUndoEnabledObject() != NULL; // HACK: casting away constness - MG; } //----------------------------------------------------------------------------- @@ -7672,6 +7673,22 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent) } //----------------------------------------------------------------------------- +// getFirstUndoEnabledObject() +//----------------------------------------------------------------------------- +LLViewerObject* LLObjectSelection::getFirstUndoEnabledObject(BOOL get_parent) +{ + struct f : public LLSelectedNodeFunctor + { + bool apply(LLSelectNode* node) + { + LLViewerObject* obj = node->getObject(); + return obj && (obj->permModify() || (obj->permMove() && !obj->isPermanentEnforced())); + } + } func; + return getFirstSelectedObject(&func, get_parent); +} + +//----------------------------------------------------------------------------- // Position + Rotation update methods called from LLViewerJoystick //----------------------------------------------------------------------------- bool LLSelectMgr::selectionMove(const LLVector3& displ, diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 90f7fdfe13..bc50e443f8 100755 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -305,6 +305,7 @@ public: LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE); LLViewerObject* getFirstDeleteableObject(); LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE); + LLViewerObject* getFirstUndoEnabledObject(BOOL get_parent = FALSE); /// Return the object that lead to this selection, possible a child LLViewerObject* getPrimaryObject() { return mPrimaryObject; } |