aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmaniprotate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llmaniprotate.cpp')
-rw-r--r--linden/indra/newview/llmaniprotate.cpp75
1 files changed, 46 insertions, 29 deletions
diff --git a/linden/indra/newview/llmaniprotate.cpp b/linden/indra/newview/llmaniprotate.cpp
index 940e78a..fb3de3a 100644
--- a/linden/indra/newview/llmaniprotate.cpp
+++ b/linden/indra/newview/llmaniprotate.cpp
@@ -2,6 +2,8 @@
2 * @file llmaniprotate.cpp 2 * @file llmaniprotate.cpp
3 * @brief LLManipRotate class implementation 3 * @brief LLManipRotate class implementation
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 *
5 * Copyright (c) 2002-2007, Linden Research, Inc. 7 * Copyright (c) 2002-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
@@ -107,7 +110,7 @@ void LLManipRotate::handleSelect()
107{ 110{
108 // *FIX: put this in mouseDown? 111 // *FIX: put this in mouseDown?
109 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); 112 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
110 gFloaterTools->setStatusText("Drag colored bands to rotate object"); 113 gFloaterTools->setStatusText("rotate");
111 LLManip::handleSelect(); 114 LLManip::handleSelect();
112} 115}
113 116
@@ -115,8 +118,6 @@ void LLManipRotate::handleDeselect()
115{ 118{
116 mHighlightedPart = LL_NO_PART; 119 mHighlightedPart = LL_NO_PART;
117 mManipPart = LL_NO_PART; 120 mManipPart = LL_NO_PART;
118
119 gFloaterTools->setStatusText("");
120 LLManip::handleDeselect(); 121 LLManip::handleDeselect();
121} 122}
122 123
@@ -376,14 +377,7 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask)
376// Assumes that one of the parts of the manipulator was hit. 377// Assumes that one of the parts of the manipulator was hit.
377BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) 378BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
378{ 379{
379 BOOL can_rotate = mObjectSelection->getObjectCount() != 0; 380 BOOL can_rotate = canAffectSelection();
380 for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
381 objectp;
382 objectp = mObjectSelection->getNextObject())
383 {
384 can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
385 }
386
387 if (!can_rotate) 381 if (!can_rotate)
388 { 382 {
389 return FALSE; 383 return FALSE;
@@ -462,15 +456,18 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask)
462 // first, perform normal processing in case this was a quick-click 456 // first, perform normal processing in case this was a quick-click
463 handleHover(x, y, mask); 457 handleHover(x, y, mask);
464 458
465 mManipPart = LL_NO_PART; 459 if( hasMouseCapture() )
460 {
461 mManipPart = LL_NO_PART;
466 462
467 // Might have missed last update due to timing. 463 // Might have missed last update due to timing.
468 gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); 464 gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION );
469 gSelectMgr->enableSilhouette(TRUE); 465 gSelectMgr->enableSilhouette(TRUE);
470 //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); 466 //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject"));
471 467
472 gSelectMgr->updateSelectionCenter(); 468 gSelectMgr->updateSelectionCenter();
473 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); 469 gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
470 }
474 471
475 return LLManip::handleMouseUp(x, y, mask); 472 return LLManip::handleMouseUp(x, y, mask);
476} 473}
@@ -538,12 +535,11 @@ void LLManipRotate::drag( S32 x, S32 y )
538 BOOL damped = mSmoothRotate; 535 BOOL damped = mSmoothRotate;
539 mSmoothRotate = FALSE; 536 mSmoothRotate = FALSE;
540 537
541 LLViewerObject* object; 538 for (LLObjectSelection::iterator iter = mObjectSelection->begin();
542 LLSelectNode* selectNode; 539 iter != mObjectSelection->end(); iter++)
543
544 for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() )
545 { 540 {
546 object = selectNode->getObject(); 541 LLSelectNode* selectNode = *iter;
542 LLViewerObject* object = selectNode->getObject();
547 543
548 // have permission to move and object is root of selection or individually selected 544 // have permission to move and object is root of selection or individually selected
549 if (object->permMove() && (object->isRootEdit() || selectNode->mIndividualSelection)) 545 if (object->permMove() && (object->isRootEdit() || selectNode->mIndividualSelection))
@@ -607,10 +603,12 @@ void LLManipRotate::drag( S32 x, S32 y )
607 } 603 }
608 604
609 // update positions 605 // update positions
610 for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() ) 606 for (LLObjectSelection::iterator iter = mObjectSelection->begin();
607 iter != mObjectSelection->end(); iter++)
611 { 608 {
612 object = selectNode->getObject(); 609 LLSelectNode* selectNode = *iter;
613 610 LLViewerObject* object = selectNode->getObject();
611
614 // to avoid cumulative position changes we calculate the objects new position using its saved position 612 // to avoid cumulative position changes we calculate the objects new position using its saved position
615 if (object && object->permMove()) 613 if (object && object->permMove())
616 { 614 {
@@ -708,10 +706,10 @@ void LLManipRotate::drag( S32 x, S32 y )
708 } 706 }
709 707
710 // store changes to override updates 708 // store changes to override updates
711 for (LLSelectNode* selectNode = gSelectMgr->getSelection()->getFirstNode(); 709 for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin();
712 selectNode != NULL; 710 iter != gSelectMgr->getSelection()->end(); iter++)
713 selectNode = gSelectMgr->getSelection()->getNextNode())
714 { 711 {
712 LLSelectNode* selectNode = *iter;
715 LLViewerObject*cur = selectNode->getObject(); 713 LLViewerObject*cur = selectNode->getObject();
716 if( cur->permModify() && cur->permMove() && !cur->isAvatar()) 714 if( cur->permModify() && cur->permMove() && !cur->isAvatar())
717 { 715 {
@@ -1866,3 +1864,22 @@ S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis)
1866 1864
1867 return axis_index; 1865 return axis_index;
1868} 1866}
1867
1868//virtual
1869BOOL LLManipRotate::canAffectSelection()
1870{
1871 BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
1872 if (can_rotate)
1873 {
1874 struct f : public LLSelectedObjectFunctor
1875 {
1876 virtual bool apply(LLViewerObject* objectp)
1877 {
1878 return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
1879 }
1880 } func;
1881 can_rotate = mObjectSelection->applyToObjects(&func);
1882 }
1883 return can_rotate;
1884}
1885