@ -44,20 +44,20 @@ namespace MaterialEditor
AtomToolsFramework : : InspectorWidget : : Reset ( ) ;
AtomToolsFramework : : InspectorWidget : : Reset ( ) ;
}
}
bool MaterialInspector : : ShouldGroupAutoExpanded ( const AZStd : : string & groupName Id ) const
bool MaterialInspector : : ShouldGroupAutoExpanded ( const AZStd : : string & groupName ) const
{
{
auto stateItr = m_windowSettings - > m_inspectorCollapsedGroups . find ( GetGroupSaveStateKey ( groupName Id ) ) ;
auto stateItr = m_windowSettings - > m_inspectorCollapsedGroups . find ( GetGroupSaveStateKey ( groupName ) ) ;
return stateItr = = m_windowSettings - > m_inspectorCollapsedGroups . end ( ) ;
return stateItr = = m_windowSettings - > m_inspectorCollapsedGroups . end ( ) ;
}
}
void MaterialInspector : : OnGroupExpanded ( const AZStd : : string & groupName Id )
void MaterialInspector : : OnGroupExpanded ( const AZStd : : string & groupName )
{
{
m_windowSettings - > m_inspectorCollapsedGroups . erase ( GetGroupSaveStateKey ( groupName Id ) ) ;
m_windowSettings - > m_inspectorCollapsedGroups . erase ( GetGroupSaveStateKey ( groupName ) ) ;
}
}
void MaterialInspector : : OnGroupCollapsed ( const AZStd : : string & groupName Id )
void MaterialInspector : : OnGroupCollapsed ( const AZStd : : string & groupName )
{
{
m_windowSettings - > m_inspectorCollapsedGroups . insert ( GetGroupSaveStateKey ( groupName Id ) ) ;
m_windowSettings - > m_inspectorCollapsedGroups . insert ( GetGroupSaveStateKey ( groupName ) ) ;
}
}
void MaterialInspector : : OnDocumentOpened ( const AZ : : Uuid & documentId )
void MaterialInspector : : OnDocumentOpened ( const AZ : : Uuid & documentId )
@ -86,9 +86,9 @@ namespace MaterialEditor
AddGroupsEnd ( ) ;
AddGroupsEnd ( ) ;
}
}
AZ : : Crc32 MaterialInspector : : GetGroupSaveStateKey ( const AZStd : : string & groupName Id ) const
AZ : : Crc32 MaterialInspector : : GetGroupSaveStateKey ( const AZStd : : string & groupName ) const
{
{
return AZ : : Crc32 ( AZStd : : string : : format ( " MaterialInspector::PropertyGroup::%s::%s " , m_documentPath . c_str ( ) , groupName Id . c_str ( ) ) ) ;
return AZ : : Crc32 ( AZStd : : string : : format ( " MaterialInspector::PropertyGroup::%s::%s " , m_documentPath . c_str ( ) , groupName . c_str ( ) ) ) ;
}
}
bool MaterialInspector : : CompareInstanceNodeProperties (
bool MaterialInspector : : CompareInstanceNodeProperties (
@ -105,10 +105,10 @@ namespace MaterialEditor
MaterialDocumentRequestBus : : EventResult (
MaterialDocumentRequestBus : : EventResult (
materialTypeSourceData , m_documentId , & MaterialDocumentRequestBus : : Events : : GetMaterialTypeSourceData ) ;
materialTypeSourceData , m_documentId , & MaterialDocumentRequestBus : : Events : : GetMaterialTypeSourceData ) ;
const AZStd : : string groupName Id = " overview " ;
const AZStd : : string groupName = " overview " ;
const AZStd : : string groupDisplayName = " Overview " ;
const AZStd : : string groupDisplayName = " Overview " ;
const AZStd : : string groupDescription = materialTypeSourceData - > m_description ;
const AZStd : : string groupDescription = materialTypeSourceData - > m_description ;
auto & group = m_groups [ groupName Id ] ;
auto & group = m_groups [ groupName ] ;
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
@ -122,9 +122,9 @@ namespace MaterialEditor
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName Id ) ,
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName ) ,
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
AddGroup ( groupName Id , groupDisplayName , groupDescription , propertyGroupWidget ) ;
AddGroup ( groupName , groupDisplayName , groupDescription , propertyGroupWidget ) ;
}
}
void MaterialInspector : : AddUvNamesGroup ( )
void MaterialInspector : : AddUvNamesGroup ( )
@ -132,10 +132,10 @@ namespace MaterialEditor
AZ : : Data : : Asset < AZ : : RPI : : MaterialAsset > materialAsset ;
AZ : : Data : : Asset < AZ : : RPI : : MaterialAsset > materialAsset ;
MaterialDocumentRequestBus : : EventResult ( materialAsset , m_documentId , & MaterialDocumentRequestBus : : Events : : GetAsset ) ;
MaterialDocumentRequestBus : : EventResult ( materialAsset , m_documentId , & MaterialDocumentRequestBus : : Events : : GetAsset ) ;
const AZStd : : string groupName Id = UvGroupName ;
const AZStd : : string groupName = UvGroupName ;
const AZStd : : string groupDisplayName = " UV Sets " ;
const AZStd : : string groupDisplayName = " UV Sets " ;
const AZStd : : string groupDescription = " UV set names in this material, which can be renamed to match those in the model. " ;
const AZStd : : string groupDescription = " UV set names in this material, which can be renamed to match those in the model. " ;
auto & group = m_groups [ groupName Id ] ;
auto & group = m_groups [ groupName ] ;
const auto & uvNameMap = materialAsset - > GetMaterialTypeAsset ( ) - > GetUvNameMap ( ) ;
const auto & uvNameMap = materialAsset - > GetMaterialTypeAsset ( ) - > GetUvNameMap ( ) ;
group . m_properties . reserve ( uvNameMap . size ( ) ) ;
group . m_properties . reserve ( uvNameMap . size ( ) ) ;
@ -145,7 +145,7 @@ namespace MaterialEditor
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
property , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : GetProperty ,
property , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : GetProperty ,
AZ : : RPI : : MaterialPropertyId ( groupName Id , uvNamePair . m_shaderInput . ToString ( ) ) . GetFullName ( ) ) ;
AZ : : RPI : : MaterialPropertyId ( groupName , uvNamePair . m_shaderInput . ToString ( ) ) . GetFullName ( ) ) ;
group . m_properties . push_back ( property ) ;
group . m_properties . push_back ( property ) ;
property . SetValue ( property . GetConfig ( ) . m_parentValue ) ;
property . SetValue ( property . GetConfig ( ) . m_parentValue ) ;
@ -153,9 +153,9 @@ namespace MaterialEditor
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName Id ) ,
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName ) ,
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
AddGroup ( groupName Id , groupDisplayName , groupDescription , propertyGroupWidget ) ;
AddGroup ( groupName , groupDisplayName , groupDescription , propertyGroupWidget ) ;
}
}
void MaterialInspector : : AddPropertiesGroup ( )
void MaterialInspector : : AddPropertiesGroup ( )
@ -166,14 +166,14 @@ namespace MaterialEditor
for ( const auto & groupDefinition : materialTypeSourceData - > GetGroupDefinitionsInDisplayOrder ( ) )
for ( const auto & groupDefinition : materialTypeSourceData - > GetGroupDefinitionsInDisplayOrder ( ) )
{
{
const AZStd : : string & groupName Id = groupDefinition . m_name Id ;
const AZStd : : string & groupName = groupDefinition . m_name ;
const AZStd : : string & groupDisplayName = ! groupDefinition . m_displayName . empty ( ) ? groupDefinition . m_displayName : groupName Id ;
const AZStd : : string & groupDisplayName = ! groupDefinition . m_displayName . empty ( ) ? groupDefinition . m_displayName : groupName ;
const AZStd : : string & groupDescription =
const AZStd : : string & groupDescription =
! groupDefinition . m_description . empty ( ) ? groupDefinition . m_description : groupDisplayName ;
! groupDefinition . m_description . empty ( ) ? groupDefinition . m_description : groupDisplayName ;
auto & group = m_groups [ groupName Id ] ;
auto & group = m_groups [ groupName ] ;
const auto & propertyLayout = materialTypeSourceData - > m_propertyLayout ;
const auto & propertyLayout = materialTypeSourceData - > m_propertyLayout ;
const auto & propertyListItr = propertyLayout . m_properties . find ( groupName Id ) ;
const auto & propertyListItr = propertyLayout . m_properties . find ( groupName ) ;
if ( propertyListItr ! = propertyLayout . m_properties . end ( ) )
if ( propertyListItr ! = propertyLayout . m_properties . end ( ) )
{
{
group . m_properties . reserve ( propertyListItr - > second . size ( ) ) ;
group . m_properties . reserve ( propertyListItr - > second . size ( ) ) ;
@ -182,21 +182,21 @@ namespace MaterialEditor
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : DynamicProperty property ;
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
property , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : GetProperty ,
property , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : GetProperty ,
AZ : : RPI : : MaterialPropertyId ( groupName Id , propertyDefinition . m_name Id ) . GetFullName ( ) ) ;
AZ : : RPI : : MaterialPropertyId ( groupName , propertyDefinition . m_name ) . GetFullName ( ) ) ;
group . m_properties . push_back ( property ) ;
group . m_properties . push_back ( property ) ;
}
}
}
}
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
auto propertyGroupWidget = new AtomToolsFramework : : InspectorPropertyGroupWidget (
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName Id ) ,
& group , & group , group . TYPEINFO_Uuid ( ) , this , this , GetGroupSaveStateKey ( groupName ) ,
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
[ this ] ( const auto source , const auto target ) { return CompareInstanceNodeProperties ( source , target ) ; } ) ;
AddGroup ( groupName Id , groupDisplayName , groupDescription , propertyGroupWidget ) ;
AddGroup ( groupName , groupDisplayName , groupDescription , propertyGroupWidget ) ;
bool isGroupVisible = false ;
bool isGroupVisible = false ;
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
AtomToolsFramework : : AtomToolsDocumentRequestBus : : EventResult (
isGroupVisible , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : IsPropertyGroupVisible , AZ : : Name { groupName Id } ) ;
isGroupVisible , m_documentId , & AtomToolsFramework : : AtomToolsDocumentRequestBus : : Events : : IsPropertyGroupVisible , AZ : : Name { groupName } ) ;
SetGroupVisible ( groupName Id , isGroupVisible ) ;
SetGroupVisible ( groupName , isGroupVisible ) ;
}
}
}
}