diff options
Diffstat (limited to 'indra/newview/llmanip.cpp')
-rw-r--r-- | indra/newview/llmanip.cpp | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index feb691520f..6e389f95b1 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -99,7 +99,7 @@ void LLManip::rebuild(LLViewerObject* vobj) LLManip::LLManip( const std::string& name, LLToolComposite* composite ) : LLTool( name, composite ), - mInSnapRegime(FALSE), + mInSnapRegime(false), mHighlightedPart(LL_NO_PART), mManipPart(LL_NO_PART) { @@ -147,7 +147,7 @@ void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 } -BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis) +bool LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis) { LLVector3 grid_origin; LLVector3 grid_scale; @@ -169,11 +169,11 @@ BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 & } else { - return FALSE; + return false; } axis.rotVec( grid_rotation ); - return TRUE; + return true; } F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing, F32 min_subdivisions, F32 max_subdivisions) @@ -215,7 +215,7 @@ LLObjectSelectionHandle LLManip::getSelection() return mObjectSelection; } -BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) +bool LLManip::handleHover(S32 x, S32 y, MASK mask) { // We only handle the event if mousedown started with us if( hasMouseCapture() ) @@ -224,7 +224,7 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) { // Somehow the object got deselected while we were dragging it. // Release the mouse - setMouseCapture( FALSE ); + setMouseCapture( false ); } LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << LL_ENDL; @@ -234,17 +234,17 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << LL_ENDL; } gViewerWindow->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } -BOOL LLManip::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLManip::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { - handled = TRUE; - setMouseCapture( FALSE ); + handled = true; + setMouseCapture( false ); } return handled; } @@ -254,20 +254,20 @@ void LLManip::updateGridSettings() sGridMaxSubdivisionLevel = gSavedSettings.getBOOL("GridSubUnit") ? (F32)gSavedSettings.getS32("GridSubdivision") : 1.f; } -BOOL LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal) +bool LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal) { LLVector3d origin_double = gAgent.getPosGlobalFromAgent(origin); LLVector3d global_point; - BOOL result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal); + bool result = getMousePointOnPlaneGlobal(global_point, x, y, origin_double, normal); point = gAgent.getPosAgentFromGlobal(global_point); return result; } -BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const +bool LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal) const { if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - BOOL result = FALSE; + bool result = false; F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgentCamera.mHUDCurZoom; F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgentCamera.mHUDCurZoom; @@ -282,7 +282,7 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect { mouse_pos.mV[VX] = (normal * (origin_agent - mouse_pos)) / (normal.mV[VX]); - result = TRUE; + result = true; } point = gAgent.getPosGlobalFromAgent(mouse_pos); @@ -294,13 +294,13 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect point, x, y, origin, normal ); } - //return FALSE; + //return false; } // Given the line defined by mouse cursor (a1 + a_param*(a2-a1)) and the line defined by b1 + b_param*(b2-b1), // returns a_param and b_param for the points where lines are closest to each other. // Returns false if the two lines are parallel. -BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) +bool LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) { LLVector3 a1; LLVector3 a2; @@ -318,7 +318,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co a2 = gAgentCamera.getCameraPositionAgent() + LLVector3(gViewerWindow->mouseDirectionGlobal(x, y)); } - BOOL parallel = TRUE; + bool parallel = true; LLVector3 a = a2 - a1; LLVector3 b = b2 - b1; @@ -332,7 +332,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) ) { a_param = (dist - normal * a1) / denom; - parallel = FALSE; + parallel = false; } normal = (a % b) % a; // normal to plane (P) through a and (shortest line between a and b) @@ -342,7 +342,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if( (denom < -F_APPROXIMATELY_ZERO) || (F_APPROXIMATELY_ZERO < denom) ) { b_param = (dist - normal * b1) / denom; - parallel = FALSE; + parallel = false; } return parallel; @@ -355,22 +355,28 @@ LLVector3 LLManip::getSavedPivotPoint() const LLVector3 LLManip::getPivotPoint() { - if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD) + LLViewerObject* object = mObjectSelection->getFirstObject(); + if (object && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD) { + LLSelectNode* select_node = mObjectSelection->getFirstNode(); + if (select_node->mSelectedGLTFNode != -1) + { + return object->getGLTFNodePositionAgent(select_node->mSelectedGLTFNode); + } return mObjectSelection->getFirstObject()->getPivotPositionAgent(); } return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); } -void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) +void LLManip::renderGuidelines(bool draw_x, bool draw_y, bool draw_z) { LLVector3 grid_origin; LLQuaternion grid_rot; LLVector3 grid_scale; LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale); - const BOOL children_ok = TRUE; + const bool children_ok = true; LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); if (!object) { @@ -496,7 +502,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons { const LLFontGL* big_fontp = LLFontGL::getFontSansSerif(); - BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; + bool hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); LLVector3 render_pos = pos; @@ -554,7 +560,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string } } - BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; + bool hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); { |