diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp index a3152faf87..59d5723911 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp @@ -271,7 +271,8 @@ namespace AZ // Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget( - &group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupNameId)); + &group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId), {}, + [this](const auto node) { return GetInstanceNodePropertyIndicator(node); }, 0); AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget); } @@ -316,7 +317,8 @@ namespace AZ // Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget( - &group, nullptr, group.TYPEINFO_Uuid(), this, this, GetSaveStateKeyForGroup(groupNameId)); + &group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId), {}, + [this](const auto node) { return GetInstanceNodePropertyIndicator(node); }, 0); AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget); } @@ -496,19 +498,26 @@ namespace AZ } } - AZ::Crc32 MaterialPropertyInspector::GetSaveStateKeyForGroup(const AZStd::string& groupNameId) const + AZ::Crc32 MaterialPropertyInspector::GetGroupSaveStateKey(const AZStd::string& groupNameId) const { return AZ::Crc32(AZStd::string::format( "MaterialPropertyInspector::PropertyGroup::%s::%s", m_editData.m_materialAssetId.ToString().c_str(), groupNameId.c_str())); } - bool MaterialPropertyInspector::AreNodePropertyValuesEqual( - const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) + bool MaterialPropertyInspector::IsInstanceNodePropertyModifed(const AzToolsFramework::InstanceDataNode* node) const { - AZ_UNUSED(source); - const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(target); - return property && AtomToolsFramework::ArePropertyValuesEqual(property->GetValue(), property->GetConfig().m_parentValue); + const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(node); + return property && !AtomToolsFramework::ArePropertyValuesEqual(property->GetValue(), property->GetConfig().m_parentValue); + } + + const char* MaterialPropertyInspector::GetInstanceNodePropertyIndicator(const AzToolsFramework::InstanceDataNode* node) const + { + if (IsInstanceNodePropertyModifed(node)) + { + return ":/PropertyEditor/Resources/changed_data_item.png"; + } + return ":/PropertyEditor/Resources/blank.png"; } bool MaterialPropertyInspector::SaveMaterial() const diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.h index 11eb2cec51..ff5a843392 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.h @@ -100,9 +100,9 @@ namespace AZ void RunEditorMaterialFunctors(); void UpdateMaterialInstanceProperty(const AtomToolsFramework::DynamicProperty& property); - AZ::Crc32 GetSaveStateKeyForGroup(const AZStd::string& groupNameId) const; - static bool AreNodePropertyValuesEqual( - const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target); + AZ::Crc32 GetGroupSaveStateKey(const AZStd::string& groupNameId) const; + bool IsInstanceNodePropertyModifed(const AzToolsFramework::InstanceDataNode* node) const; + const char* GetInstanceNodePropertyIndicator(const AzToolsFramework::InstanceDataNode* node) const; // Tracking the property that is actively being edited in the inspector const AtomToolsFramework::DynamicProperty* m_activeProperty = {};