Update snapping settings to be stored in the Settings Registry (#646)

* add overload to ActionManager to support capturing an AZStd::function

* move snapping settings to new settings registry

* remove unneeded reference in ViewportSettings

* move viewport setting function implementations to .cpp file

* add more sensible default values for snapping

* fix variable name for angle snapping

* remove const from function prototype value parameters

* add import/export api for free functions

* change from std::bind to a lambda

* remove redundant const for constexpr string_view

* add AZStd alias for std::abs
This commit is contained in:
Tom Hulton-Harrop
2021-05-10 18:40:32 +01:00
committed by GitHub
parent bdaa7eb3c1
commit b2523217c3
15 changed files with 242 additions and 81 deletions
@@ -85,14 +85,14 @@ namespace AzToolsFramework
// if we're snapping, only increment current radians when we know
// preSnapRadians is greater than the angleStep
if (snapping)
if (snapping && AZStd::abs(angleStepDegrees) > 0.0f)
{
actionInternal.m_current.m_preSnapRadians += rotationAngleRad * rotateSign;
const float angleStepRad = AZ::DegToRad(angleStepDegrees);
const float preSnapRotateSign = Sign(actionInternal.m_current.m_preSnapRadians);
// if we move more than angleStep in a frame, make sure we catch up
while (fabsf(actionInternal.m_current.m_preSnapRadians) >= angleStepRad)
while (AZStd::abs(actionInternal.m_current.m_preSnapRadians) >= angleStepRad)
{
actionInternal.m_current.m_radians += angleStepRad * preSnapRotateSign;
actionInternal.m_current.m_preSnapRadians -= angleStepRad * preSnapRotateSign;