Merge branch 'main' into sceneapi_script_regression
This commit is contained in:
@@ -19,9 +19,6 @@ namespace AZ
|
|||||||
{
|
{
|
||||||
class Vector3;
|
class Vector3;
|
||||||
|
|
||||||
//! Do not allow the scale to be zero to avoid problems with inverting scale.
|
|
||||||
static constexpr float MinNonUniformScale = 1e-3f;
|
|
||||||
|
|
||||||
using NonUniformScaleChangedEvent = AZ::Event<const AZ::Vector3&>;
|
using NonUniformScaleChangedEvent = AZ::Event<const AZ::Vector3&>;
|
||||||
|
|
||||||
//! Requests for working with non-uniform scale.
|
//! Requests for working with non-uniform scale.
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ namespace AZ
|
|||||||
bool CompareValueData(const void* lhs, const void* rhs) override;
|
bool CompareValueData(const void* lhs, const void* rhs) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Limits for transform scale values.
|
||||||
|
//! The scale should not be zero to avoid problems with inverting.
|
||||||
|
//! @{
|
||||||
|
static constexpr float MinTransformScale = 1e-2f;
|
||||||
|
static constexpr float MaxTransformScale = 1e9f;
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! The basic transformation class, represented using a quaternion rotation, vector scale and vector translation.
|
//! The basic transformation class, represented using a quaternion rotation, vector scale and vector translation.
|
||||||
//! By design, cannot represent skew transformations.
|
//! By design, cannot represent skew transformations.
|
||||||
class Transform
|
class Transform
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <AzFramework/Components/NonUniformScaleComponent.h>
|
#include <AzFramework/Components/NonUniformScaleComponent.h>
|
||||||
#include <AzCore/Serialization/SerializeContext.h>
|
#include <AzCore/Serialization/SerializeContext.h>
|
||||||
|
#include <AzCore/Math/Transform.h>
|
||||||
#include <AzCore/Math/ToString.h>
|
#include <AzCore/Math/ToString.h>
|
||||||
#include <AzCore/Component/Entity.h>
|
#include <AzCore/Component/Entity.h>
|
||||||
|
|
||||||
@@ -81,13 +82,13 @@ namespace AzFramework
|
|||||||
|
|
||||||
void NonUniformScaleComponent::SetScale(const AZ::Vector3& scale)
|
void NonUniformScaleComponent::SetScale(const AZ::Vector3& scale)
|
||||||
{
|
{
|
||||||
if (scale.GetMinElement() >= AZ::MinNonUniformScale)
|
if (scale.GetMinElement() >= AZ::MinTransformScale && scale.GetMaxElement() <= AZ::MaxTransformScale)
|
||||||
{
|
{
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AZ::Vector3 clampedScale = scale.GetMax(AZ::Vector3(AZ::MinNonUniformScale));
|
AZ::Vector3 clampedScale = scale.GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale));
|
||||||
AZ_Warning("Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s",
|
AZ_Warning("Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s",
|
||||||
AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str());
|
AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str());
|
||||||
m_scale = clampedScale;
|
m_scale = clampedScale;
|
||||||
|
|||||||
+6
-3
@@ -13,6 +13,7 @@
|
|||||||
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.h>
|
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.h>
|
||||||
#include <AzCore/Serialization/EditContext.h>
|
#include <AzCore/Serialization/EditContext.h>
|
||||||
#include <AzFramework/Components/NonUniformScaleComponent.h>
|
#include <AzFramework/Components/NonUniformScaleComponent.h>
|
||||||
|
#include <AzCore/Math/Transform.h>
|
||||||
#include <AzCore/Math/ToString.h>
|
#include <AzCore/Math/ToString.h>
|
||||||
|
|
||||||
namespace AzToolsFramework
|
namespace AzToolsFramework
|
||||||
@@ -44,7 +45,9 @@ namespace AzToolsFramework
|
|||||||
->DataElement(
|
->DataElement(
|
||||||
AZ::Edit::UIHandlers::Default, &EditorNonUniformScaleComponent::m_scale, "Non-uniform Scale",
|
AZ::Edit::UIHandlers::Default, &EditorNonUniformScaleComponent::m_scale, "Non-uniform Scale",
|
||||||
"Non-uniform scale for this entity only (does not propagate through hierarchy)")
|
"Non-uniform scale for this entity only (does not propagate through hierarchy)")
|
||||||
->Attribute(AZ::Edit::Attributes::Min, AZ::MinNonUniformScale)
|
->Attribute(AZ::Edit::Attributes::Min, AZ::MinTransformScale)
|
||||||
|
->Attribute(AZ::Edit::Attributes::Max, AZ::MaxTransformScale)
|
||||||
|
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNonUniformScaleComponent::OnScaleChanged)
|
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNonUniformScaleComponent::OnScaleChanged)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -106,13 +109,13 @@ namespace AzToolsFramework
|
|||||||
|
|
||||||
void EditorNonUniformScaleComponent::SetScale(const AZ::Vector3& scale)
|
void EditorNonUniformScaleComponent::SetScale(const AZ::Vector3& scale)
|
||||||
{
|
{
|
||||||
if (scale.GetMinElement() >= AZ::MinNonUniformScale)
|
if (scale.GetMinElement() >= AZ::MinTransformScale && scale.GetMaxElement() <= AZ::MaxTransformScale)
|
||||||
{
|
{
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AZ::Vector3 clampedScale = scale.GetMax(AZ::Vector3(AZ::MinNonUniformScale));
|
AZ::Vector3 clampedScale = scale.GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale));
|
||||||
AZ_Warning("Editor Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s",
|
AZ_Warning("Editor Non-uniform Scale Component", false, "SetScale value was clamped from %s to %s for entity %s",
|
||||||
AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str());
|
AZ::ToString(scale).c_str(), AZ::ToString(clampedScale).c_str(), GetEntity()->GetName().c_str());
|
||||||
m_scale = clampedScale;
|
m_scale = clampedScale;
|
||||||
|
|||||||
-1
@@ -1276,7 +1276,6 @@ namespace AzToolsFramework
|
|||||||
Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushableOnSliceRoot)->
|
Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushableOnSliceRoot)->
|
||||||
DataElement(TransformScaleHandler, &EditorTransform::m_scale, "Scale", "Local Scale")->
|
DataElement(TransformScaleHandler, &EditorTransform::m_scale, "Scale", "Local Scale")->
|
||||||
Attribute(AZ::Edit::Attributes::Step, 0.1f)->
|
Attribute(AZ::Edit::Attributes::Step, 0.1f)->
|
||||||
Attribute(AZ::Edit::Attributes::Min, 0.01f)->
|
|
||||||
Attribute(AZ::Edit::Attributes::ReadOnly, &EditorTransform::m_locked)
|
Attribute(AZ::Edit::Attributes::ReadOnly, &EditorTransform::m_locked)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "AzToolsFramework_precompiled.h"
|
#include "AzToolsFramework_precompiled.h"
|
||||||
#include <ToolsComponents/TransformScalePropertyHandler.h>
|
#include <ToolsComponents/TransformScalePropertyHandler.h>
|
||||||
|
#include <AzCore/Math/Transform.h>
|
||||||
#include <AzCore/Math/Vector3.h>
|
#include <AzCore/Math/Vector3.h>
|
||||||
|
|
||||||
namespace AzToolsFramework
|
namespace AzToolsFramework
|
||||||
@@ -36,8 +37,8 @@ namespace AzToolsFramework
|
|||||||
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, newCtrl);
|
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, newCtrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
newCtrl->setMinimum(0.01f);
|
newCtrl->setMinimum(AZ::MinTransformScale);
|
||||||
newCtrl->setMaximum(std::numeric_limits<float>::max());
|
newCtrl->setMaximum(AZ::MaxTransformScale);
|
||||||
|
|
||||||
return newCtrl;
|
return newCtrl;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1603,7 +1603,7 @@ namespace AzToolsFramework
|
|||||||
|
|
||||||
const AZ::Vector3 uniformScale = AZ::Vector3(action.m_start.m_sign * sumVectorElements(action.LocalScaleOffset()));
|
const AZ::Vector3 uniformScale = AZ::Vector3(action.m_start.m_sign * sumVectorElements(action.LocalScaleOffset()));
|
||||||
const AZ::Vector3 scale = (AZ::Vector3::CreateOne() +
|
const AZ::Vector3 scale = (AZ::Vector3::CreateOne() +
|
||||||
(uniformScale / initialScale)).GetMax(AZ::Vector3(0.01f));
|
(uniformScale / initialScale)).GetClamp(AZ::Vector3(AZ::MinTransformScale), AZ::Vector3(AZ::MaxTransformScale));
|
||||||
const AZ::Transform scaleTransform = AZ::Transform::CreateScale(scale);
|
const AZ::Transform scaleTransform = AZ::Transform::CreateScale(scale);
|
||||||
|
|
||||||
if (action.m_modifiers.Alt())
|
if (action.m_modifiers.Alt())
|
||||||
|
|||||||
+2
-1
@@ -54,8 +54,9 @@ namespace AZ
|
|||||||
RPI::SceneDescriptor sceneDesc;
|
RPI::SceneDescriptor sceneDesc;
|
||||||
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::TransformServiceFeatureProcessor");
|
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::TransformServiceFeatureProcessor");
|
||||||
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::MeshFeatureProcessor");
|
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::MeshFeatureProcessor");
|
||||||
|
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimplePointLightFeatureProcessor");
|
||||||
|
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SimpleSpotLightFeatureProcessor");
|
||||||
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::PointLightFeatureProcessor");
|
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::PointLightFeatureProcessor");
|
||||||
sceneDesc.m_featureProcessorNames.push_back("AZ::Render::SpotLightFeatureProcessor");
|
|
||||||
// There is currently a bug where having multiple DirectionalLightFeatureProcessors active can result in shadow flickering [ATOM-13568]
|
// There is currently a bug where having multiple DirectionalLightFeatureProcessors active can result in shadow flickering [ATOM-13568]
|
||||||
// as well as continually rebuilding MeshDrawPackets [ATOM-13633]. Lets just disable the directional light FP for now.
|
// as well as continually rebuilding MeshDrawPackets [ATOM-13633]. Lets just disable the directional light FP for now.
|
||||||
// Possibly re-enable with [GFX TODO][ATOM-13639]
|
// Possibly re-enable with [GFX TODO][ATOM-13639]
|
||||||
|
|||||||
Reference in New Issue
Block a user