Manipulator Bounds updates (#5959)
* first pass updates to improve manipulators Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * add setting to enable/disable manipulator axis flipping Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update manipulator cvar to use ed_ naming convention Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * wip updates to add AzToolsFramework values to the SettingsRegistry Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * expose a number of manipulator settings for configuration Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * add setting for manipulator base scale to change size of all manipulators together Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * minor updates before posting PR Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * add manipulator section for settings registry paths Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * fix for failing unit test after manipulator changes Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * fix total scale Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * fix for polygon prism component shape tests Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>monroegm-disable-blank-issue-2
parent
8f4ff91915
commit
8344539ab6
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
constexpr AZStd::string_view FlipManipulatorAxesTowardsViewSetting = "/Amazon/Preferences/Editor/Manipulator/FlipManipulatorAxesTowardsView";
|
||||
constexpr AZStd::string_view LinearManipulatorAxisLengthSetting = "/Amazon/Preferences/Editor/Manipulator/LinearManipulatorAxisLength";
|
||||
constexpr AZStd::string_view PlanarManipulatorAxisLengthSetting = "/Amazon/Preferences/Editor/Manipulator/PlanarManipulatorAxisLength";
|
||||
constexpr AZStd::string_view SurfaceManipulatorRadiusSetting = "/Amazon/Preferences/Editor/Manipulator/SurfaceManipulatorRadius";
|
||||
constexpr AZStd::string_view SurfaceManipulatorOpacitySetting = "/Amazon/Preferences/Editor/Manipulator/SurfaceManipulatorOpacity";
|
||||
constexpr AZStd::string_view LinearManipulatorConeLengthSetting = "/Amazon/Preferences/Editor/Manipulator/LinearManipulatorConeLength";
|
||||
constexpr AZStd::string_view LinearManipulatorConeRadiusSetting = "/Amazon/Preferences/Editor/Manipulator/LinearManipulatorConeRadius";
|
||||
constexpr AZStd::string_view ScaleManipulatorBoxHalfExtentSetting = "/Amazon/Preferences/Editor/Manipulator/ScaleManipulatorBoxHalfExtent";
|
||||
constexpr AZStd::string_view RotationManipulatorRadiusSetting = "/Amazon/Preferences/Editor/Manipulator/RotationManipulatorRadius";
|
||||
constexpr AZStd::string_view ManipulatorViewBaseScaleSetting = "/Amazon/Preferences/Editor/Manipulator/ViewBaseScale";
|
||||
|
||||
bool FlipManipulatorAxesTowardsView()
|
||||
{
|
||||
return GetRegistry(FlipManipulatorAxesTowardsViewSetting, true);
|
||||
}
|
||||
|
||||
void SetFlipManipulatorAxesTowardsView(const bool enabled)
|
||||
{
|
||||
SetRegistry(FlipManipulatorAxesTowardsViewSetting, enabled);
|
||||
}
|
||||
|
||||
float LinearManipulatorAxisLength()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(LinearManipulatorAxisLengthSetting, 2.0));
|
||||
}
|
||||
|
||||
void SetLinearManipulatorAxisLength(const float length)
|
||||
{
|
||||
SetRegistry(LinearManipulatorAxisLengthSetting, length);
|
||||
}
|
||||
|
||||
float PlanarManipulatorAxisLength()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(PlanarManipulatorAxisLengthSetting, 0.6));
|
||||
}
|
||||
|
||||
void SetPlanarManipulatorAxisLength(const float length)
|
||||
{
|
||||
SetRegistry(PlanarManipulatorAxisLengthSetting, length);
|
||||
}
|
||||
|
||||
float SurfaceManipulatorRadius()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(SurfaceManipulatorRadiusSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetSurfaceManipulatorRadius(const float radius)
|
||||
{
|
||||
SetRegistry(SurfaceManipulatorRadiusSetting, radius);
|
||||
}
|
||||
|
||||
float SurfaceManipulatorOpacity()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(SurfaceManipulatorOpacitySetting, 0.75));
|
||||
}
|
||||
|
||||
void SetSurfaceManipulatorOpacity(const float opacity)
|
||||
{
|
||||
SetRegistry(SurfaceManipulatorOpacitySetting, opacity);
|
||||
}
|
||||
|
||||
float LinearManipulatorConeLength()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(LinearManipulatorConeLengthSetting, 0.28));
|
||||
}
|
||||
|
||||
void SetLinearManipulatorConeLength(const float length)
|
||||
{
|
||||
SetRegistry(LinearManipulatorConeLengthSetting, length);
|
||||
}
|
||||
|
||||
float LinearManipulatorConeRadius()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(LinearManipulatorConeRadiusSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetLinearManipulatorConeRadius(const float radius)
|
||||
{
|
||||
SetRegistry(LinearManipulatorConeRadiusSetting, radius);
|
||||
}
|
||||
|
||||
float ScaleManipulatorBoxHalfExtent()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(ScaleManipulatorBoxHalfExtentSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetScaleManipulatorBoxHalfExtent(const float size)
|
||||
{
|
||||
SetRegistry(ScaleManipulatorBoxHalfExtentSetting, size);
|
||||
}
|
||||
|
||||
float RotationManipulatorRadius()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(RotationManipulatorRadiusSetting, 2.0));
|
||||
}
|
||||
|
||||
void SetRotationManipulatorRadius(const float radius)
|
||||
{
|
||||
SetRegistry(RotationManipulatorRadiusSetting, radius);
|
||||
}
|
||||
|
||||
float ManipulatorViewBaseScale()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(ManipulatorViewBaseScaleSetting, 1.0));
|
||||
}
|
||||
|
||||
void SetManipulatorViewBaseScale(const float scale)
|
||||
{
|
||||
SetRegistry(ManipulatorViewBaseScaleSetting, scale);
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
template<typename T>
|
||||
void SetRegistry(const AZStd::string_view setting, T&& value)
|
||||
{
|
||||
if (auto* registry = AZ::SettingsRegistry::Get())
|
||||
{
|
||||
registry->Set(setting, AZStd::forward<T>(value));
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
AZStd::remove_cvref_t<T> GetRegistry(const AZStd::string_view setting, T&& defaultValue)
|
||||
{
|
||||
AZStd::remove_cvref_t<T> value = AZStd::forward<T>(defaultValue);
|
||||
if (const auto* registry = AZ::SettingsRegistry::Get())
|
||||
{
|
||||
T potentialValue;
|
||||
if (registry->Get(potentialValue, setting))
|
||||
{
|
||||
value = AZStd::move(potentialValue);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool FlipManipulatorAxesTowardsView();
|
||||
void SetFlipManipulatorAxesTowardsView(bool enabled);
|
||||
|
||||
float LinearManipulatorAxisLength();
|
||||
void SetLinearManipulatorAxisLength(float length);
|
||||
|
||||
float PlanarManipulatorAxisLength();
|
||||
void SetPlanarManipulatorAxisLength(float length);
|
||||
|
||||
float SurfaceManipulatorRadius();
|
||||
void SetSurfaceManipulatorRadius(float radius);
|
||||
|
||||
float SurfaceManipulatorOpacity();
|
||||
void SetSurfaceManipulatorOpacity(float opacity);
|
||||
|
||||
float LinearManipulatorConeLength();
|
||||
void SetLinearManipulatorConeLength(float length);
|
||||
|
||||
float LinearManipulatorConeRadius();
|
||||
void SetLinearManipulatorConeRadius(float radius);
|
||||
|
||||
float ScaleManipulatorBoxHalfExtent();
|
||||
void SetScaleManipulatorBoxHalfExtent(float halfExtent);
|
||||
|
||||
float RotationManipulatorRadius();
|
||||
void SetRotationManipulatorRadius(float radius);
|
||||
|
||||
float ManipulatorViewBaseScale();
|
||||
void SetManipulatorViewBaseScale(float scale);
|
||||
} // namespace AzToolsFramework
|
||||
Loading…
Reference in New Issue