Moved asynchronous image loading function to atom tools framework
Moved settings registry wrapper function to atom tools framework Created registry settings with default values for preview configurations based on asset type Changed lighting preset previews and thumbnails to use reflective material Created registry settings for preset selection dialog borders, padding, sizes Updated shared preview utility functions to compare against registered asset types instead of passing them in individually Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
@@ -6,15 +6,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Atom/ImageProcessing/ImageObject.h>
|
||||
#include <Atom/ImageProcessing/ImageProcessingBus.h>
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/Jobs/JobFunction.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzQtComponents/Components/Widgets/FileDialog.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QApplication>
|
||||
@@ -24,6 +27,36 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
void LoadImageAsync(const AZStd::string& path, LoadImageAsyncCallback callback)
|
||||
{
|
||||
AZ::Job* job = AZ::CreateJobFunction(
|
||||
[path, callback]()
|
||||
{
|
||||
ImageProcessingAtom::IImageObjectPtr imageObject;
|
||||
ImageProcessingAtom::ImageProcessingRequestBus::BroadcastResult(
|
||||
imageObject, &ImageProcessingAtom::ImageProcessingRequests::LoadImagePreview, path);
|
||||
|
||||
if (imageObject)
|
||||
{
|
||||
AZ::u8* imageBuf = nullptr;
|
||||
AZ::u32 pitch = 0;
|
||||
AZ::u32 mip = 0;
|
||||
imageObject->GetImagePointer(mip, imageBuf, pitch);
|
||||
const AZ::u32 width = imageObject->GetWidth(mip);
|
||||
const AZ::u32 height = imageObject->GetHeight(mip);
|
||||
|
||||
QImage image(imageBuf, width, height, pitch, QImage::Format_RGBA8888);
|
||||
|
||||
if (callback)
|
||||
{
|
||||
callback(image);
|
||||
}
|
||||
}
|
||||
},
|
||||
true);
|
||||
job->Start();
|
||||
}
|
||||
|
||||
QFileInfo GetSaveFileInfo(const QString& initialPath)
|
||||
{
|
||||
const QFileInfo initialFileInfo(initialPath);
|
||||
|
||||
Reference in New Issue
Block a user