From 9f4031edffa86f194bad440bc2940648cca7368d Mon Sep 17 00:00:00 2001 From: Ricky Curtice Date: Tue, 18 Feb 2014 23:20:46 -0800 Subject: STORM-1920: Documented the meaning of some of the variables involved, built simplest change to solve issue. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The highlighting code assumed that the axis of the scaling movement was aligned with the scale tick marks - e.g. one of the cardinal directions with respect to the OBB of the selection. This was and is NOT true when dragging from the corner, aka scaling more than one axis at a time. The solution was to calculate the measured distance by projecting the snapped distance along the snap direction onto the axis of the relevant snap guide. This gives the correct values, and is nice and clean - both in the change involved, and in the values returned. However, while the fundamental misunderstanding in the code has been cleaned up by this change, the tick_val variable has so much jitter in the bottom end that the is_approx_equal function doesn’t come true > 98% of the time. This is the next problem to solve. --- indra/newview/llmanipscale.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llmanipscale.cpp') diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 087f617bbb..18201f9074 100755 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -870,7 +870,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) } mDragPointGlobal = lerp(mDragStartCenterGlobal, mDragStartPointGlobal, t); - LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); F32 scale_factor = 1.f; F32 max_scale = partToMaxScale(mManipPart, bbox); F32 min_scale = partToMinScale(mManipPart, bbox); @@ -888,9 +888,6 @@ void LLManipScale::dragCorner( S32 x, S32 y ) LLVector3 projected_drag_pos1 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane1, mSnapGuideDir1)); LLVector3 projected_drag_pos2 = inverse_projected_vec(mScaleDir, orthogonal_component(mouse_on_plane2, mSnapGuideDir2)); - LLVector3 mouse_offset_from_scale_line_1 = orthogonal_component(mouse_on_plane1, mScaleDir); - LLVector3 mouse_offset_from_scale_line_2 = orthogonal_component(mouse_on_plane2, mScaleDir); - BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); if (snap_enabled && (mouse_on_plane1 - projected_drag_pos1) * mSnapGuideDir1 > mSnapRegimeOffset) { @@ -1729,7 +1726,9 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) F32 text_highlight = 0.8f; - if (is_approx_equal(tick_val, mScaleSnapValue) && mInSnapRegime) + F32 measured_distance = -(mSnapGuideDir2 * (mScaleDir * mScaleSnapValue)); // The other snap guide points down the vector we are measuring against, which when the snapvalue along the scale direction is projected against gives the distance along the relevant axis of measurement. + + if (is_approx_equal(tick_val, measured_distance) && mInSnapRegime) { text_highlight = 1.f; } @@ -1781,7 +1780,9 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) F32 text_highlight = 0.8f; - if (is_approx_equal(tick_val, mScaleSnapValue) && mInSnapRegime) + F32 measured_distance = -(mSnapGuideDir1 * (mScaleDir * mScaleSnapValue)); // The other snap guide points down the vector we are measuring against, which when the snapvalue along the scale direction is projected against gives the distance along the relevant axis of measurement. + + if (is_approx_equal(tick_val, measured_distance) && mInSnapRegime) { text_highlight = 1.f; } -- cgit v1.2.3