diff options
Diffstat (limited to 'linden/indra/newview/llmaniptranslate.cpp')
-rw-r--r-- | linden/indra/newview/llmaniptranslate.cpp | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp index 7dbb470..2278453 100644 --- a/linden/indra/newview/llmaniptranslate.cpp +++ b/linden/indra/newview/llmaniptranslate.cpp | |||
@@ -101,7 +101,7 @@ const U32 ARROW_TO_AXIS[4] = | |||
101 | }; | 101 | }; |
102 | 102 | ||
103 | LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) | 103 | LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) |
104 | : LLManip( "Move", composite ), | 104 | : LLManip( std::string("Move"), composite ), |
105 | mLastHoverMouseX(-1), | 105 | mLastHoverMouseX(-1), |
106 | mLastHoverMouseY(-1), | 106 | mLastHoverMouseY(-1), |
107 | mSendUpdateOnMouseUp(FALSE), | 107 | mSendUpdateOnMouseUp(FALSE), |
@@ -113,7 +113,6 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) | |||
113 | mConeSize(0), | 113 | mConeSize(0), |
114 | mArrowLengthMeters(0.f), | 114 | mArrowLengthMeters(0.f), |
115 | mPlaneManipOffsetMeters(0.f), | 115 | mPlaneManipOffsetMeters(0.f), |
116 | mManipPart(LL_NO_PART), | ||
117 | mUpdateTimer(), | 116 | mUpdateTimer(), |
118 | mSnapOffsetMeters(0.f), | 117 | mSnapOffsetMeters(0.f), |
119 | mArrowScales(1.f, 1.f, 1.f), | 118 | mArrowScales(1.f, 1.f, 1.f), |
@@ -257,21 +256,12 @@ void LLManipTranslate::handleSelect() | |||
257 | LLManip::handleSelect(); | 256 | LLManip::handleSelect(); |
258 | } | 257 | } |
259 | 258 | ||
260 | void LLManipTranslate::handleDeselect() | ||
261 | { | ||
262 | mHighlightedPart = LL_NO_PART; | ||
263 | mManipPart = LL_NO_PART; | ||
264 | LLManip::handleDeselect(); | ||
265 | } | ||
266 | |||
267 | BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) | 259 | BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask) |
268 | { | 260 | { |
269 | BOOL handled = FALSE; | 261 | BOOL handled = FALSE; |
270 | 262 | ||
271 | // didn't click in any UI object, so must have clicked in the world | 263 | // didn't click in any UI object, so must have clicked in the world |
272 | LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); | 264 | if( (mHighlightedPart == LL_X_ARROW || |
273 | if( hit_obj && | ||
274 | (mHighlightedPart == LL_X_ARROW || | ||
275 | mHighlightedPart == LL_Y_ARROW || | 265 | mHighlightedPart == LL_Y_ARROW || |
276 | mHighlightedPart == LL_Z_ARROW || | 266 | mHighlightedPart == LL_Z_ARROW || |
277 | mHighlightedPart == LL_YZ_PLANE || | 267 | mHighlightedPart == LL_YZ_PLANE || |
@@ -687,19 +677,9 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) | |||
687 | if (selectNode->mIndividualSelection) | 677 | if (selectNode->mIndividualSelection) |
688 | { | 678 | { |
689 | send_update = FALSE; | 679 | send_update = FALSE; |
690 | LLVector3 child_offset = (old_position_local - new_position_local) * ~object->getRotation(); | 680 | |
691 | |||
692 | // counter-translate child objects if we are moving the root as an individual | 681 | // counter-translate child objects if we are moving the root as an individual |
693 | for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++) | 682 | object->resetChildrenPosition(old_position_local - new_position_local, TRUE) ; |
694 | { | ||
695 | LLViewerObject* childp = object->mChildList[child_num]; | ||
696 | |||
697 | if (!childp->isSelected()) | ||
698 | { | ||
699 | childp->setPosition(childp->getPosition() + child_offset); | ||
700 | rebuild(childp); | ||
701 | } | ||
702 | } | ||
703 | } | 683 | } |
704 | } | 684 | } |
705 | else | 685 | else |
@@ -753,18 +733,8 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) | |||
753 | 733 | ||
754 | if (selectNode->mIndividualSelection) | 734 | if (selectNode->mIndividualSelection) |
755 | { | 735 | { |
756 | LLVector3 parent_offset = (new_position_agent - old_position_agent) * ~object->getRotation(); | ||
757 | |||
758 | // counter-translate child objects if we are moving the root as an individual | 736 | // counter-translate child objects if we are moving the root as an individual |
759 | for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++) | 737 | object->resetChildrenPosition(old_position_agent - new_position_agent, TRUE) ; |
760 | { | ||
761 | LLViewerObject* childp = object->mChildList[child_num]; | ||
762 | if (!childp->isSelected()) | ||
763 | { | ||
764 | childp->setPosition(childp->getPosition() - parent_offset); | ||
765 | rebuild(childp); | ||
766 | } | ||
767 | } | ||
768 | send_update = FALSE; | 738 | send_update = FALSE; |
769 | } | 739 | } |
770 | else if (old_position_global != new_position_global) | 740 | else if (old_position_global != new_position_global) |
@@ -818,7 +788,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) | |||
818 | LLMatrix4 cfr(OGL_TO_CFR_ROTATION); | 788 | LLMatrix4 cfr(OGL_TO_CFR_ROTATION); |
819 | transform *= cfr; | 789 | transform *= cfr; |
820 | LLMatrix4 window_scale; | 790 | LLMatrix4 window_scale; |
821 | F32 zoom_level = 2.f * gAgent.getAvatarObject()->mHUDCurZoom; | 791 | F32 zoom_level = 2.f * gAgent.mHUDCurZoom; |
822 | window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), | 792 | window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), |
823 | LLQuaternion::DEFAULT, | 793 | LLQuaternion::DEFAULT, |
824 | LLVector3::zero); | 794 | LLVector3::zero); |
@@ -1056,7 +1026,7 @@ void LLManipTranslate::render() | |||
1056 | gGL.pushMatrix(); | 1026 | gGL.pushMatrix(); |
1057 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 1027 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1058 | { | 1028 | { |
1059 | F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom; | 1029 | F32 zoom = gAgent.mHUDCurZoom; |
1060 | glScalef(zoom, zoom, zoom); | 1030 | glScalef(zoom, zoom, zoom); |
1061 | } | 1031 | } |
1062 | { | 1032 | { |
@@ -1220,7 +1190,7 @@ void LLManipTranslate::renderSnapGuides() | |||
1220 | 1190 | ||
1221 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 1191 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1222 | { | 1192 | { |
1223 | guide_size_meters = 1.f / gAgent.getAvatarObject()->mHUDCurZoom; | 1193 | guide_size_meters = 1.f / gAgent.mHUDCurZoom; |
1224 | mSnapOffsetMeters = mArrowLengthMeters * 1.5f; | 1194 | mSnapOffsetMeters = mArrowLengthMeters * 1.5f; |
1225 | } | 1195 | } |
1226 | else | 1196 | else |
@@ -1412,11 +1382,11 @@ void LLManipTranslate::renderSnapGuides() | |||
1412 | { | 1382 | { |
1413 | // rescale units to meters from multiple of grid scale | 1383 | // rescale units to meters from multiple of grid scale |
1414 | offset_val *= 2.f * grid_scale[ARROW_TO_AXIS[mManipPart]]; | 1384 | offset_val *= 2.f * grid_scale[ARROW_TO_AXIS[mManipPart]]; |
1415 | renderTickValue(text_origin, offset_val, "m", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); | 1385 | renderTickValue(text_origin, offset_val, std::string("m"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); |
1416 | } | 1386 | } |
1417 | else | 1387 | else |
1418 | { | 1388 | { |
1419 | renderTickValue(text_origin, offset_val, "x", LLColor4(text_highlight, text_highlight, text_highlight, alpha)); | 1389 | renderTickValue(text_origin, offset_val, std::string("x"), LLColor4(text_highlight, text_highlight, text_highlight, alpha)); |
1420 | } | 1390 | } |
1421 | } | 1391 | } |
1422 | } | 1392 | } |
@@ -1803,7 +1773,7 @@ void LLManipTranslate::renderTranslationHandles() | |||
1803 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) | 1773 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1804 | { | 1774 | { |
1805 | mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWindowHeight(); | 1775 | mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWindowHeight(); |
1806 | mArrowLengthMeters /= gAgent.getAvatarObject()->mHUDCurZoom; | 1776 | mArrowLengthMeters /= gAgent.mHUDCurZoom; |
1807 | } | 1777 | } |
1808 | else | 1778 | else |
1809 | { | 1779 | { |