diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmaniprotate.cpp | 128 |
1 files changed, 50 insertions, 78 deletions
diff --git a/linden/indra/newview/llmaniprotate.cpp b/linden/indra/newview/llmaniprotate.cpp index 93cbfe4..452e4d4 100644 --- a/linden/indra/newview/llmaniprotate.cpp +++ b/linden/indra/newview/llmaniprotate.cpp | |||
@@ -81,7 +81,6 @@ const F32 SELECTED_MANIPULATOR_SCALE = 1.05f; | |||
81 | const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; | 81 | const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; |
82 | 82 | ||
83 | extern void handle_reset_rotation(void*); // in LLViewerWindow | 83 | extern void handle_reset_rotation(void*); // in LLViewerWindow |
84 | extern void handle_first_tool(void*); | ||
85 | 84 | ||
86 | LLManipRotate::LLManipRotate( LLToolComposite* composite ) | 85 | LLManipRotate::LLManipRotate( LLToolComposite* composite ) |
87 | : LLManip( "Rotate", composite ), | 86 | : LLManip( "Rotate", composite ), |
@@ -108,6 +107,7 @@ void LLManipRotate::handleSelect() | |||
108 | // *FIX: put this in mouseDown? | 107 | // *FIX: put this in mouseDown? |
109 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 108 | gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
110 | gFloaterTools->setStatusText("Drag colored bands to rotate object"); | 109 | gFloaterTools->setStatusText("Drag colored bands to rotate object"); |
110 | LLManip::handleSelect(); | ||
111 | } | 111 | } |
112 | 112 | ||
113 | void LLManipRotate::handleDeselect() | 113 | void LLManipRotate::handleDeselect() |
@@ -116,6 +116,7 @@ void LLManipRotate::handleDeselect() | |||
116 | mManipPart = LL_NO_PART; | 116 | mManipPart = LL_NO_PART; |
117 | 117 | ||
118 | gFloaterTools->setStatusText(""); | 118 | gFloaterTools->setStatusText(""); |
119 | LLManip::handleDeselect(); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | void LLManipRotate::render() | 122 | void LLManipRotate::render() |
@@ -127,7 +128,7 @@ void LLManipRotate::render() | |||
127 | LLGLEnable gls_alpha_test(GL_ALPHA_TEST); | 128 | LLGLEnable gls_alpha_test(GL_ALPHA_TEST); |
128 | 129 | ||
129 | // You can rotate if you can move | 130 | // You can rotate if you can move |
130 | LLViewerObject* first_object = gSelectMgr->getFirstMoveableObject(TRUE); | 131 | LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE); |
131 | if( !first_object ) | 132 | if( !first_object ) |
132 | { | 133 | { |
133 | return; | 134 | return; |
@@ -140,7 +141,7 @@ void LLManipRotate::render() | |||
140 | 141 | ||
141 | glMatrixMode(GL_MODELVIEW); | 142 | glMatrixMode(GL_MODELVIEW); |
142 | glPushMatrix(); | 143 | glPushMatrix(); |
143 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 144 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
144 | { | 145 | { |
145 | F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom; | 146 | F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom; |
146 | glScalef(zoom, zoom, zoom); | 147 | glScalef(zoom, zoom, zoom); |
@@ -358,7 +359,7 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask) | |||
358 | { | 359 | { |
359 | BOOL handled = FALSE; | 360 | BOOL handled = FALSE; |
360 | 361 | ||
361 | LLViewerObject* first_object = gSelectMgr->getFirstMoveableObject(TRUE); | 362 | LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE); |
362 | if( first_object ) | 363 | if( first_object ) |
363 | { | 364 | { |
364 | LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); | 365 | LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); |
@@ -374,10 +375,10 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask) | |||
374 | // Assumes that one of the parts of the manipulator was hit. | 375 | // Assumes that one of the parts of the manipulator was hit. |
375 | BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) | 376 | BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) |
376 | { | 377 | { |
377 | BOOL can_rotate = gSelectMgr->getObjectCount() != 0; | 378 | BOOL can_rotate = mObjectSelection->getObjectCount() != 0; |
378 | for (LLViewerObject* objectp = gSelectMgr->getFirstObject(); | 379 | for (LLViewerObject* objectp = mObjectSelection->getFirstObject(); |
379 | objectp; | 380 | objectp; |
380 | objectp = gSelectMgr->getNextObject()) | 381 | objectp = mObjectSelection->getNextObject()) |
381 | { | 382 | { |
382 | can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); | 383 | can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); |
383 | } | 384 | } |
@@ -463,11 +464,7 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) | |||
463 | mManipPart = LL_NO_PART; | 464 | mManipPart = LL_NO_PART; |
464 | 465 | ||
465 | // Might have missed last update due to timing. | 466 | // Might have missed last update due to timing. |
466 | if (mSendUpdateOnMouseUp) | 467 | gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); |
467 | { | ||
468 | gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); | ||
469 | mSendUpdateOnMouseUp = FALSE; | ||
470 | } | ||
471 | gSelectMgr->enableSilhouette(TRUE); | 468 | gSelectMgr->enableSilhouette(TRUE); |
472 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); | 469 | //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); |
473 | 470 | ||
@@ -482,7 +479,7 @@ BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask) | |||
482 | { | 479 | { |
483 | if( hasMouseCapture() ) | 480 | if( hasMouseCapture() ) |
484 | { | 481 | { |
485 | if( gSelectMgr->isEmpty() ) | 482 | if( mObjectSelection->isEmpty() ) |
486 | { | 483 | { |
487 | // Somehow the object got deselected while we were dragging it. | 484 | // Somehow the object got deselected while we were dragging it. |
488 | setMouseCapture( FALSE ); | 485 | setMouseCapture( FALSE ); |
@@ -523,12 +520,6 @@ extern U32 gFrameCount; | |||
523 | // Freeform rotation | 520 | // Freeform rotation |
524 | void LLManipRotate::drag( S32 x, S32 y ) | 521 | void LLManipRotate::drag( S32 x, S32 y ) |
525 | { | 522 | { |
526 | static LLTimer update_timer; | ||
527 | F32 elapsed_time = update_timer.getElapsedTimeF32(); | ||
528 | const F32 UPDATE_DELAY = 0.1f; // min time between transmitted updates | ||
529 | BOOL send_rotation_update = FALSE; | ||
530 | BOOL send_position_update = FALSE; | ||
531 | |||
532 | if( !updateVisiblity() ) | 523 | if( !updateVisiblity() ) |
533 | { | 524 | { |
534 | return; | 525 | return; |
@@ -548,9 +539,8 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
548 | 539 | ||
549 | LLViewerObject* object; | 540 | LLViewerObject* object; |
550 | LLSelectNode* selectNode; | 541 | LLSelectNode* selectNode; |
551 | BOOL using_linked_selection = gSavedSettings.getBOOL("SelectLinkedSet"); | ||
552 | 542 | ||
553 | for( selectNode = gSelectMgr->getFirstNode(); selectNode != NULL; selectNode = gSelectMgr->getNextNode() ) | 543 | for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() ) |
554 | { | 544 | { |
555 | object = selectNode->getObject(); | 545 | object = selectNode->getObject(); |
556 | 546 | ||
@@ -595,12 +585,6 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
595 | rebuild(object); | 585 | rebuild(object); |
596 | } | 586 | } |
597 | 587 | ||
598 | // don't send updates all the time for sub-objects | ||
599 | if (using_linked_selection && object->getRenderRotation() != new_rot) | ||
600 | { | ||
601 | send_rotation_update = TRUE; | ||
602 | } | ||
603 | |||
604 | // for individually selected roots, we need to counterrotate all the children | 588 | // for individually selected roots, we need to counterrotate all the children |
605 | if (object->isRootEdit() && selectNode->mIndividualSelection) | 589 | if (object->isRootEdit() && selectNode->mIndividualSelection) |
606 | { | 590 | { |
@@ -622,7 +606,7 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
622 | } | 606 | } |
623 | 607 | ||
624 | // update positions | 608 | // update positions |
625 | for( selectNode = gSelectMgr->getFirstNode(); selectNode != NULL; selectNode = gSelectMgr->getNextNode() ) | 609 | for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() ) |
626 | { | 610 | { |
627 | object = selectNode->getObject(); | 611 | object = selectNode->getObject(); |
628 | 612 | ||
@@ -692,11 +676,6 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
692 | } | 676 | } |
693 | } | 677 | } |
694 | 678 | ||
695 | if (using_linked_selection && object->getPositionAgent() != new_position) | ||
696 | { | ||
697 | send_position_update = TRUE; | ||
698 | } | ||
699 | |||
700 | // for individually selected roots, we need to counter-translate all unselected children | 679 | // for individually selected roots, we need to counter-translate all unselected children |
701 | if (object->isRootEdit() && selectNode->mIndividualSelection) | 680 | if (object->isRootEdit() && selectNode->mIndividualSelection) |
702 | { | 681 | { |
@@ -727,27 +706,19 @@ void LLManipRotate::drag( S32 x, S32 y ) | |||
727 | } | 706 | } |
728 | } | 707 | } |
729 | 708 | ||
730 | if ((send_position_update || send_rotation_update) && (elapsed_time > UPDATE_DELAY)) | 709 | // store changes to override updates |
710 | for (LLSelectNode* selectNode = gSelectMgr->getSelection()->getFirstNode(); | ||
711 | selectNode != NULL; | ||
712 | selectNode = gSelectMgr->getSelection()->getNextNode()) | ||
731 | { | 713 | { |
732 | U32 flag = UPD_NONE; | 714 | LLViewerObject*cur = selectNode->getObject(); |
733 | if (send_rotation_update) | 715 | if( cur->permModify() && cur->permMove() && !cur->isAvatar()) |
734 | { | ||
735 | flag |= UPD_ROTATION; | ||
736 | } | ||
737 | if (send_position_update) | ||
738 | { | 716 | { |
739 | flag |= UPD_POSITION; | 717 | selectNode->mLastRotation = cur->getRotation(); |
718 | selectNode->mLastPositionLocal = cur->getPosition(); | ||
740 | } | 719 | } |
720 | } | ||
741 | 721 | ||
742 | gSelectMgr->sendMultipleUpdate( flag ); | ||
743 | update_timer.reset(); | ||
744 | mSendUpdateOnMouseUp = FALSE; | ||
745 | } | ||
746 | else | ||
747 | { | ||
748 | mSendUpdateOnMouseUp = TRUE; | ||
749 | } | ||
750 | |||
751 | gSelectMgr->updateSelectionCenter(); | 722 | gSelectMgr->updateSelectionCenter(); |
752 | 723 | ||
753 | // RN: just clear focus so camera doesn't follow spurious object updates | 724 | // RN: just clear focus so camera doesn't follow spurious object updates |
@@ -785,7 +756,7 @@ void LLManipRotate::renderSnapGuides() | |||
785 | 756 | ||
786 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); | 757 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); |
787 | LLVector3 cam_at_axis; | 758 | LLVector3 cam_at_axis; |
788 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 759 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
789 | { | 760 | { |
790 | cam_at_axis.setVec(1.f, 0.f, 0.f); | 761 | cam_at_axis.setVec(1.f, 0.f, 0.f); |
791 | } | 762 | } |
@@ -799,7 +770,7 @@ void LLManipRotate::renderSnapGuides() | |||
799 | LLVector3 test_axis = constraint_axis; | 770 | LLVector3 test_axis = constraint_axis; |
800 | 771 | ||
801 | BOOL constrain_to_ref_object = FALSE; | 772 | BOOL constrain_to_ref_object = FALSE; |
802 | if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) | 773 | if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) |
803 | { | 774 | { |
804 | test_axis = test_axis * ~grid_rotation; | 775 | test_axis = test_axis * ~grid_rotation; |
805 | } | 776 | } |
@@ -826,7 +797,7 @@ void LLManipRotate::renderSnapGuides() | |||
826 | } | 797 | } |
827 | 798 | ||
828 | LLVector3 projected_snap_axis = world_snap_axis; | 799 | LLVector3 projected_snap_axis = world_snap_axis; |
829 | if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) | 800 | if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) |
830 | { | 801 | { |
831 | projected_snap_axis = projected_snap_axis * grid_rotation; | 802 | projected_snap_axis = projected_snap_axis * grid_rotation; |
832 | } | 803 | } |
@@ -966,32 +937,32 @@ void LLManipRotate::renderSnapGuides() | |||
966 | { | 937 | { |
967 | if (i == 0) | 938 | if (i == 0) |
968 | { | 939 | { |
969 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white); | 940 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); |
970 | } | 941 | } |
971 | else if (i == 16) | 942 | else if (i == 16) |
972 | { | 943 | { |
973 | if (constraint_axis.mV[VZ] > 0.f) | 944 | if (constraint_axis.mV[VZ] > 0.f) |
974 | { | 945 | { |
975 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white); | 946 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); |
976 | } | 947 | } |
977 | else | 948 | else |
978 | { | 949 | { |
979 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white); | 950 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); |
980 | } | 951 | } |
981 | } | 952 | } |
982 | else if (i == 32) | 953 | else if (i == 32) |
983 | { | 954 | { |
984 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white); | 955 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); |
985 | } | 956 | } |
986 | else | 957 | else |
987 | { | 958 | { |
988 | if (constraint_axis.mV[VZ] > 0.f) | 959 | if (constraint_axis.mV[VZ] > 0.f) |
989 | { | 960 | { |
990 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white); | 961 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); |
991 | } | 962 | } |
992 | else | 963 | else |
993 | { | 964 | { |
994 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white); | 965 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); |
995 | } | 966 | } |
996 | } | 967 | } |
997 | } | 968 | } |
@@ -999,7 +970,7 @@ void LLManipRotate::renderSnapGuides() | |||
999 | { | 970 | { |
1000 | if (i == 0) | 971 | if (i == 0) |
1001 | { | 972 | { |
1002 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white); | 973 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white); |
1003 | } | 974 | } |
1004 | else if (i == 16) | 975 | else if (i == 16) |
1005 | { | 976 | { |
@@ -1014,7 +985,7 @@ void LLManipRotate::renderSnapGuides() | |||
1014 | } | 985 | } |
1015 | else if (i == 32) | 986 | else if (i == 32) |
1016 | { | 987 | { |
1017 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white); | 988 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white); |
1018 | } | 989 | } |
1019 | else | 990 | else |
1020 | { | 991 | { |
@@ -1038,11 +1009,11 @@ void LLManipRotate::renderSnapGuides() | |||
1038 | { | 1009 | { |
1039 | if (constraint_axis.mV[VY] > 0.f) | 1010 | if (constraint_axis.mV[VY] > 0.f) |
1040 | { | 1011 | { |
1041 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white); | 1012 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); |
1042 | } | 1013 | } |
1043 | else | 1014 | else |
1044 | { | 1015 | { |
1045 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white); | 1016 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); |
1046 | } | 1017 | } |
1047 | } | 1018 | } |
1048 | else if (i == 32) | 1019 | else if (i == 32) |
@@ -1053,11 +1024,11 @@ void LLManipRotate::renderSnapGuides() | |||
1053 | { | 1024 | { |
1054 | if (constraint_axis.mV[VY] > 0.f) | 1025 | if (constraint_axis.mV[VY] > 0.f) |
1055 | { | 1026 | { |
1056 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white); | 1027 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white); |
1057 | } | 1028 | } |
1058 | else | 1029 | else |
1059 | { | 1030 | { |
1060 | renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white); | 1031 | renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white); |
1061 | } | 1032 | } |
1062 | } | 1033 | } |
1063 | } | 1034 | } |
@@ -1072,7 +1043,7 @@ void LLManipRotate::renderSnapGuides() | |||
1072 | getObjectAxisClosestToMouse(object_axis); | 1043 | getObjectAxisClosestToMouse(object_axis); |
1073 | 1044 | ||
1074 | // project onto constraint plane | 1045 | // project onto constraint plane |
1075 | LLSelectNode* first_node = gSelectMgr->getFirstMoveableNode(TRUE); | 1046 | LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); |
1076 | object_axis = object_axis * first_node->getObject()->getRenderRotation(); | 1047 | object_axis = object_axis * first_node->getObject()->getRenderRotation(); |
1077 | object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis(); | 1048 | object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis(); |
1078 | object_axis.normVec(); | 1049 | object_axis.normVec(); |
@@ -1156,7 +1127,7 @@ BOOL LLManipRotate::updateVisiblity() | |||
1156 | BOOL visible = FALSE; | 1127 | BOOL visible = FALSE; |
1157 | 1128 | ||
1158 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); | 1129 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); |
1159 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1130 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1160 | { | 1131 | { |
1161 | mCenterToCam = LLVector3(-1.f / gAgent.getAvatarObject()->mHUDCurZoom, 0.f, 0.f); | 1132 | mCenterToCam = LLVector3(-1.f / gAgent.getAvatarObject()->mHUDCurZoom, 0.f, 0.f); |
1162 | mCenterToCamNorm = mCenterToCam; | 1133 | mCenterToCamNorm = mCenterToCam; |
@@ -1265,7 +1236,7 @@ LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y ) | |||
1265 | F32 angle = (-1.f + dist_to_intersection / dist_to_tangent_point) * in_sphere_angle; | 1236 | F32 angle = (-1.f + dist_to_intersection / dist_to_tangent_point) * in_sphere_angle; |
1266 | 1237 | ||
1267 | LLVector3 axis; | 1238 | LLVector3 axis; |
1268 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1239 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1269 | { | 1240 | { |
1270 | axis = LLVector3(-1.f, 0.f, 0.f) % profile_center_to_intersection; | 1241 | axis = LLVector3(-1.f, 0.f, 0.f) % profile_center_to_intersection; |
1271 | } | 1242 | } |
@@ -1308,7 +1279,7 @@ LLVector3 LLManipRotate::getConstraintAxis() | |||
1308 | 1279 | ||
1309 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); | 1280 | gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); |
1310 | 1281 | ||
1311 | LLSelectNode* first_node = gSelectMgr->getFirstMoveableNode(TRUE); | 1282 | LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); |
1312 | if (first_node) | 1283 | if (first_node) |
1313 | { | 1284 | { |
1314 | // *FIX: get agent local attachment grid working | 1285 | // *FIX: get agent local attachment grid working |
@@ -1322,7 +1293,7 @@ LLVector3 LLManipRotate::getConstraintAxis() | |||
1322 | 1293 | ||
1323 | LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | 1294 | LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) |
1324 | { | 1295 | { |
1325 | LLSelectNode* first_object_node = gSelectMgr->getFirstMoveableNode(TRUE); | 1296 | LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE); |
1326 | LLVector3 constraint_axis = getConstraintAxis(); | 1297 | LLVector3 constraint_axis = getConstraintAxis(); |
1327 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); | 1298 | LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); |
1328 | 1299 | ||
@@ -1339,7 +1310,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1339 | LLVector3 axis2; | 1310 | LLVector3 axis2; |
1340 | 1311 | ||
1341 | LLVector3 test_axis = constraint_axis; | 1312 | LLVector3 test_axis = constraint_axis; |
1342 | if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) | 1313 | if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) |
1343 | { | 1314 | { |
1344 | test_axis = test_axis * ~grid_rotation; | 1315 | test_axis = test_axis * ~grid_rotation; |
1345 | } | 1316 | } |
@@ -1363,7 +1334,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1363 | axis1 = LLVector3::x_axis; | 1334 | axis1 = LLVector3::x_axis; |
1364 | } | 1335 | } |
1365 | 1336 | ||
1366 | if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) | 1337 | if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) |
1367 | { | 1338 | { |
1368 | axis1 = axis1 * grid_rotation; | 1339 | axis1 = axis1 * grid_rotation; |
1369 | } | 1340 | } |
@@ -1385,7 +1356,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1385 | // We're looking at the ring edge-on. | 1356 | // We're looking at the ring edge-on. |
1386 | LLVector3 snap_plane_center = (center + (constraint_axis * mRadiusMeters * 0.5f)); | 1357 | LLVector3 snap_plane_center = (center + (constraint_axis * mRadiusMeters * 0.5f)); |
1387 | LLVector3 cam_to_snap_plane; | 1358 | LLVector3 cam_to_snap_plane; |
1388 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1359 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1389 | { | 1360 | { |
1390 | cam_to_snap_plane.setVec(1.f, 0.f, 0.f); | 1361 | cam_to_snap_plane.setVec(1.f, 0.f, 0.f); |
1391 | } | 1362 | } |
@@ -1435,7 +1406,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1435 | { | 1406 | { |
1436 | // try other plane | 1407 | // try other plane |
1437 | snap_plane_center = (center - (constraint_axis * mRadiusMeters * 0.5f)); | 1408 | snap_plane_center = (center - (constraint_axis * mRadiusMeters * 0.5f)); |
1438 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1409 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1439 | { | 1410 | { |
1440 | cam_to_snap_plane.setVec(1.f, 0.f, 0.f); | 1411 | cam_to_snap_plane.setVec(1.f, 0.f, 0.f); |
1441 | } | 1412 | } |
@@ -1482,7 +1453,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) | |||
1482 | if (snap_plane > 0) | 1453 | if (snap_plane > 0) |
1483 | { | 1454 | { |
1484 | LLVector3 cam_at_axis; | 1455 | LLVector3 cam_at_axis; |
1485 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1456 | if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) |
1486 | { | 1457 | { |
1487 | cam_at_axis.setVec(1.f, 0.f, 0.f); | 1458 | cam_at_axis.setVec(1.f, 0.f, 0.f); |
1488 | } | 1459 | } |
@@ -1680,9 +1651,10 @@ LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const | |||
1680 | } | 1651 | } |
1681 | 1652 | ||
1682 | // Utility function. Should probably be moved to another class. | 1653 | // Utility function. Should probably be moved to another class. |
1654 | //static | ||
1683 | void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir ) | 1655 | void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir ) |
1684 | { | 1656 | { |
1685 | if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) | 1657 | if (gSelectMgr->getSelection()->getSelectType() == SELECT_TYPE_HUD) |
1686 | { | 1658 | { |
1687 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 1659 | F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
1688 | F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; | 1660 | F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; |
@@ -1704,7 +1676,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) | |||
1704 | mHighlightedPart = LL_NO_PART; | 1676 | mHighlightedPart = LL_NO_PART; |
1705 | 1677 | ||
1706 | //LLBBox bbox = gSelectMgr->getBBoxOfSelection(); | 1678 | //LLBBox bbox = gSelectMgr->getBBoxOfSelection(); |
1707 | LLViewerObject *first_object = gSelectMgr->getFirstMoveableObject(TRUE); | 1679 | LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); |
1708 | 1680 | ||
1709 | if (!first_object) | 1681 | if (!first_object) |
1710 | { | 1682 | { |
@@ -1840,7 +1812,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) | |||
1840 | 1812 | ||
1841 | S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis) | 1813 | S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis) |
1842 | { | 1814 | { |
1843 | LLSelectNode* first_object_node = gSelectMgr->getFirstMoveableNode(TRUE); | 1815 | LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE); |
1844 | 1816 | ||
1845 | if (!first_object_node) | 1817 | if (!first_object_node) |
1846 | { | 1818 | { |