Expose the ability to control manipulator line bounds (#3890)
Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
@@ -5,96 +5,57 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "EditorPreferencesPageViewportGizmo.h"
|
||||
|
||||
// Editor
|
||||
#include "EditorViewportSettings.h"
|
||||
#include "Settings.h"
|
||||
|
||||
|
||||
void CEditorPreferencesPage_ViewportGizmo::Reflect(AZ::SerializeContext& serialize)
|
||||
void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& serialize)
|
||||
{
|
||||
serialize.Class<AxisGizmo>()
|
||||
->Version(1)
|
||||
->Field("Size", &AxisGizmo::m_size)
|
||||
->Field("Text", &AxisGizmo::m_text)
|
||||
->Field("MaxCount", &AxisGizmo::m_maxCount);
|
||||
serialize.Class<Manipulators>()->Version(1)->Field("LineBoundWidth", &Manipulators::m_manipulatorLineBoundWidth);
|
||||
|
||||
serialize.Class<Helpers>()
|
||||
->Version(1)
|
||||
->Field("LabelsOn", &Helpers::m_helpersGlobalScale)
|
||||
->Field("LabelsOn", &Helpers::m_tagpointScaleMulti)
|
||||
->Field("LabelsOn", &Helpers::m_rulerSphereScale)
|
||||
->Field("LabelsDistance", &Helpers::m_rulerSphereTrans);
|
||||
serialize.Class<CEditorPreferencesPage_ViewportManipulator>()->Version(2)->Field(
|
||||
"Manipulators", &CEditorPreferencesPage_ViewportManipulator::m_manipulators);
|
||||
|
||||
serialize.Class<CEditorPreferencesPage_ViewportGizmo>()
|
||||
->Version(1)
|
||||
->Field("Axis Gizmo", &CEditorPreferencesPage_ViewportGizmo::m_axisGizmo)
|
||||
->Field("Helpers", &CEditorPreferencesPage_ViewportGizmo::m_helpers);
|
||||
|
||||
AZ::EditContext* editContext = serialize.GetEditContext();
|
||||
if (editContext)
|
||||
if (AZ::EditContext* editContext = serialize.GetEditContext())
|
||||
{
|
||||
editContext->Class<AxisGizmo>("Axis Gizmo", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AxisGizmo::m_size, "Size", "Axis Gizmo Size")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &AxisGizmo::m_text, "Text Labels", "Text Labels on Axis Gizmo")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AxisGizmo::m_maxCount, "Max Count", "Max Count of Axis Gizmos");
|
||||
editContext->Class<Manipulators>("Manipulators", "")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorLineBoundWidth, "Line Bound Width",
|
||||
"Manipulator Line Bound Width")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.001f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f);
|
||||
|
||||
editContext->Class<Helpers>("Helpers", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_helpersGlobalScale, "Helpers Scale", "Helpers Scale")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_tagpointScaleMulti, "Tagpoint Scale Multiplier", "Tagpoint Scale Multiplier")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_rulerSphereScale, "Ruler Sphere Scale", "Ruler Sphere Scale")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_rulerSphereTrans, "Ruler Sphere Transparency", "Ruler Sphere Transparency")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100.0f);
|
||||
|
||||
editContext->Class<CEditorPreferencesPage_ViewportGizmo>("Gizmo Viewport Preferences", "Gizmo Viewport Preferences")
|
||||
editContext
|
||||
->Class<CEditorPreferencesPage_ViewportManipulator>("Manipulator Viewport Preferences", "Manipulator Viewport Preferences")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGizmo::m_axisGizmo, "Axis Gizmo", "Axis Gizmo")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGizmo::m_helpers, "Helpers", "Helpers");
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportManipulator::m_manipulators, "Manipulators", "Manipulators");
|
||||
}
|
||||
}
|
||||
|
||||
CEditorPreferencesPage_ViewportGizmo::CEditorPreferencesPage_ViewportGizmo()
|
||||
CEditorPreferencesPage_ViewportManipulator::CEditorPreferencesPage_ViewportManipulator()
|
||||
{
|
||||
InitializeSettings();
|
||||
m_icon = QIcon(":/res/Gizmos.svg");
|
||||
}
|
||||
|
||||
QIcon& CEditorPreferencesPage_ViewportGizmo::GetIcon()
|
||||
QIcon& CEditorPreferencesPage_ViewportManipulator::GetIcon()
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportGizmo::OnApply()
|
||||
void CEditorPreferencesPage_ViewportManipulator::OnApply()
|
||||
{
|
||||
gSettings.gizmo.axisGizmoSize = m_axisGizmo.m_size;
|
||||
gSettings.gizmo.axisGizmoText = m_axisGizmo.m_text;
|
||||
gSettings.gizmo.axisGizmoMaxCount = m_axisGizmo.m_maxCount;
|
||||
|
||||
gSettings.gizmo.helpersScale = m_helpers.m_helpersGlobalScale;
|
||||
gSettings.gizmo.tagpointScaleMulti = m_helpers.m_tagpointScaleMulti;
|
||||
gSettings.gizmo.rulerSphereScale = m_helpers.m_rulerSphereScale;
|
||||
gSettings.gizmo.rulerSphereTrans = m_helpers.m_rulerSphereTrans;
|
||||
SandboxEditor::SetManipulatorLineBoundWidth(m_manipulators.m_manipulatorLineBoundWidth);
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportGizmo::InitializeSettings()
|
||||
void CEditorPreferencesPage_ViewportManipulator::InitializeSettings()
|
||||
{
|
||||
m_axisGizmo.m_size = gSettings.gizmo.axisGizmoSize;
|
||||
m_axisGizmo.m_text = gSettings.gizmo.axisGizmoText;
|
||||
m_axisGizmo.m_maxCount = gSettings.gizmo.axisGizmoMaxCount;
|
||||
|
||||
m_helpers.m_helpersGlobalScale = gSettings.gizmo.helpersScale;
|
||||
m_helpers.m_tagpointScaleMulti = gSettings.gizmo.tagpointScaleMulti;
|
||||
m_helpers.m_rulerSphereScale = gSettings.gizmo.rulerSphereScale;
|
||||
m_helpers.m_rulerSphereTrans = gSettings.gizmo.rulerSphereTrans;
|
||||
m_manipulators.m_manipulatorLineBoundWidth = SandboxEditor::ManipulatorLineBoundWidth();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user