From 1841bc69e65a80d7b9c12c5f954a012c6848ef8f Mon Sep 17 00:00:00 2001 From: Cinders Date: Mon, 14 Jan 2013 23:39:14 -0700 Subject: [PATCH] FIRE-8882: A better implementation of the switch, updated with Cron's most recent work on this, more to come. --- indra/newview/app_settings/settings.xml | 13 ++ indra/newview/llmanip.h | 8 + indra/newview/llmaniprotate.cpp | 103 ++++++---- indra/newview/llmanipscale.cpp | 178 ++++++++++++------ indra/newview/llmaniptranslate.cpp | 64 ++++--- .../default/xui/en/floater_build_options.xml | 46 ++++- 6 files changed, 300 insertions(+), 112 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5868fa53a8..e71bf89589 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -19703,5 +19703,18 @@ Change of this parameter will affect the layout of buttons in notification toast 1 + + FSSnapDomain + + Comment + Direction of snap lines (0 = outside of boundary, 1 = inside boundary) + Persist + 1 + Type + U32 + Value + 1 + + diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h index 6263e4244f..87ffbbd4ab 100644 --- a/indra/newview/llmanip.h +++ b/indra/newview/llmanip.h @@ -112,6 +112,14 @@ public: LL_EDGE_MIN = LL_EDGE_NEGX_NEGY, LL_EDGE_MAX = LL_EDGE_POSZ_POSX } EManipPartRanges; + +// FIRE-8882 + // For use in detecting the snap domain location + typedef enum e_snap_domains { + LL_SNAP_DOMAIN_OUTSIDE = 0, + LL_SNAP_DOMAIN_INSIDE = 1 + } ESnapDomains; +// public: static void rebuild(LLViewerObject* vobj); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index cd57c0ad2a..40560488ab 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -72,7 +72,7 @@ const F32 COS_DELTA = cos( DELTA ); const F32 MAX_MANIP_SELECT_DISTANCE = 100.f; const F32 SNAP_ANGLE_INCREMENT = 5.625f; const F32 SNAP_ANGLE_DETENTE = SNAP_ANGLE_INCREMENT; -// FIRE-8882 +// FIRE-8882 //const F32 SNAP_GUIDE_RADIUS_1 = 2.8f; //const F32 SNAP_GUIDE_RADIUS_2 = 2.4f; //const F32 SNAP_GUIDE_RADIUS_3 = 2.2f; @@ -80,13 +80,10 @@ const F32 SNAP_ANGLE_DETENTE = SNAP_ANGLE_INCREMENT; //const F32 SNAP_GUIDE_RADIUS_5 = 2.05f; //const F32 SNAP_GUIDE_INNER_RADIUS = 2.f; const F32 SNAP_GUIDE_RING_RADIUS = 2.f; -const F32 SNAP_GUIDE_TEXT_RADIUS = SNAP_GUIDE_RING_RADIUS + 0.2f; -const F32 SNAP_GUIDE_RADIUS_1 = SNAP_GUIDE_RING_RADIUS - 0.8f; -const F32 SNAP_GUIDE_RADIUS_2 = SNAP_GUIDE_RING_RADIUS - 0.4f; -const F32 SNAP_GUIDE_RADIUS_3 = SNAP_GUIDE_RING_RADIUS - 0.2f; -const F32 SNAP_GUIDE_RADIUS_4 = SNAP_GUIDE_RING_RADIUS - 0.1f; -const F32 SNAP_GUIDE_RADIUS_5 = SNAP_GUIDE_RING_RADIUS - 0.05f; -// +const F32 SNAP_GUIDE_RADIUS_STEP = 0.05f; +const F32 SNAP_GUIDE_TEXT_RADIUS_INNER_DOMAIN = SNAP_GUIDE_RING_RADIUS + 0.2f; +const F32 SNAP_GUIDE_TEXT_RADIUS_OUTER_DOMAIN = SNAP_GUIDE_RING_RADIUS + 0.1f; +// const F32 AXIS_ONTO_CAM_TOLERANCE = cos( 80.f * DEG_TO_RAD ); const F32 SELECTED_MANIPULATOR_SCALE = 1.05f; const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; @@ -425,10 +422,7 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE); // save selection center -// FIRE-8882 - //mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //LLSelectMgr::getInstance()->getSelectionCenterGlobal(); mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); -// mManipPart = (EManipPart)hit_part; LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); @@ -904,6 +898,20 @@ void LLManipRotate::renderSnapGuides() } gGL.popMatrix(); +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); + F32 tick_scale = 0.f; + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: + tick_scale = 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = -1.0f; + break; + } +// + for (S32 i = 0; i < 64; i++) { BOOL render_text = TRUE; @@ -925,38 +933,38 @@ void LLManipRotate::renderSnapGuides() F32 tick_length = 0.f; if (i % 16 == 0) { -// FIRE-8882 +// FIRE-8882 //tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_1 - SNAP_GUIDE_INNER_RADIUS); - tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_1 - SNAP_GUIDE_RING_RADIUS); -// + tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_STEP * tick_scale * 16.f); +// } else if (i % 8 == 0) { -// FIRE-8882 +// FIRE-8882 //tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_2 - SNAP_GUIDE_INNER_RADIUS); - tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_2 - SNAP_GUIDE_RING_RADIUS); -// + tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_STEP * tick_scale * 8.f); +// } else if (i % 4 == 0) { -// FIRE-8882 +// FIRE-8882 //tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_3 - SNAP_GUIDE_INNER_RADIUS); - tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_3 - SNAP_GUIDE_RING_RADIUS); -// + tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_STEP * tick_scale * 4.f); +// } else if (i % 2 == 0) { -// FIRE-8882 +// FIRE-8882 //tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_4 - SNAP_GUIDE_INNER_RADIUS); - tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_4 - SNAP_GUIDE_RING_RADIUS); -// + tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_STEP * tick_scale * 2.f); +// } else { -// FIRE-8882 +// FIRE-8882 //tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_5 - SNAP_GUIDE_INNER_RADIUS); - tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_5 - SNAP_GUIDE_RING_RADIUS); -// + tick_length = mRadiusMeters * (SNAP_GUIDE_RADIUS_STEP * tick_scale); +// } if (mCamEdgeOn) @@ -997,15 +1005,23 @@ void LLManipRotate::renderSnapGuides() // } -// FIRE-8882 +// FIRE-8882 //text_point = outer_point + (projected_snap_axis * mRadiusMeters * 0.1f) * rot; - text_point = ring_point + (projected_snap_axis * mRadiusMeters * (SNAP_GUIDE_TEXT_RADIUS - SNAP_GUIDE_RING_RADIUS)) * rot; + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: + text_point = ring_point + (projected_snap_axis * mRadiusMeters * (SNAP_GUIDE_TEXT_RADIUS_OUTER_DOMAIN - SNAP_GUIDE_RING_RADIUS)) * rot; + break; + case LL_SNAP_DOMAIN_INSIDE: + text_point = ring_point + (projected_snap_axis * mRadiusMeters * (SNAP_GUIDE_TEXT_RADIUS_INNER_DOMAIN - SNAP_GUIDE_RING_RADIUS)) * rot; + break; + } //gGL.vertex3fv(inner_point.mV); //gGL.vertex3fv(outer_point.mV); gGL.vertex3fv(ring_point.mV); gGL.vertex3fv(tip_point.mV); -// +// } gGL.end(); @@ -1578,10 +1594,18 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) } } -// FIRE-8882 + +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); + //if (snap_plane > 0) - if (snap_plane == SP_BETWEEN_PLANES) -// + if + ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && snap_plane != SP_BETWEEN_PLANES) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && snap_plane == SP_BETWEEN_PLANES) + ) +// { LLVector3 cam_at_axis; if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) @@ -1715,7 +1739,20 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) return LLQuaternion::DEFAULT; } - if (gSavedSettings.getBOOL("SnapEnabled") && projected_mouse.magVec() <= SNAP_GUIDE_RING_RADIUS * mRadiusMeters) +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); + + //if (gSavedSettings.getBOOL("SnapEnabled") && projected_mouse.magVec() > SNAP_GUIDE_INNER_RADIUS * mRadiusMeters) + if + ( + gSavedSettings.getBOOL("SnapEnabled") && + ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && projected_mouse.magVec() > SNAP_GUIDE_RING_RADIUS * mRadiusMeters) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && projected_mouse.magVec() <= SNAP_GUIDE_RING_RADIUS * mRadiusMeters) + ) + ) +// { // FIRE-8882 //if (!mInSnapRegime) diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 2f7af2965a..9eb9cb1b38 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -66,7 +66,7 @@ const F32 MAX_MANIP_SELECT_DISTANCE_SQUARED = 11.f * 11.f; const F32 SNAP_GUIDE_SCREEN_OFFSET = 0.05f; const F32 SNAP_GUIDE_SCREEN_LENGTH = 0.7f; // FIRE-8882 -const F32 SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION = 1.3f; +const F32 SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION = 1.3f; // Used then the snapping domain is set to inside // const F32 SELECTED_MANIPULATOR_SCALE = 1.2f; const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; @@ -823,12 +823,12 @@ void LLManipScale::renderAxisHandle( const LLVector3& start, const LLVector3& en // General scale call void LLManipScale::drag( S32 x, S32 y ) { - if( (LL_FACE_MIN <= (S32)mManipPart) + if( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) ) { dragFace( x, y ); } - else if( (LL_CORNER_MIN <= (S32)mManipPart) + else if( (LL_CORNER_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_CORNER_MAX) ) { dragCorner( x, y ); @@ -939,14 +939,25 @@ void LLManipScale::dragCorner( S32 x, S32 y ) F32 max_scale = partToMaxScale(mManipPart, bbox); F32 min_scale = partToMinScale(mManipPart, bbox); -// FIRE-8882 +// FIRE-8882 //BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); //if (snap_enabled && dist_from_scale_line_1 > mSnapRegimeOffset * snap_dir_dot_mouse_offset1) //{ + + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); + if (gSavedSettings.getBOOL("SnapEnabled")) { - if (dist_from_scale_line_1 <= mSnapRegimeOffset * snap_dir_dot_mouse_offset1 && dist_from_scale_line_1 > 0.f) -// + F32 regime_dist1 = mSnapRegimeOffset * snap_dir_dot_mouse_offset1; + F32 regime_dist2 = mSnapRegimeOffset * snap_dir_dot_mouse_offset2; + + if + ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && dist_from_scale_line_1 > regime_dist1) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && dist_from_scale_line_1 <= regime_dist1 && dist_from_scale_line_1 > 0.f) + ) +// { mInSnapRegime = TRUE; LLVector3 projected_drag_pos = mouse_on_plane1 - (dist_from_scale_line_1 / snap_dir_dot_mouse_offset1) * mSnapGuideDir1; @@ -964,10 +975,15 @@ void LLManipScale::dragCorner( S32 x, S32 y ) scale_factor *= 0.5f; } } -// FIRE-8882 +// FIRE-8882 //else if (snap_enabled && dist_from_scale_line_2 > mSnapRegimeOffset * snap_dir_dot_mouse_offset2) - else if (dist_from_scale_line_2 <= mSnapRegimeOffset * snap_dir_dot_mouse_offset2 && dist_from_scale_line_2 > 0.f) -// + else if + ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && dist_from_scale_line_2 > regime_dist2) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && dist_from_scale_line_2 <= regime_dist2 && dist_from_scale_line_2 > 0.f) + ) +// { mInSnapRegime = TRUE; LLVector3 projected_drag_pos = mouse_on_plane2 - (dist_from_scale_line_2 / snap_dir_dot_mouse_offset2) * mSnapGuideDir2; @@ -1165,12 +1181,19 @@ void LLManipScale::dragFace( S32 x, S32 y ) F32 dist_from_scale_line = dist_vec(scale_center_to_mouse, (mouse_on_scale_line - mScaleCenter)); F32 dist_along_scale_line = scale_center_to_mouse * mScaleDir; -// FIRE-8882 +// FIRE-8882 //BOOL snap_enabled = gSavedSettings.getBOOL("SnapEnabled"); + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); //if (snap_enabled && dist_from_scale_line > mSnapRegimeOffset) - if (gSavedSettings.getBOOL("SnapEnabled") && dist_from_scale_line <= mSnapRegimeOffset) -// + if (gSavedSettings.getBOOL("SnapEnabled") && + ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && dist_from_scale_line > mSnapRegimeOffset) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && dist_from_scale_line <= mSnapRegimeOffset) + ) + ) +// { mInSnapRegime = TRUE; @@ -1698,6 +1721,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing); +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); +// + for (pass = 0; pass < 3; pass++) { LLColor4 tick_color = setupSnapGuideRenderPass(pass); @@ -1719,10 +1746,19 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) continue; } -// FIRE-8882 +// FIRE-8882 //F32 tick_scale = 1.f; - F32 tick_scale = -0.8f; -// + F32 tick_scale = 0.f; + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: + tick_scale = 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = -0.8f; + break; + } +// for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) { if (fmodf((F32)(i + sub_div_offset_1), division_level) == 0.f) @@ -1755,10 +1791,19 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) continue; } -// FIRE-8882 +// FIRE-8882 //F32 tick_scale = 1.f; - F32 tick_scale = -0.8f; -// + F32 tick_scale = 0.f; + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: + tick_scale = 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = -0.8f; + break; + } +// for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) { if (fmodf((F32)(i + sub_div_offset_2), division_level) == 0.f) @@ -1777,7 +1822,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) gGL.end(); } - // render tick labels + // render near-side tick labels start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1)); stop_tick = llmin(max_ticks1, num_ticks_per_side1); @@ -1787,37 +1832,47 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) for (S32 i = start_tick; i <= stop_tick; i++) { -// FIRE-8882 - //F32 tick_scale = 1.f; -// + F32 tick_scale = 1.f; F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side1))); LLVector3 tick_pos = drag_point + (mScaleDir * (mScaleSnapUnit1 / max_subdivisions * (F32)i - grid_offset1)); -// FIRE-8882 - //for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) - if (fmodf((F32)(i + label_sub_div_offset_1), (max_subdivisions / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f) -// +// FIRE-8882 + switch (snap_domain) { -// FIRE-8882 - //if (fmodf((F32)(i + label_sub_div_offset_1), division_level) == 0.f) - //{ - // break; - //} - //tick_scale *= 0.7f; + case LL_SNAP_DOMAIN_OUTSIDE: +// + for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) + { + if (fmodf((F32)(i + label_sub_div_offset_1), division_level) == 0.f) + { + break; + } + tick_scale *= 0.7f; + } +// FIRE-8882 + tick_scale += 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION; + break; + } +// + + if (fmodf((F32)(i + label_sub_div_offset_1), (max_subdivisions / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f) + { +// FIRE-8882 + //LLVector3 text_origin = tick_pos + + // (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale)); LLVector3 text_origin; - if ( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) ) // Face drag + if (snap_domain == LL_SNAP_DOMAIN_INSIDE && (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) ) // Face drag { text_origin = tick_pos; // Just off center is a good place for face ticks. } - else // Corner drag + else // Corner drag, or not in the inner snap domain - assuming that means that means the outer domain for now. { - text_origin = tick_pos + (mSnapGuideDir1 * (mSnapRegimeOffset * SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION)); + text_origin = tick_pos + (mSnapGuideDir1 * (mSnapRegimeOffset * tick_scale)); } - //if (fmodf((F32)(i + label_sub_div_offset_1), (max_subdivisions / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f) - //{ - // LLVector3 text_origin = tick_pos + - // (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale)); -// +// EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 tick_val; @@ -1849,37 +1904,46 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) } } - // label ticks on opposite side, only can happen in scaling modes that effect more than one axis. + // label ticks on opposite side, only can happen in scaling modes that effect more than one axis and when the object's axis don't have the same scale. A differing scale indicates both conditions. if (mScaleSnapUnit2 != mScaleSnapUnit1) { start_tick = -(llmin(ticks_from_scale_center_2, num_ticks_per_side2)); stop_tick = llmin(max_ticks2, num_ticks_per_side2); for (S32 i = start_tick; i <= stop_tick; i++) { -// FIRE-8882 - //F32 tick_scale = 1.f; -// + F32 tick_scale = 1.f; F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side2))); LLVector3 tick_pos = drag_point + (mScaleDir * (mScaleSnapUnit2 / max_subdivisions * (F32)i - grid_offset2)); -// FIRE-8882 - //for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) - //{ - // if (fmodf((F32)(i + label_sub_div_offset_2), division_level) == 0.f) - // { - // break; - // } - // tick_scale *= 0.7f; - //} -// +// FIRE-8882 + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: +// + for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) + { + if (fmodf((F32)(i + label_sub_div_offset_2), division_level) == 0.f) + { + break; + } + tick_scale *= 0.7f; + } +// FIRE-8882 + tick_scale += 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION; + break; + } +// if (fmodf((F32)(i + label_sub_div_offset_2), (max_subdivisions / llmin(max_subdivisions, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, tick_label_spacing)))) == 0.f) { -// FIRE-8882 +// FIRE-8882 //LLVector3 text_origin = tick_pos + // (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale)); - LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * (mSnapRegimeOffset * SNAP_GUIDE_CORNER_DRAG_TEXT_POSITION)); // No test needed, as this code area only activates in the Corner Drag case. That is until such a time as edge scaling is resurrected... -// + LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset * tick_scale); // No test needed, as this code area only activates in the Corner Drag case. That is until such a time as edge scaling is resurrected... +// EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 tick_val; diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index e2bc188801..83263ea6bd 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -556,10 +556,15 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (gSavedSettings.getBOOL("SnapEnabled")) { -// FIRE-8882 +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); //if (off_axis_magnitude > mSnapOffsetMeters) - if (off_axis_magnitude <= mSnapOffsetMeters) -// + if ( + (snap_domain == LL_SNAP_DOMAIN_OUTSIDE && off_axis_magnitude > mSnapOffsetMeters) + || + (snap_domain == LL_SNAP_DOMAIN_INSIDE && off_axis_magnitude <= mSnapOffsetMeters) + ) +// { mInSnapRegime = TRUE; LLVector3 mouse_down_offset(mDragCursorStartGlobal - mDragSelectionStartGlobal); @@ -1280,6 +1285,10 @@ void LLManipTranslate::renderSnapGuides() S32 sub_div_offset = llround(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale); S32 num_ticks_per_side = llmax(1, llfloor(0.5f * guide_size_meters / smallest_grid_unit_scale)); +// FIRE-8882 + U32 snap_domain = gSavedSettings.getU32("FSSnapDomain"); +// + LLGLDepthTest gls_depth(GL_FALSE); for (S32 pass = 0; pass < 3; pass++) @@ -1326,11 +1335,20 @@ void LLManipTranslate::renderSnapGuides() // add in off-axis offset tick_start += (mSnapOffsetAxis * mSnapOffsetMeters); -// FIRE-8882 +// FIRE-8882 //BOOL is_sub_tick = FALSE; //F32 tick_scale = 1.f; - F32 tick_scale = -0.8f; -// + F32 tick_scale = 0.f; + switch (snap_domain) + { + case LL_SNAP_DOMAIN_OUTSIDE: + tick_scale = 1.f; + break; + case LL_SNAP_DOMAIN_INSIDE: + tick_scale = -0.8f; + break; + } +// for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f) { if (fmodf((F32)(i + sub_div_offset), division_level) == 0.f) @@ -1423,24 +1441,28 @@ void LLManipTranslate::renderSnapGuides() if (fmodf((F32)(i + sub_div_offset), (max_subdivisions / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, translate_axis, getMinGridScale(), tick_label_spacing)))) == 0.f) { -// FIRE-8882 +// FIRE-8882 //F32 snap_offset_meters; + F32 snap_offset_meters = 0.f; - //if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f) - //{ - // snap_offset_meters = mSnapOffsetMeters; - //} - //else - //{ - // snap_offset_meters = -mSnapOffsetMeters; - //} -// + if (snap_domain == LL_SNAP_DOMAIN_OUTSIDE) { +// + if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f) + { + snap_offset_meters = mSnapOffsetMeters; + } + else + { + snap_offset_meters = -mSnapOffsetMeters; + } +// FIRE-8882 + } + //else case assuming snap_domain == LL_SNAP_DOMAIN_INSIDE for now. This results in snap_offset_meters == 0.f and the third term of the text_origin assignment becoming zero as an expected consequence. ~Cron Stardust +// + LLVector3 text_origin = selection_center + -// FIRE-8882 - //(translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit)) + - // (mSnapOffsetAxis * snap_offset_meters * (1.f + tick_scale)); - (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit)); -// + (translate_axis * ((smallest_grid_unit_scale * (F32)i) - offset_nearest_grid_unit)) + + (mSnapOffsetAxis * snap_offset_meters * (1.f + tick_scale)); LLVector3 tick_offset = (tick_pos - mGridOrigin) * ~mGridRotation; F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale(); diff --git a/indra/newview/skins/default/xui/en/floater_build_options.xml b/indra/newview/skins/default/xui/en/floater_build_options.xml index db5e1b5de4..99bf3c18e6 100644 --- a/indra/newview/skins/default/xui/en/floater_build_options.xml +++ b/indra/newview/skins/default/xui/en/floater_build_options.xml @@ -1,7 +1,7 @@ + + + Snap on: + + + + + +