You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.9 KiB
C++
76 lines
2.9 KiB
C++
/*
|
|
* 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
|
|
|
|
#if !defined(Q_MOC_RUN)
|
|
#include <Atom/RPI.Reflect/Image/StreamingImageAsset.h>
|
|
|
|
#include <AzToolsFramework/AssetBrowser/AssetPicker/AssetPickerDialog.h>
|
|
#include <AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.hxx>
|
|
#endif
|
|
|
|
namespace GradientSignal
|
|
{
|
|
class SupportedImageAssetPickerDialog
|
|
: public AzToolsFramework::AssetBrowser::AssetPickerDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
AZ_CLASS_ALLOCATOR(SupportedImageAssetPickerDialog, AZ::SystemAllocator, 0);
|
|
|
|
explicit SupportedImageAssetPickerDialog(AssetSelectionModel& selection, QWidget* parent = nullptr);
|
|
|
|
protected:
|
|
bool EvaluateSelection() const override;
|
|
};
|
|
|
|
class StreamingImagePropertyAssetCtrl
|
|
: public AzToolsFramework::PropertyAssetCtrl
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AZ_CLASS_ALLOCATOR(StreamingImagePropertyAssetCtrl, AZ::SystemAllocator, 0);
|
|
|
|
StreamingImagePropertyAssetCtrl(QWidget* parent = nullptr);
|
|
|
|
void PickAssetSelectionFromDialog(AssetSelectionModel& selection, QWidget* parent) override;
|
|
|
|
public Q_SLOTS:
|
|
void OnAutocomplete(const QModelIndex& index) override;
|
|
};
|
|
|
|
//! We need a custom asset property handler for the AZ::RPI::StreamingImageAsset on our
|
|
//! Image Gradient component because only a subset of the streaming image asset pixel formats
|
|
//! are currently supported by the image data pixel retrieval API that the Image Gradient
|
|
//! relies on
|
|
class StreamingImagePropertyHandler
|
|
: QObject
|
|
, public AzToolsFramework::PropertyHandler<AZ::Data::Asset<AZ::Data::AssetData>, StreamingImagePropertyAssetCtrl>
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AZ_CLASS_ALLOCATOR(StreamingImagePropertyHandler, AZ::SystemAllocator, 0);
|
|
|
|
AZ::u32 GetHandlerName() const override;
|
|
bool IsDefaultHandler() const override;
|
|
QWidget* GetFirstInTabOrder(StreamingImagePropertyAssetCtrl* widget) override;
|
|
QWidget* GetLastInTabOrder(StreamingImagePropertyAssetCtrl* widget) override;
|
|
void UpdateWidgetInternalTabbing(StreamingImagePropertyAssetCtrl* widget);
|
|
|
|
QWidget* CreateGUI(QWidget* parent) override;
|
|
void ConsumeAttribute(StreamingImagePropertyAssetCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
|
|
void WriteGUIValuesIntoProperty(size_t index, StreamingImagePropertyAssetCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
|
bool ReadValuesIntoGUI(size_t index, StreamingImagePropertyAssetCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
|
|
|
|
static void Register();
|
|
};
|
|
}
|