c2abd2d74f
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>
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
|
|
#include <AzCore/Serialization/SerializeContext.h>
|
|
|
|
namespace AZ
|
|
{
|
|
namespace RPI
|
|
{
|
|
void MaterialPropertiesLayout::Reflect(ReflectContext* context)
|
|
{
|
|
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
|
{
|
|
serializeContext->Class<MaterialPropertiesLayout>()
|
|
->Version(1)
|
|
->Field("Indexes", &MaterialPropertiesLayout::m_materialPropertyIndexes)
|
|
->Field("Properties", &MaterialPropertiesLayout::m_materialPropertyDescriptors)
|
|
;
|
|
}
|
|
|
|
IdReflectionMapForMaterialProperties::Reflect(context);
|
|
MaterialPropertyOutputId::Reflect(context);
|
|
MaterialPropertyDescriptor::Reflect(context);
|
|
}
|
|
|
|
size_t MaterialPropertiesLayout::GetPropertyCount() const
|
|
{
|
|
return m_materialPropertyDescriptors.size();
|
|
}
|
|
|
|
MaterialPropertyIndex MaterialPropertiesLayout::FindPropertyIndex(const Name& propertyId) const
|
|
{
|
|
return m_materialPropertyIndexes.Find(propertyId);
|
|
}
|
|
|
|
const MaterialPropertyDescriptor* MaterialPropertiesLayout::GetPropertyDescriptor(MaterialPropertyIndex index) const
|
|
{
|
|
if (index.IsValid() && index.GetIndex() < m_materialPropertyDescriptors.size())
|
|
{
|
|
return &m_materialPropertyDescriptors[index.GetIndex()];
|
|
}
|
|
else
|
|
{
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
} // namespace RPI
|
|
} // namespace AZ
|