Atom Tools: Saving tool settings, made inspector configurable, moved to ATF
Changed material editor inspector into generic, configurable, document inspector and moved to atom tools framework Renamed atom tools framework settings registry utility functions Added more settings registry utility functions to get, set, and save values and objects Added saving tool settings to atom tools application Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
+8
-10
@@ -14,8 +14,11 @@
|
||||
#include <Atom/RPI.Edit/Material/MaterialPropertyId.h>
|
||||
#include <Atom/RPI.Edit/Material/MaterialUtils.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialNameContext.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/EditorMaterialSystemComponentRequestBus.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentBus.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConfig.h>
|
||||
#include <AtomToolsFramework/Inspector/InspectorPropertyGroupWidget.h>
|
||||
#include <AtomToolsFramework/Util/MaterialPropertyUtil.h>
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
@@ -24,9 +27,6 @@
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/EditorMaterialSystemComponentRequestBus.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentBus.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConfig.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QApplication>
|
||||
@@ -54,7 +54,6 @@ namespace AZ
|
||||
|
||||
MaterialPropertyInspector::~MaterialPropertyInspector()
|
||||
{
|
||||
AtomToolsFramework::InspectorRequestBus::Handler::BusDisconnect();
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
AZ::EntitySystemBus::Handler::BusDisconnect();
|
||||
EditorMaterialSystemComponentNotificationBus::Handler::BusDisconnect();
|
||||
@@ -137,7 +136,6 @@ namespace AZ
|
||||
m_dirtyPropertyFlags.set();
|
||||
m_internalEditNotification = {};
|
||||
|
||||
AtomToolsFramework::InspectorRequestBus::Handler::BusDisconnect();
|
||||
AtomToolsFramework::InspectorWidget::Reset();
|
||||
}
|
||||
|
||||
@@ -590,7 +588,7 @@ namespace AZ
|
||||
|
||||
bool MaterialPropertyInspector::IsInstanceNodePropertyModifed(const AzToolsFramework::InstanceDataNode* node) const
|
||||
{
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(node);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(node);
|
||||
return property && !AtomToolsFramework::ArePropertyValuesEqual(property->GetValue(), property->GetConfig().m_parentValue);
|
||||
}
|
||||
|
||||
@@ -719,7 +717,7 @@ namespace AZ
|
||||
// This function is called continuously anytime a property changes until the edit has completed
|
||||
// Because of that, we have to track whether or not we are continuing to edit the same property to know when editing has
|
||||
// started and ended
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property)
|
||||
{
|
||||
if (m_activeProperty != property)
|
||||
@@ -731,7 +729,7 @@ namespace AZ
|
||||
|
||||
void MaterialPropertyInspector::AfterPropertyModified(AzToolsFramework::InstanceDataNode* pNode)
|
||||
{
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property)
|
||||
{
|
||||
if (m_activeProperty == property)
|
||||
@@ -748,7 +746,7 @@ namespace AZ
|
||||
// As above, there are symmetrical functions on the notification interface for when editing begins and ends and has been
|
||||
// completed but they are not being called following that pattern. when this function executes the changes to the property
|
||||
// are ready to be committed or reverted
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property)
|
||||
{
|
||||
if (m_activeProperty == property)
|
||||
|
||||
+2
-1
@@ -15,10 +15,11 @@
|
||||
#include <Atom/RPI.Edit/Material/MaterialTypeSourceData.h>
|
||||
#include <Atom/RPI.Edit/Material/MaterialUtils.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialNameContext.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialNameContext.h>
|
||||
#include <AtomToolsFramework/Util/MaterialPropertyUtil.h>
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
|
||||
+15
-15
@@ -6,10 +6,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Material/EditorMaterialModelUvNameMapInspector.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <Atom/RPI.Edit/Common/AssetUtils.h>
|
||||
#include <Atom/RPI.Edit/Common/JsonUtils.h>
|
||||
#include <Atom/RPI.Edit/Material/MaterialPropertyId.h>
|
||||
@@ -19,11 +15,13 @@
|
||||
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
|
||||
|
||||
#include <AtomToolsFramework/Inspector/InspectorPropertyGroupWidget.h>
|
||||
#include <AtomToolsFramework/Util/MaterialPropertyUtil.h>
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <Material/EditorMaterialModelUvNameMapInspector.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QApplication>
|
||||
@@ -47,15 +45,16 @@ namespace AZ
|
||||
const RPI::MaterialModelUvOverrideMap& matModUvOverrides,
|
||||
const AZStd::unordered_set<AZ::Name>& modelUvNames,
|
||||
MaterialModelUvOverrideMapChangedCallBack matModUvOverrideMapChangedCallBack,
|
||||
QWidget* parent
|
||||
)
|
||||
QWidget* parent)
|
||||
: AtomToolsFramework::InspectorWidget(parent)
|
||||
, m_matModUvOverrideMapChangedCallBack(matModUvOverrideMapChangedCallBack)
|
||||
, m_matModUvOverrides(matModUvOverrides)
|
||||
{
|
||||
// Load the originating product asset from which the new source has set will be generated
|
||||
auto materialAssetOutcome = AZ::RPI::AssetUtils::LoadAsset<AZ::RPI::MaterialAsset>(assetId);
|
||||
AZ_Error("AZ::Render::EditorMaterialComponentInspector", materialAssetOutcome, "Failed to load material asset: %s", assetId.ToString<AZStd::string>().c_str());
|
||||
AZ_Error(
|
||||
"AZ::Render::EditorMaterialComponentInspector", materialAssetOutcome, "Failed to load material asset: %s",
|
||||
assetId.ToString<AZStd::string>().c_str());
|
||||
|
||||
auto materialAsset = materialAssetOutcome.GetValue();
|
||||
|
||||
@@ -68,12 +67,13 @@ namespace AZ
|
||||
|
||||
MaterialModelUvNameMapInspector::~MaterialModelUvNameMapInspector()
|
||||
{
|
||||
AtomToolsFramework::InspectorRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void MaterialModelUvNameMapInspector::Reset()
|
||||
{
|
||||
AtomToolsFramework::InspectorRequestBus::Handler::BusDisconnect();
|
||||
m_activeProperty = {};
|
||||
m_group = {};
|
||||
|
||||
AtomToolsFramework::InspectorWidget::Reset();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace AZ
|
||||
// For some reason the reflected property editor notifications are not symmetrical
|
||||
// This function is called continuously anytime a property changes until the edit has completed
|
||||
// Because of that, we have to track whether or not we are continuing to edit the same property to know when editing has started and ended
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property && m_activeProperty != property)
|
||||
{
|
||||
m_activeProperty = property;
|
||||
@@ -128,7 +128,7 @@ namespace AZ
|
||||
|
||||
void MaterialModelUvNameMapInspector::AfterPropertyModified(AzToolsFramework::InstanceDataNode* pNode)
|
||||
{
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property && m_activeProperty == property)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
@@ -159,7 +159,7 @@ namespace AZ
|
||||
{
|
||||
// As above, there are symmetrical functions on the notification interface for when editing begins and ends and has been completed but they are not being called following that pattern.
|
||||
// when this function executes the changes to the property are ready to be committed or reverted
|
||||
const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(pNode);
|
||||
const auto property = AtomToolsFramework::FindAncestorInstanceDataNodeByType<AtomToolsFramework::DynamicProperty>(pNode);
|
||||
if (property && m_activeProperty == property)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
|
||||
+6
-6
@@ -53,9 +53,9 @@ namespace AZ
|
||||
|
||||
thumbnailConfig.m_modelId = assetInfo.m_assetId;
|
||||
thumbnailConfig.m_materialId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(MaterialAssetPathSetting, DefaultMaterialPath));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(MaterialAssetPathSetting, DefaultMaterialPath));
|
||||
thumbnailConfig.m_lightingId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(LightingAssetPathSetting, DefaultLightingPresetPath));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(LightingAssetPathSetting, DefaultLightingPresetPath));
|
||||
}
|
||||
else if (assetInfo.m_assetType == RPI::MaterialAsset::RTTI_Type())
|
||||
{
|
||||
@@ -65,10 +65,10 @@ namespace AZ
|
||||
"/O3DE/Atom/CommonFeature/SharedPreview/MaterialAssetType/LightingAssetPath";
|
||||
|
||||
thumbnailConfig.m_modelId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(ModelAssetPathSetting, DefaultModelPath));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(ModelAssetPathSetting, DefaultModelPath));
|
||||
thumbnailConfig.m_materialId = assetInfo.m_assetId;
|
||||
thumbnailConfig.m_lightingId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(LightingAssetPathSetting, DefaultLightingPresetPath));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(LightingAssetPathSetting, DefaultLightingPresetPath));
|
||||
}
|
||||
else if (assetInfo.m_assetType == RPI::AnyAsset::RTTI_Type())
|
||||
{
|
||||
@@ -78,9 +78,9 @@ namespace AZ
|
||||
"/O3DE/Atom/CommonFeature/SharedPreview/LightingAssetType/MaterialAssetPath";
|
||||
|
||||
thumbnailConfig.m_modelId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(ModelAssetPathSetting, DefaultModelPath));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(ModelAssetPathSetting, DefaultModelPath));
|
||||
thumbnailConfig.m_materialId = SharedPreviewUtils::GetAssetIdForProductPath(
|
||||
AtomToolsFramework::GetSettingOrDefault<AZStd::string>(MaterialAssetPathSetting, "materials/reflectionprobe/reflectionprobevisualization.azmaterial"));
|
||||
AtomToolsFramework::GetSettingsValue<AZStd::string>(MaterialAssetPathSetting, "materials/reflectionprobe/reflectionprobevisualization.azmaterial"));
|
||||
thumbnailConfig.m_lightingId = assetInfo.m_assetId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user