Merge branch 'development' into Prism/RefactorProjectSettings
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "EditorPreferencesPageViewportManipulator.h"
|
||||
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
|
||||
// Editor
|
||||
#include "EditorViewportSettings.h"
|
||||
#include "Settings.h"
|
||||
@@ -19,7 +21,17 @@ void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& s
|
||||
serialize.Class<Manipulators>()
|
||||
->Version(1)
|
||||
->Field("LineBoundWidth", &Manipulators::m_manipulatorLineBoundWidth)
|
||||
->Field("CircleBoundWidth", &Manipulators::m_manipulatorCircleBoundWidth);
|
||||
->Field("CircleBoundWidth", &Manipulators::m_manipulatorCircleBoundWidth)
|
||||
->Field("LinearManipulatorAxisLength", &Manipulators::m_linearManipulatorAxisLength)
|
||||
->Field("PlanarManipulatorAxisLength", &Manipulators::m_planarManipulatorAxisLength)
|
||||
->Field("SurfaceManipulatorRadius", &Manipulators::m_surfaceManipulatorRadius)
|
||||
->Field("SurfaceManipulatorOpacity", &Manipulators::m_surfaceManipulatorOpacity)
|
||||
->Field("LinearManipulatorConeLength", &Manipulators::m_linearManipulatorConeLength)
|
||||
->Field("LinearManipulatorConeRadius", &Manipulators::m_linearManipulatorConeRadius)
|
||||
->Field("ScaleManipulatorBoxHalfExtent", &Manipulators::m_scaleManipulatorBoxHalfExtent)
|
||||
->Field("RotationManipulatorRadius", &Manipulators::m_rotationManipulatorRadius)
|
||||
->Field("ManipulatorViewBaseScale", &Manipulators::m_manipulatorViewBaseScale)
|
||||
->Field("FlipManipulatorAxesTowardsView", &Manipulators::m_flipManipulatorAxesTowardsView);
|
||||
|
||||
serialize.Class<CEditorPreferencesPage_ViewportManipulator>()->Version(2)->Field(
|
||||
"Manipulators", &CEditorPreferencesPage_ViewportManipulator::m_manipulators);
|
||||
@@ -36,7 +48,55 @@ void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& s
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorCircleBoundWidth, "Circle Bound Width",
|
||||
"Manipulator Circle Bound Width")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.001f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f);
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorAxisLength, "Linear Manipulator Axis Length",
|
||||
"Length of default Linear Manipulator (for Translation and Scale Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 5.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_planarManipulatorAxisLength, "Planar Manipulator Axis Length",
|
||||
"Length of default Planar Manipulator (for Translation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 5.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_surfaceManipulatorRadius, "Surface Manipulator Radius",
|
||||
"Radius of default Surface Manipulator (for Translation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.05f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_surfaceManipulatorOpacity, "Surface Manipulator Opacity",
|
||||
"Opacity of default Surface Manipulator (for Translation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorConeLength, "Linear Manipulator Cone Length",
|
||||
"Length of cone for default Linear Manipulator (for Translation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.05f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_linearManipulatorConeRadius, "Linear Manipulator Cone Radius",
|
||||
"Radius of cone for default Linear Manipulator (for Translation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.05f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 0.5f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_scaleManipulatorBoxHalfExtent, "Scale Manipulator Box Half Extent",
|
||||
"Half extent of box for default Scale Manipulator")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.05f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_rotationManipulatorRadius, "Rotation Manipulator Radius",
|
||||
"Radius of default Angular Manipulators (for Rotation Manipulators)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.5f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 5.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorViewBaseScale, "Manipulator View Base Scale",
|
||||
"The base scale to apply to all Manipulator Views (default is 1.0)")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.5f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Manipulators::m_flipManipulatorAxesTowardsView, "Flip Manipulator Axes Towards View",
|
||||
"Determines whether Planar and Linear Manipulators should switch to face the view (camera) in the Editor");
|
||||
|
||||
editContext
|
||||
->Class<CEditorPreferencesPage_ViewportManipulator>("Manipulator Viewport Preferences", "Manipulator Viewport Preferences")
|
||||
@@ -82,10 +142,32 @@ void CEditorPreferencesPage_ViewportManipulator::OnApply()
|
||||
{
|
||||
SandboxEditor::SetManipulatorLineBoundWidth(m_manipulators.m_manipulatorLineBoundWidth);
|
||||
SandboxEditor::SetManipulatorCircleBoundWidth(m_manipulators.m_manipulatorCircleBoundWidth);
|
||||
|
||||
AzToolsFramework::SetLinearManipulatorAxisLength(m_manipulators.m_linearManipulatorAxisLength);
|
||||
AzToolsFramework::SetPlanarManipulatorAxisLength(m_manipulators.m_planarManipulatorAxisLength);
|
||||
AzToolsFramework::SetSurfaceManipulatorRadius(m_manipulators.m_surfaceManipulatorRadius);
|
||||
AzToolsFramework::SetSurfaceManipulatorOpacity(m_manipulators.m_surfaceManipulatorOpacity);
|
||||
AzToolsFramework::SetLinearManipulatorConeLength(m_manipulators.m_linearManipulatorConeLength);
|
||||
AzToolsFramework::SetLinearManipulatorConeRadius(m_manipulators.m_linearManipulatorConeRadius);
|
||||
AzToolsFramework::SetScaleManipulatorBoxHalfExtent(m_manipulators.m_scaleManipulatorBoxHalfExtent);
|
||||
AzToolsFramework::SetRotationManipulatorRadius(m_manipulators.m_rotationManipulatorRadius);
|
||||
AzToolsFramework::SetFlipManipulatorAxesTowardsView(m_manipulators.m_flipManipulatorAxesTowardsView);
|
||||
AzToolsFramework::SetManipulatorViewBaseScale(m_manipulators.m_manipulatorViewBaseScale);
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportManipulator::InitializeSettings()
|
||||
{
|
||||
m_manipulators.m_manipulatorLineBoundWidth = SandboxEditor::ManipulatorLineBoundWidth();
|
||||
m_manipulators.m_manipulatorCircleBoundWidth = SandboxEditor::ManipulatorCircleBoundWidth();
|
||||
|
||||
m_manipulators.m_linearManipulatorAxisLength = AzToolsFramework::LinearManipulatorAxisLength();
|
||||
m_manipulators.m_planarManipulatorAxisLength = AzToolsFramework::PlanarManipulatorAxisLength();
|
||||
m_manipulators.m_surfaceManipulatorRadius = AzToolsFramework::SurfaceManipulatorRadius();
|
||||
m_manipulators.m_surfaceManipulatorOpacity = AzToolsFramework::SurfaceManipulatorOpacity();
|
||||
m_manipulators.m_linearManipulatorConeLength = AzToolsFramework::LinearManipulatorConeLength();
|
||||
m_manipulators.m_linearManipulatorConeRadius = AzToolsFramework::LinearManipulatorConeRadius();
|
||||
m_manipulators.m_scaleManipulatorBoxHalfExtent = AzToolsFramework::ScaleManipulatorBoxHalfExtent();
|
||||
m_manipulators.m_rotationManipulatorRadius = AzToolsFramework::RotationManipulatorRadius();
|
||||
m_manipulators.m_flipManipulatorAxesTowardsView = AzToolsFramework::FlipManipulatorAxesTowardsView();
|
||||
m_manipulators.m_manipulatorViewBaseScale = AzToolsFramework::ManipulatorViewBaseScale();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,16 @@ private:
|
||||
|
||||
float m_manipulatorLineBoundWidth = 0.0f;
|
||||
float m_manipulatorCircleBoundWidth = 0.0f;
|
||||
float m_linearManipulatorAxisLength = 0.0f;
|
||||
float m_planarManipulatorAxisLength = 0.0f;
|
||||
float m_surfaceManipulatorRadius = 0.0f;
|
||||
float m_surfaceManipulatorOpacity = 0.0f;
|
||||
float m_linearManipulatorConeLength = 0.0f;
|
||||
float m_linearManipulatorConeRadius = 0.0f;
|
||||
float m_scaleManipulatorBoxHalfExtent = 0.0f;
|
||||
float m_rotationManipulatorRadius = 0.0f;
|
||||
float m_manipulatorViewBaseScale = 0.0f;
|
||||
bool m_flipManipulatorAxesTowardsView = false;
|
||||
};
|
||||
|
||||
Manipulators m_manipulators;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
@@ -57,31 +58,6 @@ namespace SandboxEditor
|
||||
constexpr AZStd::string_view CameraDefaultStartingPositionY = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/y";
|
||||
constexpr AZStd::string_view CameraDefaultStartingPositionZ = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/z";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
struct EditorViewportSettingsCallbacksImpl : public EditorViewportSettingsCallbacks
|
||||
{
|
||||
EditorViewportSettingsCallbacksImpl()
|
||||
@@ -118,399 +94,409 @@ namespace SandboxEditor
|
||||
AZ::Vector3 CameraDefaultEditorPosition()
|
||||
{
|
||||
return AZ::Vector3(
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionX, 0.0)),
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionY, -10.0)),
|
||||
aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionZ, 4.0)));
|
||||
aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionX, 0.0)),
|
||||
aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionY, -10.0)),
|
||||
aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraDefaultStartingPositionZ, 4.0)));
|
||||
}
|
||||
|
||||
void SetCameraDefaultEditorPosition(const AZ::Vector3& defaultCameraPosition)
|
||||
{
|
||||
SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
|
||||
SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
|
||||
SetRegistry(CameraDefaultStartingPositionZ, defaultCameraPosition.GetZ());
|
||||
AzToolsFramework::SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
|
||||
AzToolsFramework::SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
|
||||
AzToolsFramework::SetRegistry(CameraDefaultStartingPositionZ, defaultCameraPosition.GetZ());
|
||||
}
|
||||
|
||||
AZ::u64 MaxItemsShownInAssetBrowserSearch()
|
||||
{
|
||||
return GetRegistry(AssetBrowserMaxItemsShownInSearchSetting, aznumeric_cast<AZ::u64>(50));
|
||||
return AzToolsFramework::GetRegistry(AssetBrowserMaxItemsShownInSearchSetting, aznumeric_cast<AZ::u64>(50));
|
||||
}
|
||||
|
||||
void SetMaxItemsShownInAssetBrowserSearch(const AZ::u64 numberOfItemsShown)
|
||||
{
|
||||
SetRegistry(AssetBrowserMaxItemsShownInSearchSetting, numberOfItemsShown);
|
||||
AzToolsFramework::SetRegistry(AssetBrowserMaxItemsShownInSearchSetting, numberOfItemsShown);
|
||||
}
|
||||
|
||||
bool GridSnappingEnabled()
|
||||
{
|
||||
return GetRegistry(GridSnappingSetting, false);
|
||||
return AzToolsFramework::GetRegistry(GridSnappingSetting, false);
|
||||
}
|
||||
|
||||
void SetGridSnapping(const bool enabled)
|
||||
{
|
||||
SetRegistry(GridSnappingSetting, enabled);
|
||||
AzToolsFramework::SetRegistry(GridSnappingSetting, enabled);
|
||||
}
|
||||
|
||||
float GridSnappingSize()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(GridSizeSetting, 0.1));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(GridSizeSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetGridSnappingSize(const float size)
|
||||
{
|
||||
SetRegistry(GridSizeSetting, size);
|
||||
AzToolsFramework::SetRegistry(GridSizeSetting, size);
|
||||
}
|
||||
|
||||
bool AngleSnappingEnabled()
|
||||
{
|
||||
return GetRegistry(AngleSnappingSetting, false);
|
||||
return AzToolsFramework::GetRegistry(AngleSnappingSetting, false);
|
||||
}
|
||||
|
||||
void SetAngleSnapping(const bool enabled)
|
||||
{
|
||||
SetRegistry(AngleSnappingSetting, enabled);
|
||||
AzToolsFramework::SetRegistry(AngleSnappingSetting, enabled);
|
||||
}
|
||||
|
||||
float AngleSnappingSize()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(AngleSizeSetting, 5.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(AngleSizeSetting, 5.0));
|
||||
}
|
||||
|
||||
void SetAngleSnappingSize(const float size)
|
||||
{
|
||||
SetRegistry(AngleSizeSetting, size);
|
||||
AzToolsFramework::SetRegistry(AngleSizeSetting, size);
|
||||
}
|
||||
|
||||
bool ShowingGrid()
|
||||
{
|
||||
return GetRegistry(ShowGridSetting, false);
|
||||
return AzToolsFramework::GetRegistry(ShowGridSetting, false);
|
||||
}
|
||||
|
||||
void SetShowingGrid(const bool showing)
|
||||
{
|
||||
SetRegistry(ShowGridSetting, showing);
|
||||
AzToolsFramework::SetRegistry(ShowGridSetting, showing);
|
||||
}
|
||||
|
||||
bool StickySelectEnabled()
|
||||
{
|
||||
return GetRegistry(StickySelectSetting, false);
|
||||
return AzToolsFramework::GetRegistry(StickySelectSetting, false);
|
||||
}
|
||||
|
||||
void SetStickySelectEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(StickySelectSetting, enabled);
|
||||
AzToolsFramework::SetRegistry(StickySelectSetting, enabled);
|
||||
}
|
||||
|
||||
float ManipulatorLineBoundWidth()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetManipulatorLineBoundWidth(const float lineBoundWidth)
|
||||
{
|
||||
SetRegistry(ManipulatorLineBoundWidthSetting, lineBoundWidth);
|
||||
AzToolsFramework::SetRegistry(ManipulatorLineBoundWidthSetting, lineBoundWidth);
|
||||
}
|
||||
|
||||
float ManipulatorCircleBoundWidth()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(ManipulatorCircleBoundWidthSetting, 0.1));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(ManipulatorCircleBoundWidthSetting, 0.1));
|
||||
}
|
||||
|
||||
void SetManipulatorCircleBoundWidth(const float circleBoundWidth)
|
||||
{
|
||||
SetRegistry(ManipulatorCircleBoundWidthSetting, circleBoundWidth);
|
||||
AzToolsFramework::SetRegistry(ManipulatorCircleBoundWidthSetting, circleBoundWidth);
|
||||
}
|
||||
|
||||
float CameraTranslateSpeed()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraTranslateSpeedSetting, 10.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraTranslateSpeedSetting, 10.0));
|
||||
}
|
||||
|
||||
void SetCameraTranslateSpeed(const float speed)
|
||||
{
|
||||
SetRegistry(CameraTranslateSpeedSetting, speed);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateSpeedSetting, speed);
|
||||
}
|
||||
|
||||
float CameraBoostMultiplier()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraBoostMultiplierSetting, 3.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraBoostMultiplierSetting, 3.0));
|
||||
}
|
||||
|
||||
void SetCameraBoostMultiplier(const float multiplier)
|
||||
{
|
||||
SetRegistry(CameraBoostMultiplierSetting, multiplier);
|
||||
AzToolsFramework::SetRegistry(CameraBoostMultiplierSetting, multiplier);
|
||||
}
|
||||
|
||||
float CameraRotateSpeed()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraRotateSpeedSetting, 0.005));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraRotateSpeedSetting, 0.005));
|
||||
}
|
||||
|
||||
void SetCameraRotateSpeed(const float speed)
|
||||
{
|
||||
SetRegistry(CameraRotateSpeedSetting, speed);
|
||||
AzToolsFramework::SetRegistry(CameraRotateSpeedSetting, speed);
|
||||
}
|
||||
|
||||
float CameraScrollSpeed()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraScrollSpeedSetting, 0.02));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraScrollSpeedSetting, 0.02));
|
||||
}
|
||||
|
||||
void SetCameraScrollSpeed(const float speed)
|
||||
{
|
||||
SetRegistry(CameraScrollSpeedSetting, speed);
|
||||
AzToolsFramework::SetRegistry(CameraScrollSpeedSetting, speed);
|
||||
}
|
||||
|
||||
float CameraDollyMotionSpeed()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraDollyMotionSpeedSetting, 0.01));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraDollyMotionSpeedSetting, 0.01));
|
||||
}
|
||||
|
||||
void SetCameraDollyMotionSpeed(const float speed)
|
||||
{
|
||||
SetRegistry(CameraDollyMotionSpeedSetting, speed);
|
||||
AzToolsFramework::SetRegistry(CameraDollyMotionSpeedSetting, speed);
|
||||
}
|
||||
|
||||
bool CameraOrbitYawRotationInverted()
|
||||
{
|
||||
return GetRegistry(CameraOrbitYawRotationInvertedSetting, false);
|
||||
return AzToolsFramework::GetRegistry(CameraOrbitYawRotationInvertedSetting, false);
|
||||
}
|
||||
|
||||
void SetCameraOrbitYawRotationInverted(const bool inverted)
|
||||
{
|
||||
SetRegistry(CameraOrbitYawRotationInvertedSetting, inverted);
|
||||
AzToolsFramework::SetRegistry(CameraOrbitYawRotationInvertedSetting, inverted);
|
||||
}
|
||||
|
||||
bool CameraPanInvertedX()
|
||||
{
|
||||
return GetRegistry(CameraPanInvertedXSetting, true);
|
||||
return AzToolsFramework::GetRegistry(CameraPanInvertedXSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraPanInvertedX(const bool inverted)
|
||||
{
|
||||
SetRegistry(CameraPanInvertedXSetting, inverted);
|
||||
AzToolsFramework::SetRegistry(CameraPanInvertedXSetting, inverted);
|
||||
}
|
||||
|
||||
bool CameraPanInvertedY()
|
||||
{
|
||||
return GetRegistry(CameraPanInvertedYSetting, true);
|
||||
return AzToolsFramework::GetRegistry(CameraPanInvertedYSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraPanInvertedY(const bool inverted)
|
||||
{
|
||||
SetRegistry(CameraPanInvertedYSetting, inverted);
|
||||
AzToolsFramework::SetRegistry(CameraPanInvertedYSetting, inverted);
|
||||
}
|
||||
|
||||
float CameraPanSpeed()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraPanSpeedSetting, 0.01));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraPanSpeedSetting, 0.01));
|
||||
}
|
||||
|
||||
void SetCameraPanSpeed(float speed)
|
||||
{
|
||||
SetRegistry(CameraPanSpeedSetting, speed);
|
||||
AzToolsFramework::SetRegistry(CameraPanSpeedSetting, speed);
|
||||
}
|
||||
|
||||
float CameraRotateSmoothness()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraRotateSmoothnessSetting, 5.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraRotateSmoothnessSetting, 5.0));
|
||||
}
|
||||
|
||||
void SetCameraRotateSmoothness(const float smoothness)
|
||||
{
|
||||
SetRegistry(CameraRotateSmoothnessSetting, smoothness);
|
||||
AzToolsFramework::SetRegistry(CameraRotateSmoothnessSetting, smoothness);
|
||||
}
|
||||
|
||||
float CameraTranslateSmoothness()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraTranslateSmoothnessSetting, 5.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraTranslateSmoothnessSetting, 5.0));
|
||||
}
|
||||
|
||||
void SetCameraTranslateSmoothness(const float smoothness)
|
||||
{
|
||||
SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
|
||||
}
|
||||
|
||||
bool CameraRotateSmoothingEnabled()
|
||||
{
|
||||
return GetRegistry(CameraRotateSmoothingSetting, true);
|
||||
return AzToolsFramework::GetRegistry(CameraRotateSmoothingSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraRotateSmoothingEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(CameraRotateSmoothingSetting, enabled);
|
||||
AzToolsFramework::SetRegistry(CameraRotateSmoothingSetting, enabled);
|
||||
}
|
||||
|
||||
bool CameraTranslateSmoothingEnabled()
|
||||
{
|
||||
return GetRegistry(CameraTranslateSmoothingSetting, true);
|
||||
return AzToolsFramework::GetRegistry(CameraTranslateSmoothingSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraTranslateSmoothingEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(CameraTranslateSmoothingSetting, enabled);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateSmoothingSetting, enabled);
|
||||
}
|
||||
|
||||
bool CameraCaptureCursorForLook()
|
||||
{
|
||||
return GetRegistry(CameraCaptureCursorLookSetting, true);
|
||||
return AzToolsFramework::GetRegistry(CameraCaptureCursorLookSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraCaptureCursorForLook(const bool capture)
|
||||
{
|
||||
SetRegistry(CameraCaptureCursorLookSetting, capture);
|
||||
AzToolsFramework::SetRegistry(CameraCaptureCursorLookSetting, capture);
|
||||
}
|
||||
|
||||
float CameraDefaultOrbitDistance()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(CameraDefaultOrbitDistanceSetting, 20.0));
|
||||
return aznumeric_cast<float>(AzToolsFramework::GetRegistry(CameraDefaultOrbitDistanceSetting, 20.0));
|
||||
}
|
||||
|
||||
void SetCameraDefaultOrbitDistance(const float distance)
|
||||
{
|
||||
SetRegistry(CameraDefaultOrbitDistanceSetting, distance);
|
||||
AzToolsFramework::SetRegistry(CameraDefaultOrbitDistanceSetting, distance);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateForwardChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
GetRegistry(CameraTranslateForwardIdSetting, AZStd::string("keyboard_key_alphanumeric_W")).c_str());
|
||||
AzToolsFramework::GetRegistry(CameraTranslateForwardIdSetting, AZStd::string("keyboard_key_alphanumeric_W")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId)
|
||||
{
|
||||
SetRegistry(CameraTranslateForwardIdSetting, cameraTranslateForwardId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateForwardIdSetting, cameraTranslateForwardId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateBackwardChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
GetRegistry(CameraTranslateBackwardIdSetting, AZStd::string("keyboard_key_alphanumeric_S")).c_str());
|
||||
AzToolsFramework::GetRegistry(CameraTranslateBackwardIdSetting, AZStd::string("keyboard_key_alphanumeric_S")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateBackwardChannelId(AZStd::string_view cameraTranslateBackwardId)
|
||||
{
|
||||
SetRegistry(CameraTranslateBackwardIdSetting, cameraTranslateBackwardId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateBackwardIdSetting, cameraTranslateBackwardId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateLeftChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraTranslateLeftIdSetting, AZStd::string("keyboard_key_alphanumeric_A")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraTranslateLeftIdSetting, AZStd::string("keyboard_key_alphanumeric_A")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateLeftChannelId(AZStd::string_view cameraTranslateLeftId)
|
||||
{
|
||||
SetRegistry(CameraTranslateLeftIdSetting, cameraTranslateLeftId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateLeftIdSetting, cameraTranslateLeftId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateRightChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
GetRegistry(CameraTranslateRightIdSetting, AZStd::string("keyboard_key_alphanumeric_D")).c_str());
|
||||
AzToolsFramework::GetRegistry(CameraTranslateRightIdSetting, AZStd::string("keyboard_key_alphanumeric_D")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateRightChannelId(AZStd::string_view cameraTranslateRightId)
|
||||
{
|
||||
SetRegistry(CameraTranslateRightIdSetting, cameraTranslateRightId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateRightIdSetting, cameraTranslateRightId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateUpChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraTranslateUpIdSetting, AZStd::string("keyboard_key_alphanumeric_E")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraTranslateUpIdSetting, AZStd::string("keyboard_key_alphanumeric_E")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateUpChannelId(AZStd::string_view cameraTranslateUpId)
|
||||
{
|
||||
SetRegistry(CameraTranslateUpIdSetting, cameraTranslateUpId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateUpIdSetting, cameraTranslateUpId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateDownChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraTranslateDownIdSetting, AZStd::string("keyboard_key_alphanumeric_Q")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraTranslateDownIdSetting, AZStd::string("keyboard_key_alphanumeric_Q")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateDownChannelId(AZStd::string_view cameraTranslateDownId)
|
||||
{
|
||||
SetRegistry(CameraTranslateDownIdSetting, cameraTranslateDownId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateDownIdSetting, cameraTranslateDownId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateBoostChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
GetRegistry(CameraTranslateBoostIdSetting, AZStd::string("keyboard_key_modifier_shift_l")).c_str());
|
||||
AzToolsFramework::GetRegistry(CameraTranslateBoostIdSetting, AZStd::string("keyboard_key_modifier_shift_l")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId)
|
||||
{
|
||||
SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
|
||||
AzToolsFramework::SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraOrbitChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId)
|
||||
{
|
||||
SetRegistry(CameraOrbitIdSetting, cameraOrbitId);
|
||||
AzToolsFramework::SetRegistry(CameraOrbitIdSetting, cameraOrbitId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraFreeLookChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraFreeLookIdSetting, AZStd::string("mouse_button_right")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraFreeLookIdSetting, AZStd::string("mouse_button_right")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId)
|
||||
{
|
||||
SetRegistry(CameraFreeLookIdSetting, cameraFreeLookId);
|
||||
AzToolsFramework::SetRegistry(CameraFreeLookIdSetting, cameraFreeLookId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraFreePanChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraFreePanIdSetting, AZStd::string("mouse_button_middle")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraFreePanIdSetting, AZStd::string("mouse_button_middle")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId)
|
||||
{
|
||||
SetRegistry(CameraFreePanIdSetting, cameraFreePanId);
|
||||
AzToolsFramework::SetRegistry(CameraFreePanIdSetting, cameraFreePanId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraOrbitLookChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraOrbitLookIdSetting, AZStd::string("mouse_button_left")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraOrbitLookIdSetting, AZStd::string("mouse_button_left")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId)
|
||||
{
|
||||
SetRegistry(CameraOrbitLookIdSetting, cameraOrbitLookId);
|
||||
AzToolsFramework::SetRegistry(CameraOrbitLookIdSetting, cameraOrbitLookId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraOrbitDollyChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraOrbitDollyIdSetting, AZStd::string("mouse_button_right")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraOrbitDollyIdSetting, AZStd::string("mouse_button_right")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId)
|
||||
{
|
||||
SetRegistry(CameraOrbitDollyIdSetting, cameraOrbitDollyId);
|
||||
AzToolsFramework::SetRegistry(CameraOrbitDollyIdSetting, cameraOrbitDollyId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraOrbitPanChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraOrbitPanIdSetting, AZStd::string("mouse_button_middle")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraOrbitPanIdSetting, AZStd::string("mouse_button_middle")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId)
|
||||
{
|
||||
SetRegistry(CameraOrbitPanIdSetting, cameraOrbitPanId);
|
||||
AzToolsFramework::SetRegistry(CameraOrbitPanIdSetting, cameraOrbitPanId);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraFocusChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(GetRegistry(CameraFocusIdSetting, AZStd::string("keyboard_key_alphanumeric_X")).c_str());
|
||||
return AzFramework::InputChannelId(
|
||||
AzToolsFramework::GetRegistry(CameraFocusIdSetting, AZStd::string("keyboard_key_alphanumeric_X")).c_str());
|
||||
}
|
||||
|
||||
void SetCameraFocusChannelId(AZStd::string_view cameraFocusId)
|
||||
{
|
||||
SetRegistry(CameraFocusIdSetting, cameraFocusId);
|
||||
AzToolsFramework::SetRegistry(CameraFocusIdSetting, cameraFocusId);
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/INavigationSystem.h>
|
||||
#include <CryCommon/LyShine/ILyShine.h>
|
||||
#include <CryCommon/MainThreadRenderRequestBus.h>
|
||||
|
||||
// Editor
|
||||
@@ -595,13 +594,6 @@ void CGameEngine::SwitchToInEditor()
|
||||
// Enable accelerators.
|
||||
GetIEditor()->EnableAcceleratos(true);
|
||||
|
||||
|
||||
// reset UI system
|
||||
if (gEnv->pLyShine)
|
||||
{
|
||||
gEnv->pLyShine->Reset();
|
||||
}
|
||||
|
||||
// [Anton] - order changed, see comments for CGameEngine::SetSimulationMode
|
||||
//! Send event to switch out of game.
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_OUTOFGAME);
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
class UndoStack;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that the UI Editor needs to implement
|
||||
class UiEditorDLLInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorDLLInterface(){}
|
||||
|
||||
//! Get the selected elements in the UiEditor
|
||||
virtual LyShine::EntityArray GetSelectedElements() = 0;
|
||||
|
||||
//! Get the id of the active Canvas the UiEditor
|
||||
virtual AZ::EntityId GetActiveCanvasId() = 0;
|
||||
|
||||
//! Get the active undo stack for the UI Editor
|
||||
virtual UndoStack* GetActiveUndoStack() = 0;
|
||||
|
||||
//! Soft-switch to the given file. Note that this should prompt for unsaved changes, etc.
|
||||
virtual void OpenSourceCanvasFile(QString absolutePathToFile) = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UiEditorDLLInterface"; }
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorDLLInterface> UiEditorDLLBus;
|
||||
@@ -13,7 +13,6 @@ set(FILES
|
||||
EditorCommonAPI.h
|
||||
ActionOutput.h
|
||||
ActionOutput.cpp
|
||||
UiEditorDLLBus.h
|
||||
DockTitleBarWidget.cpp
|
||||
DockTitleBarWidget.h
|
||||
SaveUtilities/AsyncSaveRunner.h
|
||||
|
||||
@@ -486,9 +486,11 @@ namespace AZ
|
||||
|
||||
// Merge Command Line arguments
|
||||
constexpr bool executeRegDumpCommands = false;
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
|
||||
|
||||
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
|
||||
// Skip over merging the User Registry in non-debug and profile configurations
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
|
||||
#endif
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);
|
||||
|
||||
|
||||
@@ -914,11 +914,11 @@ namespace UnitTest
|
||||
m_testAssetManager->SetParallelDependentLoadingEnabled(true);
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_LoadTest_SameAsset_DifferentFilters)
|
||||
#else
|
||||
TEST_F(AssetJobsFloodTest, LoadTest_SameAsset_DifferentFilters)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
{
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
|
||||
|
||||
@@ -1263,11 +1263,11 @@ namespace UnitTest
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_AssetWithNoLoadReference_LoadDependencies_NoLoadNotLoaded)
|
||||
#else
|
||||
TEST_F(AssetJobsFloodTest, AssetWithNoLoadReference_LoadDependencies_NoLoadNotLoaded)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
{
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
|
||||
// Setup has already created/destroyed assets
|
||||
@@ -1304,11 +1304,11 @@ namespace UnitTest
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_AssetWithNoLoadReference_LoadContainerDependencies_LoadAllLoadsNoLoad)
|
||||
#else
|
||||
TEST_F(AssetJobsFloodTest, AssetWithNoLoadReference_LoadContainerDependencies_LoadAllLoadsNoLoad)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
{
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
|
||||
// Setup has already created/destroyed assets
|
||||
@@ -1343,11 +1343,11 @@ namespace UnitTest
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_AssetWithNoLoadReference_LoadDependencies_BehaviorObeyed)
|
||||
#else
|
||||
TEST_F(AssetJobsFloodTest, AssetWithNoLoadReference_LoadDependencies_BehaviorObeyed)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
{
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
|
||||
// Setup has already created/destroyed assets
|
||||
|
||||
@@ -12,13 +12,57 @@
|
||||
|
||||
namespace AzFramework::Terrain
|
||||
{
|
||||
// Create a handler that can be accessed from Python scripts to receive terrain change notifications.
|
||||
class TerrainDataNotificationHandler final
|
||||
: public AzFramework::Terrain::TerrainDataNotificationBus::Handler
|
||||
, public AZ::BehaviorEBusHandler
|
||||
{
|
||||
public:
|
||||
AZ_EBUS_BEHAVIOR_BINDER(
|
||||
TerrainDataNotificationHandler,
|
||||
"{A83EF103-295A-4653-8279-F30FBF3F9037}",
|
||||
AZ::SystemAllocator,
|
||||
OnTerrainDataCreateBegin,
|
||||
OnTerrainDataCreateEnd,
|
||||
OnTerrainDataDestroyBegin,
|
||||
OnTerrainDataDestroyEnd,
|
||||
OnTerrainDataChanged);
|
||||
|
||||
void OnTerrainDataCreateBegin() override
|
||||
{
|
||||
Call(FN_OnTerrainDataCreateBegin);
|
||||
}
|
||||
|
||||
void OnTerrainDataCreateEnd() override
|
||||
{
|
||||
Call(FN_OnTerrainDataCreateEnd);
|
||||
}
|
||||
|
||||
void OnTerrainDataDestroyBegin() override
|
||||
{
|
||||
Call(FN_OnTerrainDataDestroyBegin);
|
||||
}
|
||||
|
||||
void OnTerrainDataDestroyEnd() override
|
||||
{
|
||||
Call(FN_OnTerrainDataDestroyEnd);
|
||||
}
|
||||
|
||||
void OnTerrainDataChanged(
|
||||
const AZ::Aabb& dirtyRegion, AzFramework::Terrain::TerrainDataNotifications::TerrainDataChangedMask dataChangedMask) override
|
||||
{
|
||||
Call(FN_OnTerrainDataChanged, dirtyRegion, dataChangedMask);
|
||||
}
|
||||
};
|
||||
|
||||
void TerrainDataRequests::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AzFramework::Terrain::TerrainDataRequestBus>("TerrainDataRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Terrain")
|
||||
->Event("GetHeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeight)
|
||||
->Attribute(AZ::Script::Attributes::Module, "terrain")
|
||||
->Event("GetNormal", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetNormal)
|
||||
->Event("GetMaxSurfaceWeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetMaxSurfaceWeight)
|
||||
->Event("GetMaxSurfaceWeightFromVector2",
|
||||
@@ -34,8 +78,24 @@ namespace AzFramework::Terrain
|
||||
->Event("GetTerrainAabb", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetTerrainAabb)
|
||||
->Event("GetTerrainHeightQueryResolution",
|
||||
&AzFramework::Terrain::TerrainDataRequestBus::Events::GetTerrainHeightQueryResolution)
|
||||
->Event("GetHeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightVal)
|
||||
->Event("GetHeightFromVector2", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightValFromVector2)
|
||||
->Event("GetHeightFromFloats", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightValFromFloats)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<AzFramework::Terrain::TerrainDataNotificationBus>("TerrainDataNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Terrain")
|
||||
->Attribute(AZ::Script::Attributes::Module, "terrain")
|
||||
->Event("OnTerrainDataCreateBegin", &AzFramework::Terrain::TerrainDataNotifications::OnTerrainDataCreateBegin)
|
||||
->Event("OnTerrainDataCreateEnd", &AzFramework::Terrain::TerrainDataNotifications::OnTerrainDataCreateEnd)
|
||||
->Event("OnTerrainDataDestroyBegin", &AzFramework::Terrain::TerrainDataNotifications::OnTerrainDataDestroyBegin)
|
||||
->Event("OnTerrainDataDestroyEnd", &AzFramework::Terrain::TerrainDataNotifications::OnTerrainDataDestroyEnd)
|
||||
->Event("OnTerrainDataChanged", &AzFramework::Terrain::TerrainDataNotifications::OnTerrainDataChanged)
|
||||
->Handler<AzFramework::Terrain::TerrainDataNotificationHandler>()
|
||||
;
|
||||
}
|
||||
|
||||
//TerrainDataNotificationHandler::Reflect(context);
|
||||
}
|
||||
} // namespace AzFramework::Terrain
|
||||
|
||||
@@ -144,13 +144,31 @@ namespace AzFramework
|
||||
return result;
|
||||
}
|
||||
SurfaceData::SurfacePoint BehaviorContextGetSurfacePointFromVector2(
|
||||
const AZ::Vector2& inPosition,
|
||||
Sampler sampleFilter = Sampler::DEFAULT) const
|
||||
const AZ::Vector2& inPosition, Sampler sampleFilter = Sampler::DEFAULT) const
|
||||
{
|
||||
SurfaceData::SurfacePoint result;
|
||||
GetSurfacePointFromVector2(inPosition, result, sampleFilter);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Functions without the optional bool* parameter that can be used from Python tests.
|
||||
float GetHeightVal(AZ::Vector3 position, Sampler sampler = Sampler::BILINEAR) const
|
||||
{
|
||||
bool terrainExists;
|
||||
return GetHeight(position, sampler, &terrainExists);
|
||||
}
|
||||
|
||||
float GetHeightValFromVector2(AZ::Vector2 position, Sampler sampler = Sampler::BILINEAR) const
|
||||
{
|
||||
bool terrainExists;
|
||||
return GetHeightFromVector2(position, sampler, &terrainExists);
|
||||
}
|
||||
|
||||
float GetHeightValFromFloats(float x, float y, Sampler sampler = Sampler::BILINEAR) const
|
||||
{
|
||||
bool terrainExists;
|
||||
return GetHeightFromFloats(x, y, sampler, &terrainExists);
|
||||
}
|
||||
};
|
||||
using TerrainDataRequestBus = AZ::EBus<TerrainDataRequests>;
|
||||
|
||||
|
||||
@@ -13,6 +13,13 @@
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
//! Null implementation of DebugDisplayRequests for dummy draw calls.
|
||||
class NullDebugDisplayRequests : public AzFramework::DebugDisplayRequests
|
||||
{
|
||||
public:
|
||||
virtual ~NullDebugDisplayRequests() = default;
|
||||
};
|
||||
|
||||
//! Minimal implementation of DebugDisplayRequests to support testing shapes.
|
||||
//! Stores a list of points based on received draw calls to delineate the exterior of the object requested to be drawn.
|
||||
class TestDebugDisplayRequests : public AzFramework::DebugDisplayRequests
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
#include <AzFramework/XcbEventHandler.h>
|
||||
|
||||
@@ -29,6 +29,13 @@ namespace InputUnitTests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class InputTest : public ScopedAllocatorSetupFixture
|
||||
{
|
||||
public:
|
||||
InputTest() : ScopedAllocatorSetupFixture()
|
||||
{
|
||||
// Many input tests are only valid if the GamePad device is supported on this platform.
|
||||
m_gamepadSupported = InputDeviceGamepad::GetMaxSupportedGamepads() > 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void SetUp() override
|
||||
@@ -46,6 +53,7 @@ namespace InputUnitTests
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZStd::unique_ptr<InputSystemComponent> m_inputSystemComponent;
|
||||
bool m_gamepadSupported;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -78,12 +86,17 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_ActivateDeactivate_Successfull)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_ActivateDeactivate_Successfull)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_ActivateDeactivate_Successfull";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_ActivateDeactivate_Successfull";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// Create an input context (they are inactive by default).
|
||||
InputContext inputContext("TestInputContext");
|
||||
|
||||
@@ -148,12 +161,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_AddRemoveInputMapping_Successfull)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_AddRemoveInputMapping_Successfull)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_AddRemoveInputMapping_Successfull";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_AddRemoveInputMapping_Successfull";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -256,12 +275,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_ConsumeProcessedInput_Consumed)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_ConsumeProcessedInput_Consumed)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_ConsumeProcessedInput_Consumed";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_ConsumeProcessedInput_Consumed";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
InputContext::InitData initData;
|
||||
|
||||
// Create a high priority input context that consumes input processed by any of its mappings.
|
||||
@@ -340,12 +365,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_FilteredInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_FilteredInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_FilteredInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_FilteredInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context that initially only listens for keyboard input.
|
||||
InputContext::InitData initData;
|
||||
initData.autoActivate = true;
|
||||
@@ -413,12 +444,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_AddRemoveSourceInput_Successful)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_AddRemoveSourceInput_Successful)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_AddRemoveSourceInput_Successful";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_AddRemoveSourceInput_Successful";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -491,12 +528,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_SingleSourceInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_SingleSourceInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_SingleSourceInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_SingleSourceInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -558,12 +601,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_MultipleSourceInputs_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_MultipleSourceInputs_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_MultipleSourceInputs_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_MultipleSourceInputs_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -650,12 +699,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_AddRemoveSourceInput_Successful)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_AddRemoveSourceInput_Successful)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_AddRemoveSourceInput_Successful";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_AddRemoveSourceInput_Successful";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -728,12 +783,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_SingleSourceInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_SingleSourceInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_SingleSourceInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_SingleSourceInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -795,12 +856,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputs_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputs_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputs_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputs_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -909,12 +976,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -969,12 +1042,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
|
||||
+2
-1
@@ -29,7 +29,8 @@ namespace UnitTest
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
ToolsApplicationFixtureT::SetUpEditorFixtureImpl();
|
||||
m_viewportManipulatorInteraction = AZStd::make_unique<IndirectCallManipulatorViewportInteraction>();
|
||||
m_viewportManipulatorInteraction =
|
||||
AZStd::make_unique<IndirectCallManipulatorViewportInteraction>(ToolsApplicationFixtureT::CreateDebugDisplayRequests());
|
||||
m_actionDispatcher = AZStd::make_unique<ImmediateModeActionDispatcher>(*m_viewportManipulatorInteraction);
|
||||
m_cameraState =
|
||||
AzFramework::CreateIdentityDefaultCamera(AZ::Vector3::CreateZero(), AzManipulatorTestFramework::DefaultViewportSize);
|
||||
|
||||
+2
-3
@@ -17,11 +17,10 @@ namespace AzManipulatorTestFramework
|
||||
class ViewportInteraction;
|
||||
|
||||
//! Implementation of manipulator viewport interaction that manipulates the manager directly.
|
||||
class DirectCallManipulatorViewportInteraction
|
||||
: public ManipulatorViewportInteraction
|
||||
class DirectCallManipulatorViewportInteraction : public ManipulatorViewportInteraction
|
||||
{
|
||||
public:
|
||||
DirectCallManipulatorViewportInteraction();
|
||||
explicit DirectCallManipulatorViewportInteraction(AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests);
|
||||
~DirectCallManipulatorViewportInteraction();
|
||||
|
||||
// ManipulatorViewportInteractionInterface ...
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace AzManipulatorTestFramework
|
||||
class IndirectCallManipulatorViewportInteraction : public ManipulatorViewportInteraction
|
||||
{
|
||||
public:
|
||||
IndirectCallManipulatorViewportInteraction();
|
||||
explicit IndirectCallManipulatorViewportInteraction(AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests);
|
||||
~IndirectCallManipulatorViewportInteraction();
|
||||
|
||||
// ManipulatorViewportInteractionInterface ...
|
||||
|
||||
+7
-4
@@ -11,10 +11,13 @@
|
||||
#include <AzFramework/Visibility/EntityVisibilityQuery.h>
|
||||
#include <AzManipulatorTestFramework/AzManipulatorTestFramework.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
class DebugDisplayRequests;
|
||||
}
|
||||
|
||||
namespace AzManipulatorTestFramework
|
||||
{
|
||||
class NullDebugDisplayRequests;
|
||||
|
||||
//! Implementation of the viewport interaction model to handle viewport interaction requests.
|
||||
class ViewportInteraction
|
||||
: public ViewportInteractionInterface
|
||||
@@ -23,7 +26,7 @@ namespace AzManipulatorTestFramework
|
||||
, private AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
ViewportInteraction();
|
||||
explicit ViewportInteraction(AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests);
|
||||
~ViewportInteraction();
|
||||
|
||||
// ViewportInteractionInterface overrides ...
|
||||
@@ -63,7 +66,7 @@ namespace AzManipulatorTestFramework
|
||||
static constexpr AzFramework::ViewportId m_viewportId = 1234; //!< Arbitrary viewport id for manipulator tests.
|
||||
|
||||
AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
|
||||
AZStd::unique_ptr<NullDebugDisplayRequests> m_nullDebugDisplayRequests;
|
||||
AZStd::shared_ptr<AzFramework::DebugDisplayRequests> m_debugDisplayRequests;
|
||||
AzFramework::CameraState m_cameraState;
|
||||
bool m_gridSnapping = false;
|
||||
bool m_angularSnapping = false;
|
||||
|
||||
+3
-2
@@ -118,10 +118,11 @@ namespace AzManipulatorTestFramework
|
||||
return m_manipulatorManager->Interacting();
|
||||
}
|
||||
|
||||
DirectCallManipulatorViewportInteraction::DirectCallManipulatorViewportInteraction()
|
||||
DirectCallManipulatorViewportInteraction::DirectCallManipulatorViewportInteraction(
|
||||
AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests)
|
||||
: m_customManager(
|
||||
AZStd::make_unique<CustomManipulatorManager>(AzToolsFramework::ManipulatorManagerId(AZ::Crc32("TestManipulatorManagerId"))))
|
||||
, m_viewportInteraction(AZStd::make_unique<ViewportInteraction>())
|
||||
, m_viewportInteraction(AZStd::make_unique<ViewportInteraction>(AZStd::move(debugDisplayRequests)))
|
||||
, m_manipulatorManager(AZStd::make_unique<DirectCallManipulatorManager>(m_viewportInteraction.get(), m_customManager))
|
||||
{
|
||||
}
|
||||
|
||||
+3
-2
@@ -76,8 +76,9 @@ namespace AzManipulatorTestFramework
|
||||
return manipulatorInteracting;
|
||||
}
|
||||
|
||||
IndirectCallManipulatorViewportInteraction::IndirectCallManipulatorViewportInteraction()
|
||||
: m_viewportInteraction(AZStd::make_unique<ViewportInteraction>())
|
||||
IndirectCallManipulatorViewportInteraction::IndirectCallManipulatorViewportInteraction(
|
||||
AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests)
|
||||
: m_viewportInteraction(AZStd::make_unique<ViewportInteraction>(AZStd::move(debugDisplayRequests)))
|
||||
, m_manipulatorManager(AZStd::make_unique<IndirectCallManipulatorManager>(*m_viewportInteraction))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,15 +13,8 @@
|
||||
|
||||
namespace AzManipulatorTestFramework
|
||||
{
|
||||
// Null debug display for dummy draw calls
|
||||
class NullDebugDisplayRequests : public AzFramework::DebugDisplayRequests
|
||||
{
|
||||
public:
|
||||
virtual ~NullDebugDisplayRequests() = default;
|
||||
};
|
||||
|
||||
ViewportInteraction::ViewportInteraction()
|
||||
: m_nullDebugDisplayRequests(AZStd::make_unique<NullDebugDisplayRequests>())
|
||||
ViewportInteraction::ViewportInteraction(AZStd::shared_ptr<AzFramework::DebugDisplayRequests> debugDisplayRequests)
|
||||
: m_debugDisplayRequests(AZStd::move(debugDisplayRequests))
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler::BusConnect(m_viewportId);
|
||||
AzToolsFramework::ViewportInteraction::ViewportSettingsRequestBus::Handler::BusConnect(m_viewportId);
|
||||
@@ -102,7 +95,7 @@ namespace AzManipulatorTestFramework
|
||||
|
||||
AzFramework::DebugDisplayRequests& ViewportInteraction::GetDebugDisplay()
|
||||
{
|
||||
return *m_nullDebugDisplayRequests;
|
||||
return *m_debugDisplayRequests;
|
||||
}
|
||||
|
||||
void ViewportInteraction::SetGridSnapping(const bool enabled)
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace UnitTest
|
||||
{
|
||||
public:
|
||||
GridSnappingFixture()
|
||||
: m_viewportManipulatorInteraction(AZStd::make_unique<AzManipulatorTestFramework::DirectCallManipulatorViewportInteraction>())
|
||||
: m_viewportManipulatorInteraction(AZStd::make_unique<AzManipulatorTestFramework::DirectCallManipulatorViewportInteraction>(
|
||||
AZStd::make_shared<NullDebugDisplayRequests>()))
|
||||
, m_actionDispatcher(
|
||||
AZStd::make_unique<AzManipulatorTestFramework::ImmediateModeActionDispatcher>(*m_viewportManipulatorInteraction))
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace UnitTest
|
||||
{
|
||||
public:
|
||||
AValidViewportInteraction()
|
||||
: m_viewportInteraction(AZStd::make_unique<AzManipulatorTestFramework::ViewportInteraction>())
|
||||
: m_viewportInteraction(
|
||||
AZStd::make_unique<AzManipulatorTestFramework::ViewportInteraction>(AZStd::make_shared<NullDebugDisplayRequests>()))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -75,9 +75,11 @@ namespace UnitTest
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
m_directState =
|
||||
AZStd::make_unique<State>(AZStd::make_unique<AzManipulatorTestFramework::DirectCallManipulatorViewportInteraction>());
|
||||
AZStd::make_unique<State>(AZStd::make_unique<AzManipulatorTestFramework::DirectCallManipulatorViewportInteraction>(
|
||||
AZStd::make_shared<NullDebugDisplayRequests>()));
|
||||
m_busState =
|
||||
AZStd::make_unique<State>(AZStd::make_unique<AzManipulatorTestFramework::IndirectCallManipulatorViewportInteraction>());
|
||||
AZStd::make_unique<State>(AZStd::make_unique<AzManipulatorTestFramework::IndirectCallManipulatorViewportInteraction>(
|
||||
AZStd::make_shared<NullDebugDisplayRequests>()));
|
||||
m_cameraState =
|
||||
AzFramework::CreateIdentityDefaultCamera(AZ::Vector3::CreateZero(), AzManipulatorTestFramework::DefaultViewportSize);
|
||||
}
|
||||
|
||||
+4
-3
@@ -323,7 +323,7 @@ namespace AzQtComponents
|
||||
saturation *= 2.0 - lightness;
|
||||
}
|
||||
double value = (lightness + saturation) / 2.0;
|
||||
saturation = (2.0 * saturation) / (lightness + saturation);
|
||||
saturation = qFuzzyIsNull(lightness + saturation) ? 0 : (2.0 * saturation) / (lightness + saturation);
|
||||
|
||||
m_hsv.saturation = AZ::GetClamp(saturation, 0.0, 1.0);
|
||||
m_hsv.value = AZ::GetClamp(value, 0.0, 12.5);
|
||||
@@ -341,11 +341,12 @@ namespace AzQtComponents
|
||||
double saturation = m_hsv.saturation * m_hsv.value;
|
||||
if (lightness <= 1.0)
|
||||
{
|
||||
saturation /= lightness;
|
||||
saturation = (qFuzzyIsNull(lightness)) ? 0.0 : saturation / lightness;
|
||||
}
|
||||
else
|
||||
{
|
||||
saturation /= 2.0 - lightness;
|
||||
double two_minus_lightness = 2.0 - lightness;
|
||||
saturation = (qFuzzyIsNull(two_minus_lightness)) ? 0.0 : saturation / two_minus_lightness;
|
||||
}
|
||||
lightness /= 2.0;
|
||||
|
||||
|
||||
@@ -164,11 +164,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST
|
||||
TEST(AzQtComponents, DISABLED_ColorConversionsTestAllZeros)
|
||||
#else
|
||||
TEST(AzQtComponents, ColorConversionsTestAllZeros)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST
|
||||
{
|
||||
TestConversions({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 });
|
||||
}
|
||||
|
||||
@@ -14,16 +14,14 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
|
||||
#define AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ASSET_LOAD_TESTS true
|
||||
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ATOM_RPI_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST true
|
||||
|
||||
#define AZ_TRAIT_DISABLE_FAILED_FRAMEPROFILER_TEST true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_GRADIENT_SIGNAL_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_MULTIPLAYER_GRIDMATE_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_NATIVE_WINDOWS_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_PROCESS_LAUNCHER_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_EMOTION_FX_TESTS true
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ namespace AzToolsFramework
|
||||
|
||||
void ReadOnlyEntitySystemComponent::RefreshReadOnlyState(const EntityIdList& entityIds)
|
||||
{
|
||||
for (const AZ::EntityId entityId : entityIds)
|
||||
for (const AZ::EntityId& entityId : entityIds)
|
||||
{
|
||||
bool wasReadOnly = m_readOnlystates[entityId];
|
||||
QueryReadOnlyStateForEntity(entityId);
|
||||
@@ -67,10 +67,10 @@ namespace AzToolsFramework
|
||||
|
||||
void ReadOnlyEntitySystemComponent::RefreshReadOnlyStateForAllEntities()
|
||||
{
|
||||
for (auto elem : m_readOnlystates)
|
||||
for (auto& elem : m_readOnlystates)
|
||||
{
|
||||
AZ::EntityId entityId = elem.first;
|
||||
bool wasReadOnly = m_readOnlystates[entityId];
|
||||
bool wasReadOnly = elem.second;
|
||||
QueryReadOnlyStateForEntity(entityId);
|
||||
|
||||
if (bool isReadOnly = m_readOnlystates[entityId]; wasReadOnly != isReadOnly)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
void TraceLogger::PrepareLogFile(const AZStd::string& logFileName)
|
||||
void TraceLogger::OpenLogFile(const AZStd::string& logFileName, bool clearLogFile)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace AzToolsFramework
|
||||
AZStd::string logPath;
|
||||
StringFunc::Path::Join(logDirectory.c_str(), logFileName.c_str(), logPath);
|
||||
|
||||
m_logFile.reset(aznew LogFile(logPath.c_str()));
|
||||
m_logFile.reset(aznew LogFile(logPath.c_str(), clearLogFile));
|
||||
if (m_logFile)
|
||||
{
|
||||
m_logFile->SetMachineReadable(false);
|
||||
@@ -81,7 +81,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_logFile->AppendLog(LogFile::SEV_NORMAL, message.window.c_str(), message.message.c_str());
|
||||
}
|
||||
m_startupLogSink = {};
|
||||
m_startupLogSink.clear();
|
||||
m_logFile->FlushLog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace AzToolsFramework
|
||||
~TraceLogger();
|
||||
|
||||
//! Open log file and dump log sink into it
|
||||
void PrepareLogFile(const AZStd::string& logFileName);
|
||||
void OpenLogFile(const AZStd::string& logFileName, bool clearLogFile);
|
||||
|
||||
//! Add filter to ignore messages for windows with matching names
|
||||
void AddWindowFilter(const AZStd::string& filter);
|
||||
@@ -55,7 +55,8 @@ namespace AzToolsFramework
|
||||
AZStd::string window;
|
||||
AZStd::string message;
|
||||
};
|
||||
AZStd::vector<LogMessage> m_startupLogSink;
|
||||
|
||||
AZStd::list<LogMessage> m_startupLogSink;
|
||||
AZStd::unordered_set<AZStd::string> m_windowFilters;
|
||||
AZStd::unordered_set<AZStd::string> m_messageFilters;
|
||||
AZStd::unique_ptr<AzFramework::LogFile> m_logFile;
|
||||
|
||||
+2
-2
@@ -191,8 +191,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_manipulatorView->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay, cameraState,
|
||||
mouseInteraction);
|
||||
ManipulatorState{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
}
|
||||
|
||||
void AngularManipulator::SetAxis(const AZ::Vector3& axis)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
AZ_CVAR(bool, cl_manipulatorDrawDebug, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Enable debug drawing for Manipulators");
|
||||
AZ_CVAR(bool, ed_manipulatorDrawDebug, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Enable debug drawing for Manipulators");
|
||||
|
||||
const AZ::Color BaseManipulator::s_defaultMouseOverColor = AZ::Color(1.0f, 1.0f, 0.0f, 1.0f); // yellow
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace AzFramework
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
AZ_CVAR_EXTERNED(bool, cl_manipulatorDrawDebug);
|
||||
AZ_CVAR_EXTERNED(bool, ed_manipulatorDrawDebug);
|
||||
|
||||
namespace UndoSystem
|
||||
{
|
||||
|
||||
+2
-2
@@ -116,8 +116,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_manipulatorView->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ TransformUniformScale(GetSpace()), GetNonUniformScale(), m_localStart, MouseOver() }, debugDisplay, cameraState,
|
||||
mouseInteraction);
|
||||
ManipulatorState{ TransformUniformScale(GetSpace()), GetNonUniformScale(), m_localStart, MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace AzToolsFramework
|
||||
? AZ::Transform::CreateFromQuaternionAndTranslation(m_visualOrientationOverride, GetLocalPosition())
|
||||
: GetLocalTransform();
|
||||
|
||||
if (cl_manipulatorDrawDebug)
|
||||
if (ed_manipulatorDrawDebug)
|
||||
{
|
||||
if (PerformingAction())
|
||||
{
|
||||
@@ -239,8 +239,8 @@ namespace AzToolsFramework
|
||||
|
||||
view->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ ApplySpace(localTransform), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay, cameraState,
|
||||
mouseInteraction);
|
||||
ManipulatorState{ ApplySpace(localTransform), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ namespace AzToolsFramework
|
||||
|
||||
for (const auto& pair : m_manipulatorIdToPtrMap)
|
||||
{
|
||||
pair.second->Draw({ Interacting() }, debugDisplay, cameraState, mouseInteraction);
|
||||
pair.second->Draw(ManipulatorManagerState{ Interacting() }, debugDisplay, cameraState, mouseInteraction);
|
||||
}
|
||||
|
||||
RefreshMouseOverState(mouseInteraction.m_mousePick);
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
AZ::Transform ApplySpace(const AZ::Transform& localTransform, const AZ::Transform& space, const AZ::Vector3& nonUniformScale)
|
||||
{
|
||||
AZ::Transform result;
|
||||
result.SetRotation(space.GetRotation() * localTransform.GetRotation());
|
||||
result.SetTranslation(space.TransformPoint(nonUniformScale * localTransform.GetTranslation()));
|
||||
result.SetUniformScale(space.GetUniformScale() * localTransform.GetUniformScale());
|
||||
return result;
|
||||
}
|
||||
|
||||
const AZ::Transform& ManipulatorSpace::GetSpace() const
|
||||
{
|
||||
return m_space;
|
||||
@@ -32,11 +41,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::Transform ManipulatorSpace::ApplySpace(const AZ::Transform& localTransform) const
|
||||
{
|
||||
AZ::Transform result;
|
||||
result.SetRotation(m_space.GetRotation() * localTransform.GetRotation());
|
||||
result.SetTranslation(m_space.TransformPoint(m_nonUniformScale * localTransform.GetTranslation()));
|
||||
result.SetUniformScale(m_space.GetUniformScale() * localTransform.GetUniformScale());
|
||||
return result;
|
||||
return AzToolsFramework::ApplySpace(localTransform, m_space, m_nonUniformScale);
|
||||
}
|
||||
|
||||
const AZ::Vector3& ManipulatorSpaceWithLocalPosition::GetLocalPosition() const
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace AZ
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
AZ::Transform ApplySpace(const AZ::Transform& localTransform, const AZ::Transform& space, const AZ::Vector3& nonUniformScale);
|
||||
|
||||
//! Handles location for manipulators which have a global space but no local transformation.
|
||||
class ManipulatorSpace
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <AzToolsFramework/Manipulators/PlanarManipulator.h>
|
||||
#include <AzToolsFramework/Manipulators/SplineSelectionManipulator.h>
|
||||
#include <AzToolsFramework/Maths/TransformUtils.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
AZ_CVAR(
|
||||
@@ -30,6 +31,13 @@ AZ_CVAR(
|
||||
nullptr,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"Display additional debug drawing for manipulator bounds");
|
||||
AZ_CVAR(
|
||||
float,
|
||||
ed_planarManipulatorBoundScaleFactor,
|
||||
1.75f,
|
||||
nullptr,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"The scale factor to apply to the planar manipulator bounds");
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -78,7 +86,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
// check if we actually needed to flip the axis, if so, write to shouldCorrect
|
||||
// so we know and are able to draw it differently if we wish (e.g. hollow if flipped)
|
||||
const bool correcting = ShouldFlipCameraAxis(worldFromLocal, localPosition, axis, cameraState);
|
||||
const bool correcting =
|
||||
FlipManipulatorAxesTowardsView() && ShouldFlipCameraAxis(worldFromLocal, localPosition, axis, cameraState);
|
||||
|
||||
// the corrected axis, if no flip was required, output == input
|
||||
correctedAxis = correcting ? -axis : axis;
|
||||
@@ -325,7 +334,8 @@ namespace AzToolsFramework
|
||||
float ManipulatorView::ManipulatorViewScaleMultiplier(
|
||||
const AZ::Vector3& worldPosition, const AzFramework::CameraState& cameraState) const
|
||||
{
|
||||
return ScreenSizeFixed() ? CalculateScreenToWorldMultiplier(worldPosition, cameraState) : 1.0f;
|
||||
const float screenScale = ScreenSizeFixed() ? CalculateScreenToWorldMultiplier(worldPosition, cameraState) : 1.0f;
|
||||
return screenScale * ManipulatorViewBaseScale();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -342,47 +352,77 @@ namespace AzToolsFramework
|
||||
const AZ::Vector3 axis1 = m_axis1;
|
||||
const AZ::Vector3 axis2 = m_axis2;
|
||||
|
||||
CameraCorrectAxis(
|
||||
axis1, m_cameraCorrectedAxis1, managerState, mouseInteraction, manipulatorState.m_worldFromLocal,
|
||||
manipulatorState.m_localPosition, cameraState);
|
||||
CameraCorrectAxis(
|
||||
axis2, m_cameraCorrectedAxis2, managerState, mouseInteraction, manipulatorState.m_worldFromLocal,
|
||||
manipulatorState.m_localPosition, cameraState);
|
||||
// support partial application of CameraCorrectAxis to reduce redundant call site parameters
|
||||
auto cameraCorrectAxisPartialFn =
|
||||
[&manipulatorState, &managerState, &mouseInteraction, &cameraState](const AZ::Vector3& inAxis, AZ::Vector3& outAxis)
|
||||
{
|
||||
CameraCorrectAxis(
|
||||
inAxis, outAxis, managerState, mouseInteraction, manipulatorState.m_worldFromLocal, manipulatorState.m_localPosition,
|
||||
cameraState);
|
||||
};
|
||||
|
||||
const Picking::BoundShapeQuad quadBound = CalculateQuadBound(
|
||||
manipulatorState.m_localPosition, manipulatorState, m_cameraCorrectedAxis1, m_cameraCorrectedAxis2,
|
||||
m_size *
|
||||
ManipulatorViewScaleMultiplier(
|
||||
manipulatorState.m_worldFromLocal.TransformPoint(manipulatorState.m_localPosition), cameraState));
|
||||
cameraCorrectAxisPartialFn(axis1, m_cameraCorrectedAxis1);
|
||||
cameraCorrectAxisPartialFn(axis2, m_cameraCorrectedAxis2);
|
||||
cameraCorrectAxisPartialFn(axis1 * axis1.Dot(m_offset), m_cameraCorrectedOffsetAxis1);
|
||||
cameraCorrectAxisPartialFn(axis2 * axis2.Dot(m_offset), m_cameraCorrectedOffsetAxis2);
|
||||
|
||||
const AZ::Vector3 totalScale =
|
||||
manipulatorState.m_nonUniformScale * AZ::Vector3(manipulatorState.m_worldFromLocal.GetUniformScale());
|
||||
|
||||
const auto cameraCorrectedVisualOffset = (m_cameraCorrectedOffsetAxis1 + m_cameraCorrectedOffsetAxis2) * totalScale.GetReciprocal();
|
||||
const auto viewScale =
|
||||
ManipulatorViewScaleMultiplier(manipulatorState.m_worldFromLocal.TransformPoint(manipulatorState.m_localPosition), cameraState);
|
||||
const Picking::BoundShapeQuad quadBoundVisual = CalculateQuadBound(
|
||||
manipulatorState.m_localPosition + (cameraCorrectedVisualOffset * viewScale), manipulatorState, m_cameraCorrectedAxis1,
|
||||
m_cameraCorrectedAxis2, m_size * viewScale);
|
||||
|
||||
debugDisplay.SetLineWidth(defaultLineWidth(manipulatorState.m_mouseOver));
|
||||
|
||||
debugDisplay.SetColor(ViewColor(manipulatorState.m_mouseOver, m_axis1Color, m_mouseOverColor).GetAsVector4());
|
||||
debugDisplay.DrawLine(quadBound.m_corner4, quadBound.m_corner3);
|
||||
debugDisplay.DrawLine(quadBoundVisual.m_corner4, quadBoundVisual.m_corner3);
|
||||
debugDisplay.DrawLine(quadBoundVisual.m_corner1, quadBoundVisual.m_corner2);
|
||||
|
||||
debugDisplay.SetColor(ViewColor(manipulatorState.m_mouseOver, m_axis2Color, m_mouseOverColor).GetAsVector4());
|
||||
debugDisplay.DrawLine(quadBound.m_corner2, quadBound.m_corner3);
|
||||
debugDisplay.DrawLine(quadBoundVisual.m_corner4, quadBoundVisual.m_corner1);
|
||||
debugDisplay.DrawLine(quadBoundVisual.m_corner2, quadBoundVisual.m_corner3);
|
||||
|
||||
if (manipulatorState.m_mouseOver)
|
||||
{
|
||||
debugDisplay.SetColor(Vector3ToVector4(m_mouseOverColor.GetAsVector3(), 0.5f));
|
||||
|
||||
debugDisplay.CullOff();
|
||||
debugDisplay.DrawQuad(quadBound.m_corner1, quadBound.m_corner2, quadBound.m_corner3, quadBound.m_corner4);
|
||||
debugDisplay.DrawQuad(
|
||||
quadBoundVisual.m_corner1, quadBoundVisual.m_corner2, quadBoundVisual.m_corner3, quadBoundVisual.m_corner4);
|
||||
debugDisplay.CullOn();
|
||||
}
|
||||
|
||||
RefreshBoundInternal(managerId, manipulatorId, quadBound);
|
||||
// total size of bounds to use for mouse intersection
|
||||
const float hitSize = m_size * ed_planarManipulatorBoundScaleFactor;
|
||||
// size of edge bounds (the 'margin/border' outside the visual representation)
|
||||
const float edgeSize = (hitSize - m_size) * 0.5f;
|
||||
const AZ::Vector3 edgeOffset =
|
||||
((m_cameraCorrectedAxis1 * edgeSize + m_cameraCorrectedAxis2 * edgeSize) * totalScale.GetReciprocal());
|
||||
const auto cameraCorrectedHitOffset = cameraCorrectedVisualOffset - edgeOffset;
|
||||
const Picking::BoundShapeQuad quadBoundHit = CalculateQuadBound(
|
||||
manipulatorState.m_localPosition + (cameraCorrectedHitOffset * viewScale), manipulatorState, m_cameraCorrectedAxis1,
|
||||
m_cameraCorrectedAxis2, hitSize * viewScale);
|
||||
|
||||
if (ed_manipulatorDisplayBoundDebug)
|
||||
{
|
||||
debugDisplay.DrawQuad(quadBoundHit.m_corner1, quadBoundHit.m_corner2, quadBoundHit.m_corner3, quadBoundHit.m_corner4);
|
||||
}
|
||||
|
||||
RefreshBoundInternal(managerId, manipulatorId, quadBoundHit);
|
||||
}
|
||||
|
||||
void ManipulatorViewQuadBillboard::Draw(
|
||||
const ManipulatorManagerId managerId,
|
||||
const ManipulatorManagerState& /*managerState*/,
|
||||
[[maybe_unused]] const ManipulatorManagerState& managerState,
|
||||
const ManipulatorId manipulatorId,
|
||||
const ManipulatorState& manipulatorState,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
const AzFramework::CameraState& cameraState,
|
||||
const ViewportInteraction::MouseInteraction& /*mouseInteraction*/)
|
||||
[[maybe_unused]] const ViewportInteraction::MouseInteraction& mouseInteraction)
|
||||
{
|
||||
const Picking::BoundShapeQuad quadBound = CalculateQuadBoundBillboard(
|
||||
manipulatorState.m_localPosition, manipulatorState.m_worldFromLocal,
|
||||
@@ -442,7 +482,7 @@ namespace AzToolsFramework
|
||||
|
||||
void ManipulatorViewLineSelect::Draw(
|
||||
const ManipulatorManagerId managerId,
|
||||
const ManipulatorManagerState& /*managerState*/,
|
||||
[[maybe_unused]] const ManipulatorManagerState& managerState,
|
||||
const ManipulatorId manipulatorId,
|
||||
const ManipulatorState& manipulatorState,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
@@ -570,7 +610,7 @@ namespace AzToolsFramework
|
||||
|
||||
void ManipulatorViewSphere::Draw(
|
||||
const ManipulatorManagerId managerId,
|
||||
const ManipulatorManagerState& /*managerState*/,
|
||||
[[maybe_unused]] const ManipulatorManagerState& managerState,
|
||||
const ManipulatorId manipulatorId,
|
||||
const ManipulatorState& manipulatorState,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
@@ -599,12 +639,12 @@ namespace AzToolsFramework
|
||||
|
||||
void ManipulatorViewCircle::Draw(
|
||||
const ManipulatorManagerId managerId,
|
||||
const ManipulatorManagerState& /*managerState*/,
|
||||
[[maybe_unused]] const ManipulatorManagerState& managerState,
|
||||
const ManipulatorId manipulatorId,
|
||||
const ManipulatorState& manipulatorState,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
const AzFramework::CameraState& cameraState,
|
||||
const ViewportInteraction::MouseInteraction& /*mouseInteraction*/)
|
||||
[[maybe_unused]] const ViewportInteraction::MouseInteraction& mouseInteraction)
|
||||
{
|
||||
const float viewScale =
|
||||
ManipulatorViewScaleMultiplier(manipulatorState.m_worldFromLocal.TransformPoint(manipulatorState.m_localPosition), cameraState);
|
||||
@@ -665,7 +705,7 @@ namespace AzToolsFramework
|
||||
|
||||
void ManipulatorViewSplineSelect::Draw(
|
||||
const ManipulatorManagerId managerId,
|
||||
const ManipulatorManagerState& /*managerState*/,
|
||||
[[maybe_unused]] const ManipulatorManagerState& managerState,
|
||||
const ManipulatorId manipulatorId,
|
||||
const ManipulatorState& manipulatorState,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
@@ -698,12 +738,18 @@ namespace AzToolsFramework
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AZStd::unique_ptr<ManipulatorViewQuad> CreateManipulatorViewQuad(
|
||||
const PlanarManipulator& planarManipulator, const AZ::Color& axis1Color, const AZ::Color& axis2Color, const float size)
|
||||
const AZ::Vector3& axis1,
|
||||
const AZ::Vector3& axis2,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
const AZ::Vector3& offset,
|
||||
const float size)
|
||||
{
|
||||
AZStd::unique_ptr<ManipulatorViewQuad> viewQuad = AZStd::make_unique<ManipulatorViewQuad>();
|
||||
viewQuad->m_axis1 = planarManipulator.GetAxis1();
|
||||
viewQuad->m_axis2 = planarManipulator.GetAxis2();
|
||||
viewQuad->m_axis1 = axis1;
|
||||
viewQuad->m_axis2 = axis2;
|
||||
viewQuad->m_size = size;
|
||||
viewQuad->m_offset = offset;
|
||||
viewQuad->m_axis1Color = axis1Color;
|
||||
viewQuad->m_axis2Color = axis2Color;
|
||||
return viewQuad;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace AzToolsFramework
|
||||
AZ_RTTI(ManipulatorView, "{7529E3E9-39B3-4D15-899A-FA13770113B2}")
|
||||
|
||||
ManipulatorView();
|
||||
ManipulatorView(bool screenSizeFixed);
|
||||
explicit ManipulatorView(bool screenSizeFixed);
|
||||
virtual ~ManipulatorView();
|
||||
ManipulatorView(ManipulatorView&&) = default;
|
||||
ManipulatorView& operator=(ManipulatorView&&) = default;
|
||||
@@ -117,13 +117,16 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::Vector3 m_axis1 = AZ::Vector3(1.0f, 0.0f, 0.0f);
|
||||
AZ::Vector3 m_axis2 = AZ::Vector3(0.0f, 1.0f, 0.0f);
|
||||
AZ::Vector3 m_offset = AZ::Vector3::CreateZero();
|
||||
AZ::Color m_axis1Color = AZ::Color(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
AZ::Color m_axis2Color = AZ::Color(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
float m_size = 0.06f; //!< size to render and do mouse ray intersection tests against.
|
||||
|
||||
private:
|
||||
AZ::Vector3 m_cameraCorrectedAxis1;
|
||||
AZ::Vector3 m_cameraCorrectedAxis2;
|
||||
AZ::Vector3 m_cameraCorrectedAxis1; //!< First axis of quad (should be orthogonal to second axis).
|
||||
AZ::Vector3 m_cameraCorrectedAxis2; //!< Second axis of quad (should be orthogonal to first axis).
|
||||
AZ::Vector3 m_cameraCorrectedOffsetAxis1; //!< Offset along first axis (parallel with first axis).
|
||||
AZ::Vector3 m_cameraCorrectedOffsetAxis2; //!< Offset along second axis (parallel with second axis).
|
||||
};
|
||||
|
||||
//! A screen aligned quad, centered at the position of the manipulator, display filled.
|
||||
@@ -379,7 +382,12 @@ namespace AzToolsFramework
|
||||
// Helpers to create various manipulator views.
|
||||
|
||||
AZStd::unique_ptr<ManipulatorViewQuad> CreateManipulatorViewQuad(
|
||||
const PlanarManipulator& planarManipulator, const AZ::Color& axis1Color, const AZ::Color& axis2Color, float size);
|
||||
const AZ::Vector3& axis1,
|
||||
const AZ::Vector3& axis2,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
const AZ::Vector3& offset,
|
||||
float size);
|
||||
|
||||
AZStd::unique_ptr<ManipulatorViewQuadBillboard> CreateManipulatorViewQuadBillboard(const AZ::Color& color, float size);
|
||||
|
||||
|
||||
+3
-3
@@ -132,7 +132,7 @@ namespace AzToolsFramework
|
||||
const AzFramework::CameraState& cameraState,
|
||||
const ViewportInteraction::MouseInteraction& mouseInteraction)
|
||||
{
|
||||
if (cl_manipulatorDrawDebug)
|
||||
if (ed_manipulatorDrawDebug)
|
||||
{
|
||||
const AZ::Transform combined = TransformUniformScale(GetSpace()) * GetLocalTransform();
|
||||
for (const auto& fixed : m_fixedAxes)
|
||||
@@ -145,8 +145,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
view->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
ManipulatorState{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() },
|
||||
debugDisplay, cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace AzToolsFramework
|
||||
const AzFramework::CameraState& cameraState,
|
||||
const ViewportInteraction::MouseInteraction& mouseInteraction)
|
||||
{
|
||||
if (cl_manipulatorDrawDebug)
|
||||
if (ed_manipulatorDrawDebug)
|
||||
{
|
||||
if (PerformingAction())
|
||||
{
|
||||
@@ -202,8 +202,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
view->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
ManipulatorState{ ApplySpace(GetLocalTransform()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() },
|
||||
debugDisplay, cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "ScaleManipulators.h"
|
||||
|
||||
#include <AzToolsFramework/Maths/TransformUtils.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -120,25 +121,25 @@ namespace AzToolsFramework
|
||||
void ScaleManipulators::ConfigureView(
|
||||
const float axisLength, const AZ::Color& axis1Color, const AZ::Color& axis2Color, const AZ::Color& axis3Color)
|
||||
{
|
||||
const float boxSize = 0.1f;
|
||||
const float boxHalfExtent = ScaleManipulatorBoxHalfExtent();
|
||||
const AZ::Color colors[] = { axis1Color, axis2Color, axis3Color };
|
||||
|
||||
for (size_t manipulatorIndex = 0; manipulatorIndex < m_axisScaleManipulators.size(); ++manipulatorIndex)
|
||||
{
|
||||
const auto lineLength = axisLength - boxSize;
|
||||
const auto lineLength = axisLength - (2.0f * boxHalfExtent);
|
||||
|
||||
ManipulatorViews views;
|
||||
views.emplace_back(
|
||||
CreateManipulatorViewLine(*m_axisScaleManipulators[manipulatorIndex], colors[manipulatorIndex], axisLength, m_lineBoundWidth));
|
||||
views.emplace_back(CreateManipulatorViewLine(
|
||||
*m_axisScaleManipulators[manipulatorIndex], colors[manipulatorIndex], axisLength, m_lineBoundWidth));
|
||||
views.emplace_back(CreateManipulatorViewBox(
|
||||
AZ::Transform::CreateIdentity(), colors[manipulatorIndex],
|
||||
m_axisScaleManipulators[manipulatorIndex]->GetAxis() * lineLength, AZ::Vector3(boxSize)));
|
||||
m_axisScaleManipulators[manipulatorIndex]->GetAxis() * (lineLength + boxHalfExtent), AZ::Vector3(boxHalfExtent)));
|
||||
m_axisScaleManipulators[manipulatorIndex]->SetViews(AZStd::move(views));
|
||||
}
|
||||
|
||||
ManipulatorViews views;
|
||||
views.emplace_back(CreateManipulatorViewBox(
|
||||
AZ::Transform::CreateIdentity(), AZ::Color::CreateOne(), AZ::Vector3::CreateZero(), AZ::Vector3(boxSize)));
|
||||
AZ::Transform::CreateIdentity(), AZ::Color::CreateOne(), AZ::Vector3::CreateZero(), AZ::Vector3(boxHalfExtent)));
|
||||
m_uniformScaleManipulator->SetViews(AZStd::move(views));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -90,8 +90,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
view->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ TransformUniformScale(GetSpace()), GetNonUniformScale(), GetLocalPosition(), MouseOver() }, debugDisplay, cameraState,
|
||||
mouseInteraction);
|
||||
ManipulatorState{ TransformUniformScale(GetSpace()), GetNonUniformScale(), GetLocalPosition(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -94,8 +94,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_manipulatorView->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ TransformUniformScale(GetSpace()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
ManipulatorState{ TransformUniformScale(GetSpace()), GetNonUniformScale(), AZ::Vector3::CreateZero(), MouseOver() },
|
||||
debugDisplay, cameraState, mouseInteraction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -166,8 +166,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_manipulatorView->Draw(
|
||||
GetManipulatorManagerId(), managerState, GetManipulatorId(),
|
||||
{ TransformUniformScale(GetSpace()), GetNonUniformScale(), GetLocalPosition(), MouseOver() }, debugDisplay, cameraState,
|
||||
mouseInteraction);
|
||||
ManipulatorState{ TransformUniformScale(GetSpace()), GetNonUniformScale(), GetLocalPosition(), MouseOver() }, debugDisplay,
|
||||
cameraState, mouseInteraction);
|
||||
}
|
||||
|
||||
void SurfaceManipulator::InvalidateImpl()
|
||||
|
||||
+61
-22
@@ -10,18 +10,30 @@
|
||||
|
||||
#include <AzCore/Math/VectorConversions.h>
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorView.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
static const float SurfaceManipulatorTransparency = 0.75f;
|
||||
static const float LinearManipulatorAxisLength = 2.0f;
|
||||
static const float SurfaceManipulatorRadius = 0.1f;
|
||||
|
||||
static const AZ::Color LinearManipulatorXAxisColor = AZ::Color(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
static const AZ::Color LinearManipulatorYAxisColor = AZ::Color(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
static const AZ::Color LinearManipulatorZAxisColor = AZ::Color(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
static const AZ::Color SurfaceManipulatorColor = AZ::Color(1.0f, 1.0f, 0.0f, 0.5f);
|
||||
|
||||
static TranslationManipulatorsViewCreateInfo DefaultTranslationManipulatorViewCreateInfo()
|
||||
{
|
||||
TranslationManipulatorsViewCreateInfo createInfo;
|
||||
createInfo.axis1Color = LinearManipulatorXAxisColor;
|
||||
createInfo.axis2Color = LinearManipulatorYAxisColor;
|
||||
createInfo.axis3Color = LinearManipulatorZAxisColor;
|
||||
createInfo.surfaceColor = SurfaceManipulatorColor;
|
||||
createInfo.linearAxisLength = LinearManipulatorAxisLength();
|
||||
createInfo.linearConeLength = LinearManipulatorConeLength();
|
||||
createInfo.linearConeRadius = LinearManipulatorConeRadius();
|
||||
createInfo.planarAxisLength = PlanarManipulatorAxisLength();
|
||||
createInfo.surfaceRadius = SurfaceManipulatorRadius();
|
||||
return createInfo;
|
||||
}
|
||||
|
||||
TranslationManipulators::TranslationManipulators(
|
||||
const Dimensions dimensions, const AZ::Transform& worldFromLocal, const AZ::Vector3& nonUniformScale)
|
||||
: m_dimensions(dimensions)
|
||||
@@ -234,15 +246,32 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void TranslationManipulators::ConfigureView2d(const TranslationManipulatorsViewCreateInfo& translationManipulatorViewCreateInfo)
|
||||
{
|
||||
ConfigureLinearView(
|
||||
translationManipulatorViewCreateInfo.linearAxisLength, translationManipulatorViewCreateInfo.linearConeLength,
|
||||
translationManipulatorViewCreateInfo.linearConeRadius, translationManipulatorViewCreateInfo.axis1Color,
|
||||
translationManipulatorViewCreateInfo.axis2Color, translationManipulatorViewCreateInfo.axis3Color);
|
||||
ConfigurePlanarView(
|
||||
translationManipulatorViewCreateInfo.planarAxisLength, translationManipulatorViewCreateInfo.linearAxisLength,
|
||||
translationManipulatorViewCreateInfo.linearConeLength, translationManipulatorViewCreateInfo.axis1Color,
|
||||
translationManipulatorViewCreateInfo.axis2Color, translationManipulatorViewCreateInfo.axis3Color);
|
||||
}
|
||||
|
||||
void TranslationManipulators::ConfigureView3d(const TranslationManipulatorsViewCreateInfo& translationManipulatorViewCreateInfo)
|
||||
{
|
||||
ConfigureView2d(translationManipulatorViewCreateInfo);
|
||||
ConfigureSurfaceView(translationManipulatorViewCreateInfo.surfaceRadius, translationManipulatorViewCreateInfo.surfaceColor);
|
||||
}
|
||||
|
||||
void TranslationManipulators::ConfigureLinearView(
|
||||
const float axisLength,
|
||||
const float coneLength,
|
||||
const float coneRadius,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
const AZ::Color& axis3Color /*= AZ::Color(0.0f, 0.0f, 1.0f, 0.5f)*/)
|
||||
{
|
||||
const float coneLength = 0.28f;
|
||||
const float coneRadius = 0.07f;
|
||||
|
||||
const AZ::Color axesColor[] = { axis1Color, axis2Color, axis3Color };
|
||||
|
||||
const auto configureLinearView = [lineBoundWidth = m_lineBoundWidth, coneLength, axisLength,
|
||||
@@ -251,7 +280,7 @@ namespace AzToolsFramework
|
||||
const auto lineLength = axisLength - coneLength;
|
||||
|
||||
ManipulatorViews views;
|
||||
views.emplace_back(CreateManipulatorViewLine(*linearManipulator, color, lineLength, lineBoundWidth));
|
||||
views.emplace_back(CreateManipulatorViewLine(*linearManipulator, color, axisLength, lineBoundWidth));
|
||||
views.emplace_back(
|
||||
CreateManipulatorViewCone(*linearManipulator, color, linearManipulator->GetAxis() * lineLength, coneLength, coneRadius));
|
||||
linearManipulator->SetViews(AZStd::move(views));
|
||||
@@ -264,19 +293,21 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
void TranslationManipulators::ConfigurePlanarView(
|
||||
const float planarAxisLength,
|
||||
const float linearAxisLength,
|
||||
const float linearConeLength,
|
||||
const AZ::Color& plane1Color,
|
||||
const AZ::Color& plane2Color /*= AZ::Color(0.0f, 1.0f, 0.0f, 0.5f)*/,
|
||||
const AZ::Color& plane3Color /*= AZ::Color(0.0f, 0.0f, 1.0f, 0.5f)*/)
|
||||
{
|
||||
const float planeSize = 0.6f;
|
||||
const AZ::Color planesColor[] = { plane1Color, plane2Color, plane3Color };
|
||||
|
||||
for (size_t manipulatorIndex = 0; manipulatorIndex < m_planarManipulators.size(); ++manipulatorIndex)
|
||||
{
|
||||
const AZStd::shared_ptr<ManipulatorViewQuad> manipulatorView = CreateManipulatorViewQuad(
|
||||
*m_planarManipulators[manipulatorIndex], planesColor[manipulatorIndex], planesColor[(manipulatorIndex + 1) % 3], planeSize);
|
||||
|
||||
m_planarManipulators[manipulatorIndex]->SetViews(ManipulatorViews{ manipulatorView });
|
||||
const auto& planarManipulator = *m_planarManipulators[manipulatorIndex];
|
||||
m_planarManipulators[manipulatorIndex]->SetViews(ManipulatorViews{ CreateManipulatorViewQuadForPlanarTranslationManipulator(
|
||||
planarManipulator.GetAxis1(), planarManipulator.GetAxis2(), planesColor[manipulatorIndex],
|
||||
planesColor[(manipulatorIndex + 1) % 3], linearAxisLength, linearConeLength, planarAxisLength) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,12 +317,11 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_surfaceManipulator->SetView(CreateManipulatorViewSphere(
|
||||
color, radius,
|
||||
[](const ViewportInteraction::MouseInteraction& /*mouseInteraction*/, bool mouseOver,
|
||||
[]([[maybe_unused]] const ViewportInteraction::MouseInteraction& mouseInteraction, bool mouseOver,
|
||||
const AZ::Color& defaultColor) -> AZ::Color
|
||||
{
|
||||
const AZ::Color color[2] = {
|
||||
defaultColor,
|
||||
Vector3ToVector4(BaseManipulator::s_defaultMouseOverColor.GetAsVector3(), SurfaceManipulatorTransparency)
|
||||
defaultColor, Vector3ToVector4(BaseManipulator::s_defaultMouseOverColor.GetAsVector3(), SurfaceManipulatorOpacity())
|
||||
};
|
||||
|
||||
return color[mouseOver];
|
||||
@@ -325,16 +355,25 @@ namespace AzToolsFramework
|
||||
void ConfigureTranslationManipulatorAppearance3d(TranslationManipulators* translationManipulators)
|
||||
{
|
||||
translationManipulators->SetAxes(AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Vector3::CreateAxisZ());
|
||||
translationManipulators->ConfigurePlanarView(LinearManipulatorXAxisColor, LinearManipulatorYAxisColor, LinearManipulatorZAxisColor);
|
||||
translationManipulators->ConfigureLinearView(
|
||||
LinearManipulatorAxisLength, LinearManipulatorXAxisColor, LinearManipulatorYAxisColor, LinearManipulatorZAxisColor);
|
||||
translationManipulators->ConfigureSurfaceView(SurfaceManipulatorRadius, SurfaceManipulatorColor);
|
||||
translationManipulators->ConfigureView3d(DefaultTranslationManipulatorViewCreateInfo());
|
||||
}
|
||||
|
||||
void ConfigureTranslationManipulatorAppearance2d(TranslationManipulators* translationManipulators)
|
||||
{
|
||||
translationManipulators->SetAxes(AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY());
|
||||
translationManipulators->ConfigurePlanarView(LinearManipulatorXAxisColor);
|
||||
translationManipulators->ConfigureLinearView(LinearManipulatorAxisLength, LinearManipulatorXAxisColor, LinearManipulatorYAxisColor);
|
||||
translationManipulators->ConfigureView2d(DefaultTranslationManipulatorViewCreateInfo());
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<ManipulatorViewQuad> CreateManipulatorViewQuadForPlanarTranslationManipulator(
|
||||
const AZ::Vector3& axis1,
|
||||
const AZ::Vector3& axis2,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
const float linearAxisLength,
|
||||
const float linearConeLength,
|
||||
const float planarAxisLength)
|
||||
{
|
||||
const AZ::Vector3 offset = (axis1 + axis2) * (((linearAxisLength - linearConeLength) * 0.5f) - (planarAxisLength * 0.5f));
|
||||
return CreateManipulatorViewQuad(axis1, axis2, axis1Color, axis2Color, offset, planarAxisLength);
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+37
-6
@@ -15,6 +15,20 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! Parameters to configure the appearance of the TranslationManipulators view(s).
|
||||
struct TranslationManipulatorsViewCreateInfo
|
||||
{
|
||||
float linearAxisLength;
|
||||
float linearConeLength;
|
||||
float linearConeRadius;
|
||||
float planarAxisLength;
|
||||
float surfaceRadius;
|
||||
AZ::Color axis1Color;
|
||||
AZ::Color axis2Color;
|
||||
AZ::Color axis3Color;
|
||||
AZ::Color surfaceColor;
|
||||
};
|
||||
|
||||
//! TranslationManipulators is an aggregation of 3 linear manipulators, 3 planar manipulators
|
||||
//! and one surface manipulator who share the same transform.
|
||||
class TranslationManipulators : public Manipulators
|
||||
@@ -23,6 +37,9 @@ namespace AzToolsFramework
|
||||
AZ_RTTI(TranslationManipulators, "{D5E49EA2-30E0-42BC-A51D-6A7F87818260}")
|
||||
AZ_CLASS_ALLOCATOR(TranslationManipulators, AZ::SystemAllocator, 0)
|
||||
|
||||
TranslationManipulators(TranslationManipulators&&) = delete;
|
||||
TranslationManipulators& operator=(TranslationManipulators&&) = delete;
|
||||
|
||||
//! How many dimensions does this translation manipulator have.
|
||||
enum class Dimensions
|
||||
{
|
||||
@@ -52,25 +69,31 @@ namespace AzToolsFramework
|
||||
|
||||
void SetAxes(const AZ::Vector3& axis1, const AZ::Vector3& axis2, const AZ::Vector3& axis3 = AZ::Vector3::CreateAxisZ());
|
||||
|
||||
void ConfigureView2d(const TranslationManipulatorsViewCreateInfo& translationManipulatorViewCreateInfo);
|
||||
void ConfigureView3d(const TranslationManipulatorsViewCreateInfo& translationManipulatorViewCreateInfo);
|
||||
|
||||
//! Sets the bound width to use for the line/axis of a linear manipulator.
|
||||
void SetLineBoundWidth(float lineBoundWidth);
|
||||
|
||||
private:
|
||||
void ConfigurePlanarView(
|
||||
float planeSize,
|
||||
float linearAxisLength,
|
||||
float linearConeLength,
|
||||
const AZ::Color& plane1Color,
|
||||
const AZ::Color& plane2Color = AZ::Color(0.0f, 1.0f, 0.0f, 0.5f),
|
||||
const AZ::Color& plane3Color = AZ::Color(0.0f, 0.0f, 1.0f, 0.5f));
|
||||
|
||||
void ConfigureLinearView(
|
||||
float axisLength,
|
||||
float coneLength,
|
||||
float coneRadius,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
const AZ::Color& axis3Color = AZ::Color(0.0f, 0.0f, 1.0f, 0.5f));
|
||||
|
||||
void ConfigureSurfaceView(float radius, const AZ::Color& color);
|
||||
|
||||
//! Sets the bound width to use for the line/axis of a linear manipulator.
|
||||
void SetLineBoundWidth(float lineBoundWidth);
|
||||
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(TranslationManipulators)
|
||||
|
||||
// Manipulators
|
||||
void ProcessManipulators(const AZStd::function<void(BaseManipulator*)>&) override;
|
||||
|
||||
@@ -130,4 +153,12 @@ namespace AzToolsFramework
|
||||
void ConfigureTranslationManipulatorAppearance3d(TranslationManipulators* translationManipulators);
|
||||
void ConfigureTranslationManipulatorAppearance2d(TranslationManipulators* translationManipulators);
|
||||
|
||||
AZStd::shared_ptr<ManipulatorViewQuad> CreateManipulatorViewQuadForPlanarTranslationManipulator(
|
||||
const AZ::Vector3& axis1,
|
||||
const AZ::Vector3& axis2,
|
||||
const AZ::Color& axis1Color,
|
||||
const AZ::Color& axis2Color,
|
||||
float linearAxisLength,
|
||||
float linearConeLength,
|
||||
float planarAxisLength);
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -521,21 +521,18 @@ namespace AzToolsFramework
|
||||
nestedInstanceLink.has_value(),
|
||||
"A valid link was not found for one of the instances provided as input for the CreatePrefab operation.");
|
||||
|
||||
PrefabDomReference nestedInstanceLinkDom = nestedInstanceLink->get().GetLinkDom();
|
||||
AZ_Assert(
|
||||
nestedInstanceLinkDom.has_value(),
|
||||
"A valid DOM was not found for the link corresponding to one of the instances provided as input for the "
|
||||
"CreatePrefab operation.");
|
||||
|
||||
PrefabDomValueReference nestedInstanceLinkPatches =
|
||||
PrefabDomUtils::FindPrefabDomValue(nestedInstanceLinkDom->get(), PrefabDomUtils::PatchesName);
|
||||
AZ_Assert(
|
||||
nestedInstanceLinkPatches.has_value(),
|
||||
"A valid DOM for patches was not found for the link corresponding to one of the instances provided as input for the "
|
||||
"CreatePrefab operation.");
|
||||
|
||||
PrefabDom patchesCopyForUndoSupport;
|
||||
patchesCopyForUndoSupport.CopyFrom(nestedInstanceLinkPatches->get(), patchesCopyForUndoSupport.GetAllocator());
|
||||
PrefabDomReference nestedInstanceLinkDom = nestedInstanceLink->get().GetLinkDom();
|
||||
if (nestedInstanceLinkDom.has_value())
|
||||
{
|
||||
PrefabDomValueReference nestedInstanceLinkPatches =
|
||||
PrefabDomUtils::FindPrefabDomValue(nestedInstanceLinkDom->get(), PrefabDomUtils::PatchesName);
|
||||
if (nestedInstanceLinkPatches.has_value())
|
||||
{
|
||||
patchesCopyForUndoSupport.CopyFrom(nestedInstanceLinkPatches->get(), patchesCopyForUndoSupport.GetAllocator());
|
||||
}
|
||||
}
|
||||
|
||||
PrefabUndoHelpers::RemoveLink(
|
||||
sourceInstance->GetTemplateId(), targetTemplateId, sourceInstance->GetInstanceAlias(), sourceInstance->GetLinkId(),
|
||||
AZStd::move(patchesCopyForUndoSupport), undoBatch);
|
||||
|
||||
+6
-1
@@ -8,10 +8,12 @@
|
||||
|
||||
#include <API/ToolsApplicationAPI.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLockComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityComponent.h>
|
||||
#include <Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <Prefab/PrefabSystemScriptingHandler.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <Prefab/EditorPrefabComponent.h>
|
||||
#include <ToolsComponents/TransformComponent.h>
|
||||
|
||||
@@ -72,6 +74,9 @@ namespace AzToolsFramework::Prefab
|
||||
entities, commonRoot, &topLevelEntities);
|
||||
|
||||
auto containerEntity = AZStd::make_unique<AZ::Entity>();
|
||||
containerEntity->CreateComponent<Components::TransformComponent>();
|
||||
containerEntity->CreateComponent<Components::EditorLockComponent>();
|
||||
containerEntity->CreateComponent<Components::EditorVisibilityComponent>();
|
||||
containerEntity->CreateComponent<Prefab::EditorPrefabComponent>();
|
||||
|
||||
for (AZ::Entity* entity : topLevelEntities)
|
||||
|
||||
+2
-6
@@ -565,9 +565,7 @@ namespace AzToolsFramework
|
||||
EditorRequestBus::BroadcastResult(position, &EditorRequestBus::Events::GetWorldPositionAtViewportCenter);
|
||||
}
|
||||
|
||||
// Instantiating from context menu always puts the instance at the root level
|
||||
auto createPrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(prefabFilePath, parentId, position);
|
||||
|
||||
if (!createPrefabOutcome.IsSuccess())
|
||||
{
|
||||
WarnUserOfError("Prefab Instantiation Error",createPrefabOutcome.GetError());
|
||||
@@ -594,15 +592,13 @@ namespace AzToolsFramework
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise return since it needs to be inside an authored prefab
|
||||
return;
|
||||
EditorRequestBus::BroadcastResult(position, &EditorRequestBus::Events::GetWorldPositionAtViewportCenter);
|
||||
}
|
||||
|
||||
// Instantiating from context menu always puts the instance at the root level
|
||||
auto createPrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(prefabAssetPath, parentId, position);
|
||||
if (!createPrefabOutcome.IsSuccess())
|
||||
{
|
||||
WarnUserOfError("Prefab Instantiation Error", createPrefabOutcome.GetError());
|
||||
WarnUserOfError("Procedural Prefab Instantiation Error", createPrefabOutcome.GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -15,12 +15,14 @@
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/parallel/binary_semaphore.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AZTestShared/Math/MathTestHelpers.h>
|
||||
#include <AZTestShared/Utils/Utils.h>
|
||||
#include <AzFramework/UnitTest/TestDebugDisplayRequests.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/ViewportEditorModeTrackerInterface.h>
|
||||
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
|
||||
@@ -235,6 +237,13 @@ namespace UnitTest
|
||||
return toolsApp;
|
||||
}
|
||||
|
||||
//! It is possible to override this in classes deriving from ToolsApplicationFixture to provide alternate
|
||||
//! implementations of the DebugDisplayRequests interface (e.g. TestDebugDisplayRequests).
|
||||
virtual AZStd::shared_ptr<AzFramework::DebugDisplayRequests> CreateDebugDisplayRequests()
|
||||
{
|
||||
return AZStd::make_shared<NullDebugDisplayRequests>();
|
||||
}
|
||||
|
||||
protected:
|
||||
TestEditorActions m_editorActions;
|
||||
ToolsApplicationMessageHandler m_messageHandler; // used to suppress trace messages in test output
|
||||
|
||||
@@ -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
|
||||
+4
-2
@@ -33,6 +33,7 @@
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <AzToolsFramework/Viewport/ActionBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h>
|
||||
#include <Entity/EditorEntityContextBus.h>
|
||||
@@ -1376,7 +1377,7 @@ namespace AzToolsFramework
|
||||
// view
|
||||
rotationManipulators->SetLocalAxes(AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Vector3::CreateAxisZ());
|
||||
rotationManipulators->ConfigureView(
|
||||
2.0f, AzFramework::ViewportColors::XAxisColor, AzFramework::ViewportColors::YAxisColor,
|
||||
RotationManipulatorRadius(), AzFramework::ViewportColors::XAxisColor, AzFramework::ViewportColors::YAxisColor,
|
||||
AzFramework::ViewportColors::ZAxisColor);
|
||||
|
||||
struct SharedRotationState
|
||||
@@ -1535,7 +1536,8 @@ namespace AzToolsFramework
|
||||
RecalculateAverageManipulatorTransform(m_entityIdManipulators.m_lookups, m_pivotOverrideFrame, m_pivotMode, m_referenceFrame));
|
||||
|
||||
scaleManipulators->SetAxes(AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Vector3::CreateAxisZ());
|
||||
scaleManipulators->ConfigureView(2.0f, AZ::Color::CreateOne(), AZ::Color::CreateOne(), AZ::Color::CreateOne());
|
||||
scaleManipulators->ConfigureView(
|
||||
LinearManipulatorAxisLength(), AZ::Color::CreateOne(), AZ::Color::CreateOne(), AZ::Color::CreateOne());
|
||||
|
||||
struct SharedScaleState
|
||||
{
|
||||
|
||||
@@ -506,6 +506,8 @@ set(FILES
|
||||
Viewport/ViewportMessages.cpp
|
||||
Viewport/ViewportTypes.h
|
||||
Viewport/ViewportTypes.cpp
|
||||
Viewport/ViewportSettings.h
|
||||
Viewport/ViewportSettings.cpp
|
||||
ViewportUi/Button.h
|
||||
ViewportUi/Button.cpp
|
||||
ViewportUi/ButtonGroup.h
|
||||
|
||||
@@ -7,12 +7,16 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzManipulatorTestFramework/AzManipulatorTestFramework.h>
|
||||
#include <AzManipulatorTestFramework/DirectManipulatorViewportInteraction.h>
|
||||
#include <AzManipulatorTestFramework/ImmediateModeActionDispatcher.h>
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
#include <AzToolsFramework/Manipulators/RotationManipulators.h>
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorView.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
|
||||
#include <AzToolsFramework/Manipulators/RotationManipulators.h>
|
||||
#include <AzToolsFramework/Manipulators/TranslationManipulators.h>
|
||||
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
|
||||
#include <AzToolsFramework/UnitTest/ToolsTestApplication.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
@@ -21,8 +25,7 @@ namespace UnitTest
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
class ManipulatorViewTest
|
||||
: public AllocatorsTestFixture
|
||||
class ManipulatorViewTest : public AllocatorsTestFixture
|
||||
{
|
||||
AZStd::unique_ptr<AZ::SerializeContext> m_serializeContext;
|
||||
|
||||
@@ -32,7 +35,7 @@ namespace UnitTest
|
||||
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
|
||||
m_app.Start(AzFramework::Application::Descriptor());
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
// in the unit tests.
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
}
|
||||
@@ -51,12 +54,9 @@ namespace UnitTest
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Given
|
||||
const AZ::Transform orientation =
|
||||
AZ::Transform::CreateFromQuaternion(
|
||||
AZ::Quaternion::CreateFromAxisAngle(
|
||||
AZ::Vector3::CreateAxisX(), AZ::DegToRad(-90.0f)));
|
||||
AZ::Transform::CreateFromQuaternion(AZ::Quaternion::CreateRotationX(AZ::DegToRad(-90.0f)));
|
||||
|
||||
const AZ::Transform translation =
|
||||
AZ::Transform::CreateTranslation(AZ::Vector3(5.0f, 0.0f, 10.0f));
|
||||
const AZ::Transform translation = AZ::Transform::CreateTranslation(AZ::Vector3(5.0f, 0.0f, 10.0f));
|
||||
|
||||
const AZ::Transform manipulatorSpace = translation * orientation;
|
||||
// create a rotation manipulator in an arbitrary space
|
||||
@@ -67,8 +67,7 @@ namespace UnitTest
|
||||
// When
|
||||
const AZ::Vector3 worldCameraPosition = AZ::Vector3(5.0f, -10.0f, 10.0f);
|
||||
// transform the view direction to the space of the manipulator (space + local transform)
|
||||
const AZ::Vector3 viewDirection =
|
||||
CalculateViewDirection(rotationManipulators, worldCameraPosition);
|
||||
const AZ::Vector3 viewDirection = CalculateViewDirection(rotationManipulators, worldCameraPosition);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -84,8 +83,7 @@ namespace UnitTest
|
||||
cameraState.m_position = AZ::Vector3::CreateAxisY(20.0f);
|
||||
cameraState.m_forward = -AZ::Vector3::CreateAxisY();
|
||||
|
||||
const float scale =
|
||||
AzToolsFramework::CalculateScreenToWorldMultiplier(AZ::Vector3::CreateZero(), cameraState);
|
||||
const float scale = AzToolsFramework::CalculateScreenToWorldMultiplier(AZ::Vector3::CreateZero(), cameraState);
|
||||
|
||||
EXPECT_NEAR(scale, 2.0f, std::numeric_limits<float>::epsilon());
|
||||
}
|
||||
@@ -96,9 +94,57 @@ namespace UnitTest
|
||||
cameraState.m_position = AZ::Vector3::CreateAxisY(20.0f);
|
||||
cameraState.m_forward = -AZ::Vector3::CreateAxisY();
|
||||
|
||||
const float scale =
|
||||
AzToolsFramework::CalculateScreenToWorldMultiplier(AZ::Vector3::CreateAxisX(-10.0f), cameraState);
|
||||
const float scale = AzToolsFramework::CalculateScreenToWorldMultiplier(AZ::Vector3::CreateAxisX(-10.0f), cameraState);
|
||||
|
||||
EXPECT_NEAR(scale, 2.0f, std::numeric_limits<float>::epsilon());
|
||||
}
|
||||
|
||||
TEST_F(ManipulatorViewTest, ManipulatorViewQuadDrawsAtCorrectPositionWhenManipulatorSpaceIsScaledUniformlyAndNonUniformly)
|
||||
{
|
||||
// Given
|
||||
// simulate a custom manipulator space (e.g. entity transform) and a local offset within that space (e.g. spline vertex position)
|
||||
const AZ::Transform space =
|
||||
AZ::Transform::CreateTranslation(AZ::Vector3(2.0f, -3.0f, -4.0f)) * AZ::Transform::CreateUniformScale(2.0f);
|
||||
const AZ::Vector3 localPosition = AZ::Vector3(2.0f, -2.0f, 0.0f);
|
||||
const AZ::Vector3 nonUniformScale = AZ::Vector3(2.0f, 3.0f, 4.0f);
|
||||
const AZ::Transform combinedTransform =
|
||||
AzToolsFramework::ApplySpace(AZ::Transform::CreateTranslation(localPosition), space, nonUniformScale);
|
||||
|
||||
// create a manipulator state based on the space and local position
|
||||
AzToolsFramework::ManipulatorState manipulatorState{};
|
||||
manipulatorState.m_worldFromLocal = combinedTransform;
|
||||
manipulatorState.m_nonUniformScale = nonUniformScale;
|
||||
// note: This is zero as the localPosition is already encoded in the combinedTransform
|
||||
manipulatorState.m_localPosition = AZ::Vector3::CreateZero();
|
||||
|
||||
// camera (go to position format) - 10.00, -15.00, 6.00, -90.00, 0.00
|
||||
const AzFramework::CameraState cameraState = AzFramework::CreateDefaultCamera(
|
||||
AZ::Transform::CreateFromMatrix3x3AndTranslation(
|
||||
AZ::Matrix3x3::CreateRotationX(AZ::DegToRad(-90.0f)), AZ::Vector3(10.0f, -15.0f, 6.0f)),
|
||||
AZ::Vector2(1280, 720));
|
||||
|
||||
// test debug display instance to record vertices that were output
|
||||
auto testDebugDisplayRequests = AZStd::make_shared<TestDebugDisplayRequests>();
|
||||
auto planarTranslationViewQuad = CreateManipulatorViewQuadForPlanarTranslationManipulator(
|
||||
AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Color::CreateZero(), AZ::Color::CreateZero(), 2.2f, 0.2f, 1.0f);
|
||||
|
||||
// When
|
||||
// draw the quad as it would be for a manipulator
|
||||
planarTranslationViewQuad->Draw(
|
||||
AzToolsFramework::ManipulatorManagerId(1), AzToolsFramework::ManipulatorManagerState{ false },
|
||||
AzToolsFramework::ManipulatorId(1), manipulatorState, *testDebugDisplayRequests, cameraState,
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction{});
|
||||
|
||||
const AZStd::vector<AZ::Vector3> expectedDisplayPositions = {
|
||||
AZ::Vector3(10.5f, -13.5f, -4.0f), AZ::Vector3(11.5f, -13.5f, -4.0f), AZ::Vector3(10.5f, -14.5f, -4.0f),
|
||||
AZ::Vector3(11.5f, -14.5f, -4.0f), AZ::Vector3(10.5f, -13.5f, -4.0f), AZ::Vector3(10.5f, -14.5f, -4.0f),
|
||||
AZ::Vector3(11.5f, -14.5f, -4.0f), AZ::Vector3(11.5f, -13.5f, -4.0f)
|
||||
};
|
||||
|
||||
// Then
|
||||
const auto points = testDebugDisplayRequests->GetPoints();
|
||||
// quad vertices appear in the expected position (not offset or scaled incorrectly by space scale)
|
||||
using ::testing::UnorderedPointwise;
|
||||
EXPECT_THAT(points, UnorderedPointwise(ContainerIsClose(), expectedDisplayPositions));
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
|
||||
#include <Prefab/PrefabTestComponent.h>
|
||||
#include <Prefab/PrefabTestDomUtils.h>
|
||||
#include <Prefab/PrefabTestFixture.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
using PrefabDeleteTest = PrefabTestFixture;
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesInInstance_DeleteSingleEntitySucceeds)
|
||||
{
|
||||
PrefabEntityResult createEntityResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created.
|
||||
AZ::EntityId testEntityId = createEntityResult.GetValue();
|
||||
ASSERT_TRUE(testEntityId.IsValid());
|
||||
AZ::Entity* testEntity = AzToolsFramework::GetEntityById(testEntityId);
|
||||
ASSERT_TRUE(testEntity != nullptr);
|
||||
|
||||
m_prefabPublicInterface->DeleteEntitiesInInstance(AzToolsFramework::EntityIdList{ testEntityId });
|
||||
|
||||
// Verify that entity can't be found after deletion.
|
||||
testEntity = AzToolsFramework::GetEntityById(testEntityId);
|
||||
EXPECT_TRUE(testEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesInInstance_DeleteSinglePrefabSucceeds)
|
||||
{
|
||||
PrefabEntityResult createEntityResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created.
|
||||
AZ::EntityId createdEntityId = createEntityResult.GetValue();
|
||||
ASSERT_TRUE(createdEntityId.IsValid());
|
||||
AZ::Entity* createdEntity = AzToolsFramework::GetEntityById(createdEntityId);
|
||||
ASSERT_TRUE(createdEntity != nullptr);
|
||||
|
||||
// Rather than hardcode a path, use a path from settings registry since that will work on all platforms.
|
||||
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
|
||||
AZ::IO::FixedMaxPath path;
|
||||
registry->Get(path.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
CreatePrefabResult createPrefabResult =
|
||||
m_prefabPublicInterface->CreatePrefabInMemory(AzToolsFramework::EntityIdList{ createdEntityId }, path);
|
||||
|
||||
AZ::EntityId createdPrefabContainerId = createPrefabResult.GetValue();
|
||||
ASSERT_TRUE(createdPrefabContainerId.IsValid());
|
||||
AZ::Entity* prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
ASSERT_TRUE(prefabContainerEntity != nullptr);
|
||||
|
||||
// Verify that the prefab container entity and the entity within are deleted.
|
||||
m_prefabPublicInterface->DeleteEntitiesInInstance(AzToolsFramework::EntityIdList{ createdPrefabContainerId });
|
||||
prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
EXPECT_TRUE(prefabContainerEntity == nullptr);
|
||||
createdEntity = AzToolsFramework::GetEntityById(createdEntityId);
|
||||
EXPECT_TRUE(createdEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesAndAllDescendantsInInstance_DeletingEntityDeletesChildEntityToo)
|
||||
{
|
||||
PrefabEntityResult parentEntityCreationResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that valid parent entity is created.
|
||||
AZ::EntityId parentEntityId = parentEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(parentEntityId.IsValid());
|
||||
AZ::Entity* parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity != nullptr);
|
||||
|
||||
// Verify that valid child entity is created.
|
||||
PrefabEntityResult childEntityCreationResult = m_prefabPublicInterface->CreateEntity(parentEntityId, AZ::Vector3());
|
||||
AZ::EntityId childEntityId = childEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(childEntityId.IsValid());
|
||||
AZ::Entity* childEntity = AzToolsFramework::GetEntityById(childEntityId);
|
||||
ASSERT_TRUE(childEntity != nullptr);
|
||||
|
||||
// PrefabTestFixture won't add required editor components by default. Hence we add them here.
|
||||
AddRequiredEditorComponents(childEntity);
|
||||
AddRequiredEditorComponents(parentEntity);
|
||||
|
||||
// Parent the child entity under the parent entity.
|
||||
AZ::TransformBus::Event(childEntityId, &AZ::TransformBus::Events::SetParent, parentEntityId);
|
||||
|
||||
// Delete parent entity and its children.
|
||||
m_prefabPublicInterface->DeleteEntitiesAndAllDescendantsInInstance(AzToolsFramework::EntityIdList{ parentEntityId });
|
||||
|
||||
// Verify that both the parent and child entities are deleted.
|
||||
parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
EXPECT_TRUE(parentEntity == nullptr);
|
||||
childEntity = AzToolsFramework::GetEntityById(childEntityId);
|
||||
EXPECT_TRUE(childEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesAndAllDescendantsInInstance_DeletingEntityDeletesChildPrefabToo)
|
||||
{
|
||||
PrefabEntityResult entityToBePutUnderPrefabResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created that will be put in a prefab later.
|
||||
AZ::EntityId entityToBePutUnderPrefabId = entityToBePutUnderPrefabResult.GetValue();
|
||||
ASSERT_TRUE(entityToBePutUnderPrefabId.IsValid());
|
||||
AZ::Entity* entityToBePutUnderPrefab = AzToolsFramework::GetEntityById(entityToBePutUnderPrefabId);
|
||||
ASSERT_TRUE(entityToBePutUnderPrefab != nullptr);
|
||||
|
||||
// Verify that a valid parent entity is created.
|
||||
PrefabEntityResult parentEntityCreationResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
AZ::EntityId parentEntityId = parentEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(parentEntityId.IsValid());
|
||||
AZ::Entity* parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity != nullptr);
|
||||
|
||||
// Rather than hardcode a path, use a path from settings registry since that will work on all platforms.
|
||||
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
|
||||
AZ::IO::FixedMaxPath path;
|
||||
registry->Get(path.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
CreatePrefabResult createPrefabResult =
|
||||
m_prefabPublicInterface->CreatePrefabInMemory(AzToolsFramework::EntityIdList{ entityToBePutUnderPrefabId }, path);
|
||||
|
||||
// Verify that a valid prefab container entity is created.
|
||||
AZ::EntityId createdPrefabContainerId = createPrefabResult.GetValue();
|
||||
ASSERT_TRUE(createdPrefabContainerId.IsValid());
|
||||
AZ::Entity* prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
ASSERT_TRUE(prefabContainerEntity != nullptr);
|
||||
|
||||
// PrefabTestFixture won't add required editor components by default. Hence we add them here.
|
||||
AddRequiredEditorComponents(parentEntity);
|
||||
AddRequiredEditorComponents(prefabContainerEntity);
|
||||
|
||||
// Parent the prefab under the parent entity.
|
||||
AZ::TransformBus::Event(createdPrefabContainerId, &AZ::TransformBus::Events::SetParent, parentEntityId);
|
||||
|
||||
// Delete the parent entity.
|
||||
m_prefabPublicInterface->DeleteEntitiesAndAllDescendantsInInstance(AzToolsFramework::EntityIdList{ parentEntityId });
|
||||
|
||||
// Validate that the parent and the prefab under it and the entity inside the prefab are all deleted.
|
||||
parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity == nullptr);
|
||||
entityToBePutUnderPrefab = AzToolsFramework::GetEntityById(entityToBePutUnderPrefabId);
|
||||
ASSERT_TRUE(entityToBePutUnderPrefab == nullptr);
|
||||
prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
EXPECT_TRUE(prefabContainerEntity == nullptr);
|
||||
}
|
||||
} // namespace UnitTest
|
||||
@@ -57,6 +57,11 @@ namespace UnitTest
|
||||
return AZStd::make_unique<PrefabTestToolsApplication>("PrefabTestApplication");
|
||||
}
|
||||
|
||||
void PrefabTestFixture::PropagateAllTemplateChanges()
|
||||
{
|
||||
m_prefabSystemComponent->OnSystemTick();
|
||||
}
|
||||
|
||||
AZ::Entity* PrefabTestFixture::CreateEntity(const char* entityName, const bool shouldActivate)
|
||||
{
|
||||
// Circumvent the EntityContext system and generate a new entity with a transformcomponent
|
||||
@@ -125,4 +130,13 @@ namespace UnitTest
|
||||
EXPECT_EQ(entityInInstance->GetState(), AZ::Entity::State::Active);
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabTestFixture::AddRequiredEditorComponents(AZ::Entity* entity)
|
||||
{
|
||||
ASSERT_TRUE(entity != nullptr);
|
||||
entity->Deactivate();
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequests::AddRequiredComponents, *entity);
|
||||
entity->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace UnitTest
|
||||
|
||||
AZStd::unique_ptr<ToolsTestApplication> CreateTestApplication() override;
|
||||
|
||||
void PropagateAllTemplateChanges();
|
||||
|
||||
AZ::Entity* CreateEntity(const char* entityName, const bool shouldActivate = true);
|
||||
|
||||
void CompareInstances(const Instance& instanceA, const Instance& instanceB, bool shouldCompareLinkIds = true,
|
||||
@@ -62,6 +64,8 @@ namespace UnitTest
|
||||
//! Validates that all entities within a prefab instance are in 'Active' state.
|
||||
void ValidateInstanceEntitiesActive(Instance& instance);
|
||||
|
||||
void AddRequiredEditorComponents(AZ::Entity* entity);
|
||||
|
||||
PrefabSystemComponent* m_prefabSystemComponent = nullptr;
|
||||
PrefabLoaderInterface* m_prefabLoaderInterface = nullptr;
|
||||
PrefabPublicInterface* m_prefabPublicInterface = nullptr;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace UnitTest
|
||||
void ProcessDeferredUpdates()
|
||||
{
|
||||
// Force a prefab propagation for updates that are deferred to the next tick.
|
||||
m_prefabSystemComponent->OnSystemTick();
|
||||
PropagateAllTemplateChanges();
|
||||
|
||||
// Ensure the model process its entity update queue
|
||||
m_model->ProcessEntityUpdates();
|
||||
|
||||
@@ -69,6 +69,7 @@ set(FILES
|
||||
Prefab/PrefabFocus/PrefabFocusTests.cpp
|
||||
Prefab/MockPrefabFileIOActionValidator.cpp
|
||||
Prefab/MockPrefabFileIOActionValidator.h
|
||||
Prefab/PrefabDeleteTests.cpp
|
||||
Prefab/PrefabDuplicateTests.cpp
|
||||
Prefab/PrefabEntityAliasTests.cpp
|
||||
Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
|
||||
|
||||
@@ -299,7 +299,7 @@ void android_main(android_app* appState)
|
||||
{
|
||||
// Adding a start up banner so you can see when the game is starting up in amongst the logcat spam
|
||||
LOGI("****************************************************************");
|
||||
LOGI("* Amazon Lumberyard - Launching Game... *");
|
||||
LOGI("* Launching Game... *");
|
||||
LOGI("****************************************************************");
|
||||
|
||||
// setup the system command handler which are guaranteed to be called on the same
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
|
||||
// Forward declarations
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of changes to the sprite settings
|
||||
class UiSpriteSettingsChangeNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
/**
|
||||
* Overrides the default AZ::EBusTraits address policy so that the bus
|
||||
* has multiple addresses at which to receive messages. This bus is
|
||||
* identified by Sprite pointer. Messages addressed to an ID are received by
|
||||
* handlers connected to that ID.
|
||||
*/
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
/**
|
||||
* Overrides the default AZ::EBusTraits ID type so that Sprite pointers are
|
||||
* used to access the addresses of the bus.
|
||||
*/
|
||||
typedef ISprite* BusIdType;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~UiSpriteSettingsChangeNotification() {}
|
||||
|
||||
//! Called when the sprite settings such as number of cells etc change
|
||||
virtual void OnSpriteSettingsChanged() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSpriteSettingsChangeNotification> UiSpriteSettingsChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Notify listeners when sprite image sources change.
|
||||
class UiSpriteSourceNotificationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiSpriteSourceNotificationInterface() {}
|
||||
|
||||
//! A sprite image (or sequence of images) has changed file sources.
|
||||
virtual void OnSpriteSourceChanged() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSpriteSourceNotificationInterface> UiSpriteSourceNotificationBus;
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
class FileIOStream;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus interface for tools to talk to the LyShine system
|
||||
//! It is valid to use this bus from resource compilers or the UI Editor
|
||||
class UiSystemToolsInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // types
|
||||
|
||||
class CanvasAssetHandle
|
||||
{
|
||||
public:
|
||||
virtual ~CanvasAssetHandle() {};
|
||||
};
|
||||
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
// Public functions
|
||||
|
||||
//! Load a canvas but do not init or activate the entities
|
||||
//! The CanvasAssetHandle is an opaque pointer only valid to be passed to the
|
||||
//! methods below.
|
||||
virtual CanvasAssetHandle* LoadCanvasFromStream(AZ::IO::GenericStream& stream, const AZ::ObjectStream::FilterDescriptor& filterDesc) = 0;
|
||||
|
||||
//! Save a canvas to a stream
|
||||
virtual void SaveCanvasToStream(CanvasAssetHandle* canvas, AZ::IO::FileIOStream& stream) = 0;
|
||||
|
||||
//! Get the slice component for a loaded canvas
|
||||
virtual AZ::SliceComponent* GetRootSliceSliceComponent(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Get the slice entity for a loaded canvas
|
||||
virtual AZ::Entity* GetRootSliceEntity(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Get the canvas entity for a loaded canvas
|
||||
virtual AZ::Entity* GetCanvasEntity(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Replace the slice component with a new one. The old slice component is not deleted.
|
||||
//! The client is responsible for that.
|
||||
virtual void ReplaceRootSliceSliceComponent(CanvasAssetHandle* canvas, AZ::SliceComponent* newSliceComponent) = 0;
|
||||
|
||||
//! Replace the canvas entity with a new one. The old canvas entity is not deleted.
|
||||
//! The client is responsible for that.
|
||||
virtual void ReplaceCanvasEntity(CanvasAssetHandle* canvas, AZ::Entity* newCanvasEntity) = 0;
|
||||
|
||||
//! Delete the canvas file object and its canvas entity and slice entity.
|
||||
virtual void DestroyCanvas(CanvasAssetHandle* canvas) = 0;
|
||||
};
|
||||
|
||||
using UiSystemToolsBus = AZ::EBus<UiSystemToolsInterface>;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
// Forward declarations
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimateEntityInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimateEntityInterface() {}
|
||||
|
||||
//! Called when the animation system has updated the data members of an entity's components
|
||||
virtual void PropertyValuesChanged() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! More than one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimateEntityInterface> UiAnimateEntityBus;
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
|
||||
struct IUiAnimNode;
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimNodeInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef IUiAnimNode* BusIdType;
|
||||
//! Only one implementation for an IAnimNode* can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimNodeInterface() {}
|
||||
|
||||
virtual AZ::EntityId GetAzEntityId() = 0;
|
||||
virtual void SetAzEntity(AZ::Entity* entity) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimNodeInterface> UiAnimNodeBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimationInterface() {}
|
||||
|
||||
//! Start a sequence
|
||||
virtual void StartSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Play a sequence from startTime to endTime
|
||||
virtual void PlaySequenceRange(const AZStd::string& sequenceName, float startTime, float endTime) = 0;
|
||||
|
||||
//! Stop a sequence
|
||||
virtual void StopSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Abort a sequence
|
||||
virtual void AbortSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Pause a sequence
|
||||
virtual void PauseSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Resume a sequence
|
||||
virtual void ResumeSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Reset a sequence
|
||||
virtual void ResetSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get the speed of a sequence
|
||||
virtual float GetSequencePlayingSpeed(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Set the speed of a sequence
|
||||
virtual void SetSequencePlayingSpeed(const AZStd::string& sequenceName, float speed) = 0;
|
||||
|
||||
//! Get the current time of a sequence
|
||||
virtual float GetSequencePlayingTime(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get whether a sequence is currently playing
|
||||
virtual bool IsSequencePlaying(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get the length of a sequence in seconds
|
||||
virtual float GetSequenceLength(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Set the behavior a sequence will exhibit when it stops playing
|
||||
virtual void SetSequenceStopBehavior(IUiAnimationSystem::ESequenceStopBehavior stopBehavior) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimationInterface> UiAnimationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimationNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimationNotifications(){}
|
||||
|
||||
//! Called on an animation event
|
||||
virtual void OnUiAnimationEvent(IUiAnimationListener::EUiAnimationEvent uiAnimationEvent, AZStd::string animSequenceName) = 0;
|
||||
|
||||
//! Called on animation track event triggered
|
||||
virtual void OnUiTrackEvent(AZStd::string eventName, AZStd::string valueName, AZStd::string animSequenceName) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimationNotifications> UiAnimationNotificationBus;
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiButtonInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef AZStd::function<void(AZ::EntityId, AZ::Vector2)> OnClickCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiButtonInterface() {}
|
||||
|
||||
//! Get the on-click callback
|
||||
virtual OnClickCallback GetOnClickCallback() = 0;
|
||||
|
||||
//! Set the on-click callback
|
||||
virtual void SetOnClickCallback(OnClickCallback onClick) = 0;
|
||||
|
||||
//! Get the action name
|
||||
virtual const LyShine::ActionName& GetOnClickActionName() = 0;
|
||||
|
||||
//! Set the action name
|
||||
virtual void SetOnClickActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiButtonInterface> UiButtonBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiButtonNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiButtonNotifications() {}
|
||||
|
||||
//! Notify listeners that the button was clicked
|
||||
virtual void OnButtonClick() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiButtonNotifications> UiButtonNotificationBus;
|
||||
@@ -1,483 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Matrix4x4.h>
|
||||
#include <AzFramework/Input/Channels/InputChannelDigitalWithSharedModifierKeyStates.h>
|
||||
#include <AzFramework/Input/User/LocalUserId.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
// Forward declarations
|
||||
struct IUiAnimationSystem;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCanvasInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
//! Deleting a canvas will delete all its child elements recursively and all of their components
|
||||
virtual ~UiCanvasInterface() {}
|
||||
|
||||
//! Get the asset ID path name of this canvas. If not loaded or saved yet this will be ""
|
||||
virtual const AZStd::string& GetPathname() = 0;
|
||||
|
||||
//! Get the ID of this canvas. This will remain the same while this canvas is loaded.
|
||||
virtual LyShine::CanvasId GetCanvasId() = 0;
|
||||
|
||||
//! Get the unique ID of this canvas
|
||||
virtual AZ::u64 GetUniqueCanvasId() = 0;
|
||||
|
||||
//! Get the draw order of this canvas. Rendering is back-to-front, so higher numbers render in front of lower numbers.
|
||||
virtual int GetDrawOrder() = 0;
|
||||
|
||||
//! Set the draw order of this canvas. Rendering is back-to-front, so higher numbers render in front of lower numbers.
|
||||
virtual void SetDrawOrder(int drawOrder) = 0;
|
||||
|
||||
//! Get the flag indicating if this canvas will stay loaded through a level unload.
|
||||
virtual bool GetKeepLoadedOnLevelUnload() = 0;
|
||||
|
||||
//! Set the flag indicating if this canvas will stay loaded through a level unload.
|
||||
virtual void SetKeepLoadedOnLevelUnload(bool keepLoaded) = 0;
|
||||
|
||||
//! Force a layout recompute. Layouts marked for a recompute are handled on the canvas update,
|
||||
//! so this can be used if an immediate recompute is desired
|
||||
virtual void RecomputeChangedLayouts() = 0;
|
||||
|
||||
//! Get the number child elements of this canvas
|
||||
virtual int GetNumChildElements() = 0;
|
||||
|
||||
//! Get the specified child element, index must be less than GetNumChildElements()
|
||||
virtual AZ::Entity* GetChildElement(int index) = 0;
|
||||
|
||||
//! Get the specified child entity Id, index must be less than GetNumChildElements()
|
||||
virtual AZ::EntityId GetChildElementEntityId(int index) = 0;
|
||||
|
||||
//! Get the child elements of this canvas
|
||||
virtual LyShine::EntityArray GetChildElements() = 0;
|
||||
|
||||
//! Get the child entity Ids of this canvas
|
||||
virtual AZStd::vector<AZ::EntityId> GetChildElementEntityIds() = 0;
|
||||
|
||||
//! Create a new element that is a child of the canvas, the canvas has ownership of the child
|
||||
virtual AZ::Entity* CreateChildElement(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the element on this canvas with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindElementById(LyShine::ElementId id) = 0;
|
||||
|
||||
//! Return the first element on this canvas with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindElementByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first element on this canvas with the given name or nullptr if no match
|
||||
virtual AZ::EntityId FindElementEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Find all elements on this canvas with the given name
|
||||
virtual void FindElementsByName(const LyShine::NameType& name, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! Return the element with the given hierarchical name or nullptr if no match
|
||||
//! \param name, a hierarchical name relative to the root with '/' as the separator
|
||||
virtual AZ::Entity* FindElementByHierarchicalName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Find all elements on this canvas matching the predicate
|
||||
virtual void FindElements(AZStd::function<bool(const AZ::Entity*)> predicate, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! Get the front-most element whose bounds include the given point in canvas space
|
||||
//! \return nullptr if no match
|
||||
virtual AZ::Entity* PickElement(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Get all element whose bounds intersect with the given box in canvas space
|
||||
//! \return empty EntityArray if no match
|
||||
virtual LyShine::EntityArray PickElements(const AZ::Vector2& bound0, const AZ::Vector2& bound1) = 0;
|
||||
|
||||
//! Look for an entity with interactable component to handle an event at given point
|
||||
virtual AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Save this canvas to the given path in XML
|
||||
//! \return true if no error
|
||||
virtual bool SaveToXml(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname) = 0;
|
||||
|
||||
//! Initialize a set of entities that have been added to the canvas
|
||||
//! Used when instantiating a slice or for undo/redo, copy/paste
|
||||
//! \param topLevelEntities - The elements that were created
|
||||
//! \param makeUniqueNamesAndIds If false the entity names and ElementIds in the string are kept, else unique ones are generated
|
||||
//! \param insertionPoint The parent element for the created elements, if nullptr the root element is the parent
|
||||
virtual void FixupCreatedEntities(LyShine::EntityArray topLevelEntities, bool makeUniqueNamesAndIds, AZ::Entity* optionalInsertionPoint) = 0;
|
||||
|
||||
//! Add an existing entity to the canvas (only for internal use from editor)
|
||||
//! \param element The newly created element to add to the canvas
|
||||
//! \param parent The parent element for the created element, if nullptr the root element is the parent
|
||||
//! \param insertBefore The sibling element to place this element before, if nullptr then add as last child
|
||||
virtual void AddElement(AZ::Entity* element, AZ::Entity* parent, AZ::Entity* insertBefore) = 0;
|
||||
|
||||
//! Go through all elements in the canvas and reinitialize them
|
||||
//! This is done whenever a slice asset changes and the entity context is rebuilt from the root slice asset
|
||||
virtual void ReinitializeElements() = 0;
|
||||
|
||||
//! Save this canvas to an XML string
|
||||
//! \return the resulting string
|
||||
virtual AZStd::string SaveToXmlString() = 0;
|
||||
|
||||
//! Get an element name that is unique to the children of the specified parent and to an optional array of elements
|
||||
//! \param parentEntityId The entityId of the parent who's children's names must not match the returned name
|
||||
//! \param baseName The name to append a unique identifier to
|
||||
//! \param includedChildren An array of any other elements who's names must not match the returned name
|
||||
//! \return Unique name that does not match the specified parent's children or the optional array of children
|
||||
virtual AZStd::string GetUniqueChildName(AZ::EntityId parentEntityId, AZStd::string baseName, const LyShine::EntityArray* includeChildren) = 0;
|
||||
|
||||
//! Clone an element and add it to this canvas as a child of the given parent element
|
||||
//! The entity and all its components/children are cloned and new IDs are generated
|
||||
//! NOTE: Only state that is persistent/reflected is cloned
|
||||
//! \param sourceEntity The entity to clone
|
||||
//! \param parentEntity The parent element for the created elements, if nullptr the root element is the parent
|
||||
//! \return The new entity
|
||||
virtual AZ::Entity* CloneElement(AZ::Entity* sourceEntity, AZ::Entity* parentEntity) = 0;
|
||||
|
||||
//! Clone an element and add it to this canvas as a child of the given parent element
|
||||
//! The entity and all its components/children are cloned and new IDs are generated
|
||||
//! NOTE: Only state that is persistent/reflected is cloned
|
||||
//! \param sourceEntity The entity to clone (may be from a different canvas)
|
||||
//! \param parentEntity The parent element for the created elements, if invalid the root element is the parent
|
||||
//! \param insertBefore The child of the parent element that the new element should be inserted before, if invalid the new element is the last child element
|
||||
//! \return The new entity
|
||||
virtual AZ::EntityId CloneElementEntityId(AZ::EntityId sourceEntity, AZ::EntityId parentEntity, AZ::EntityId insertBefore) = 0;
|
||||
|
||||
//! Create a clone of this canvas entity
|
||||
//! \param canvasSize The resolution to display the canvas at
|
||||
virtual AZ::Entity* CloneCanvas(const AZ::Vector2& canvasSize) = 0;
|
||||
|
||||
//! Set the transformation from canvas space to viewport space
|
||||
virtual void SetCanvasToViewportMatrix(const AZ::Matrix4x4& matrix) = 0;
|
||||
|
||||
//! Get the transformation from canvas space to viewport space
|
||||
virtual const AZ::Matrix4x4& GetCanvasToViewportMatrix() = 0;
|
||||
|
||||
//! Get the transformation from viewport space to canvas space
|
||||
virtual void GetViewportToCanvasMatrix(AZ::Matrix4x4& matrix) = 0;
|
||||
|
||||
//! Returns the "target" size of the canvas (in pixels)
|
||||
//
|
||||
//! The target canvas size changes depending on whether you're running in
|
||||
//! the UI Editor or in-game. While in-game, we assume that the canvas size
|
||||
//! fills the screen, so the target canvas size is the size of the viewport.
|
||||
//
|
||||
//! When using the editor, however, the target size is the "authored" size of
|
||||
//! the canvas. The canvas is authored in one resolution, but it may be
|
||||
//! displayed by the game at whatever the game resolution is set to.
|
||||
virtual AZ::Vector2 GetCanvasSize() = 0;
|
||||
|
||||
//! Set the authored size of the canvas (in pixels)
|
||||
virtual void SetCanvasSize(const AZ::Vector2& canvasSize) = 0;
|
||||
|
||||
//! Set the target size of the canvas (in pixels)
|
||||
//!
|
||||
//! This should be called before the UpdateCanvas and RenderCanvas methods.
|
||||
//! When running in game in full screen mode the target canvas size should be set to the viewport size
|
||||
virtual void SetTargetCanvasSize(bool isInGame, const AZ::Vector2& targetCanvasSize) = 0;
|
||||
|
||||
//! Get scale to adjust for the difference between canvas size (authored size)
|
||||
//! and the viewport size (target canvas size) when running on current device
|
||||
virtual AZ::Vector2 GetDeviceScale() = 0;
|
||||
|
||||
//! Get flag that indicates whether visual element's vertices should snap to the nearest pixel
|
||||
virtual bool GetIsPixelAligned() = 0;
|
||||
|
||||
//! Set flag that indicates whether visual element's vertices should snap to the nearest pixel
|
||||
virtual void SetIsPixelAligned(bool isPixelAligned) = 0;
|
||||
|
||||
//! Get flag that indicates whether text should snap to the nearest pixel
|
||||
virtual bool GetIsTextPixelAligned() = 0;
|
||||
|
||||
//! Set flag that indicates whether text should snap to the nearest pixel
|
||||
virtual void SetIsTextPixelAligned(bool isTextPixelAligned) = 0;
|
||||
|
||||
//! Get the animation system for this canvas
|
||||
virtual IUiAnimationSystem* GetAnimationSystem() = 0;
|
||||
|
||||
//! Get flag that governs whether the canvas is enabled
|
||||
//
|
||||
//! A canvas that's enabled will be updated and rendered each frame.
|
||||
virtual bool GetEnabled() = 0;
|
||||
|
||||
//! Set flag that governs whether the canvas is enabled
|
||||
//
|
||||
//! A canvas that's enabled will be updated and rendered each frame.
|
||||
virtual void SetEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get flag that controls whether the canvas is rendering to a texture
|
||||
virtual bool GetIsRenderToTexture() = 0;
|
||||
|
||||
//! Set flag that controls whether the canvas is rendering to a texture
|
||||
virtual void SetIsRenderToTexture(bool isRenderToTexture) = 0;
|
||||
|
||||
//! Get the render target name that this canvas will render to
|
||||
virtual AZStd::string GetRenderTargetName() = 0;
|
||||
|
||||
//! Set the render target name that this canvas will render to
|
||||
virtual void SetRenderTargetName(const AZStd::string& name) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles positional input (mouse/touch)
|
||||
virtual bool GetIsPositionalInputSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles positional input (mouse/touch)
|
||||
virtual void SetIsPositionalInputSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas consumes all input events while it is enabled
|
||||
virtual bool GetIsConsumingAllInputEvents() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas consumes all input events while it is enabled
|
||||
virtual void SetIsConsumingAllInputEvents(bool isConsuming) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles multi-touch input
|
||||
virtual bool GetIsMultiTouchSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles multi-touch input
|
||||
virtual void SetIsMultiTouchSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles navigation input (via keyboard/gamepad)
|
||||
virtual bool GetIsNavigationSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles navigation input (via keyboard/gamepad)
|
||||
virtual void SetIsNavigationSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get the analog (eg. thumb-stick) input value that must be exceeded before a navigation command will be processed
|
||||
virtual float GetNavigationThreshold() = 0;
|
||||
|
||||
//! Set the analog (eg. thumb-stick) input value that must be exceeded before a navigation command will be processed
|
||||
virtual void SetNavigationThreshold(float navigationThreshold) = 0;
|
||||
|
||||
//! Get the delay (milliseconds) before a held navigation command will begin repeating
|
||||
virtual AZ::u64 GetNavigationRepeatDelay() = 0;
|
||||
|
||||
//! Set the delay (milliseconds) before a held navigation command will begin repeating
|
||||
virtual void SetNavigationRepeatDelay(AZ::u64 navigationRepeatDelay) = 0;
|
||||
|
||||
//! Get the delay (milliseconds) before a held navigation command will continue repeating
|
||||
virtual AZ::u64 GetNavigationRepeatPeriod() = 0;
|
||||
|
||||
//! Set the delay (milliseconds) before a held navigation command will continue repeating
|
||||
virtual void SetNavigationRepeatPeriod(AZ::u64 navigationRepeatPeriod) = 0;
|
||||
|
||||
//! Get the local user id that is being used to filter incoming input events
|
||||
virtual AzFramework::LocalUserId GetLocalUserIdInputFilter() = 0;
|
||||
|
||||
//! Set the local user id that will be used to filter incoming input events
|
||||
virtual void SetLocalUserIdInputFilter(AzFramework::LocalUserId localUserId) = 0;
|
||||
|
||||
//! Handle an input event for the canvas
|
||||
virtual bool HandleInputEvent(const AzFramework::InputChannel::Snapshot& inputSnapshot,
|
||||
const AZ::Vector2* viewportPos = nullptr,
|
||||
AzFramework::ModifierKeyMask activeModifierKeys = AzFramework::ModifierKeyMask::None) = 0;
|
||||
|
||||
//! Handle a unicode text event for the canvas
|
||||
virtual bool HandleTextEvent(const AZStd::string& textUTF8) = 0;
|
||||
|
||||
//! Handle a positional input event for the canvas, this could come from
|
||||
//! a ray cast intersection for example
|
||||
virtual bool HandleInputPositionalEvent(const AzFramework::InputChannel::Snapshot& inputSnapshot, AZ::Vector2 viewportPos) = 0;
|
||||
|
||||
//! Get the mouse position of the last input event
|
||||
virtual AZ::Vector2 GetMousePosition() = 0;
|
||||
|
||||
//! Get the element to be displayed when hovering over an interactable
|
||||
virtual AZ::EntityId GetTooltipDisplayElement() = 0;
|
||||
|
||||
//! Set the element to be displayed when hovering over an interactable
|
||||
virtual void SetTooltipDisplayElement(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Force the active interactable for the canvas to be the given one,
|
||||
//! also force AutoActivation of interactable,
|
||||
//! intended for internal use by UI components
|
||||
virtual void ForceFocusInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
//! Force the active interactable for the canvas to be the given one,
|
||||
//! also set last mouse pos to point,
|
||||
//! intended for internal use by UI components
|
||||
virtual void ForceActiveInteractable(AZ::EntityId interactableId, bool shouldStayActive, AZ::Vector2 point) = 0;
|
||||
|
||||
//! Get the hover interactable
|
||||
virtual AZ::EntityId GetHoverInteractable() = 0;
|
||||
|
||||
//! Force the hover interactable for the canvas to be the given one, this can be useful when using
|
||||
//! keyboard/gamepad navigation and the current hover interactable is deleted by a script and the script
|
||||
//! wants to specify the new hover interactable
|
||||
virtual void ForceHoverInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
//! Clear all active interactables, and all hover interactables if last input was positional (mouse/touch).
|
||||
//! This is intended for internal use by UI components
|
||||
virtual void ClearAllInteractables() = 0;
|
||||
|
||||
//! Generate Enter pressed/released input events on an interactable.
|
||||
//! Useful for automated testing to simulate button clicks
|
||||
virtual void ForceEnterInputEventOnInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasInterface> UiCanvasBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The canvas component implements this bus and it is provided for C++ implementations of
|
||||
//! UI components to use to talk to the canvas
|
||||
class UiCanvasComponentImplementationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasComponentImplementationInterface() {}
|
||||
|
||||
//! Mark the render graph for the canvas as dirty. This will cause the render graph to get
|
||||
//! cleared and rebuilt on the next render.
|
||||
virtual void MarkRenderGraphDirty() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasComponentImplementationInterface> UiCanvasComponentImplementationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas actions
|
||||
class UiCanvasActionNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasActionNotification(){}
|
||||
|
||||
//! Called when the canvas sends an action to the listener
|
||||
virtual void OnAction(AZ::EntityId entityId, const LyShine::ActionName& actionName) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasActionNotification> UiCanvasNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified when the draw order of any
|
||||
//! canvas changes
|
||||
class UiCanvasOrderNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
virtual ~UiCanvasOrderNotification(){}
|
||||
|
||||
//! Called when the draw order setting for a canvas changes
|
||||
//! Note this is used to update the order in the UiCanvasManager so that
|
||||
//! order has not been updated when this fires.
|
||||
virtual void OnCanvasDrawOrderChanged(AZ::EntityId canvasEntityId) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasOrderNotification> UiCanvasOrderNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified when any canvas has been
|
||||
//! enabled or disabled
|
||||
class UiCanvasEnabledStateNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
virtual ~UiCanvasEnabledStateNotification() {}
|
||||
|
||||
//! Called when the canvas was enabled or disabled
|
||||
virtual void OnCanvasEnabledStateChanged(AZ::EntityId canvasEntityId, bool enabled) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasEnabledStateNotification> UiCanvasEnabledStateNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas size or scale changes
|
||||
class UiCanvasSizeNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasSizeNotification() {}
|
||||
|
||||
//! Called when the target canvas size or uniform device scale changes.
|
||||
virtual void OnCanvasSizeOrScaleChange(AZ::EntityId canvasEntityId) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasSizeNotification> UiCanvasSizeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of changes to the canvas
|
||||
//! pixel alignment settings
|
||||
class UiCanvasPixelAlignmentNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasPixelAlignmentNotification() {}
|
||||
|
||||
//! Called when the pixel alignment setting for the canvas changes
|
||||
virtual void OnCanvasPixelAlignmentChange() {}
|
||||
|
||||
//! Called when the text pixel alignment setting for the canvas changes
|
||||
virtual void OnCanvasTextPixelAlignmentChange() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasPixelAlignmentNotification> UiCanvasPixelAlignmentNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas input.
|
||||
//! Note that interactables already get methods called on them when they themselves are interacted
|
||||
//! with. This notification bus is intended for other entities or Lua to know when some other
|
||||
//! entities are interacted with.
|
||||
class UiCanvasInputNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasInputNotifications() {}
|
||||
|
||||
//! Called when an element is pressed. Will return an invalid entity id if no interactable was
|
||||
//! pressed.
|
||||
virtual void OnCanvasPrimaryPressed([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element is released. The released entity that is sent is the entity that was
|
||||
//! active (if any).
|
||||
virtual void OnCanvasPrimaryReleased([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element is pressed. Will be an invalid entity id if no interactable was
|
||||
//! pressed.
|
||||
virtual void OnCanvasMultiTouchPressed([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Called when an element is released. The released entity that is sent is the entity that was
|
||||
//! active (if any).
|
||||
virtual void OnCanvasMultiTouchReleased([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Called when an element starts being hovered
|
||||
virtual void OnCanvasHoverStart([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element ends being hovered
|
||||
virtual void OnCanvasHoverEnd([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when the enter key is pressed
|
||||
virtual void OnCanvasEnterPressed([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when the enter key is released
|
||||
virtual void OnCanvasEnterReleased([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasInputNotifications> UiCanvasInputNotificationBus;
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzFramework/Input/User/LocalUserId.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCanvasManagerInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef std::vector<AZ::EntityId> CanvasEntityList;
|
||||
|
||||
public:
|
||||
//! Create a canvas
|
||||
virtual AZ::EntityId CreateCanvas() = 0;
|
||||
|
||||
//! Load a canvas
|
||||
virtual AZ::EntityId LoadCanvas(const AZStd::string& canvasPathname) = 0;
|
||||
|
||||
//! Unload a canvas
|
||||
virtual void UnloadCanvas(AZ::EntityId canvasEntityId) = 0;
|
||||
|
||||
//! Find a canvas by path, optionally load the canvas if it was not found
|
||||
virtual AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& canvasPathname, bool loadIfNotFound = false) = 0;
|
||||
|
||||
//! Get a list of canvases that are loaded in game, this is sorted by draw order
|
||||
virtual CanvasEntityList GetLoadedCanvases() = 0;
|
||||
|
||||
//! Set the local user id that will be used to filter incoming input events for all canvases.
|
||||
//! Can be overriden for an individual canvas using UiCanvasInterface::SetLocalUserIdInputFilter.
|
||||
virtual void SetLocalUserIdInputFilterForAllCanvases(AzFramework::LocalUserId localUserId) = 0;
|
||||
};
|
||||
typedef AZ::EBus<UiCanvasManagerInterface> UiCanvasManagerBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas manager changes
|
||||
class UiCanvasManagerNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~UiCanvasManagerNotification() {}
|
||||
|
||||
//! Called when a canvas has been loaded
|
||||
virtual void OnCanvasLoaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
|
||||
//! Called when a canvas has been unloaded/destroyed
|
||||
virtual void OnCanvasUnloaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
|
||||
//! Called when a canvas has been reloaded (due to hot-loading)
|
||||
//! For a hot-load, the OnCanvasLoaded/OnCanvasUnloaded notifications are not sent - only this one is
|
||||
virtual void OnCanvasReloaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasManagerNotification> UiCanvasManagerNotificationBus;
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Elements that require update notifications should connect to this bus using the entity id of their
|
||||
//! containing canvas.
|
||||
class UiCanvasUpdateNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasUpdateNotification() {}
|
||||
|
||||
//! Update the component. This is called when the game is running.
|
||||
//! It is different from the TickBus in that it is called only when the canvas is updated.
|
||||
//! So it is not called if the canvas is disabled.
|
||||
virtual void Update(float deltaTime) = 0;
|
||||
|
||||
//! Update the component while in the editor.
|
||||
//! This is called every frame when in the editor and the game is NOT running.
|
||||
virtual void UpdateInEditor(float /*deltaTime*/) {}
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasUpdateNotification> UiCanvasUpdateNotificationBus;
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCheckboxInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! params: sending entity id, new state
|
||||
typedef AZStd::function<void(AZ::EntityId, AZ::Vector2, bool)> StateChangeCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCheckboxInterface() {}
|
||||
|
||||
//! Query the state of the checkbox
|
||||
//! \return The current state for the checkbox.
|
||||
virtual bool GetState() = 0;
|
||||
|
||||
//! Manually override the state of the checkbox
|
||||
//! \param isOn The new desired state of the checkbox.
|
||||
virtual void SetState(bool checked) = 0;
|
||||
|
||||
//! Toggle the state of the checkbox
|
||||
//! \return The new state of the checkbox.
|
||||
virtual bool ToggleState() = 0;
|
||||
|
||||
//! Get the state change callback
|
||||
virtual StateChangeCallback GetStateChangeCallback() = 0;
|
||||
|
||||
//! Set the state change callback
|
||||
virtual void SetStateChangeCallback(StateChangeCallback onChange) = 0;
|
||||
|
||||
//! Set the optional checked (ON) entity
|
||||
virtual void SetCheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional checked (ON) entity
|
||||
virtual AZ::EntityId GetCheckedEntity() = 0;
|
||||
|
||||
//! Set the optional unchecked (OFF) entity
|
||||
virtual void SetUncheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional unchecked (OFF) entity
|
||||
virtual AZ::EntityId GetUncheckedEntity() = 0;
|
||||
|
||||
//! Get the action triggered when turned on
|
||||
virtual const LyShine::ActionName& GetTurnOnActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned on
|
||||
virtual void SetTurnOnActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when turned off
|
||||
virtual const LyShine::ActionName& GetTurnOffActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned off
|
||||
virtual void SetTurnOffActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when changed
|
||||
virtual const LyShine::ActionName& GetChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when changed
|
||||
virtual void SetChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCheckboxInterface> UiCheckboxBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCheckboxNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCheckboxNotifications() {}
|
||||
|
||||
//! Notify listeners that the checkbox state has changed
|
||||
virtual void OnCheckboxStateChange([[maybe_unused]] bool checked) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCheckboxNotifications> UiCheckboxNotificationBus;
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDraggableInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! States that the component can be in during a drag. Lua scripts can switch the state to alert the user
|
||||
enum class DragState
|
||||
{
|
||||
Normal,
|
||||
Valid,
|
||||
Invalid
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDraggableInterface() {}
|
||||
|
||||
//! Get the state of the drag
|
||||
virtual DragState GetDragState() = 0;
|
||||
|
||||
//! Set the state of the drag. This is only relevant during a drag.
|
||||
//! The state affects the visual state of the draggable and can be used to indicate when it is
|
||||
//! over a valid drop target.
|
||||
virtual void SetDragState(DragState dragState) = 0;
|
||||
|
||||
//! Redo the drag, this is not usually needed but if a UiDraggableNotificationBus handler causes
|
||||
//! drop targets to move, and keyboard or console navigation is being used, it can be needed.
|
||||
//! In that case the handler should call this method after moving drop targets.
|
||||
virtual void RedoDrag(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Set this draggable element to be a proxy for another draggable element and start a drag on
|
||||
//! this draggable element at the specified point
|
||||
virtual void SetAsProxy(AZ::EntityId originalDraggableId, AZ::Vector2 point) = 0;
|
||||
|
||||
//! Conclude the drag of a proxy. This should be called from the OnDragEnd callback of the proxy and
|
||||
//! will result in calling OnDragEnd on the draggable element that this is a proxy for
|
||||
virtual void ProxyDragEnd(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Check if this draggable element is a proxy
|
||||
virtual bool IsProxy() = 0;
|
||||
|
||||
//! Get the original draggable element that this element is a proxy for
|
||||
//! Returns an invalid entity id if this is not a proxy
|
||||
virtual AZ::EntityId GetOriginalFromProxy() = 0;
|
||||
|
||||
//! Get the flag that indicates if this draggable can be dropped on any canvas
|
||||
virtual bool GetCanDropOnAnyCanvas() = 0;
|
||||
|
||||
//! Set the flag that indicates if this draggable can be dropped on any canvas
|
||||
virtual void SetCanDropOnAnyCanvas(bool anyCanvas) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDraggableInterface> UiDraggableBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDraggableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDraggableNotifications() {}
|
||||
|
||||
//! Called on drag start
|
||||
virtual void OnDragStart(AZ::Vector2 position) = 0;
|
||||
|
||||
//! Called on position change during drag
|
||||
virtual void OnDrag(AZ::Vector2 position) = 0;
|
||||
|
||||
//! Called on drag end
|
||||
virtual void OnDragEnd(AZ::Vector2 position) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDraggableNotifications> UiDraggableNotificationBus;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropTargetInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
using DropState = int;
|
||||
enum
|
||||
{
|
||||
DropStateNormal = 0,
|
||||
DropStateValid,
|
||||
DropStateInvalid,
|
||||
|
||||
NumDropStates
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropTargetInterface() {}
|
||||
|
||||
//! Get the OnDrop action name
|
||||
virtual const LyShine::ActionName& GetOnDropActionName() = 0;
|
||||
|
||||
//! Set the OnDrop action name
|
||||
virtual void SetOnDropActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Called when mouse/touch enters the bounds of this drop target while dragging a UiDraggableComponent
|
||||
virtual void HandleDropHoverStart(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on the currently drop hovered drop target component when mouse/touch moves outside of bounds
|
||||
virtual void HandleDropHoverEnd(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called when a draggable is dropped on this drop target
|
||||
virtual void HandleDrop(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Get the state of the drop
|
||||
virtual DropState GetDropState() = 0;
|
||||
|
||||
//! Set the state of the drop target.
|
||||
//! The state affects the visual state of the drop target and can be used to indicate when it has
|
||||
//! a valid draggable hovering over it.
|
||||
virtual void SetDropState(DropState dropState) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropTargetInterface> UiDropTargetBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropTargetNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropTargetNotifications() {}
|
||||
|
||||
//! Called on starting hovering over a drop target
|
||||
virtual void OnDropHoverStart(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on ending hovering over a drop target
|
||||
virtual void OnDropHoverEnd(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on drop
|
||||
virtual void OnDrop(AZ::EntityId draggable) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropTargetNotifications> UiDropTargetNotificationBus;
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UI Dropdown Component is an interactable component which displays a list of options when clicked.
|
||||
//! In its default state, the dropdown display a simple button, next to an arrow indicating the dropdown
|
||||
//! functionality. When the arrow / option is clicked, the dropdown list appears, displaying the options available.
|
||||
//! If the list is too long to be displayed, a scrollbar can be added to scroll up and down the list of options.
|
||||
class UiDropdownInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownInterface() {}
|
||||
|
||||
//! Get the currently selected option
|
||||
virtual AZ::EntityId GetValue() = 0;
|
||||
|
||||
//! Set the currently selected option manually
|
||||
virtual void SetValue(AZ::EntityId value) = 0;
|
||||
|
||||
//! Get the content element this dropdown will expand
|
||||
virtual AZ::EntityId GetContent() = 0;
|
||||
|
||||
//! Set the content element this dropdown will expand
|
||||
virtual void SetContent(AZ::EntityId content) = 0;
|
||||
|
||||
//! Get whether this dropdown should expand automatically on hover
|
||||
virtual bool GetExpandOnHover() = 0;
|
||||
|
||||
//! Set whether this dropdown should expand automatically on hover
|
||||
virtual void SetExpandOnHover(bool expandOnHover) = 0;
|
||||
|
||||
//! Get how long to wait before expanding upon hover / collapsing upon exit
|
||||
virtual float GetWaitTime() = 0;
|
||||
|
||||
//! Set how long to wait before expanding upon hover / collapsing upon exit
|
||||
virtual void SetWaitTime(float waitTime) = 0;
|
||||
|
||||
//! Get whether this dropdown should collapse when the user clicks outside
|
||||
virtual bool GetCollapseOnOutsideClick() = 0;
|
||||
|
||||
//! Set whether this dropdown should collapse when the user clicks outside
|
||||
virtual void SetCollapseOnOutsideClick(bool collapseOnOutsideClick) = 0;
|
||||
|
||||
//! Get the element the dropdown content will parent to when expanded (the canvas by default)
|
||||
virtual AZ::EntityId GetExpandedParentId() = 0;
|
||||
|
||||
//! Set the element the dropdown content will parent to when expanded
|
||||
virtual void SetExpandedParentId(AZ::EntityId expandedParentId) = 0;
|
||||
|
||||
//! Get the text element to display to show the currently selected option
|
||||
virtual AZ::EntityId GetTextElement() = 0;
|
||||
|
||||
//! Set the text element to display to show the currently selected option
|
||||
virtual void SetTextElement(AZ::EntityId textElement) = 0;
|
||||
|
||||
//! Get the icon element to display to show the currently selected option
|
||||
virtual AZ::EntityId GetIconElement() = 0;
|
||||
|
||||
//! Set the icon element to display to show the currently selected option
|
||||
virtual void SetIconElement(AZ::EntityId iconElement) = 0;
|
||||
|
||||
//! Expand the dropdown
|
||||
virtual void Expand() = 0;
|
||||
|
||||
//! Collapse the dropdown
|
||||
virtual void Collapse() = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown is expanded
|
||||
virtual const LyShine::ActionName& GetExpandedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown is expanded
|
||||
virtual void SetExpandedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown is collapsed
|
||||
virtual const LyShine::ActionName& GetCollapsedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown is collapsed
|
||||
virtual void SetCollapsedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown value is changed
|
||||
virtual const LyShine::ActionName& GetOptionSelectedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown value is changed
|
||||
virtual void SetOptionSelectedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownInterface> UiDropdownBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropdownNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownNotifications() {}
|
||||
|
||||
//! Notify listeners that the dropdown was expanded
|
||||
virtual void OnDropdownExpanded() {}
|
||||
|
||||
//! Notify listeners that the dropdown was collapsed
|
||||
virtual void OnDropdownCollapsed() {}
|
||||
|
||||
//! Notify listeners that an option was selected
|
||||
virtual void OnDropdownValueChanged([[maybe_unused]] AZ::EntityId option) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownNotifications> UiDropdownNotificationBus;
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UiDropdownOptionComponent is a component that is designed to work in conjunction with the
|
||||
//! UiDropdownComponent. It represents any option of that dropdown that the user should be able to
|
||||
//! select to update the value of the dropdown.
|
||||
class UiDropdownOptionInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownOptionInterface() {}
|
||||
|
||||
//! Get the owning dropdown of this option
|
||||
virtual AZ::EntityId GetOwningDropdown() = 0;
|
||||
|
||||
//! Set the owning dropdown of this option
|
||||
virtual void SetOwningDropdown(AZ::EntityId owningDropdown) = 0;
|
||||
|
||||
//! Get the text element of this option
|
||||
virtual AZ::EntityId GetTextElement() = 0;
|
||||
|
||||
//! Set the text element of this option
|
||||
virtual void SetTextElement(AZ::EntityId textElement) = 0;
|
||||
|
||||
//! Get the icon element of this option
|
||||
virtual AZ::EntityId GetIconElement() = 0;
|
||||
|
||||
//! Set the icon element of this option
|
||||
virtual void SetIconElement(AZ::EntityId iconElement) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownOptionInterface> UiDropdownOptionBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropdownOptionNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownOptionNotifications() {}
|
||||
|
||||
//! Notify listeners that the dropdown option was selected
|
||||
virtual void OnDropdownOptionSelected() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownOptionNotifications> UiDropdownOptionNotificationBus;
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a dynamic layout component needs to implement. A dynamic layout component
|
||||
//! clones a prototype element to achieve the desired number of children. The parent is resized
|
||||
//! accordingly
|
||||
class UiDynamicLayoutInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicLayoutInterface() {}
|
||||
|
||||
//! Clone a prototype element or remove cloned elements to end up with the specified number of children
|
||||
virtual void SetNumChildElements(int numChildren) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicLayoutInterface> UiDynamicLayoutBus;
|
||||
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a dynamic scrollbox component needs to implement. A dynamic scrollbox
|
||||
//! component sets up scrollbox content as a horizontal or vertical list of elements that are
|
||||
//! cloned from prototype entities. Only the minimum number of entities are created for efficient
|
||||
//! scrolling
|
||||
class UiDynamicScrollBoxInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxInterface() {}
|
||||
|
||||
//! Refresh the content. Should be called when list size or element content has changed.
|
||||
//! This will reset any cached information such as element sizes, so it is recommended
|
||||
//! to use AddElementsToEnd and RemoveElementsFromFront if possible when elements vary
|
||||
//! in size. AddElementsToEnd and RemoveElementsFromFront will also ensure that the
|
||||
//! scroll offset is adjusted to keep the visible elements in place
|
||||
virtual void RefreshContent() = 0;
|
||||
|
||||
//! Add elements to the end of the list.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void AddElementsToEnd(int numElementsToAdd, bool scrollToEndIfWasAtEnd) = 0;
|
||||
|
||||
//! Remove elements from the front of the list.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void RemoveElementsFromFront(int numElementsToRemove) = 0;
|
||||
|
||||
//! Scroll to the end of the list
|
||||
virtual void ScrollToEnd() = 0;
|
||||
|
||||
//! Get the element index of the specified child element. Returns -1 if not found.
|
||||
//! If the list is divided into sections, the index is local to the section
|
||||
virtual int GetElementIndexOfChild(AZ::EntityId childElement) = 0;
|
||||
|
||||
//! Get the section index of the specified child element. Returns -1 if not found.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetSectionIndexOfChild(AZ::EntityId childElement) = 0;
|
||||
|
||||
//! Get the child element at the specified element index.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual AZ::EntityId GetChildAtElementIndex(int index) = 0;
|
||||
|
||||
//! Get the child element at the specified section index and element index.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual AZ::EntityId GetChildAtSectionAndElementIndex(int sectionIndex, int index) = 0;
|
||||
|
||||
//! Get whether the list should automatically prepare and refresh its content post activation
|
||||
virtual bool GetAutoRefreshOnPostActivate() = 0;
|
||||
|
||||
//! Set whether the list should automatically prepare and refresh its content post activation
|
||||
virtual void SetAutoRefreshOnPostActivate(bool autoRefresh) = 0;
|
||||
|
||||
//! Get the prototype entity used for the elements
|
||||
virtual AZ::EntityId GetPrototypeElement() = 0;
|
||||
|
||||
//! Set the prototype entity used for the elements
|
||||
virtual void SetPrototypeElement(AZ::EntityId prototypeElement) = 0;
|
||||
|
||||
//! Get whether the elements vary in size
|
||||
virtual bool GetElementsVaryInSize() = 0;
|
||||
|
||||
//! Set whether the elements vary in size
|
||||
virtual void SetElementsVaryInSize(bool varyInSize) = 0;
|
||||
|
||||
//! Get whether to auto calculate the elements when they vary in size
|
||||
virtual bool GetAutoCalculateVariableElementSize() = 0;
|
||||
|
||||
//! Set whether to auto calculate the elements when they vary in size
|
||||
virtual void SetAutoCalculateVariableElementSize(bool autoCalculateSize) = 0;
|
||||
|
||||
//! Get the estimated size for the variable elements. If set to 0, then element sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual float GetEstimatedVariableElementSize() = 0;
|
||||
|
||||
//! Set the estimated size for the variable elements. If set to 0, then element sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual void SetEstimatedVariableElementSize(float estimatedSize) = 0;
|
||||
|
||||
//! Get whether the list is divided into sections with headers
|
||||
virtual bool GetSectionsEnabled() = 0;
|
||||
|
||||
//! Set whether the list is divided into sections with headers
|
||||
virtual void SetSectionsEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get the prototype entity used for the headers
|
||||
virtual AZ::EntityId GetPrototypeHeader() = 0;
|
||||
|
||||
//! Set the prototype entity used for the headers
|
||||
virtual void SetPrototypeHeader(AZ::EntityId prototypeHeader) = 0;
|
||||
|
||||
//! Get whether headers stick to the beginning of the visible list area
|
||||
virtual bool GetHeadersSticky() = 0;
|
||||
|
||||
//! Set whether headers stick to the beginning of the visible list area
|
||||
virtual void SetHeadersSticky(bool stickyHeaders) = 0;
|
||||
|
||||
//! Get whether the headers vary in size
|
||||
virtual bool GetHeadersVaryInSize() = 0;
|
||||
|
||||
//! Set whether the headers vary in size
|
||||
virtual void SetHeadersVaryInSize(bool varyInSize) = 0;
|
||||
|
||||
//! Get whether to auto calculate the headers when they vary in size
|
||||
virtual bool GetAutoCalculateVariableHeaderSize() = 0;
|
||||
|
||||
//! Set whether to auto calculate the headers when they vary in size
|
||||
virtual void SetAutoCalculateVariableHeaderSize(bool autoCalculateSize) = 0;
|
||||
|
||||
//! Get the estimated size for the variable headers. If set to 0, then header sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual float GetEstimatedVariableHeaderSize() = 0;
|
||||
|
||||
//! Set the estimated size for the variable headers. If set to 0, then header sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual void SetEstimatedVariableHeaderSize(float estimatedSize) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxInterface> UiDynamicScrollBoxBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that provides data needed to display a list of elements
|
||||
class UiDynamicScrollBoxDataInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxDataInterface() {}
|
||||
|
||||
//! Returns the number of elements in the list.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual int GetNumElements() { return 0; }
|
||||
|
||||
//! Returns the width of an element at the specified index.
|
||||
//! Called when a horizontal list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual float GetElementWidth([[maybe_unused]] int index) { return 0.0f; }
|
||||
|
||||
//! Returns the height of an element at the specified index.
|
||||
//! Called when a vertical list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual float GetElementHeight([[maybe_unused]] int index) { return 0.0f; }
|
||||
|
||||
//! Returns the number of sections in the list.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetNumSections() { return 0; }
|
||||
|
||||
//! Returns the number of elements in the specified section.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetNumElementsInSection([[maybe_unused]] int sectionIndex) { return 0; }
|
||||
|
||||
//! Returns the width of an element at the specified section.
|
||||
//! Called when a horizontal list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetElementInSectionWidth([[maybe_unused]] int sectionIndex, [[maybe_unused]] int elementindex) { return 0.0f; }
|
||||
|
||||
//! Returns the height of an element at the specified section.
|
||||
//! Called when a vertical list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetElementInSectionHeight([[maybe_unused]] int sectionIndex, [[maybe_unused]] int elementindex) { return 0.0f; }
|
||||
|
||||
//! Returns the width of a header at the specified section.
|
||||
//! Called when a horizontal list contains headers of varying size, and the header's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetSectionHeaderWidth([[maybe_unused]] int sectionIndex) { return 0.0f; }
|
||||
|
||||
//! Returns the height of a header at the specified section.
|
||||
//! Called when a vertical list contains elements of varying size, and the header's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetSectionHeaderHeight([[maybe_unused]] int sectionIndex) { return 0.0f; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxDataInterface> UiDynamicScrollBoxDataBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to receive notifications of element state
|
||||
//! changes, such as when an element is about to scroll into view
|
||||
class UiDynamicScrollBoxElementNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxElementNotifications(){}
|
||||
|
||||
//! Called when an element is about to become visible. Used to populate the element with data for display.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void OnElementBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when elements have variable sizes and are set to auto calculate.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void OnPrepareElementForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when an element in a section is about to become visible. Used to populate the element with data for display
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnElementInSectionBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when elements in sections have variable sizes and are set to auto calculate
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnPrepareElementInSectionForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when a header is about to become visible. Used to populate the header with data for display.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnSectionHeaderBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex) {}
|
||||
|
||||
//! Called when headers have variable sizes and are set to auto calculate.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnPrepareSectionHeaderForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxElementNotifications> UiDynamicScrollBoxElementNotificationBus;
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorInterface() {}
|
||||
|
||||
//! Test if this entity should be visible in the Ui Canvas Editor
|
||||
virtual bool GetIsVisible() = 0;
|
||||
|
||||
//! Set whether this entity should be visible in the Ui Canvas Editor
|
||||
virtual void SetIsVisible(bool isVisible) = 0;
|
||||
|
||||
//! Test if this entity is selectable in the UI Canvas Editor
|
||||
virtual bool GetIsSelectable() = 0;
|
||||
|
||||
//! Set whether this entity is selectable in the UI Canvas Editor
|
||||
virtual void SetIsSelectable(bool isSelectable) = 0;
|
||||
|
||||
//! Test if this entity is currently selected in the UI Canvas Editor
|
||||
virtual bool GetIsSelected() = 0;
|
||||
|
||||
//! Set whether this entity is currently selected in the UI Canvas Editor
|
||||
virtual void SetIsSelected(bool isSelected) = 0;
|
||||
|
||||
//! Test if this entity is currently expanded in the UI Canvas Editor
|
||||
virtual bool GetIsExpanded() = 0;
|
||||
|
||||
//! Set whether this entity is currently expanded in the UI Canvas Editor
|
||||
virtual void SetIsExpanded(bool isExpanded) = 0;
|
||||
|
||||
//! Test if all the parents of this UI element are visible in the editor
|
||||
virtual bool AreAllAncestorsVisible() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorInterface> UiEditorBus;
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorCanvasInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorCanvasInterface() {}
|
||||
|
||||
//! Get the snap state.
|
||||
virtual bool GetIsSnapEnabled() = 0;
|
||||
|
||||
//! Set the snap state.
|
||||
virtual void SetIsSnapEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get the translation distance to snap to
|
||||
virtual float GetSnapDistance() = 0;
|
||||
|
||||
//! Set the translation distance to snap to
|
||||
virtual void SetSnapDistance(float distance) = 0;
|
||||
|
||||
//! Get the degrees of rotation to snap to
|
||||
virtual float GetSnapRotationDegrees() = 0;
|
||||
|
||||
//! Set the degrees of rotation to snap to
|
||||
virtual void SetSnapRotationDegrees(float degrees) = 0;
|
||||
|
||||
//! Get the positions of the horizontal guide lines (along y-axis in canvas pixels)
|
||||
virtual AZStd::vector<float> GetHorizontalGuidePositions() = 0;
|
||||
|
||||
//! Add a horizontal guide line
|
||||
virtual void AddHorizontalGuide(float position) = 0;
|
||||
|
||||
//! Remove the horizontal guide line at the given index
|
||||
virtual void RemoveHorizontalGuide(int index) = 0;
|
||||
|
||||
//! Set the position of the horizontal guide line at the given index
|
||||
virtual void SetHorizontalGuidePosition(int index, float position) = 0;
|
||||
|
||||
//! Get the positions of the vertical guide lines (along x-axis in canvas pixels)
|
||||
virtual AZStd::vector<float> GetVerticalGuidePositions() = 0;
|
||||
|
||||
//! Add a vertical guide line
|
||||
virtual void AddVerticalGuide(float position) = 0;
|
||||
|
||||
//! Remove the vertical guide line at the given index
|
||||
virtual void RemoveVerticalGuide(int index) = 0;
|
||||
|
||||
//! Set the position of the vertical guide line at the given index
|
||||
virtual void SetVerticalGuidePosition(int index, float position) = 0;
|
||||
|
||||
//! Remove all of the guides
|
||||
virtual void RemoveAllGuides() = 0;
|
||||
|
||||
//! Get the color to draw the guide lines on this canvas
|
||||
virtual AZ::Color GetGuideColor() = 0;
|
||||
|
||||
//! Set the color to draw the guide lines on this canvas
|
||||
virtual void SetGuideColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Get whether the guides on this canvas are locked
|
||||
virtual bool GetGuidesAreLocked() = 0;
|
||||
|
||||
//! Set whether the guides on this canvas are locked
|
||||
virtual void SetGuidesAreLocked(bool areLocked) = 0;
|
||||
|
||||
//! Check the canvas for any orphaned elements. These are elements not referenced as a child by the canvas or any of its descendant elements.
|
||||
virtual bool CheckForOrphanedElements() = 0;
|
||||
|
||||
//! Recover any orphaned elements in the canvas by placing them under a special top-level element.
|
||||
virtual void RecoverOrphanedElements() = 0;
|
||||
|
||||
//! Remove any orphaned elements in the canvas.
|
||||
virtual void RemoveOrphanedElements() = 0;
|
||||
|
||||
//! Update the canvas from the UI Editor
|
||||
//! \param deltaTime the amount of time in seconds since the last call to this function
|
||||
//! \param isInGame, true if canvas being updated in preview mode, false if being updated in edit mode
|
||||
virtual void UpdateCanvasInEditorViewport(float deltaTime, bool isInGame) = 0;
|
||||
|
||||
//! Render the canvas in the UI Editor
|
||||
//! \param isInGame, true if canvas being rendered in preview mode, false if being rendered in edit mode
|
||||
//! \param viewportSize, this is the size of the viewport that the canvas is being rendered to
|
||||
virtual void RenderCanvasInEditorViewport(bool isInGame, AZ::Vector2 viewportSize) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorCanvasInterface> UiEditorCanvasBus;
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorChangeNotificationInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorChangeNotificationInterface() {}
|
||||
|
||||
//! Called when the transform properties in the UI editor need to be refreshed
|
||||
virtual void OnEditorTransformPropertiesNeedRefresh() = 0;
|
||||
|
||||
//! Forces a refresh of the entire properties tree in the UI Editor.
|
||||
virtual void OnEditorPropertiesRefreshEntireTree() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorChangeNotificationInterface> UiEditorChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Notify components who store directories as properties when directory contents change.
|
||||
class UiEditorRefreshDirectoryNotificationInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorRefreshDirectoryNotificationInterface() {}
|
||||
|
||||
//! Notify directory properties that they should refresh their contents
|
||||
virtual void OnRefreshDirectory() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorRefreshDirectoryNotificationInterface> UiEditorRefreshDirectoryNotificationBus;
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
class IRenderGraph;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
//! Deleting an element will remove it from its parent and delete its child elements and components
|
||||
virtual ~UiElementInterface() {}
|
||||
|
||||
//! Render the element and its child elements and components, this is done by adding primitives to the render graph
|
||||
//! \param renderGraph, the render graph being added to
|
||||
//! \param isInGame, true if element being rendered in game (or preview), false if being render in edit mode
|
||||
virtual void RenderElement(LyShine::IRenderGraph* renderGraph, bool isInGame) = 0;
|
||||
|
||||
//! Retrieves the identifier of this element.
|
||||
virtual LyShine::ElementId GetElementId() = 0;
|
||||
|
||||
//! Get the name of this element
|
||||
virtual LyShine::NameType GetName() = 0;
|
||||
|
||||
//! Get the canvas that contains this element (returns AZ::InvalidEntityId if element has no canvas)
|
||||
virtual AZ::EntityId GetCanvasEntityId() = 0;
|
||||
|
||||
//! Get the parent element of this element (returns nullptr if element has no parent)
|
||||
virtual AZ::Entity* GetParent() = 0;
|
||||
|
||||
//! Get the parent entity Id of this element (returns invalid Id if element has no parent)
|
||||
virtual AZ::EntityId GetParentEntityId() = 0;
|
||||
|
||||
//! Get the number child elements of this element
|
||||
virtual int GetNumChildElements() = 0;
|
||||
|
||||
//! Get the specified child element, index must be less than GetNumChildElements()
|
||||
virtual AZ::Entity* GetChildElement(int index) = 0;
|
||||
|
||||
//! Get the specified child entity Id, index must be less than GetNumChildElements()
|
||||
virtual AZ::EntityId GetChildEntityId(int index) = 0;
|
||||
|
||||
//! Get the specified child's UiElementInterface, index must be less than GetNumChildElements()
|
||||
//! and the element must be fully initialized
|
||||
virtual UiElementInterface* GetChildElementInterface(int index) = 0;
|
||||
|
||||
//! Get the index of the specified child element
|
||||
virtual int GetIndexOfChild(const AZ::Entity* child) = 0;
|
||||
|
||||
//! Get the index of the specified child element
|
||||
virtual int GetIndexOfChildByEntityId(AZ::EntityId childId) = 0;
|
||||
|
||||
//! Get the child elements of this element
|
||||
virtual LyShine::EntityArray GetChildElements() = 0;
|
||||
|
||||
//! Get the child entity Ids of this element
|
||||
virtual AZStd::vector<AZ::EntityId> GetChildEntityIds() = 0;
|
||||
|
||||
//! Create a new element that is a child of this element, this element (the parent) has ownership of the child
|
||||
//! The new entity will have a UiElementComponent added but will not yet be initialized or activated
|
||||
virtual AZ::Entity* CreateChildElement(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Destroy this element
|
||||
virtual void DestroyElement() = 0;
|
||||
|
||||
//! Queue up element for destruction at end of frame
|
||||
virtual void DestroyElementOnFrameEnd() = 0;
|
||||
|
||||
//! Re-parent this element to move it in the hierarchy
|
||||
//! \param newParent New parent element. If null then the canvas is the parent
|
||||
//! \param nextElement Element to insert this element before. If null element is put at end of child list
|
||||
virtual void Reparent(AZ::Entity* newParent, AZ::Entity* insertBefore = nullptr) = 0;
|
||||
|
||||
//! Re-parent this element to move it in the hierarchy
|
||||
//! \param newParent New parent element. If InvalidEntityId then the canvas is the parent
|
||||
//! \param nextElement Element to insert this element before. If InvalidEntityId then element is put at end of child list
|
||||
virtual void ReparentByEntityId(AZ::EntityId newParent, AZ::EntityId insertBefore) = 0;
|
||||
|
||||
//! Add this element as a child of the specified parent
|
||||
//! \param newParent New parent element. If null then the canvas is the parent
|
||||
//! \param index Child index where element is inserted. If -1 element is put at end of child list
|
||||
virtual void AddToParentAtIndex(AZ::Entity* newParent, int index = -1) = 0;
|
||||
|
||||
//! Remove this element from its parent
|
||||
virtual void RemoveFromParent() = 0;
|
||||
|
||||
//! Get the front-most child element whose bounds include the given point in canvas space
|
||||
//! \return nullptr if no match
|
||||
virtual AZ::Entity* FindFrontmostChildContainingPoint(AZ::Vector2 point, bool isInGame) = 0;
|
||||
|
||||
//! Get all the children whose bounds intersect with the given rect in canvas space
|
||||
//! \return Empty EntityArray if no match
|
||||
virtual LyShine::EntityArray FindAllChildrenIntersectingRect(const AZ::Vector2& bound0, const AZ::Vector2& bound1, bool isInGame) = 0;
|
||||
|
||||
//! Look for an entity with interactable component to handle an event at given point
|
||||
virtual AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Look for a parent (ancestor) entity with interactable component to handle dragging starting at given point
|
||||
virtual AZ::EntityId FindParentInteractableSupportingDrag(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Return the first immediate child element with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindChildByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first descendant element with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindDescendantByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first immediate child entity Id with the given name or invalid Id if no match
|
||||
virtual AZ::EntityId FindChildEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first descendant entity Id with the given name or invalid Id if no match
|
||||
virtual AZ::EntityId FindDescendantEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first immediate child element with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindChildByEntityId(AZ::EntityId id) = 0;
|
||||
|
||||
//! Return the descendant element with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindDescendantById(LyShine::ElementId id) = 0;
|
||||
|
||||
//! recursively find descendant elements matching a predicate
|
||||
//! \param result, any matching elements will be added to this array
|
||||
virtual void FindDescendantElements(AZStd::function<bool(const AZ::Entity*)> predicate, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! recursively visit descendant elements and call the given function on them
|
||||
//! The function is called first on the element and then on its children
|
||||
virtual void CallOnDescendantElements(AZStd::function<void(const AZ::EntityId)> callFunction) = 0;
|
||||
|
||||
//! Return whether a given element is an ancestor of this element
|
||||
virtual bool IsAncestor(AZ::EntityId id) = 0;
|
||||
|
||||
//! Enabled/disabled
|
||||
virtual bool IsEnabled() = 0;
|
||||
virtual void SetIsEnabled(bool isEnabled) = 0;
|
||||
virtual bool GetAreElementAndAncestorsEnabled() = 0;
|
||||
|
||||
//! This can be used to disable the render without disabling the update/interaction.
|
||||
//! This is used internally by components that temporarily disable rendering of other elements (though they preserve the existing value).
|
||||
virtual bool IsRenderEnabled() = 0;
|
||||
virtual void SetIsRenderEnabled(bool isRenderEnabled) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementInterface> UiElementBus;
|
||||
|
||||
// UI_ANIMATION_REVISIT This may be a temporary location
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementChangeNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiElementChangeNotification() {}
|
||||
|
||||
//! Notify listeners that a property has change on this entity
|
||||
virtual void UiElementPropertyChanged() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementChangeNotification> UiElementChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiElementNotifications() {}
|
||||
|
||||
//! Notify listeners that the element is being destroyed
|
||||
virtual void OnUiElementBeingDestroyed() {}
|
||||
|
||||
//! Notify listeners that the element has been fixed up (canvas and parent for the element have been set)
|
||||
virtual void OnUiElementFixup(AZ::EntityId /*canvasEntityId*/, AZ::EntityId /*parentEntityId*/) {}
|
||||
|
||||
//! Notify listeners that the element has been enabled or disabled (the flag on this element was changed)
|
||||
virtual void OnUiElementEnabledChanged(bool /*isEnabled*/) {}
|
||||
|
||||
//! Notify listeners that the element has been enabled or disabled either directly or to a change to an ancestors enabled flag
|
||||
virtual void OnUiElementAndAncestorsEnabledChanged(bool /*areElementAndAncestorsEnabled*/) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementNotifications> UiElementNotificationBus;
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UI entity context.
|
||||
//! There is one UiEntityContext per UI canvas.
|
||||
class UiEntityContextRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiEntityContextRequests() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Accessed by EntityContextId
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::EntityContextId BusIdType;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Creates an entity in a UI context.
|
||||
//! \return a new entity
|
||||
virtual AZ::Entity* CreateUiEntity(const char* name) = 0;
|
||||
|
||||
//! Registers an existing entity with a UI context.
|
||||
virtual void AddUiEntity(AZ::Entity* entity) = 0;
|
||||
|
||||
//! Registers an existing set of entities with a UI context.
|
||||
virtual void AddUiEntities(const AzFramework::EntityList& entities) = 0;
|
||||
|
||||
//! Destroys an entity in a UI context.
|
||||
//! \return whether or not the entity was destroyed. A false return value signifies the entity did not belong to the UI context.
|
||||
virtual bool DestroyUiEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Clones a set of entities.
|
||||
//! \param sourceEntities - the source set of entities to clone
|
||||
//! \param resultEntities - the set of entities cloned from the source
|
||||
virtual bool CloneUiEntities(const AZStd::vector<AZ::EntityId>& sourceEntities, AzFramework::EntityList& resultEntities) = 0;
|
||||
|
||||
};
|
||||
|
||||
using UiEntityContextRequestBus = AZ::EBus<UiEntityContextRequests>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving events/notifications from the UI entity context
|
||||
class UiEntityContextNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiEntityContextNotification() {};
|
||||
|
||||
//! Fired when the context is being reset.
|
||||
virtual void OnContextReset() {}
|
||||
|
||||
//! Fired when a slice has been successfully instantiated.
|
||||
virtual void OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/, const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Fired when a slice has failed to instantiate.
|
||||
virtual void OnSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/, const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Fired when the entity stream has been successfully loaded.
|
||||
virtual void OnEntityStreamLoadSuccess() {}
|
||||
|
||||
//! Fired when the entity stream load has failed
|
||||
virtual void OnEntityStreamLoadFailed() {}
|
||||
};
|
||||
|
||||
using UiEntityContextNotificationBus = AZ::EBus<UiEntityContextNotification>;
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiFaderInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFaderInterface() {}
|
||||
|
||||
//! Get the fade value. This is a float between 0 and 1. 1 means no fade. 0 means complete fade to invisible.
|
||||
virtual float GetFadeValue() = 0;
|
||||
|
||||
//! Set the fade value
|
||||
virtual void SetFadeValue(float fade) = 0;
|
||||
|
||||
//! Trigger a fade animation.
|
||||
//! \param targetValue The value to end the fade at [0,1]
|
||||
//! \param speed Speed measured in full fade amount per second; 0 means instant
|
||||
//! \param listener The listener to notify when the fade is completed or interrupted
|
||||
virtual void Fade(float targetValue, float speed) = 0;
|
||||
|
||||
//! Get whether a fade animation is taking place
|
||||
virtual bool IsFading() = 0;
|
||||
|
||||
//! Get the flag that indicates whether the fader should use render to texture
|
||||
virtual bool GetUseRenderToTexture() = 0;
|
||||
|
||||
//! Set the flag that indicates whether the fader should use render to texture
|
||||
virtual void SetUseRenderToTexture(bool useRenderToTexture) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFaderInterface> UiFaderBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement
|
||||
class UiFaderNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFaderNotifications(){}
|
||||
|
||||
//! Called when the animation triggered by UiFaderInterface::Fade() is done.
|
||||
//! The listener is automatically removed from the fader component after this is called.
|
||||
virtual void OnFadeComplete() = 0;
|
||||
|
||||
//! Called when the animation triggered by UiFaderInterface::Fade() is interrupted.
|
||||
//! The listener is automatically removed from the fader component after this is called.
|
||||
virtual void OnFadeInterrupted() = 0;
|
||||
|
||||
//! Called when the fader component is destroyed
|
||||
virtual void OnFaderDestroyed() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFaderNotifications> UiFaderNotificationBus;
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus that defines the interface for flipbook animations.
|
||||
//!
|
||||
//! A flipbook animation component exists on an entity that has an image component
|
||||
//! and interacts with the image bus to achieve its functionality (such as by
|
||||
//! manipulating sprite-sheet indices).
|
||||
class UiFlipbookAnimationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // Types
|
||||
|
||||
//! Defines the looping behavior when playing back a flipbook animation.
|
||||
enum class LoopType
|
||||
{
|
||||
None, //!< No looping behavior
|
||||
|
||||
Linear, //!< When end frame is reached, next frame will be the loop start frame
|
||||
|
||||
PingPong //!< When end frame is reached, next frame will be the previous frame,
|
||||
//!< continuing in reverse until the start frame is reached.
|
||||
};
|
||||
|
||||
//! Units of speed for framerate
|
||||
enum class FramerateUnits
|
||||
{
|
||||
FPS, //!< Framerate of animation
|
||||
|
||||
SecondsPerFrame, //!< Number of seconds to wait before playing next frame
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~UiFlipbookAnimationInterface() {}
|
||||
|
||||
//! Start the animation sequence, beginning at the start frame.
|
||||
//!
|
||||
//! If a LoopType other than None has been set, the animation won't stop
|
||||
//! unless explicitly done so (or the image is unloaded/destroyed).
|
||||
virtual void Start() = 0;
|
||||
|
||||
//! Stops animation playback.
|
||||
virtual void Stop() = 0;
|
||||
|
||||
//! \return True if the flipbook animation is currently playing, false otherwise.
|
||||
virtual bool IsPlaying() = 0;
|
||||
|
||||
//! \return The starting frame of the animation.
|
||||
virtual AZ::u32 GetStartFrame() = 0;
|
||||
|
||||
//! Sets the starting frame of the animation.
|
||||
virtual void SetStartFrame(AZ::u32 startFrame) = 0;
|
||||
|
||||
//! \return End frame of the animation.
|
||||
virtual AZ::u32 GetEndFrame() = 0;
|
||||
|
||||
//! Sets the ending frame of the animation.
|
||||
virtual void SetEndFrame(AZ::u32 endFrame) = 0;
|
||||
|
||||
//! \return The current frame of the animation that's being rendered.
|
||||
virtual AZ::u32 GetCurrentFrame() = 0;
|
||||
|
||||
//! Sets the current frame of the animation to render.
|
||||
//!
|
||||
//! If the animation is currently playing, this will effectively "skip"
|
||||
//! to the given frame.
|
||||
virtual void SetCurrentFrame(AZ::u32 currentFrame) = 0;
|
||||
|
||||
//! This frame is distinct from the start frame and allows a "lead in"
|
||||
//! seqence of frames to play leading up to the looping animation. The
|
||||
//! frames that occur prior to the loop start frame will only play once.
|
||||
//!
|
||||
//! \return The frame to start the loop from.
|
||||
virtual AZ::u32 GetLoopStartFrame() = 0;
|
||||
|
||||
//! Sets the starting frame for looping sequences.
|
||||
virtual void SetLoopStartFrame(AZ::u32 loopStartFrame) = 0;
|
||||
|
||||
//! \return The LoopType of the flipbook animation.
|
||||
virtual LoopType GetLoopType() = 0;
|
||||
|
||||
//! Sets the LoopType of the flipbook animation.
|
||||
virtual void SetLoopType(LoopType loopType) = 0;
|
||||
|
||||
//! Gets the speed used to determine when to transition to the next frame.
|
||||
//!
|
||||
//! Framerate is defined relative to unit of time, specified by FramerateUnits.
|
||||
//!
|
||||
//! See GetFramerateUnit, SetFramerateUnit.
|
||||
virtual float GetFramerate() = 0;
|
||||
|
||||
//! Sets the speed used to determine when to transition to the next frame.
|
||||
//!
|
||||
//! Framerate is defined relative to unit of time, specified by FramerateUnits.
|
||||
//!
|
||||
//! See GetFramerateUnit, SetFramerateUnit.
|
||||
virtual void SetFramerate(float framerate) = 0;
|
||||
|
||||
//! Gets the framerate unit.
|
||||
virtual FramerateUnits GetFramerateUnit() = 0;
|
||||
|
||||
//! Sets the framerate unit.
|
||||
virtual void SetFramerateUnit(FramerateUnits framerateUnit) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the flipbook (applied only once during playback).
|
||||
virtual float GetStartDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the flipbook (applied only once during playback).
|
||||
virtual void SetStartDelay(float startDelay) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the loop sequence.
|
||||
virtual float GetLoopDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the loop sequence.
|
||||
virtual void SetLoopDelay(float loopDelay) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the reverse loop sequence (PingPong loop types only).
|
||||
virtual float GetReverseDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the reverse loop sequence (PingPong loop types only).
|
||||
virtual void SetReverseDelay(float reverseDelay) = 0;
|
||||
|
||||
//! Returns true if the animation will begin playing when the component activates, false otherwise.
|
||||
virtual bool GetIsAutoPlay() = 0;
|
||||
|
||||
//! Sets whether the animation will automatically begin playing.
|
||||
//!
|
||||
//! This flag is ignored after the component has activated.
|
||||
virtual void SetIsAutoPlay(bool isAutoPlay) = 0;
|
||||
};
|
||||
|
||||
using UiFlipbookAnimationBus = AZ::EBus<UiFlipbookAnimationInterface>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Allows listeners to be aware of events, like loop completion, occurring.
|
||||
class UiFlipbookAnimationNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFlipbookAnimationNotifications() {}
|
||||
|
||||
//! Notify listeners when the animation starts
|
||||
virtual void OnAnimationStarted() {}
|
||||
|
||||
//! Notify listeners when the animation stops
|
||||
virtual void OnAnimationStopped() {}
|
||||
|
||||
//! Notify listeners when the current loop sequence has completed
|
||||
//!
|
||||
//! This will only trigger for LoopType sequences other than None.
|
||||
//!
|
||||
//! For Linear LoopType, this will trigger on the last frame of the last
|
||||
//! frame of the loop.
|
||||
//!
|
||||
//! For PingPong LoopType, this will trigger on the last frame of the
|
||||
//! loop sequence before reversing the loop direction.
|
||||
virtual void OnLoopSequenceCompleted() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFlipbookAnimationNotifications> UiFlipbookAnimationNotificationsBus;
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Serialization/IdUtils.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UI game entity context.
|
||||
class UiGameEntityContextRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextRequests() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Accessed by EntityContextId
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::EntityContextId BusIdType;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Instantiates a dynamic slice asynchronously.
|
||||
//! \return a ticket identifying the spawn request.
|
||||
//! Callers can immediately subscribe to the SliceInstantiationResultBus for this ticket
|
||||
//! to receive result for this specific request.
|
||||
virtual AzFramework::SliceInstantiationTicket InstantiateDynamicSlice(
|
||||
const AZ::Data::Asset<AZ::Data::AssetData>& /*sliceAsset*/,
|
||||
const AZ::Vector2& /*position*/,
|
||||
bool /*isViewportPosition*/,
|
||||
AZ::Entity* /*parent*/,
|
||||
const AZ::IdUtils::Remapper<AZ::EntityId>::IdMapper& /*customIdMapper*/)
|
||||
{ return AzFramework::SliceInstantiationTicket(); }
|
||||
};
|
||||
|
||||
using UiGameEntityContextBus = AZ::EBus<UiGameEntityContextRequests>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving notifications from the UI game entity context component.
|
||||
class UiGameEntityContextNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextNotifications() = default;
|
||||
|
||||
/// Fired when a slice has been successfully instantiated.
|
||||
virtual void OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/,
|
||||
const AZ::SliceComponent::SliceInstanceAddress& /*instance*/,
|
||||
const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
/// Fired when a slice asset could not be instantiated.
|
||||
virtual void OnSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/,
|
||||
const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
};
|
||||
|
||||
using UiGameEntityContextNotificationBus = AZ::EBus<UiGameEntityContextNotifications>;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving notifications from the UI game entity context component. This bus is used
|
||||
//! by the UiSpawnerComponent that depends on the UiGameEntityContext fixing entities up before
|
||||
//! it sends out notifications to listeners on the UiSpawnerNotificationBus
|
||||
class UiGameEntityContextSliceInstantiationResults
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextSliceInstantiationResults() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Addressed by SliceInstantiationTicket
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::SliceInstantiationTicket BusIdType;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Signals that a slice was successfully instantiated prior to entity registration.
|
||||
virtual void OnEntityContextSlicePreInstantiate(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/) {}
|
||||
|
||||
//! Signals that a slice was successfully instantiated after entity registration.
|
||||
virtual void OnEntityContextSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/) {}
|
||||
|
||||
//! Signals that a slice could not be instantiated.
|
||||
virtual void OnEntityContextSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/) {}
|
||||
};
|
||||
|
||||
using UiGameEntityContextSliceInstantiationResultsBus = AZ::EBus<UiGameEntityContextSliceInstantiationResults>;
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiImageInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class ImageType : int32_t
|
||||
{
|
||||
Stretched, //!< the texture is stretched to fit the rect without maintaining aspect ratio
|
||||
Sliced, //!< the texture is sliced such that center stretches and the edges do not
|
||||
Fixed, //!< the texture is not stretched at all
|
||||
Tiled, //!< the texture is tiled (repeated)
|
||||
StretchedToFit, //!< the texture is scaled to fit the rect while maintaining aspect ratio
|
||||
StretchedToFill //!< the texture is scaled to fill the rect while maintaining aspect ratio
|
||||
};
|
||||
|
||||
enum class SpriteType : int32_t
|
||||
{
|
||||
SpriteAsset,
|
||||
RenderTarget,
|
||||
};
|
||||
|
||||
enum class FillType : int32_t
|
||||
{
|
||||
None, //!< the image is displayed fully filled
|
||||
Linear, //!< the image is filled linearly from one edge to the opposing edge
|
||||
Radial, //!< the image is filled radially around the center
|
||||
RadialCorner, //!< the image is filled radially around a corner
|
||||
RadialEdge, //!< the image is filled radially around the midpoint of an edge
|
||||
};
|
||||
|
||||
enum class FillCornerOrigin : int32_t
|
||||
{
|
||||
TopLeft,
|
||||
TopRight,
|
||||
BottomRight,
|
||||
BottomLeft,
|
||||
};
|
||||
|
||||
enum class FillEdgeOrigin : int32_t
|
||||
{
|
||||
Left,
|
||||
Top,
|
||||
Right,
|
||||
Bottom,
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiImageInterface() {}
|
||||
|
||||
//! Gets the image color tint
|
||||
virtual AZ::Color GetColor() = 0;
|
||||
|
||||
//! Sets the image color tint
|
||||
virtual void SetColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Gets the image color alpha
|
||||
virtual float GetAlpha() = 0;
|
||||
|
||||
//! Sets the image color alpha
|
||||
virtual void SetAlpha(float color) = 0;
|
||||
|
||||
//! Gets the sprite for this element
|
||||
virtual ISprite* GetSprite() = 0;
|
||||
|
||||
//! Sets the sprite for this element
|
||||
virtual void SetSprite(ISprite* sprite) = 0;
|
||||
|
||||
//! Gets the source location of the image to be displayed by the element
|
||||
virtual AZStd::string GetSpritePathname() = 0;
|
||||
|
||||
//! Sets the source location of the image to be displayed by the element
|
||||
virtual void SetSpritePathname(AZStd::string spritePath) = 0;
|
||||
|
||||
//! Sets the source location of the image to be displayed by the element only
|
||||
//! if the sprite asset exists. Otherwise, the current sprite remains unchanged.
|
||||
//! Returns whether the sprite changed
|
||||
virtual bool SetSpritePathnameIfExists(AZStd::string spritePath) = 0;
|
||||
|
||||
//! Gets the name of the render target
|
||||
virtual AZStd::string GetRenderTargetName() = 0;
|
||||
|
||||
//! Sets the name of the render target
|
||||
virtual void SetRenderTargetName(AZStd::string renderTargetName) = 0;
|
||||
|
||||
//! Gets whether the render target is in sRGB color space
|
||||
virtual bool GetIsRenderTargetSRGB() = 0;
|
||||
|
||||
//! Sets whether the render target is in sRGB color space
|
||||
virtual void SetIsRenderTargetSRGB(bool isSRGB) = 0;
|
||||
|
||||
//! Gets the type of the sprite
|
||||
virtual SpriteType GetSpriteType() = 0;
|
||||
|
||||
//! Sets the type of the sprite
|
||||
virtual void SetSpriteType(SpriteType spriteType) = 0;
|
||||
|
||||
//! Gets the type of the image
|
||||
virtual ImageType GetImageType() = 0;
|
||||
|
||||
//! Sets the type of the image
|
||||
virtual void SetImageType(ImageType imageType) = 0;
|
||||
|
||||
//! Gets the fill type for the image
|
||||
virtual FillType GetFillType() = 0;
|
||||
|
||||
//! Sets the fill type for the image
|
||||
virtual void SetFillType(FillType fillType) = 0;
|
||||
|
||||
//! Gets the fill amount for the image in the range [0,1]
|
||||
virtual float GetFillAmount() = 0;
|
||||
|
||||
//! Sets the fill amount for the image in the range [0,1]
|
||||
virtual void SetFillAmount(float fillAmount) = 0;
|
||||
|
||||
//! Gets the start angle for radial fill, measured clockwise in degrees from straight up
|
||||
virtual float GetRadialFillStartAngle() = 0;
|
||||
|
||||
//! Sets the start angle for radial fill, measured clockwise in degrees from straight up
|
||||
virtual void SetRadialFillStartAngle(float radialFillStartAngle) = 0;
|
||||
|
||||
//! Gets the corner fill origin
|
||||
virtual FillCornerOrigin GetCornerFillOrigin() = 0;
|
||||
|
||||
//! Sets the corner fill origin
|
||||
virtual void SetCornerFillOrigin(FillCornerOrigin cornerOrigin) = 0;
|
||||
|
||||
//! Gets the edge fill origin
|
||||
virtual FillEdgeOrigin GetEdgeFillOrigin() = 0;
|
||||
|
||||
//! Sets the edge fill origin
|
||||
virtual void SetEdgeFillOrigin(FillEdgeOrigin edgeOrigin) = 0;
|
||||
|
||||
//! Gets whether the image is filled clockwise
|
||||
virtual bool GetFillClockwise() = 0;
|
||||
|
||||
//! Sets whether the image is filled clockwise
|
||||
virtual void SetFillClockwise(bool fillClockwise) = 0;
|
||||
|
||||
//! Gets whether the center of a sliced image is filled
|
||||
virtual bool GetFillCenter() = 0;
|
||||
|
||||
//! Sets whether the center of a sliced image is filled
|
||||
virtual void SetFillCenter(bool fillCenter) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiImageInterface> UiImageBus;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiImageSequenceInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class ImageType : int32_t
|
||||
{
|
||||
Stretched, //!< the texture is stretched to fit the rect without maintaining aspect ratio
|
||||
Fixed, //!< the texture is not stretched at all
|
||||
StretchedToFit, //!< the texture is scaled to fit the rect while maintaining aspect ratio
|
||||
StretchedToFill //!< the texture is scaled to fill the rect while maintaining aspect ratio
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiImageSequenceInterface() {}
|
||||
|
||||
//! Gets the type of the image
|
||||
virtual ImageType GetImageType() = 0;
|
||||
|
||||
//! Sets the type of the image
|
||||
virtual void SetImageType(ImageType imageType) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiImageSequenceInterface> UiImageSequenceBus;
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Defines an interface for working with indexable image types, such as sprite-sheets or image sequences.
|
||||
class UiIndexableImageInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiIndexableImageInterface() {}
|
||||
|
||||
//! Sets the index of the image to display
|
||||
virtual void SetImageIndex(AZ::u32 index) = 0;
|
||||
|
||||
//! Gets the index of the image to display
|
||||
virtual const AZ::u32 GetImageIndex() = 0;
|
||||
|
||||
//! Gets the number of indices for this image.
|
||||
virtual const AZ::u32 GetImageIndexCount() = 0;
|
||||
|
||||
//! Given an index, return its alias (if defined)
|
||||
virtual AZStd::string GetImageIndexAlias(AZ::u32 index) = 0;
|
||||
|
||||
//! Given an index, set an alias for it
|
||||
virtual void SetImageIndexAlias(AZ::u32 index, const AZStd::string& alias) = 0;
|
||||
|
||||
//! Given an alias, return the index that corresponds to it
|
||||
virtual AZ::u32 GetImageIndexFromAlias(const AZStd::string& alias) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiIndexableImageInterface> UiIndexableImageBus;
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInitializationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInitializationInterface() {}
|
||||
|
||||
//! Initialize the component after it has been created as part of a set of entities.
|
||||
//! I.e. After a group of entities has been created and activated from a load or clone operation
|
||||
//! in the game (not in the UI Editor) this is called on each created element.
|
||||
//! This allows the component to perform operations that rely on related entities being
|
||||
//! activated.
|
||||
virtual void InGamePostActivate() = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UiInitializationInterface"; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInitializationInterface> UiInitializationBus;
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This bus allows the get/set of properties for a group of actions that many interactable components
|
||||
// implement.
|
||||
// It is separate from UiInteractableBus because UiInteractableBus is part of a core system for how
|
||||
// the UI canvas communincates with any UI element that wants user input. Sometimes UI components
|
||||
// want input because they are part of a 2D puzzle for example but they do not always want to have
|
||||
// to support the standard action changes.
|
||||
class UiInteractableActionsInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef AZStd::function<void(AZ::EntityId)> OnActionCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableActionsInterface() {}
|
||||
|
||||
//! Get the hover start action name
|
||||
virtual const LyShine::ActionName& GetHoverStartActionName() = 0;
|
||||
|
||||
//! Set the hover start action name
|
||||
virtual void SetHoverStartActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the hover end action name
|
||||
virtual const LyShine::ActionName& GetHoverEndActionName() = 0;
|
||||
|
||||
//! Set the hover end action name
|
||||
virtual void SetHoverEndActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the pressed action name
|
||||
virtual const LyShine::ActionName& GetPressedActionName() = 0;
|
||||
|
||||
//! Set the pressed action name
|
||||
virtual void SetPressedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the released action name
|
||||
virtual const LyShine::ActionName& GetReleasedActionName() = 0;
|
||||
|
||||
//! Set the released action name
|
||||
virtual void SetReleasedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the hover start callback
|
||||
virtual OnActionCallback GetHoverStartActionCallback() = 0;
|
||||
|
||||
//! Set the hover start callback
|
||||
virtual void SetHoverStartActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the hover end callback
|
||||
virtual OnActionCallback GetHoverEndActionCallback() = 0;
|
||||
|
||||
//! Set the hover end callback
|
||||
virtual void SetHoverEndActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the pressed callback
|
||||
virtual OnActionCallback GetPressedActionCallback() = 0;
|
||||
|
||||
//! Set the pressed callback
|
||||
virtual void SetPressedActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the release callback
|
||||
virtual OnActionCallback GetReleasedActionCallback() = 0;
|
||||
|
||||
//! Set the release callback
|
||||
virtual void SetReleasedActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableActionsInterface> UiInteractableActionsBus;
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Input/Channels/InputChannelDigitalWithSharedModifierKeyStates.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractableInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableInterface() {}
|
||||
|
||||
//! Check whether this component can handle the event at the given location
|
||||
virtual bool CanHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Called on an interactable component when a pressed event is received over it
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param shouldStayActive, output - true if the interactable wants to become the active element for the canvas
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandlePressed(AZ::Vector2 point, bool& shouldStayActive) = 0;
|
||||
|
||||
//! Called on the currently pressed interactable component when a release event is received
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleReleased(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Called on an interactable component when a multi-touch pressed event is received over it
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleMultiTouchPressed(AZ::Vector2 point, int multiTouchIndex) = 0;
|
||||
|
||||
//! Called on the currently pressed interactable component when a multi-touch release event is received
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleMultiTouchReleased(AZ::Vector2 point, int multiTouchIndex) = 0;
|
||||
|
||||
//! Called on an interactable component when an enter pressed event is received
|
||||
//! \param shouldStayActive, output - true if the interactable wants to become the active element for the canvas
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleEnterPressed([[maybe_unused]] bool& shouldStayActive) { return false; }
|
||||
|
||||
//! Called on the currently pressed interactable component when an enter released event is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleEnterReleased() { return false; }
|
||||
|
||||
//! Called when the interactable was navigated to via gamepad/keyboard, and auto activation is enabled on the interactable
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleAutoActivation() { return false; }
|
||||
|
||||
//! Called on the currently active interactable component when text input is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleTextInput([[maybe_unused]] const AZStd::string& textUTF8) { return false; };
|
||||
|
||||
//! Called on the currently active interactable component when input is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleKeyInputBegan([[maybe_unused]] const AzFramework::InputChannel::Snapshot& inputSnapshot, [[maybe_unused]] AzFramework::ModifierKeyMask activeModifierKeys) { return false; }
|
||||
|
||||
//! Called on the currently active interactable component when a mouse/touch position event is received
|
||||
//! \param point, the current mouse/touch position (viewport space)
|
||||
virtual void InputPositionUpdate([[maybe_unused]] AZ::Vector2 point) {};
|
||||
|
||||
//! Called on the currently pressed interactable component when a multi-touch position event is received
|
||||
//! \param point, the current mouse/touch position (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
virtual void MultiTouchPositionUpdate([[maybe_unused]] AZ::Vector2 point, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Returns true if this interactable supports taking active status when a drag is started on a child
|
||||
//! interactble AND the given drag startPoint would be a valid drag start point
|
||||
//! \param point, the start point of the drag (which would be on a child interactable) (viewport space)
|
||||
virtual bool DoesSupportDragHandOff([[maybe_unused]] AZ::Vector2 startPoint) { return false; }
|
||||
|
||||
//! Called on a parent of the currently active interactable element to allow interactables that
|
||||
//! contain other interactables to support drags that start on the child.
|
||||
//! If this return true the hand-off occured and the caller will no longer be considered the
|
||||
//! active interactable by the canvas.
|
||||
//! \param currentActiveInteractable, the child element that is the currently active interactable
|
||||
//! \param startPoint, the start point of the potential drag (viewport space)
|
||||
//! \param currentPoint, the current points of the potential drag (viewport space)
|
||||
virtual bool OfferDragHandOff([[maybe_unused]] AZ::EntityId currentActiveInteractable, [[maybe_unused]] AZ::Vector2 startPoint, [[maybe_unused]] AZ::Vector2 currentPoint, [[maybe_unused]] float dragThreshold) { return false; };
|
||||
|
||||
//! Called on the currently active interactable component when the active interactable changes
|
||||
virtual void LostActiveStatus() {};
|
||||
|
||||
//! Called when mouse/touch enters the bounds of this interactable
|
||||
virtual void HandleHoverStart() = 0;
|
||||
|
||||
//! Called on the currently hovered interactable component when mouse/touch moves outside of bounds
|
||||
virtual void HandleHoverEnd() = 0;
|
||||
|
||||
//! Called when a descendant of the interactable becomes the hover interactable by being navigated to
|
||||
virtual void HandleDescendantReceivedHoverByNavigation([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
|
||||
//! Called when the interactable becomes the hover interactable by being navigated to from one of its descendants
|
||||
virtual void HandleReceivedHoverByNavigatingFromDescendant([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
|
||||
//! Query whether the interactable is currently pressed
|
||||
virtual bool IsPressed() { return false; }
|
||||
|
||||
//! Enable/disable event handling
|
||||
virtual bool IsHandlingEvents() { return true; }
|
||||
virtual void SetIsHandlingEvents([[maybe_unused]] bool isHandlingEvents) {}
|
||||
|
||||
//! Enable/disable multi-touch event handling
|
||||
virtual bool IsHandlingMultiTouchEvents() { return true; }
|
||||
virtual void SetIsHandlingMultiTouchEvents([[maybe_unused]] bool isHandlingMultiTouchEvents) {}
|
||||
|
||||
//! Get/set whether the interactable automatically becomes active when navigated to via gamepad/keyboard
|
||||
virtual bool GetIsAutoActivationEnabled() = 0;
|
||||
virtual void SetIsAutoActivationEnabled(bool isEnabled) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableInterface> UiInteractableBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractableActiveNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableActiveNotifications() {}
|
||||
|
||||
//! Notify listener that this interactable is no longer active
|
||||
virtual void ActiveCancelled() {}
|
||||
|
||||
//! Notify listener that this interactable has given up active status to a new interactable
|
||||
virtual void ActiveChanged([[maybe_unused]] AZ::EntityId m_newActiveInteractable, [[maybe_unused]] bool shouldStayActive) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableActiveNotifications> UiInteractableActiveNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement in order to get notifications when actions are
|
||||
//! triggered
|
||||
class UiInteractableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableNotifications(){}
|
||||
|
||||
//! Called on hover start
|
||||
virtual void OnHoverStart() {};
|
||||
|
||||
//! Called on hover end
|
||||
virtual void OnHoverEnd() {};
|
||||
|
||||
//! Called on pressed
|
||||
virtual void OnPressed() {};
|
||||
|
||||
//! Called on released
|
||||
virtual void OnReleased() {};
|
||||
|
||||
//! Called on receiving hover by being navigated to from a descendant
|
||||
virtual void OnReceivedHoverByNavigatingFromDescendant([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableNotifications> UiInteractableNotificationBus;
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This bus allows the get/set of properties for a group of states that many interactable components
|
||||
// implement.
|
||||
// It is separate from UiInteractableBus because UiInteractableBus is part of a core system for how
|
||||
// the UI canvas communincates with any UI element that wants user input. Sometimes UI components
|
||||
// want input because they are part of a 2D puzzle for example but they do not always want to have
|
||||
// to support the standard state changes.
|
||||
class UiInteractableStatesInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! The different visual states that an interactable can be in. An enum class is avoided so that
|
||||
//! derived components of UiInteractableComponent can extend with additional states.
|
||||
using State = int;
|
||||
enum
|
||||
{
|
||||
StateNormal = 0,
|
||||
StateHover,
|
||||
StatePressed,
|
||||
StateDisabled,
|
||||
NumStates
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableStatesInterface() {}
|
||||
|
||||
//! Set the color to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a color action for this state/target combination then replaces it
|
||||
virtual void SetStateColor(State state, AZ::EntityId target, const AZ::Color& color) = 0;
|
||||
|
||||
//! Get the color to be used for the given target when the interactable is in the given state
|
||||
//! \return the color to be used for the given target when the interactable is in the given state
|
||||
virtual AZ::Color GetStateColor(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a color action for this state/target combination
|
||||
//! \return true if the interactable has a color action for this state/target combination
|
||||
virtual bool HasStateColor(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the alpha to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has an alpha action for this state/target combination then replaces it
|
||||
virtual void SetStateAlpha(State state, AZ::EntityId target, float alpha) = 0;
|
||||
|
||||
//! Get the alpha to be used for the given target when the interactable is in the given state
|
||||
//! \return the alpha to be used for the given target when the interactable is in the given state
|
||||
virtual float GetStateAlpha(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has an alpha action for this state/target combination
|
||||
//! \return true if the interactable has an alpha action for this state/target combination
|
||||
virtual bool HasStateAlpha(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the sprite to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a sprite action for this state/target combination then replaces it
|
||||
virtual void SetStateSprite(State state, AZ::EntityId target, ISprite* sprite) = 0;
|
||||
|
||||
//! Get the sprite to be used for the given target when the interactable is in the given state
|
||||
//! \return the sprite to be used for the given target when the interactable is in the given state
|
||||
virtual ISprite* GetStateSprite(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the sprite path to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a sprite action for this state/target combination then replaces it
|
||||
virtual void SetStateSpritePathname(State state, AZ::EntityId target, const AZStd::string& spritePath) = 0;
|
||||
|
||||
//! Get the sprite path to be used for the given target when the interactable is in the given state
|
||||
//! \return the sprite path to be used for the given target when the interactable is in the given state
|
||||
virtual AZStd::string GetStateSpritePathname(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a sprite action for this state/target combination
|
||||
//! \return true if the interactable has a sprite action for this state/target combination
|
||||
virtual bool HasStateSprite(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the font to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a font action for this state/target combination then replaces it
|
||||
virtual void SetStateFont(State state, AZ::EntityId target, const AZStd::string& fontPathname, unsigned int fontEffectIndex) = 0;
|
||||
|
||||
//! Get the font path to be used for the given target when the interactable is in the given state
|
||||
//! \return the font path to be used for the given target when the interactable is in the given state
|
||||
virtual AZStd::string GetStateFontPathname(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get the font effect to be used for the given target when the interactable is in the given state
|
||||
//! \return the font effect to be used for the given target when the interactable is in the given state
|
||||
virtual unsigned int GetStateFontEffectIndex(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a font action for this state/target combination
|
||||
//! \return true if the interactable has a font action for this state/target combination
|
||||
virtual bool HasStateFont(State state, AZ::EntityId target) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableStatesInterface> UiInteractableStatesBus;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractionMaskInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractionMaskInterface() {}
|
||||
|
||||
//! Check whether this element is masking the given point
|
||||
virtual bool IsPointMasked(AZ::Vector2 point) = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UIInteractionMaskInterface"; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractionMaskInterface> UiInteractionMaskBus;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Horizontal order used by layout components
|
||||
enum class HorizontalOrder
|
||||
{
|
||||
LeftToRight,
|
||||
RightToLeft
|
||||
};
|
||||
|
||||
//! Vertical order used by layout components
|
||||
enum class VerticalOrder
|
||||
{
|
||||
TopToBottom,
|
||||
BottomToTop
|
||||
};
|
||||
|
||||
//! Padding (in pixels) inside the edges of an element
|
||||
struct Padding
|
||||
{
|
||||
AZ_TYPE_INFO(Padding, "{DE5C18B0-4214-4A37-B590-8D45CC450A96}")
|
||||
|
||||
Padding()
|
||||
: m_left(0)
|
||||
, m_top(0)
|
||||
, m_right(0)
|
||||
, m_bottom(0) {}
|
||||
|
||||
int m_left;
|
||||
int m_right;
|
||||
int m_top;
|
||||
int m_bottom;
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutInterface() {}
|
||||
|
||||
//! Get whether this layout component uses layout cells to calculate its layout
|
||||
virtual bool IsUsingLayoutCellsToCalculateLayout() = 0;
|
||||
|
||||
//! Get whether this layout component should bypass the default layout cell values calculated by its children
|
||||
virtual bool GetIgnoreDefaultLayoutCells() = 0;
|
||||
|
||||
//! Set whether this layout component should bypass the default layout cell values calculated by its children
|
||||
virtual void SetIgnoreDefaultLayoutCells(bool ignoreDefaultLayoutCells) = 0;
|
||||
|
||||
//! Get the horizontal child alignment
|
||||
virtual IDraw2d::HAlign GetHorizontalChildAlignment() = 0;
|
||||
|
||||
//! Set the horizontal child alignment
|
||||
virtual void SetHorizontalChildAlignment(IDraw2d::HAlign alignment) = 0;
|
||||
|
||||
//! Get the vertical child alignment
|
||||
virtual IDraw2d::VAlign GetVerticalChildAlignment() = 0;
|
||||
|
||||
//! Set the vertical child alignment
|
||||
virtual void SetVerticalChildAlignment(IDraw2d::VAlign alignment) = 0;
|
||||
|
||||
//! Find out whether this layout component is currently overriding the transform of the specified element.
|
||||
virtual bool IsControllingChild(AZ::EntityId childId) = 0;
|
||||
|
||||
//! Get the size the element needs to be to fit a specified number of child elements of a certain size
|
||||
virtual AZ::Vector2 GetSizeToFitChildElements(const AZ::Vector2& childElementSize, int numChildElements) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutInterface> UiLayoutBus;
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiLayoutCellBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutCellInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutCellInterface() {}
|
||||
|
||||
//! Get the overridden min width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMinWidth() = 0;
|
||||
|
||||
//! Set the overridden min width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMinWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden min height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMinHeight() = 0;
|
||||
|
||||
//! Set the overridden min height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMinHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden target width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetTargetWidth() = 0;
|
||||
|
||||
//! Set the overridden target width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetTargetWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden target height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetTargetHeight() = 0;
|
||||
|
||||
//! Set the overridden target height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetTargetHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden max width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMaxWidth() = 0;
|
||||
|
||||
//! Set the overridden max width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMaxWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden max height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMaxHeight() = 0;
|
||||
|
||||
//! Set the overridden max height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMaxHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden extra width ratio. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetExtraWidthRatio() = 0;
|
||||
|
||||
//! Set the overridden extra width ratio. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetExtraWidthRatio(float width) = 0;
|
||||
|
||||
//! Get the overridden extra height ratio. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetExtraHeightRatio() = 0;
|
||||
|
||||
//! Set the overridden extra height ratio. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetExtraHeightRatio(float height) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutCellInterface> UiLayoutCellBus;
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiLayoutCellBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutCellDefaultInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutCellDefaultInterface() {}
|
||||
|
||||
//! Get the minimum width
|
||||
virtual float GetMinWidth() = 0;
|
||||
|
||||
//! Get the minimum height
|
||||
virtual float GetMinHeight() = 0;
|
||||
|
||||
//! Get the target width
|
||||
//! \param maxWidth A width that the element will not surpass. LyShine::UiLayoutCellUnspecifiedSize means no max
|
||||
virtual float GetTargetWidth(float maxWidth) = 0;
|
||||
|
||||
//! Get the target height
|
||||
//! \param maxHeight A height that the element will not surpass. LyShine::UiLayoutCellUnspecifiedSize means no max
|
||||
virtual float GetTargetHeight(float maxHeight) = 0;
|
||||
|
||||
//! Get the extra width ratio
|
||||
virtual float GetExtraWidthRatio() = 0;
|
||||
|
||||
//! Get the extra height ratio
|
||||
virtual float GetExtraHeightRatio() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutCellDefaultInterface> UiLayoutCellDefaultBus;
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/Bus/UiLayoutBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutColumnInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutColumnInterface() {}
|
||||
|
||||
//! Get the padding (in pixels) inside the edges of the element
|
||||
virtual UiLayoutInterface::Padding GetPadding() = 0;
|
||||
|
||||
//! Set the padding (in pixels) inside the edges of the element
|
||||
virtual void SetPadding(UiLayoutInterface::Padding padding) = 0;
|
||||
|
||||
//! Get the spacing (in pixels) between child elements
|
||||
virtual float GetSpacing() = 0;
|
||||
|
||||
//! Set the spacing (in pixels) between child elements
|
||||
virtual void SetSpacing(float spacing) = 0;
|
||||
|
||||
//! Get the vertical order for this layout
|
||||
virtual UiLayoutInterface::VerticalOrder GetOrder() = 0;
|
||||
|
||||
//! Set the vertical order for this layout
|
||||
virtual void SetOrder(UiLayoutInterface::VerticalOrder order) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutColumnInterface> UiLayoutColumnBus;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! This interface can to be implemented by any component that wants to modify transform properties
|
||||
//! of elements are runtime using the Layout system. The methods in this interface will be called
|
||||
//! by the LayoutManager whenever the element is told to recompute its layout. Because an element
|
||||
//! might have multiple components that implement this interface, the handlers will be sorted by
|
||||
//! priority (lower priority number gets called earlier).
|
||||
class UiLayoutControllerInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutControllerInterface() {}
|
||||
|
||||
//! Set elements' width transform properties
|
||||
virtual void ApplyLayoutWidth() = 0;
|
||||
|
||||
//! Set elements' height transform properties
|
||||
virtual void ApplyLayoutHeight() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Events are ordered, each handler may set its priority
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::MultipleAndOrdered;
|
||||
|
||||
//! Priority will be used for ordering, lower priority number means it gets called earlier
|
||||
struct BusHandlerOrderCompare
|
||||
{
|
||||
AZ_FORCE_INLINE bool operator()(const UiLayoutControllerInterface* left, const UiLayoutControllerInterface* right) const { return left->GetPriority() < right->GetPriority(); }
|
||||
};
|
||||
|
||||
protected: // member data
|
||||
|
||||
static const unsigned int k_defaultPriority = 100; // Default is 100, make it lower to get called earlier, higher to get called later
|
||||
virtual unsigned int GetPriority() const { return k_defaultPriority; }
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutControllerInterface> UiLayoutControllerBus;
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! This component resizes its element to fit its content. It uses cell sizing information given to
|
||||
//! it by other Layout components, Text component, or Image component (fixed type).
|
||||
class UiLayoutFitterInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Fit type indicating enabled fits
|
||||
enum class FitType
|
||||
{
|
||||
None,
|
||||
HorizontalOnly,
|
||||
VerticalOnly,
|
||||
HorizontalAndVertical
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutFitterInterface() {}
|
||||
|
||||
//! Get whether to resize the element horizontally
|
||||
virtual bool GetHorizontalFit() = 0;
|
||||
|
||||
//! Set whether to resize the element horizontally
|
||||
virtual void SetHorizontalFit(bool horizontalFit) = 0;
|
||||
|
||||
//! Get whether to resize the element vertically
|
||||
virtual bool GetVerticalFit() = 0;
|
||||
|
||||
//! Set whether to resize the element vertically
|
||||
virtual void SetVerticalFit(bool verticalFit) = 0;
|
||||
|
||||
//! Get the fit type
|
||||
virtual FitType GetFitType() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutFitterInterface> UiLayoutFitterBus;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user