Fixed up a few small things to get Material Editor working again.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
"description": "Base material for the reflection probe visualization model.",
|
||||
"version": 1,
|
||||
"propertyLayout": {
|
||||
"version": 1,
|
||||
"propertySets": [
|
||||
{
|
||||
"name": "settings",
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace AZ
|
||||
static const float DefaultMax;
|
||||
static const float DefaultStep;
|
||||
|
||||
// TODO: Consider making this private and readonly because it is used as the key for lookups and collision validation.
|
||||
AZStd::string m_name; //!< The name of the property within the property group. The full property ID will be groupName.propertyName.
|
||||
|
||||
MaterialPropertyVisibility m_visibility = MaterialPropertyVisibility::Default;
|
||||
@@ -213,9 +214,9 @@ namespace AZ
|
||||
AZStd::string m_description; //< TODO: Make this private
|
||||
|
||||
//! Version 1 is the default and should not contain any version update.
|
||||
uint32_t m_version = 1;
|
||||
uint32_t m_version = 1; //< TODO: Make this private
|
||||
|
||||
VersionUpdates m_versionUpdates;
|
||||
VersionUpdates m_versionUpdates; //< TODO: Make this private
|
||||
|
||||
//! A list of shader variants that are always used at runtime; they cannot be turned off
|
||||
AZStd::vector<ShaderVariantReferenceData> m_shaderCollection; //< TODO: Make this private
|
||||
@@ -283,11 +284,7 @@ namespace AZ
|
||||
MaterialTypeAssetCreator& materialTypeAssetCreator,
|
||||
AZStd::vector<AZStd::string>& propertyNameContext,
|
||||
const MaterialTypeSourceData::PropertySet* propertySet) const;
|
||||
|
||||
//! Possibly renames @propertyId based on the material version update steps.
|
||||
//! @return true if the property was renamed
|
||||
bool ApplyPropertyRenames(MaterialPropertyId& propertyId) const;
|
||||
|
||||
|
||||
//! Construct a complete list of group definitions, including implicit groups, arranged in the same order as the source data.
|
||||
//! Groups with the same name will be consolidated into a single entry.
|
||||
//! Operates on the old format PropertyLayout::m_groups, used for conversion to the new format.
|
||||
|
||||
@@ -585,11 +585,11 @@ namespace MaterialEditor
|
||||
bool result = true;
|
||||
|
||||
// populate sourceData with properties that meet the filter
|
||||
m_materialTypeSourceData.EnumerateProperties([this, &sourceData, &propertyFilter, &result](const AZStd::string& propertyIdContext, const auto& propertyDefinition) {
|
||||
m_materialTypeSourceData.EnumerateProperties([&](const AZStd::string& propertyIdContext, const auto& propertyDefinition) {
|
||||
|
||||
const AZStd::string propertyId = propertyIdContext + propertyDefinition->m_name;
|
||||
Name propertyId{propertyIdContext + propertyDefinition->m_name};
|
||||
|
||||
const auto it = m_properties.find(Name{propertyId});
|
||||
const auto it = m_properties.find(propertyId);
|
||||
if (it != m_properties.end() && propertyFilter(it->second))
|
||||
{
|
||||
MaterialPropertyValue propertyValue = AtomToolsFramework::ConvertToRuntimeType(it->second.GetValue());
|
||||
@@ -603,7 +603,7 @@ namespace MaterialEditor
|
||||
}
|
||||
|
||||
// TODO: Support populating the Material Editor with nested property sets, not just the top level.
|
||||
const AZStd::string groupName = propertyId.substr(0, propertyId.size() - propertyDefinition->m_name.size() - 1);
|
||||
const AZStd::string groupName = propertyId.GetStringView().substr(0, propertyId.GetStringView().size() - propertyDefinition->m_name.size() - 1);
|
||||
sourceData.m_properties[groupName][propertyDefinition->m_name].m_value = propertyValue;
|
||||
}
|
||||
}
|
||||
@@ -897,12 +897,12 @@ namespace MaterialEditor
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool enumerateResult = m_materialTypeSourceData.EnumeratePropertySets(
|
||||
[this, &materialTypeSourceFilePath](const AZStd::string&, const MaterialTypeSourceData::PropertySet* propertySet)
|
||||
[this](const AZStd::string&, const MaterialTypeSourceData::PropertySet* propertySet)
|
||||
{
|
||||
const MaterialFunctorSourceData::EditorContext editorContext = MaterialFunctorSourceData::EditorContext(
|
||||
materialTypeSourceFilePath, m_materialAsset->GetMaterialPropertiesLayout());
|
||||
m_materialSourceData.m_materialType, m_materialAsset->GetMaterialPropertiesLayout());
|
||||
|
||||
for (Ptr<MaterialFunctorSourceDataHolder> functorData : propertySet->GetFunctors())
|
||||
{
|
||||
|
||||
+3
-3
@@ -122,7 +122,7 @@ namespace AZ
|
||||
AZ::RPI::MaterialPropertyValue propertyValue =
|
||||
editData.m_materialAsset->GetPropertyValues()[propertyIndex.GetIndex()];
|
||||
|
||||
AZ::RPI::MaterialPropertyValue propertyValueDefault = propertyDefinition.m_value;
|
||||
AZ::RPI::MaterialPropertyValue propertyValueDefault = propertyDefinition->m_value;
|
||||
if (editData.m_materialParentAsset.IsReady())
|
||||
{
|
||||
propertyValueDefault = editData.m_materialParentAsset->GetPropertyValues()[propertyIndex.GetIndex()];
|
||||
@@ -135,7 +135,7 @@ namespace AZ
|
||||
propertyValue = AZ::RPI::MaterialPropertyValue::FromAny(propertyOverrideItr->second);
|
||||
}
|
||||
|
||||
if (!AtomToolsFramework::ConvertToExportFormat(path, propertyId, propertyDefinition, propertyValue))
|
||||
if (!AtomToolsFramework::ConvertToExportFormat(path, propertyId, *propertyDefinition, propertyValue))
|
||||
{
|
||||
AZ_Error("AZ::Render::EditorMaterialComponentUtil", false, "Failed to export: %s", path.c_str());
|
||||
result = false;
|
||||
@@ -151,7 +151,7 @@ namespace AZ
|
||||
|
||||
// TODO: Support populating the Material Editor with nested property sets, not just the top level.
|
||||
const AZStd::string groupName = propertyId.GetStringView().substr(0, propertyId.GetStringView().size() - propertyDefinition->m_name.size() - 1);
|
||||
exportData.m_properties[groupName][propertyDefinition.m_name].m_value = propertyValue;
|
||||
exportData.m_properties[groupName][propertyDefinition->m_name].m_value = propertyValue;
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user