merge from main
This commit is contained in:
@@ -76,4 +76,4 @@ namespace GradientSignal
|
||||
private:
|
||||
ConstantGradientConfig m_configuration;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +109,4 @@ namespace GradientSignal
|
||||
DitherGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ namespace GradientSignal
|
||||
void GradientTransformComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
services.push_back(AZ_CRC("GradientTransformService", 0x8c8c5ecc));
|
||||
services.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
}
|
||||
|
||||
void GradientTransformComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
|
||||
@@ -79,4 +79,4 @@ namespace GradientSignal
|
||||
InvertGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +99,4 @@ namespace GradientSignal
|
||||
LevelsGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,4 @@ namespace GradientSignal
|
||||
MixedGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,4 +93,4 @@ namespace GradientSignal
|
||||
float GetFrequency() const override;
|
||||
void SetFrequency(float frequency) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,4 +93,4 @@ namespace GradientSignal
|
||||
PosterizeGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,4 +74,4 @@ namespace GradientSignal
|
||||
int GetRandomSeed() const override;
|
||||
void SetRandomSeed(int seed) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +79,4 @@ namespace GradientSignal
|
||||
ReferenceGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,4 +90,4 @@ namespace GradientSignal
|
||||
ShapeAreaFalloffGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,4 +98,4 @@ namespace GradientSignal
|
||||
SmoothStepGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,4 +114,4 @@ namespace GradientSignal
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
AZStd::atomic_bool m_dirty{ false };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,4 +127,4 @@ namespace GradientSignal
|
||||
private:
|
||||
SurfaceSlopeGradientConfig m_configuration;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,4 +83,4 @@ namespace GradientSignal
|
||||
ThresholdGradientConfig m_configuration;
|
||||
LmbrCentral::DependencyMonitor m_dependencyMonitor;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorWrappedComponentBase::ReflectSubClass<EditorConstantGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace GradientSignal
|
||||
BaseClassType::ConfigurationChanged();
|
||||
return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
namespace GradientSignal
|
||||
{
|
||||
} //namespace GradientSignal
|
||||
} //namespace GradientSignal
|
||||
|
||||
@@ -65,4 +65,4 @@ namespace GradientSignal
|
||||
m_component.WriteOutConfig(&m_configuration);
|
||||
SetDirty();
|
||||
}
|
||||
} //namespace GradientSignal
|
||||
} //namespace GradientSignal
|
||||
|
||||
@@ -46,4 +46,4 @@ namespace GradientSignal
|
||||
|
||||
void UpdateFromShape();
|
||||
};
|
||||
} //namespace GradientSignal
|
||||
} //namespace GradientSignal
|
||||
|
||||
@@ -24,13 +24,10 @@
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <QImageReader>
|
||||
#include <QDirIterator>
|
||||
#include <GradientSignalSystemComponent.h>
|
||||
#include <GradientSignal/GradientImageConversion.h>
|
||||
#include <ImageProcessing/ImageObject.h>
|
||||
#include <ImageProcessing/ImageProcessingBus.h>
|
||||
#include <Atom/ImageProcessing/ImageObject.h>
|
||||
#include <Atom/ImageProcessing/ImageProcessingBus.h>
|
||||
|
||||
@@ -258,10 +255,10 @@ namespace GradientSignal
|
||||
return AZ::Uuid::CreateString("{7520DF20-16CA-4CF6-A6DB-D96759A09EE4}");
|
||||
}
|
||||
|
||||
static AZStd::unique_ptr<ImageAsset> LegacyLoadImageFromPath(const AZStd::string& fullPath)
|
||||
static AZStd::unique_ptr<ImageAsset> AtomLoadImageFromPath(const AZStd::string& fullPath)
|
||||
{
|
||||
ImageProcessing::IImageObjectPtr imageObject;
|
||||
ImageProcessing::ImageProcessingRequestBus::BroadcastResult(imageObject, &ImageProcessing::ImageProcessingRequests::LoadImage,
|
||||
ImageProcessingAtom::IImageObjectPtr imageObject;
|
||||
ImageProcessingAtom::ImageProcessingRequestBus::BroadcastResult(imageObject, &ImageProcessingAtom::ImageProcessingRequests::LoadImage,
|
||||
fullPath);
|
||||
|
||||
if (!imageObject)
|
||||
@@ -291,57 +288,9 @@ namespace GradientSignal
|
||||
return imageAsset;
|
||||
}
|
||||
|
||||
static ImageProcessing::EPixelFormat AtomPixelFormatToLegacyPixelFormat(ImageProcessingAtom::EPixelFormat atomPixFormat)
|
||||
{
|
||||
// This could be dangerous to do if these enums have differences in the middle.
|
||||
// So far the enumerations correspond 1-to-1. Worst case this could be changed into a massive switch block.
|
||||
int pixelFormatInt = static_cast<int>(atomPixFormat);
|
||||
return static_cast<ImageProcessing::EPixelFormat>(pixelFormatInt);
|
||||
}
|
||||
|
||||
static AZStd::unique_ptr<ImageAsset> AtomLoadImageFromPath(const AZStd::string& fullPath)
|
||||
{
|
||||
ImageProcessingAtom::IImageObjectPtr imageObject;
|
||||
ImageProcessingAtom::ImageProcessingRequestBus::BroadcastResult(imageObject, &ImageProcessingAtom::ImageProcessingRequests::LoadImage,
|
||||
fullPath);
|
||||
|
||||
if (!imageObject)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
//create a new image asset
|
||||
auto imageAsset = AZStd::make_unique<ImageAsset>();
|
||||
|
||||
if (!imageAsset)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
imageAsset->m_imageWidth = imageObject->GetWidth(0);
|
||||
imageAsset->m_imageHeight = imageObject->GetHeight(0);
|
||||
imageAsset->m_imageFormat = AtomPixelFormatToLegacyPixelFormat(imageObject->GetPixelFormat());
|
||||
|
||||
AZ::u8* mem = nullptr;
|
||||
AZ::u32 pitch = 0;
|
||||
AZ::u32 mipBufferSize = imageObject->GetMipBufSize(0);
|
||||
imageObject->GetImagePointer(0, mem, pitch);
|
||||
|
||||
imageAsset->m_imageData = { mem, mem + mipBufferSize };
|
||||
|
||||
return imageAsset;
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<ImageAsset> EditorImageBuilderWorker::LoadImageFromPath(const AZStd::string& fullPath)
|
||||
{
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
return AtomLoadImageFromPath(fullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
return LegacyLoadImageFromPath(fullPath);
|
||||
}
|
||||
return AtomLoadImageFromPath(fullPath);
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<ImageSettings> EditorImageBuilderWorker::LoadImageSettingsFromPath(const AZStd::string& fullPath)
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorImageGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ namespace GradientSignal
|
||||
static constexpr const char* const s_viewportIcon = "Editor/Icons/Components/Viewport/Gradient.png";
|
||||
static constexpr const char* const s_helpUrl = "https://docs.aws.amazon.com/console/lumberyard/gradients/image-gradient";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorInvertGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ namespace GradientSignal
|
||||
static constexpr const char* const s_viewportIcon = "Editor/Icons/Components/Viewport/GradientModifier.png";
|
||||
static constexpr const char* const s_helpUrl = "https://docs.aws.amazon.com/console/lumberyard/gradientmodifiers/invert-gradient-modifier";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorLevelsGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ namespace GradientSignal
|
||||
static constexpr const char* const s_viewportIcon = "Editor/Icons/Components/Viewport/GradientModifier.png";
|
||||
static constexpr const char* const s_helpUrl = "https://docs.aws.amazon.com/console/lumberyard/gradientmodifiers/levels-gradient-modifier";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,4 @@ namespace GradientSignal
|
||||
|
||||
return EditorGradientComponentBase::ConfigurationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorPosterizeGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,4 @@ namespace GradientSignal
|
||||
|
||||
return EditorGradientComponentBase::ConfigurationChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorReferenceGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorShapeAreaFalloffGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorSmoothStepGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,4 @@ namespace GradientSignal
|
||||
m_component.WriteOutConfig(&m_configuration);
|
||||
SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorSurfaceMaskGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorSurfaceSlopeGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace GradientSignal
|
||||
{
|
||||
EditorGradientComponentBase::ReflectSubClass<EditorThresholdGradientComponent, BaseClassType>(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "GradientSignal_precompiled.h"
|
||||
|
||||
#include <GradientSignal/GradientImageConversion.h>
|
||||
#include <ImageProcessing/PixelFormats.h>
|
||||
#include <Atom/ImageProcessing/PixelFormats.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -25,10 +25,10 @@ namespace
|
||||
constexpr auto A = 3;
|
||||
}
|
||||
|
||||
ImageProcessing::EPixelFormat ExportFormatToPixelFormat(GradientSignal::ExportFormat format)
|
||||
ImageProcessingAtom::EPixelFormat ExportFormatToPixelFormat(GradientSignal::ExportFormat format)
|
||||
{
|
||||
using namespace GradientSignal;
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
@@ -49,29 +49,29 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
template <ImageProcessing::EPixelFormat>
|
||||
template <ImageProcessingAtom::EPixelFormat>
|
||||
struct Underlying {};
|
||||
|
||||
template <>
|
||||
struct Underlying<ImageProcessing::EPixelFormat::ePixelFormat_R8>
|
||||
struct Underlying<ImageProcessingAtom::EPixelFormat::ePixelFormat_R8>
|
||||
{
|
||||
using type = AZ::u8;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Underlying<ImageProcessing::EPixelFormat::ePixelFormat_R16>
|
||||
struct Underlying<ImageProcessingAtom::EPixelFormat::ePixelFormat_R16>
|
||||
{
|
||||
using type = AZ::u16;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Underlying<ImageProcessing::EPixelFormat::ePixelFormat_R32>
|
||||
struct Underlying<ImageProcessingAtom::EPixelFormat::ePixelFormat_R32>
|
||||
{
|
||||
using type = AZ::u32;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Underlying<ImageProcessing::EPixelFormat::ePixelFormat_R32F>
|
||||
struct Underlying<ImageProcessingAtom::EPixelFormat::ePixelFormat_R32F>
|
||||
{
|
||||
using type = float;
|
||||
};
|
||||
@@ -167,10 +167,10 @@ namespace
|
||||
buffer = AZStd::move(newBuffer);
|
||||
}
|
||||
|
||||
template <ImageProcessing::EPixelFormat Old>
|
||||
void ConvertBufferType(AZStd::vector<AZ::u8>& buffer, ImageProcessing::EPixelFormat newFormat, bool autoScale, AZStd::pair<float, float> userRange)
|
||||
template <ImageProcessingAtom::EPixelFormat Old>
|
||||
void ConvertBufferType(AZStd::vector<AZ::u8>& buffer, ImageProcessingAtom::EPixelFormat newFormat, bool autoScale, AZStd::pair<float, float> userRange)
|
||||
{
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (newFormat)
|
||||
{
|
||||
@@ -195,9 +195,9 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
ImageProcessing::EPixelFormat ConvertBufferType(AZStd::vector<AZ::u8>& buffer, ImageProcessing::EPixelFormat old, ImageProcessing::EPixelFormat newFormat, bool autoScale, AZStd::pair<float, float> userRange)
|
||||
ImageProcessingAtom::EPixelFormat ConvertBufferType(AZStd::vector<AZ::u8>& buffer, ImageProcessingAtom::EPixelFormat old, ImageProcessingAtom::EPixelFormat newFormat, bool autoScale, AZStd::pair<float, float> userRange)
|
||||
{
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (old)
|
||||
{
|
||||
@@ -356,9 +356,9 @@ namespace
|
||||
mem.resize(mem.size() / channels);
|
||||
}
|
||||
|
||||
AZStd::size_t GetChannels(ImageProcessing::EPixelFormat format)
|
||||
AZStd::size_t GetChannels(ImageProcessingAtom::EPixelFormat format)
|
||||
{
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
@@ -379,10 +379,10 @@ namespace
|
||||
}
|
||||
|
||||
template <template <typename> typename Op>
|
||||
ImageProcessing::EPixelFormat CallHelper(ImageProcessing::EPixelFormat format,
|
||||
ImageProcessingAtom::EPixelFormat CallHelper(ImageProcessingAtom::EPixelFormat format,
|
||||
GradientSignal::ChannelMask mask, GradientSignal::AlphaExportTransform alphaTransform, AZStd::vector<AZ::u8>& mem)
|
||||
{
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
@@ -447,7 +447,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
ImageProcessing::EPixelFormat OperationHelper(GradientSignal::ChannelExportTransform op, ImageProcessing::EPixelFormat format,
|
||||
ImageProcessingAtom::EPixelFormat OperationHelper(GradientSignal::ChannelExportTransform op, ImageProcessingAtom::EPixelFormat format,
|
||||
GradientSignal::ChannelMask mask, GradientSignal::AlphaExportTransform alphaTransform, AZStd::vector<AZ::u8>& mem)
|
||||
{
|
||||
switch (op)
|
||||
|
||||
@@ -125,4 +125,4 @@ namespace GradientSignal
|
||||
}
|
||||
}
|
||||
|
||||
AZ_DECLARE_MODULE_CLASS(Gem_GradientSignalEditor, GradientSignal::GradientSignalEditorModule)
|
||||
AZ_DECLARE_MODULE_CLASS(Gem_GradientSignalEditor, GradientSignal::GradientSignalEditorModule)
|
||||
|
||||
@@ -46,4 +46,4 @@ namespace GradientSignal
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,4 @@ namespace GradientSignal
|
||||
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,32 +19,32 @@
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
|
||||
#include <ImageProcessing/PixelFormats.h>
|
||||
#include <Atom/ImageProcessing/PixelFormats.h>
|
||||
#include <GradientSignal/Util.h>
|
||||
#include <numeric>
|
||||
|
||||
namespace
|
||||
{
|
||||
template <ImageProcessing::EPixelFormat>
|
||||
template <ImageProcessingAtom::EPixelFormat>
|
||||
float RetrieveValue(const AZ::u8* mem, size_t index)
|
||||
{
|
||||
AZ_Assert(false, "Unimplemented!");
|
||||
}
|
||||
|
||||
template <>
|
||||
float RetrieveValue<ImageProcessing::EPixelFormat::ePixelFormat_Unknown>([[maybe_unused]] const AZ::u8* mem, [[maybe_unused]] size_t index)
|
||||
float RetrieveValue<ImageProcessingAtom::EPixelFormat::ePixelFormat_Unknown>([[maybe_unused]] const AZ::u8* mem, [[maybe_unused]] size_t index)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
template <>
|
||||
float RetrieveValue<ImageProcessing::EPixelFormat::ePixelFormat_R8>(const AZ::u8* mem, size_t index)
|
||||
float RetrieveValue<ImageProcessingAtom::EPixelFormat::ePixelFormat_R8>(const AZ::u8* mem, size_t index)
|
||||
{
|
||||
return mem[index] / static_cast<float>(std::numeric_limits<AZ::u8>::max());
|
||||
}
|
||||
|
||||
template <>
|
||||
float RetrieveValue<ImageProcessing::EPixelFormat::ePixelFormat_R16>(const AZ::u8* mem, size_t index)
|
||||
float RetrieveValue<ImageProcessingAtom::EPixelFormat::ePixelFormat_R16>(const AZ::u8* mem, size_t index)
|
||||
{
|
||||
// 16 bits per channel
|
||||
auto actualMem = reinterpret_cast<const AZ::u16*>(mem);
|
||||
@@ -54,7 +54,7 @@ namespace
|
||||
}
|
||||
|
||||
template <>
|
||||
float RetrieveValue<ImageProcessing::EPixelFormat::ePixelFormat_R32>(const AZ::u8* mem, size_t index)
|
||||
float RetrieveValue<ImageProcessingAtom::EPixelFormat::ePixelFormat_R32>(const AZ::u8* mem, size_t index)
|
||||
{
|
||||
// 32 bits per channel
|
||||
auto actualMem = reinterpret_cast<const AZ::u32*>(mem);
|
||||
@@ -64,7 +64,7 @@ namespace
|
||||
}
|
||||
|
||||
template <>
|
||||
float RetrieveValue<ImageProcessing::EPixelFormat::ePixelFormat_R32F>(const AZ::u8* mem, size_t index)
|
||||
float RetrieveValue<ImageProcessingAtom::EPixelFormat::ePixelFormat_R32F>(const AZ::u8* mem, size_t index)
|
||||
{
|
||||
// 32 bits per channel
|
||||
auto actualMem = reinterpret_cast<const float*>(mem);
|
||||
@@ -73,9 +73,9 @@ namespace
|
||||
return *actualMem;
|
||||
}
|
||||
|
||||
float RetrieveValue(const AZ::u8* mem, size_t index, ImageProcessing::EPixelFormat format)
|
||||
float RetrieveValue(const AZ::u8* mem, size_t index, ImageProcessingAtom::EPixelFormat format)
|
||||
{
|
||||
using namespace ImageProcessing;
|
||||
using namespace ImageProcessingAtom;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
@@ -142,9 +142,9 @@ namespace GradientSignal
|
||||
}
|
||||
|
||||
AZ::SerializeContext::DataElementNode& format = classElement.GetSubElement(formatIndex);
|
||||
if (format.Convert<ImageProcessing::EPixelFormat>(context))
|
||||
if (format.Convert<ImageProcessingAtom::EPixelFormat>(context))
|
||||
{
|
||||
format.SetData<ImageProcessing::EPixelFormat>(context, ImageProcessing::EPixelFormat::ePixelFormat_R8);
|
||||
format.SetData<ImageProcessingAtom::EPixelFormat>(context, ImageProcessingAtom::EPixelFormat::ePixelFormat_R8);
|
||||
}
|
||||
|
||||
int bppIndex = classElement.AddElement<AZ::u8>(context, "BytesPerPixel");
|
||||
|
||||
@@ -150,4 +150,4 @@ namespace GradientSignal
|
||||
m_permutationTable[x + 256] = randtable[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace GradientSignal
|
||||
// GradientPreviewDataWidgetHandler
|
||||
//
|
||||
|
||||
GradientPreviewDataWidgetHandler* GradientPreviewDataWidgetHandler::s_instance = nullptr;
|
||||
|
||||
AZ::u32 GradientPreviewDataWidgetHandler::GetHandlerName() const
|
||||
{
|
||||
return AZ_CRC("GradientPreviewer", 0x1dbbba45);
|
||||
@@ -92,23 +90,18 @@ namespace GradientSignal
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = aznew GradientPreviewDataWidgetHandler();
|
||||
PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::Bus::Events::RegisterPropertyType, s_instance);
|
||||
}
|
||||
// Property handlers are set to auto-delete by default, which means that we're handing off ownership of the pointer to the
|
||||
// PropertyManagerComponent, where it will get cleaned up on system shutdown.
|
||||
auto propertyHandler = aznew GradientPreviewDataWidgetHandler();
|
||||
AZ_Assert(propertyHandler->AutoDelete(),
|
||||
"GradientPreviewDataWidgetHandler is no longer set to auto-delete, it will leak memory.");
|
||||
PropertyTypeRegistrationMessages::Bus::Broadcast(
|
||||
&PropertyTypeRegistrationMessages::Bus::Events::RegisterPropertyType, propertyHandler);
|
||||
}
|
||||
|
||||
void GradientPreviewDataWidgetHandler::Unregister()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
if (s_instance)
|
||||
{
|
||||
PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::Bus::Events::UnregisterPropertyType, s_instance);
|
||||
delete s_instance;
|
||||
s_instance = nullptr;
|
||||
}
|
||||
// We don't need to call UnregisterPropertyType here because it's an autoDelete handler.
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -76,8 +76,5 @@ namespace GradientSignal
|
||||
|
||||
static void Register();
|
||||
static void Unregister();
|
||||
|
||||
private:
|
||||
static GradientPreviewDataWidgetHandler* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -79,4 +79,4 @@ namespace GradientSignal
|
||||
{
|
||||
return point - bounds.GetMin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user