Merge branch 'development' into ExposeLodControls
This commit is contained in:
+49
-5
@@ -41,12 +41,56 @@ namespace AZ
|
||||
virtual const AZ::Data::AssetId GetMaterialOverride(const MaterialAssignmentId& materialAssignmentId) const = 0;
|
||||
//! Clear material override
|
||||
virtual void ClearMaterialOverride(const MaterialAssignmentId& materialAssignmentId) = 0;
|
||||
//! Set a material property value override
|
||||
virtual void SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName, const AZStd::any& propertyValue) = 0;
|
||||
//! Get a material property value override
|
||||
virtual AZStd::any GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName) const = 0;
|
||||
//! Set a material property override value wrapped by an AZStd::any
|
||||
virtual void SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::any& value) = 0;
|
||||
//! Set a material property override value to a bool
|
||||
virtual void SetPropertyOverrideBool(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const bool& value) = 0;
|
||||
//! Set a material property override value to a integer
|
||||
virtual void SetPropertyOverrideInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const int32_t& value) = 0;
|
||||
//! Set a material property override value to a unsigned integer
|
||||
virtual void SetPropertyOverrideUInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const uint32_t& value) = 0;
|
||||
//! Set a material property override value to a float
|
||||
virtual void SetPropertyOverrideFloat(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const float& value) = 0;
|
||||
//! Set a material property override value to a Vector2
|
||||
virtual void SetPropertyOverrideVector2(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector2& value) = 0;
|
||||
//! Set a material property override value to a Vector3
|
||||
virtual void SetPropertyOverrideVector3(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector3& value) = 0;
|
||||
//! Set a material property override value to a Vector4
|
||||
virtual void SetPropertyOverrideVector4(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector4& value) = 0;
|
||||
//! Set a material property override value to a color
|
||||
virtual void SetPropertyOverrideColor(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Color& value) = 0;
|
||||
//! Set a material property override value to an image asset
|
||||
virtual void SetPropertyOverrideImageAsset(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Data::Asset<AZ::RPI::ImageAsset>& value) = 0;
|
||||
//! Set a material property override value to an image instance
|
||||
virtual void SetPropertyOverrideImageInstance(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Data::Instance<AZ::RPI::Image>& value) = 0;
|
||||
//! Set a material property override value to a string
|
||||
virtual void SetPropertyOverrideString(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::string& value) = 0;
|
||||
//! Get a material property override value wrapped by an AZStd::any
|
||||
virtual AZStd::any GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a bool
|
||||
virtual bool GetPropertyOverrideBool(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as an integer
|
||||
virtual int32_t GetPropertyOverrideInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as an unsigned integer
|
||||
virtual uint32_t GetPropertyOverrideUInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a float
|
||||
virtual float GetPropertyOverrideFloat(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a Vector2
|
||||
virtual AZ::Vector2 GetPropertyOverrideVector2(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a Vector3
|
||||
virtual AZ::Vector3 GetPropertyOverrideVector3(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a Vector4
|
||||
virtual AZ::Vector4 GetPropertyOverrideVector4(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a Color
|
||||
virtual AZ::Color GetPropertyOverrideColor(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as an image asset
|
||||
virtual AZ::Data::Asset<AZ::RPI::ImageAsset> GetPropertyOverrideImageAsset(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as an image instance
|
||||
virtual AZ::Data::Instance<AZ::RPI::Image> GetPropertyOverrideImageInstance(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Get a material property override value as a string
|
||||
virtual AZStd::string GetPropertyOverrideString(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const = 0;
|
||||
//! Clear property override for a specific material assignment
|
||||
virtual void ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName) = 0;
|
||||
virtual void ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) = 0;
|
||||
//! Clear property overrides for a specific material assignment
|
||||
virtual void ClearPropertyOverrides(const MaterialAssignmentId& materialAssignmentId) = 0;
|
||||
//! Clear all property overrides
|
||||
|
||||
+5
@@ -39,6 +39,11 @@ namespace AZ
|
||||
void CopySettingsTo(LookModificationSettingsInterface* settings);
|
||||
|
||||
bool ArePropertiesReadOnly() const { return !m_enabled; }
|
||||
|
||||
bool IsUsingCustomShaper() const {
|
||||
return m_shaperPresetType == ShaperPresetType::LinearCustomRange
|
||||
|| m_shaperPresetType == ShaperPresetType::Log2CustomRange;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -535,7 +535,7 @@ namespace AZ::Render
|
||||
|
||||
void AreaLightComponentController::SetPredictionSampleCount(uint32_t count)
|
||||
{
|
||||
m_configuration.m_predictionSampleCount = count;
|
||||
m_configuration.m_predictionSampleCount = static_cast<uint16_t>(count);
|
||||
if (m_lightShapeDelegate)
|
||||
{
|
||||
m_lightShapeDelegate->SetPredictionSampleCount(count);
|
||||
@@ -549,7 +549,7 @@ namespace AZ::Render
|
||||
|
||||
void AreaLightComponentController::SetFilteringSampleCount(uint32_t count)
|
||||
{
|
||||
m_configuration.m_filteringSampleCount = count;
|
||||
m_configuration.m_filteringSampleCount = static_cast<uint16_t>(count);
|
||||
if (m_lightShapeDelegate)
|
||||
{
|
||||
m_lightShapeDelegate->SetFilteringSampleCount(count);
|
||||
|
||||
+2
-1
@@ -259,7 +259,8 @@ namespace AZ
|
||||
|
||||
void DirectionalLightComponentController::SetCascadeCount(uint32_t cascadeCount)
|
||||
{
|
||||
const uint16_t cascadeCount16 = cascadeCount = GetMin(Shadow::MaxNumberOfCascades, GetMax<uint16_t>(1, aznumeric_cast<uint16_t>(cascadeCount)));
|
||||
const uint16_t cascadeCount16 = GetMin(static_cast<uint16_t>(Shadow::MaxNumberOfCascades), GetMax<uint16_t>(1, aznumeric_cast<uint16_t>(cascadeCount)));
|
||||
cascadeCount = cascadeCount16;
|
||||
m_configuration.m_cascadeCount = cascadeCount16;
|
||||
if (m_featureProcessor)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace AZ::Render
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count);
|
||||
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace AZ::Render
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count);
|
||||
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ namespace AZ
|
||||
{
|
||||
transformedVertices.push_back(transform.TransformPoint(Vector3(vertex.GetX(), vertex.GetY(), 0.0f)));
|
||||
}
|
||||
GetFeatureProcessor()->SetPolygonPoints(GetLightHandle(), transformedVertices.data(), transformedVertices.size(), GetTransform().GetBasisZ());
|
||||
GetFeatureProcessor()->SetPolygonPoints(GetLightHandle(), transformedVertices.data(), static_cast<uint32_t>(transformedVertices.size()), GetTransform().GetBasisZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -104,7 +104,7 @@ namespace AZ::Render
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count);
|
||||
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace AZ::Render
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count);
|
||||
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
static const size_t DefaultMaterialSlotIndex = -1;
|
||||
static const size_t DefaultMaterialSlotIndex = std::numeric_limits<size_t>::max();
|
||||
|
||||
//! Details for a single editable material assignment
|
||||
struct EditorMaterialComponentSlot final
|
||||
|
||||
+178
-9
@@ -44,7 +44,29 @@ namespace AZ
|
||||
->Event("GetMaterialOverride", &MaterialComponentRequestBus::Events::GetMaterialOverride)
|
||||
->Event("ClearMaterialOverride", &MaterialComponentRequestBus::Events::ClearMaterialOverride)
|
||||
->Event("SetPropertyOverride", &MaterialComponentRequestBus::Events::SetPropertyOverride)
|
||||
->Event("SetPropertyOverrideBool", &MaterialComponentRequestBus::Events::SetPropertyOverrideBool)
|
||||
->Event("SetPropertyOverrideInt32", &MaterialComponentRequestBus::Events::SetPropertyOverrideInt32)
|
||||
->Event("SetPropertyOverrideUInt32", &MaterialComponentRequestBus::Events::SetPropertyOverrideUInt32)
|
||||
->Event("SetPropertyOverrideFloat", &MaterialComponentRequestBus::Events::SetPropertyOverrideFloat)
|
||||
->Event("SetPropertyOverrideVector2", &MaterialComponentRequestBus::Events::SetPropertyOverrideVector2)
|
||||
->Event("SetPropertyOverrideVector3", &MaterialComponentRequestBus::Events::SetPropertyOverrideVector3)
|
||||
->Event("SetPropertyOverrideVector4", &MaterialComponentRequestBus::Events::SetPropertyOverrideVector4)
|
||||
->Event("SetPropertyOverrideColor", &MaterialComponentRequestBus::Events::SetPropertyOverrideColor)
|
||||
->Event("SetPropertyOverrideImageAsset", &MaterialComponentRequestBus::Events::SetPropertyOverrideImageAsset)
|
||||
->Event("SetPropertyOverrideImageInstance", &MaterialComponentRequestBus::Events::SetPropertyOverrideImageInstance)
|
||||
->Event("SetPropertyOverrideString", &MaterialComponentRequestBus::Events::SetPropertyOverrideString)
|
||||
->Event("GetPropertyOverride", &MaterialComponentRequestBus::Events::GetPropertyOverride)
|
||||
->Event("GetPropertyOverrideBool", &MaterialComponentRequestBus::Events::GetPropertyOverrideBool)
|
||||
->Event("GetPropertyOverrideInt32", &MaterialComponentRequestBus::Events::GetPropertyOverrideInt32)
|
||||
->Event("GetPropertyOverrideUInt32", &MaterialComponentRequestBus::Events::GetPropertyOverrideUInt32)
|
||||
->Event("GetPropertyOverrideFloat", &MaterialComponentRequestBus::Events::GetPropertyOverrideFloat)
|
||||
->Event("GetPropertyOverrideVector2", &MaterialComponentRequestBus::Events::GetPropertyOverrideVector2)
|
||||
->Event("GetPropertyOverrideVector3", &MaterialComponentRequestBus::Events::GetPropertyOverrideVector3)
|
||||
->Event("GetPropertyOverrideVector4", &MaterialComponentRequestBus::Events::GetPropertyOverrideVector4)
|
||||
->Event("GetPropertyOverrideColor", &MaterialComponentRequestBus::Events::GetPropertyOverrideColor)
|
||||
->Event("GetPropertyOverrideImageAsset", &MaterialComponentRequestBus::Events::GetPropertyOverrideImageAsset)
|
||||
->Event("GetPropertyOverrideImageInstance", &MaterialComponentRequestBus::Events::GetPropertyOverrideImageInstance)
|
||||
->Event("GetPropertyOverrideString", &MaterialComponentRequestBus::Events::GetPropertyOverrideString)
|
||||
->Event("ClearPropertyOverride", &MaterialComponentRequestBus::Events::ClearPropertyOverride)
|
||||
->Event("ClearPropertyOverrides", &MaterialComponentRequestBus::Events::ClearPropertyOverrides)
|
||||
->Event("ClearAllPropertyOverrides", &MaterialComponentRequestBus::Events::ClearAllPropertyOverrides)
|
||||
@@ -331,27 +353,97 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName, const AZStd::any& propertyValue)
|
||||
void MaterialComponentController::SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::any& value)
|
||||
{
|
||||
auto& materialAssignment = m_configuration.m_materials[materialAssignmentId];
|
||||
|
||||
// When applying property overrides for the first time, new instance needs to be created in case the current instance is already used somewhere else to keep overrides local
|
||||
if (materialAssignment.m_propertyOverrides.empty())
|
||||
{
|
||||
materialAssignment.m_propertyOverrides[propertyName] = propertyValue;
|
||||
materialAssignment.m_propertyOverrides[AZ::Name(propertyName)] = value;
|
||||
materialAssignment.RebuildInstance();
|
||||
QueueMaterialUpdateNotification();
|
||||
}
|
||||
else
|
||||
{
|
||||
materialAssignment.m_propertyOverrides[propertyName] = propertyValue;
|
||||
materialAssignment.m_propertyOverrides[AZ::Name(propertyName)] = value;
|
||||
}
|
||||
|
||||
QueuePropertyChanges(materialAssignmentId);
|
||||
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialsEdited, m_configuration.m_materials);
|
||||
}
|
||||
|
||||
AZStd::any MaterialComponentController::GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName) const
|
||||
void MaterialComponentController::SetPropertyOverrideBool(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const bool& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideInt32(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const int32_t& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideUInt32(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const uint32_t& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideFloat(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const float& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideVector2(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector2& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideVector3(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector3& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideVector4(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector4& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideColor(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Color& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideImageAsset(
|
||||
const MaterialAssignmentId& materialAssignmentId,
|
||||
const AZStd::string& propertyName,
|
||||
const AZ::Data::Asset<AZ::RPI::ImageAsset>& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideImageInstance(
|
||||
const MaterialAssignmentId& materialAssignmentId,
|
||||
const AZStd::string& propertyName,
|
||||
const AZ::Data::Instance<AZ::RPI::Image>& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrideString(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::string& value)
|
||||
{
|
||||
SetPropertyOverride(materialAssignmentId, propertyName, AZStd::any(value));
|
||||
}
|
||||
|
||||
AZStd::any MaterialComponentController::GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const auto materialIt = m_configuration.m_materials.find(materialAssignmentId);
|
||||
if (materialIt == m_configuration.m_materials.end())
|
||||
@@ -360,17 +452,94 @@ namespace AZ
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto propertyIt = materialIt->second.m_propertyOverrides.find(propertyName);
|
||||
const auto propertyIt = materialIt->second.m_propertyOverrides.find(AZ::Name(propertyName));
|
||||
if (propertyIt == materialIt->second.m_propertyOverrides.end())
|
||||
{
|
||||
AZ_Error("MaterialComponentController", false, "Property not found: %s.", propertyName.GetCStr());
|
||||
AZ_Error("MaterialComponentController", false, "Property not found: %s.", propertyName.c_str());
|
||||
return {};
|
||||
}
|
||||
|
||||
return propertyIt->second;
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName)
|
||||
bool MaterialComponentController::GetPropertyOverrideBool(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<bool>() ? AZStd::any_cast<bool>(value) : false;
|
||||
}
|
||||
|
||||
int32_t MaterialComponentController::GetPropertyOverrideInt32(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<int32_t>() ? AZStd::any_cast<int32_t>(value) : 0;
|
||||
}
|
||||
|
||||
uint32_t MaterialComponentController::GetPropertyOverrideUInt32(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<uint32_t>() ? AZStd::any_cast<uint32_t>(value) : 0;
|
||||
}
|
||||
|
||||
float MaterialComponentController::GetPropertyOverrideFloat(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<float>() ? AZStd::any_cast<float>(value) : 0.0f;
|
||||
}
|
||||
|
||||
AZ::Vector2 MaterialComponentController::GetPropertyOverrideVector2(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Vector2>() ? AZStd::any_cast<AZ::Vector2>(value) : AZ::Vector2::CreateZero();
|
||||
}
|
||||
|
||||
AZ::Vector3 MaterialComponentController::GetPropertyOverrideVector3(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Vector3>() ? AZStd::any_cast<AZ::Vector3>(value) : AZ::Vector3::CreateZero();
|
||||
}
|
||||
|
||||
AZ::Vector4 MaterialComponentController::GetPropertyOverrideVector4(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Vector4>() ? AZStd::any_cast<AZ::Vector4>(value) : AZ::Vector4::CreateZero();
|
||||
}
|
||||
|
||||
AZ::Color MaterialComponentController::GetPropertyOverrideColor(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Color>() ? AZStd::any_cast<AZ::Color>(value) : AZ::Color::CreateZero();
|
||||
}
|
||||
|
||||
AZ::Data::Asset<AZ::RPI::ImageAsset> MaterialComponentController::GetPropertyOverrideImageAsset(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Data::Asset<AZ::RPI::ImageAsset>>() ? AZStd::any_cast<AZ::Data::Asset<AZ::RPI::ImageAsset>>(value) : AZ::Data::Asset<AZ::RPI::ImageAsset>();
|
||||
}
|
||||
|
||||
AZ::Data::Instance<AZ::RPI::Image> MaterialComponentController::GetPropertyOverrideImageInstance(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZ::Data::Instance<AZ::RPI::Image>>() ? AZStd::any_cast<AZ::Data::Instance<AZ::RPI::Image>>(value) : AZ::Data::Instance<AZ::RPI::Image>();
|
||||
}
|
||||
|
||||
AZStd::string MaterialComponentController::GetPropertyOverrideString(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const
|
||||
{
|
||||
const AZStd::any& value = GetPropertyOverride(materialAssignmentId, propertyName);
|
||||
return !value.empty() && value.is<AZStd::string>() ? AZStd::any_cast<AZStd::string>(value) : AZStd::string();
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName)
|
||||
{
|
||||
auto materialIt = m_configuration.m_materials.find(materialAssignmentId);
|
||||
if (materialIt == m_configuration.m_materials.end())
|
||||
@@ -379,10 +548,10 @@ namespace AZ
|
||||
return;
|
||||
}
|
||||
|
||||
auto propertyIt = materialIt->second.m_propertyOverrides.find(propertyName);
|
||||
auto propertyIt = materialIt->second.m_propertyOverrides.find(AZ::Name(propertyName));
|
||||
if (propertyIt == materialIt->second.m_propertyOverrides.end())
|
||||
{
|
||||
AZ_Error("MaterialComponentController", false, "Property not found: %s.", propertyName.GetCStr());
|
||||
AZ_Error("MaterialComponentController", false, "Property not found: %s.", propertyName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+27
-3
@@ -57,9 +57,33 @@ namespace AZ
|
||||
const AZ::Data::AssetId GetMaterialOverride(const MaterialAssignmentId& materialAssignmentId) const override;
|
||||
void ClearMaterialOverride(const MaterialAssignmentId& materialAssignmentId) override;
|
||||
|
||||
void SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName, const AZStd::any& propertyValue) override;
|
||||
AZStd::any GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName) const override;
|
||||
void ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const Name& propertyName) override;
|
||||
void SetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::any& value) override;
|
||||
void SetPropertyOverrideBool(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const bool& value) override;
|
||||
void SetPropertyOverrideInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const int32_t& value) override;
|
||||
void SetPropertyOverrideUInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const uint32_t& value) override;
|
||||
void SetPropertyOverrideFloat(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const float& value) override;
|
||||
void SetPropertyOverrideVector2(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector2& value) override;
|
||||
void SetPropertyOverrideVector3(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector3& value) override;
|
||||
void SetPropertyOverrideVector4(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Vector4& value) override;
|
||||
void SetPropertyOverrideColor(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Color& value) override;
|
||||
void SetPropertyOverrideImageAsset(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Data::Asset<AZ::RPI::ImageAsset>& value) override;
|
||||
void SetPropertyOverrideImageInstance(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZ::Data::Instance<AZ::RPI::Image>& value) override;
|
||||
void SetPropertyOverrideString(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName, const AZStd::string& value) override;
|
||||
|
||||
AZStd::any GetPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
bool GetPropertyOverrideBool(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
int32_t GetPropertyOverrideInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
uint32_t GetPropertyOverrideUInt32(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
float GetPropertyOverrideFloat(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Vector2 GetPropertyOverrideVector2(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Vector3 GetPropertyOverrideVector3(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Vector4 GetPropertyOverrideVector4(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Color GetPropertyOverrideColor(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Data::Asset<AZ::RPI::ImageAsset> GetPropertyOverrideImageAsset(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZ::Data::Instance<AZ::RPI::Image> GetPropertyOverrideImageInstance(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
AZStd::string GetPropertyOverrideString(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) const override;
|
||||
|
||||
void ClearPropertyOverride(const MaterialAssignmentId& materialAssignmentId, const AZStd::string& propertyName) override;
|
||||
void ClearPropertyOverrides(const MaterialAssignmentId& materialAssignmentId) override;
|
||||
void ClearAllPropertyOverrides() override;
|
||||
MaterialPropertyOverrideMap GetPropertyOverrides(const MaterialAssignmentId& materialAssignmentId) const override;
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace AZ
|
||||
{
|
||||
EditorMeshStatsForLod stats;
|
||||
const auto& meshes = lodAsset->GetMeshes();
|
||||
stats.m_meshCount = meshes.size();
|
||||
stats.m_meshCount = static_cast<AZ::u32>(meshes.size());
|
||||
for (const auto& mesh : meshes)
|
||||
{
|
||||
stats.m_vertCount += mesh.GetVertexCount();
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace AZ
|
||||
{
|
||||
if (m_modelAsset.IsReady())
|
||||
{
|
||||
lodCount = m_modelAsset->GetLodCount();
|
||||
lodCount = static_cast<uint32_t>(m_modelAsset->GetLodCount());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -103,7 +103,7 @@ namespace AZ
|
||||
Data::Instance<RPI::Model> model = Data::InstanceDatabase<RPI::Model>::Instance().Find(Data::InstanceId::CreateFromAssetId(m_modelAsset.GetId()));
|
||||
if (model)
|
||||
{
|
||||
lodCount = model->GetLodCount();
|
||||
lodCount = static_cast<uint32_t>(model->GetLodCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
-22
@@ -48,33 +48,44 @@ namespace AZ
|
||||
&LookModificationComponentConfig::m_enabled,
|
||||
"Enable look modification",
|
||||
"Enable look modification.")
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentConfig::m_colorGradingLut, "Color Grading LUT", "Color grading LUT")
|
||||
|
||||
->ClassElement(Edit::ClassElements::EditorData, "")
|
||||
->DataElement(Edit::UIHandlers::ComboBox,
|
||||
&LookModificationComponentConfig::m_shaperPresetType,
|
||||
"Shaper Type",
|
||||
"Shaper Type.")
|
||||
->EnumAttribute(ShaperPresetType::None, "None")
|
||||
->EnumAttribute(ShaperPresetType::Log2_48_nits, "Log2_48_nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_1000_nits, "Log2_1000_nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_2000_nits, "Log2_2000_nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_4000_nits, "Log2_4000_nits")
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
|
||||
&LookModificationComponentConfig::m_shaperPresetType, "Shaper Type", "Shaper Type.")
|
||||
->EnumAttribute(ShaperPresetType::None, "None")
|
||||
->EnumAttribute(ShaperPresetType::LinearCustomRange, "Linear Custom Range")
|
||||
->EnumAttribute(ShaperPresetType::Log2_48Nits, "Log2 48 nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_1000Nits, "Log2 1000 nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_2000Nits, "Log2 2000 nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2_4000Nits, "Log2 4000 nits")
|
||||
->EnumAttribute(ShaperPresetType::Log2CustomRange, "Log2 Custom Range")
|
||||
->EnumAttribute(ShaperPresetType::PqSmpteSt2084, "PQ (SMPTE ST 2084)")
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::EntireTree)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMinExposure, "Minimum Exposure", "The minimum exposure this LUT supports. Values smaller than this will be clamped to 0.")
|
||||
->Attribute(AZ::Edit::Attributes::Min, -50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::SoftMin, -20.0f)
|
||||
->Attribute(AZ::Edit::Attributes::SoftMax, 0.0f)
|
||||
->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMaxExposure, "Maximum Exposure", "The maximum exposure this LUT supports. Values larger than this will be clamped.")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::SoftMin, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::SoftMax, 20.0f)
|
||||
->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutIntensity, "LUT Intensity", "Blend intensity of this LUT.")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
|
||||
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutOverride, "LUT Override", "Blend intensity of this LUT.")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
|
||||
|
||||
// Overrides
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace AZ
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<EditorRadiusWeightModifierComponent>(
|
||||
"Radius Weight Modifier", "Modifies PostFX override factor based on proximity of an influencer against this entity's bounding sphere")
|
||||
"PostFX Radius Weight Modifier", "Modifies PostFX override factor based on proximity of an influencer against this entity's bounding sphere")
|
||||
->ClassElement(Edit::ClassElements::EditorData, "")
|
||||
->Attribute(Edit::Attributes::Category, "Atom")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg")
|
||||
|
||||
+2
-2
@@ -147,7 +147,7 @@ namespace SurfaceData
|
||||
|
||||
bool SurfaceDataMeshComponent::DoRayTrace(const AZ::Vector3& inPosition, AZ::Vector3& outPosition, AZ::Vector3& outNormal) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
AZStd::lock_guard<decltype(m_cacheMutex)> lock(m_cacheMutex);
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace SurfaceData
|
||||
|
||||
void SurfaceDataMeshComponent::UpdateMeshData()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
bool meshValidBeforeUpdate = false;
|
||||
bool meshValidAfterUpdate = false;
|
||||
|
||||
Reference in New Issue
Block a user