Updated the naming convention for material property "names" vs "IDs".
A "property name" is the name of the just the property without regard to the group that it's in. A "group name" is the name of the group. And a "property ID" is the full unique name of a property in the form "groupName.propertyName". This is important preparation for upcoming changes where property sets can contain other property sets, and property IDs can be arbitrarily long like "layer1.baseColor.factor" for example. The naming changes include variables, some code comments, and the .materialtype file format. I was able to make these changes in a backward compatible way so a property or group "id" field has been replaced with a "name" field, but "id" is still supported for compatibility. StandardPBR, EnhancedPBR, StandardMultilayerPBR, and Skin have all been updated. Note that MinimalPBR has not been updated, proving that backward compatibility works. (We can update this one too at some point though). Testing: Opened up materials in the material editor. Ran AtomSampleViewer in dx12 and vulkan with no new failures. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
@@ -59,7 +59,7 @@ namespace MaterialEditor
|
||||
return &m_materialTypeSourceData;
|
||||
}
|
||||
|
||||
const AZStd::any& MaterialDocument::GetPropertyValue(const AZ::Name& propertyFullName) const
|
||||
const AZStd::any& MaterialDocument::GetPropertyValue(const AZ::Name& propertyId) const
|
||||
{
|
||||
using namespace AZ;
|
||||
using namespace RPI;
|
||||
@@ -70,10 +70,10 @@ namespace MaterialEditor
|
||||
return m_invalidValue;
|
||||
}
|
||||
|
||||
const auto it = m_properties.find(propertyFullName);
|
||||
const auto it = m_properties.find(propertyId);
|
||||
if (it == m_properties.end())
|
||||
{
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyFullName.GetCStr());
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyId.GetCStr());
|
||||
return m_invalidValue;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace MaterialEditor
|
||||
return property.GetValue();
|
||||
}
|
||||
|
||||
const AtomToolsFramework::DynamicProperty& MaterialDocument::GetProperty(const AZ::Name& propertyFullName) const
|
||||
const AtomToolsFramework::DynamicProperty& MaterialDocument::GetProperty(const AZ::Name& propertyId) const
|
||||
{
|
||||
if (!IsOpen())
|
||||
{
|
||||
@@ -89,10 +89,10 @@ namespace MaterialEditor
|
||||
return m_invalidProperty;
|
||||
}
|
||||
|
||||
const auto it = m_properties.find(propertyFullName);
|
||||
const auto it = m_properties.find(propertyId);
|
||||
if (it == m_properties.end())
|
||||
{
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyFullName.GetCStr());
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyId.GetCStr());
|
||||
return m_invalidProperty;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace MaterialEditor
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void MaterialDocument::SetPropertyValue(const AZ::Name& propertyFullName, const AZStd::any& value)
|
||||
void MaterialDocument::SetPropertyValue(const AZ::Name& propertyId, const AZStd::any& value)
|
||||
{
|
||||
using namespace AZ;
|
||||
using namespace RPI;
|
||||
@@ -129,10 +129,10 @@ namespace MaterialEditor
|
||||
return;
|
||||
}
|
||||
|
||||
const auto it = m_properties.find(propertyFullName);
|
||||
const auto it = m_properties.find(propertyId);
|
||||
if (it == m_properties.end())
|
||||
{
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyFullName.GetCStr());
|
||||
AZ_Error("MaterialDocument", false, "Material document property could not be found: '%s'.", propertyId.GetCStr());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,8 +143,7 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::DynamicProperty& property = it->second;
|
||||
property.SetValue(AtomToolsFramework::ConvertToEditableType(propertyValue));
|
||||
|
||||
const AZ::RPI::MaterialPropertyId propertyId = AZ::RPI::MaterialPropertyId::Parse(propertyFullName.GetStringView());
|
||||
const auto propertyIndex = m_materialInstance->FindPropertyIndex(propertyFullName);
|
||||
const auto propertyIndex = m_materialInstance->FindPropertyIndex(propertyId);
|
||||
if (!propertyIndex.IsNull())
|
||||
{
|
||||
if (m_materialInstance->SetPropertyValue(propertyIndex, propertyValue))
|
||||
@@ -593,8 +592,9 @@ namespace MaterialEditor
|
||||
bool result = true;
|
||||
|
||||
// populate sourceData with properties that meet the filter
|
||||
m_materialTypeSourceData.EnumerateProperties([this, &sourceData, &propertyFilter, &result](const AZStd::string& groupNameId, const AZStd::string& propertyNameId, const auto& propertyDefinition) {
|
||||
const MaterialPropertyId propertyId(groupNameId, propertyNameId);
|
||||
m_materialTypeSourceData.EnumerateProperties([this, &sourceData, &propertyFilter, &result](const AZStd::string& groupName, const AZStd::string& propertyName, const auto& propertyDefinition) {
|
||||
|
||||
const MaterialPropertyId propertyId(groupName, propertyName);
|
||||
|
||||
const auto it = m_properties.find(propertyId.GetFullName());
|
||||
if (it != m_properties.end() && propertyFilter(it->second))
|
||||
@@ -609,7 +609,7 @@ namespace MaterialEditor
|
||||
return false;
|
||||
}
|
||||
|
||||
sourceData.m_properties[groupNameId][propertyNameId].m_value = propertyValue;
|
||||
sourceData.m_properties[groupName][propertyName].m_value = propertyValue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -770,11 +770,11 @@ namespace MaterialEditor
|
||||
// Populate the property map from a combination of source data and assets
|
||||
// Assets must still be used for now because they contain the final accumulated value after all other materials
|
||||
// in the hierarchy are applied
|
||||
m_materialTypeSourceData.EnumerateProperties([this, &parentPropertyValues](const AZStd::string& groupNameId, const AZStd::string& propertyNameId, const auto& propertyDefinition) {
|
||||
m_materialTypeSourceData.EnumerateProperties([this, &parentPropertyValues](const AZStd::string& groupName, const AZStd::string& propertyName, const auto& propertyDefinition) {
|
||||
AtomToolsFramework::DynamicPropertyConfig propertyConfig;
|
||||
|
||||
// Assign id before conversion so it can be used in dynamic description
|
||||
propertyConfig.m_id = MaterialPropertyId(groupNameId, propertyNameId).GetCStr();
|
||||
propertyConfig.m_id = MaterialPropertyId(groupName, propertyName).GetCStr();
|
||||
|
||||
const auto& propertyIndex = m_materialAsset->GetMaterialPropertiesLayout()->FindPropertyIndex(propertyConfig.m_id);
|
||||
const bool propertyIndexInBounds = propertyIndex.IsValid() && propertyIndex.GetIndex() < m_materialAsset->GetPropertyValues().size();
|
||||
@@ -786,8 +786,8 @@ namespace MaterialEditor
|
||||
propertyConfig.m_showThumbnail = true;
|
||||
propertyConfig.m_originalValue = AtomToolsFramework::ConvertToEditableType(m_materialAsset->GetPropertyValues()[propertyIndex.GetIndex()]);
|
||||
propertyConfig.m_parentValue = AtomToolsFramework::ConvertToEditableType(parentPropertyValues[propertyIndex.GetIndex()]);
|
||||
auto groupDefinition = m_materialTypeSourceData.FindGroup(groupNameId);
|
||||
propertyConfig.m_groupName = groupDefinition ? groupDefinition->m_displayName : groupNameId;
|
||||
auto groupDefinition = m_materialTypeSourceData.FindGroup(groupName);
|
||||
propertyConfig.m_groupName = groupDefinition ? groupDefinition->m_displayName : groupName;
|
||||
m_properties[propertyConfig.m_id] = AtomToolsFramework::DynamicProperty(propertyConfig);
|
||||
}
|
||||
return true;
|
||||
@@ -796,7 +796,7 @@ namespace MaterialEditor
|
||||
// Populate the property group visibility map
|
||||
for (MaterialTypeSourceData::GroupDefinition& group : m_materialTypeSourceData.GetGroupDefinitionsInDisplayOrder())
|
||||
{
|
||||
m_propertyGroupVisibility[AZ::Name{group.m_nameId}] = true;
|
||||
m_propertyGroupVisibility[AZ::Name{group.m_name}] = true;
|
||||
}
|
||||
|
||||
// Adding properties for material type and parent as part of making dynamic
|
||||
@@ -808,7 +808,7 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::DynamicPropertyConfig propertyConfig;
|
||||
propertyConfig.m_dataType = AtomToolsFramework::DynamicPropertyType::Asset;
|
||||
propertyConfig.m_id = "overview.materialType";
|
||||
propertyConfig.m_nameId = "materialType";
|
||||
propertyConfig.m_name = "materialType";
|
||||
propertyConfig.m_displayName = "Material Type";
|
||||
propertyConfig.m_groupName = "Overview";
|
||||
propertyConfig.m_description = "The material type defines the layout, properties, default values, shader connections, and other "
|
||||
@@ -823,7 +823,7 @@ namespace MaterialEditor
|
||||
propertyConfig = {};
|
||||
propertyConfig.m_dataType = AtomToolsFramework::DynamicPropertyType::Asset;
|
||||
propertyConfig.m_id = "overview.parentMaterial";
|
||||
propertyConfig.m_nameId = "parentMaterial";
|
||||
propertyConfig.m_name = "parentMaterial";
|
||||
propertyConfig.m_displayName = "Parent Material";
|
||||
propertyConfig.m_groupName = "Overview";
|
||||
propertyConfig.m_description =
|
||||
@@ -846,7 +846,7 @@ namespace MaterialEditor
|
||||
propertyConfig = {};
|
||||
propertyConfig.m_dataType = AtomToolsFramework::DynamicPropertyType::String;
|
||||
propertyConfig.m_id = MaterialPropertyId(UvGroupName, shaderInput).GetCStr();
|
||||
propertyConfig.m_nameId = shaderInput;
|
||||
propertyConfig.m_name = shaderInput;
|
||||
propertyConfig.m_displayName = shaderInput;
|
||||
propertyConfig.m_groupName = "UV Sets";
|
||||
propertyConfig.m_description = shaderInput;
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace MaterialEditor
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AtomToolsFramework::AtomToolsDocument
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
const AZStd::any& GetPropertyValue(const AZ::Name& propertyFullName) const override;
|
||||
const AtomToolsFramework::DynamicProperty& GetProperty(const AZ::Name& propertyFullName) const override;
|
||||
const AZStd::any& GetPropertyValue(const AZ::Name& propertyId) const override;
|
||||
const AtomToolsFramework::DynamicProperty& GetProperty(const AZ::Name& propertyId) const override;
|
||||
bool IsPropertyGroupVisible(const AZ::Name& propertyGroupFullName) const override;
|
||||
void SetPropertyValue(const AZ::Name& propertyFullName, const AZStd::any& value) override;
|
||||
void SetPropertyValue(const AZ::Name& propertyId, const AZStd::any& value) override;
|
||||
bool Open(AZStd::string_view loadPath) override;
|
||||
bool Reopen() override;
|
||||
bool Save() override;
|
||||
|
||||
+26
-26
@@ -44,20 +44,20 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::InspectorWidget::Reset();
|
||||
}
|
||||
|
||||
bool MaterialInspector::ShouldGroupAutoExpanded(const AZStd::string& groupNameId) const
|
||||
bool MaterialInspector::ShouldGroupAutoExpanded(const AZStd::string& groupName) const
|
||||
{
|
||||
auto stateItr = m_windowSettings->m_inspectorCollapsedGroups.find(GetGroupSaveStateKey(groupNameId));
|
||||
auto stateItr = m_windowSettings->m_inspectorCollapsedGroups.find(GetGroupSaveStateKey(groupName));
|
||||
return stateItr == m_windowSettings->m_inspectorCollapsedGroups.end();
|
||||
}
|
||||
|
||||
void MaterialInspector::OnGroupExpanded(const AZStd::string& groupNameId)
|
||||
void MaterialInspector::OnGroupExpanded(const AZStd::string& groupName)
|
||||
{
|
||||
m_windowSettings->m_inspectorCollapsedGroups.erase(GetGroupSaveStateKey(groupNameId));
|
||||
m_windowSettings->m_inspectorCollapsedGroups.erase(GetGroupSaveStateKey(groupName));
|
||||
}
|
||||
|
||||
void MaterialInspector::OnGroupCollapsed(const AZStd::string& groupNameId)
|
||||
void MaterialInspector::OnGroupCollapsed(const AZStd::string& groupName)
|
||||
{
|
||||
m_windowSettings->m_inspectorCollapsedGroups.insert(GetGroupSaveStateKey(groupNameId));
|
||||
m_windowSettings->m_inspectorCollapsedGroups.insert(GetGroupSaveStateKey(groupName));
|
||||
}
|
||||
|
||||
void MaterialInspector::OnDocumentOpened(const AZ::Uuid& documentId)
|
||||
@@ -86,9 +86,9 @@ namespace MaterialEditor
|
||||
AddGroupsEnd();
|
||||
}
|
||||
|
||||
AZ::Crc32 MaterialInspector::GetGroupSaveStateKey(const AZStd::string& groupNameId) const
|
||||
AZ::Crc32 MaterialInspector::GetGroupSaveStateKey(const AZStd::string& groupName) const
|
||||
{
|
||||
return AZ::Crc32(AZStd::string::format("MaterialInspector::PropertyGroup::%s::%s", m_documentPath.c_str(), groupNameId.c_str()));
|
||||
return AZ::Crc32(AZStd::string::format("MaterialInspector::PropertyGroup::%s::%s", m_documentPath.c_str(), groupName.c_str()));
|
||||
}
|
||||
|
||||
bool MaterialInspector::CompareInstanceNodeProperties(
|
||||
@@ -105,10 +105,10 @@ namespace MaterialEditor
|
||||
MaterialDocumentRequestBus::EventResult(
|
||||
materialTypeSourceData, m_documentId, &MaterialDocumentRequestBus::Events::GetMaterialTypeSourceData);
|
||||
|
||||
const AZStd::string groupNameId = "overview";
|
||||
const AZStd::string groupName = "overview";
|
||||
const AZStd::string groupDisplayName = "Overview";
|
||||
const AZStd::string groupDescription = materialTypeSourceData->m_description;
|
||||
auto& group = m_groups[groupNameId];
|
||||
auto& group = m_groups[groupName];
|
||||
|
||||
AtomToolsFramework::DynamicProperty property;
|
||||
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
|
||||
auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId),
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupName),
|
||||
[this](const auto source, const auto target) { return CompareInstanceNodeProperties(source, target); });
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
}
|
||||
|
||||
void MaterialInspector::AddUvNamesGroup()
|
||||
@@ -132,10 +132,10 @@ namespace MaterialEditor
|
||||
AZ::Data::Asset<AZ::RPI::MaterialAsset> materialAsset;
|
||||
MaterialDocumentRequestBus::EventResult(materialAsset, m_documentId, &MaterialDocumentRequestBus::Events::GetAsset);
|
||||
|
||||
const AZStd::string groupNameId = UvGroupName;
|
||||
const AZStd::string groupName = UvGroupName;
|
||||
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.";
|
||||
auto& group = m_groups[groupNameId];
|
||||
auto& group = m_groups[groupName];
|
||||
|
||||
const auto& uvNameMap = materialAsset->GetMaterialTypeAsset()->GetUvNameMap();
|
||||
group.m_properties.reserve(uvNameMap.size());
|
||||
@@ -145,7 +145,7 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::DynamicProperty property;
|
||||
AtomToolsFramework::AtomToolsDocumentRequestBus::EventResult(
|
||||
property, m_documentId, &AtomToolsFramework::AtomToolsDocumentRequestBus::Events::GetProperty,
|
||||
AZ::RPI::MaterialPropertyId(groupNameId, uvNamePair.m_shaderInput.ToString()).GetFullName());
|
||||
AZ::RPI::MaterialPropertyId(groupName, uvNamePair.m_shaderInput.ToString()).GetFullName());
|
||||
group.m_properties.push_back(property);
|
||||
|
||||
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
|
||||
auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId),
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupName),
|
||||
[this](const auto source, const auto target) { return CompareInstanceNodeProperties(source, target); });
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
}
|
||||
|
||||
void MaterialInspector::AddPropertiesGroup()
|
||||
@@ -166,14 +166,14 @@ namespace MaterialEditor
|
||||
|
||||
for (const auto& groupDefinition : materialTypeSourceData->GetGroupDefinitionsInDisplayOrder())
|
||||
{
|
||||
const AZStd::string& groupNameId = groupDefinition.m_nameId;
|
||||
const AZStd::string& groupDisplayName = !groupDefinition.m_displayName.empty() ? groupDefinition.m_displayName : groupNameId;
|
||||
const AZStd::string& groupName = groupDefinition.m_name;
|
||||
const AZStd::string& groupDisplayName = !groupDefinition.m_displayName.empty() ? groupDefinition.m_displayName : groupName;
|
||||
const AZStd::string& groupDescription =
|
||||
!groupDefinition.m_description.empty() ? groupDefinition.m_description : groupDisplayName;
|
||||
auto& group = m_groups[groupNameId];
|
||||
auto& group = m_groups[groupName];
|
||||
|
||||
const auto& propertyLayout = materialTypeSourceData->m_propertyLayout;
|
||||
const auto& propertyListItr = propertyLayout.m_properties.find(groupNameId);
|
||||
const auto& propertyListItr = propertyLayout.m_properties.find(groupName);
|
||||
if (propertyListItr != propertyLayout.m_properties.end())
|
||||
{
|
||||
group.m_properties.reserve(propertyListItr->second.size());
|
||||
@@ -182,21 +182,21 @@ namespace MaterialEditor
|
||||
AtomToolsFramework::DynamicProperty property;
|
||||
AtomToolsFramework::AtomToolsDocumentRequestBus::EventResult(
|
||||
property, m_documentId, &AtomToolsFramework::AtomToolsDocumentRequestBus::Events::GetProperty,
|
||||
AZ::RPI::MaterialPropertyId(groupNameId, propertyDefinition.m_nameId).GetFullName());
|
||||
AZ::RPI::MaterialPropertyId(groupName, propertyDefinition.m_name).GetFullName());
|
||||
group.m_properties.push_back(property);
|
||||
}
|
||||
}
|
||||
|
||||
// Passing in same group as main and comparison instance to enable custom value comparison for highlighting modified properties
|
||||
auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId),
|
||||
&group, &group, group.TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupName),
|
||||
[this](const auto source, const auto target) { return CompareInstanceNodeProperties(source, target); });
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, propertyGroupWidget);
|
||||
|
||||
bool isGroupVisible = false;
|
||||
AtomToolsFramework::AtomToolsDocumentRequestBus::EventResult(
|
||||
isGroupVisible, m_documentId, &AtomToolsFramework::AtomToolsDocumentRequestBus::Events::IsPropertyGroupVisible, AZ::Name{groupNameId});
|
||||
SetGroupVisible(groupNameId, isGroupVisible);
|
||||
isGroupVisible, m_documentId, &AtomToolsFramework::AtomToolsDocumentRequestBus::Events::IsPropertyGroupVisible, AZ::Name{groupName});
|
||||
SetGroupVisible(groupName, isGroupVisible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -37,12 +37,12 @@ namespace MaterialEditor
|
||||
void Reset() override;
|
||||
|
||||
protected:
|
||||
bool ShouldGroupAutoExpanded(const AZStd::string& groupNameId) const override;
|
||||
void OnGroupExpanded(const AZStd::string& groupNameId) override;
|
||||
void OnGroupCollapsed(const AZStd::string& groupNameId) override;
|
||||
bool ShouldGroupAutoExpanded(const AZStd::string& groupName) const override;
|
||||
void OnGroupExpanded(const AZStd::string& groupName) override;
|
||||
void OnGroupCollapsed(const AZStd::string& groupName) override;
|
||||
|
||||
private:
|
||||
AZ::Crc32 GetGroupSaveStateKey(const AZStd::string& groupNameId) const;
|
||||
AZ::Crc32 GetGroupSaveStateKey(const AZStd::string& groupName) const;
|
||||
bool CompareInstanceNodeProperties(
|
||||
const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) const;
|
||||
|
||||
|
||||
@@ -35,26 +35,26 @@ namespace MaterialEditor
|
||||
|
||||
void SettingsWidget::AddDocumentSettingsGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = "documentSettings";
|
||||
const AZStd::string groupName = "documentSettings";
|
||||
const AZStd::string groupDisplayName = "Document Settings";
|
||||
const AZStd::string groupDescription = "Document Settings";
|
||||
|
||||
const AZ::Crc32 saveStateKey(AZStd::string::format("SettingsWidget::DocumentSettingsGroup"));
|
||||
AddGroup(
|
||||
groupNameId, groupDisplayName, groupDescription,
|
||||
groupName, groupDisplayName, groupDescription,
|
||||
new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
m_documentSettings.get(), nullptr, m_documentSettings->TYPEINFO_Uuid(), this, this, saveStateKey));
|
||||
}
|
||||
|
||||
void SettingsWidget::AddDocumentSystemSettingsGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = "documentSystemSettings";
|
||||
const AZStd::string groupName = "documentSystemSettings";
|
||||
const AZStd::string groupDisplayName = "Document System Settings";
|
||||
const AZStd::string groupDescription = "Document System Settings";
|
||||
|
||||
const AZ::Crc32 saveStateKey(AZStd::string::format("SettingsWidget::DocumentSystemSettingsGroup"));
|
||||
AddGroup(
|
||||
groupNameId, groupDisplayName, groupDescription,
|
||||
groupName, groupDisplayName, groupDescription,
|
||||
new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
m_documentSystemSettings.get(), nullptr, m_documentSystemSettings->TYPEINFO_Uuid(), this, this, saveStateKey));
|
||||
}
|
||||
|
||||
+17
-17
@@ -53,19 +53,19 @@ namespace MaterialEditor
|
||||
|
||||
void ViewportSettingsInspector::AddGeneralGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = "generalSettings";
|
||||
const AZStd::string groupName = "generalSettings";
|
||||
const AZStd::string groupDisplayName = "General Settings";
|
||||
const AZStd::string groupDescription = "General Settings";
|
||||
|
||||
AddGroup(
|
||||
groupNameId, groupDisplayName, groupDescription,
|
||||
groupName, groupDisplayName, groupDescription,
|
||||
new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
m_viewportSettings.get(), nullptr, m_viewportSettings->TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupNameId)));
|
||||
m_viewportSettings.get(), nullptr, m_viewportSettings->TYPEINFO_Uuid(), this, this, GetGroupSaveStateKey(groupName)));
|
||||
}
|
||||
|
||||
void ViewportSettingsInspector::AddModelGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = "modelSettings";
|
||||
const AZStd::string groupName = "modelSettings";
|
||||
const AZStd::string groupDisplayName = "Model Settings";
|
||||
const AZStd::string groupDescription = "Model Settings";
|
||||
|
||||
@@ -93,12 +93,12 @@ namespace MaterialEditor
|
||||
if (m_modelPreset)
|
||||
{
|
||||
auto inspectorWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
m_modelPreset.get(), nullptr, m_modelPreset.get()->TYPEINFO_Uuid(), this, groupWidget, GetGroupSaveStateKey(groupNameId));
|
||||
m_modelPreset.get(), nullptr, m_modelPreset.get()->TYPEINFO_Uuid(), this, groupWidget, GetGroupSaveStateKey(groupName));
|
||||
|
||||
groupWidget->layout()->addWidget(inspectorWidget);
|
||||
}
|
||||
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, groupWidget);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, groupWidget);
|
||||
}
|
||||
|
||||
void ViewportSettingsInspector::AddModelPreset()
|
||||
@@ -152,7 +152,7 @@ namespace MaterialEditor
|
||||
|
||||
void ViewportSettingsInspector::AddLightingGroup()
|
||||
{
|
||||
const AZStd::string groupNameId = "lightingSettings";
|
||||
const AZStd::string groupName = "lightingSettings";
|
||||
const AZStd::string groupDisplayName = "Lighting Settings";
|
||||
const AZStd::string groupDescription = "Lighting Settings";
|
||||
|
||||
@@ -181,12 +181,12 @@ namespace MaterialEditor
|
||||
{
|
||||
auto inspectorWidget = new AtomToolsFramework::InspectorPropertyGroupWidget(
|
||||
m_lightingPreset.get(), nullptr, m_lightingPreset.get()->TYPEINFO_Uuid(), this, groupWidget,
|
||||
GetGroupSaveStateKey(groupNameId));
|
||||
GetGroupSaveStateKey(groupName));
|
||||
|
||||
groupWidget->layout()->addWidget(inspectorWidget);
|
||||
}
|
||||
|
||||
AddGroup(groupNameId, groupDisplayName, groupDescription, groupWidget);
|
||||
AddGroup(groupName, groupDisplayName, groupDescription, groupWidget);
|
||||
}
|
||||
|
||||
void ViewportSettingsInspector::AddLightingPreset()
|
||||
@@ -354,25 +354,25 @@ namespace MaterialEditor
|
||||
return savePath;
|
||||
}
|
||||
|
||||
AZ::Crc32 ViewportSettingsInspector::GetGroupSaveStateKey(const AZStd::string& groupNameId) const
|
||||
AZ::Crc32 ViewportSettingsInspector::GetGroupSaveStateKey(const AZStd::string& groupName) const
|
||||
{
|
||||
return AZ::Crc32(AZStd::string::format("ViewportSettingsInspector::PropertyGroup::%s", groupNameId.c_str()));
|
||||
return AZ::Crc32(AZStd::string::format("ViewportSettingsInspector::PropertyGroup::%s", groupName.c_str()));
|
||||
}
|
||||
|
||||
bool ViewportSettingsInspector::ShouldGroupAutoExpanded(const AZStd::string& groupNameId) const
|
||||
bool ViewportSettingsInspector::ShouldGroupAutoExpanded(const AZStd::string& groupName) const
|
||||
{
|
||||
auto stateItr = m_windowSettings->m_inspectorCollapsedGroups.find(GetGroupSaveStateKey(groupNameId));
|
||||
auto stateItr = m_windowSettings->m_inspectorCollapsedGroups.find(GetGroupSaveStateKey(groupName));
|
||||
return stateItr == m_windowSettings->m_inspectorCollapsedGroups.end();
|
||||
}
|
||||
|
||||
void ViewportSettingsInspector::OnGroupExpanded(const AZStd::string& groupNameId)
|
||||
void ViewportSettingsInspector::OnGroupExpanded(const AZStd::string& groupName)
|
||||
{
|
||||
m_windowSettings->m_inspectorCollapsedGroups.erase(GetGroupSaveStateKey(groupNameId));
|
||||
m_windowSettings->m_inspectorCollapsedGroups.erase(GetGroupSaveStateKey(groupName));
|
||||
}
|
||||
|
||||
void ViewportSettingsInspector::OnGroupCollapsed(const AZStd::string& groupNameId)
|
||||
void ViewportSettingsInspector::OnGroupCollapsed(const AZStd::string& groupName)
|
||||
{
|
||||
m_windowSettings->m_inspectorCollapsedGroups.insert(GetGroupSaveStateKey(groupNameId));
|
||||
m_windowSettings->m_inspectorCollapsedGroups.insert(GetGroupSaveStateKey(groupName));
|
||||
}
|
||||
|
||||
} // namespace MaterialEditor
|
||||
|
||||
+4
-4
@@ -75,10 +75,10 @@ namespace MaterialEditor
|
||||
|
||||
AZStd::string GetDefaultUniqueSaveFilePath(const AZStd::string& baseName) const;
|
||||
|
||||
AZ::Crc32 GetGroupSaveStateKey(const AZStd::string& groupNameId) const;
|
||||
bool ShouldGroupAutoExpanded(const AZStd::string& groupNameId) const override;
|
||||
void OnGroupExpanded(const AZStd::string& groupNameId) override;
|
||||
void OnGroupCollapsed(const AZStd::string& groupNameId) override;
|
||||
AZ::Crc32 GetGroupSaveStateKey(const AZStd::string& groupName) const;
|
||||
bool ShouldGroupAutoExpanded(const AZStd::string& groupName) const override;
|
||||
void OnGroupExpanded(const AZStd::string& groupName) override;
|
||||
void OnGroupCollapsed(const AZStd::string& groupName) override;
|
||||
|
||||
AZ::Render::ModelPresetPtr m_modelPreset;
|
||||
AZ::Render::LightingPresetPtr m_lightingPreset;
|
||||
|
||||
Reference in New Issue
Block a user