Add material property names to material assets, disable FBX dependency on materialtype files. (#3408)

* Add material property names to material assets, disable FBX dependency on materialtype files.

Signed-off-by: Robin <rbarrand@amazon.com>

* Add reflection for MaterialAssets. Update member variable comment.

Signed-off-by: Robin <rbarrand@amazon.com>

* Switch cvar to using bus value. Refine comments.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor functions and refine comments.

Signed-off-by: Robin <rbarrand@amazon.com>

* Realign property values when material property names are populated.

Signed-off-by: Robin <rbarrand@amazon.com>

* Switch PostLoadInit check to on asset status ready. Add realign property values code to PostLoadInit as well.

Signed-off-by: Robin <rbarrand@amazon.com>

* Stash@{1} code.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor realignment code into the right places.

Signed-off-by: Robin <rbarrand@amazon.com>

* Remove pragma optmize off.

Signed-off-by: Robin <rbarrand@amazon.com>

* More refactoring.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor comments and remove code no longer needed.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor comments and remove unused include.

Signed-off-by: Robin <rbarrand@amazon.com>

* Comment refactor, corrected some code.

Signed-off-by: Robin <rbarrand@amazon.com>

Co-authored-by: Robin <rbarrand@amazon.com>
This commit is contained in:
hershey5045
2021-09-01 16:01:33 -07:00
committed by GitHub
parent 413e82428c
commit 4249ceeae7
10 changed files with 115 additions and 16 deletions
@@ -78,7 +78,9 @@ namespace AZ
AZStd::string materialTypePath;
RPI::MaterialConverterBus::BroadcastResult(materialTypePath, &RPI::MaterialConverterBus::Events::GetMaterialTypePath);
if (conversionEnabled && !materialTypePath.empty())
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
if (conversionEnabled && !materialTypePath.empty() && !includeMaterialPropertyNames)
{
AssetBuilderSDK::SourceFileDependency materialTypeSource;
materialTypeSource.m_sourceFileDependencyPath = materialTypePath;
@@ -101,6 +103,10 @@ namespace AZ
RPI::MaterialConverterBus::BroadcastResult(conversionEnabled, &RPI::MaterialConverterBus::Events::IsEnabled);
fingerprintInfo.insert(AZStd::string::format("[MaterialConverter enabled=%d]", conversionEnabled));
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
fingerprintInfo.insert(AZStd::string::format("[MaterialConverter includeMaterialPropertyNames=%d]", includeMaterialPropertyNames));
if (!conversionEnabled)
{
AZStd::string defaultMaterialPath;
@@ -219,6 +225,8 @@ namespace AZ
}
}
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
// Build material assets.
for (auto& itr : materialSourceDataByUid)
{
@@ -226,7 +234,7 @@ namespace AZ
Data::AssetId assetId(sourceSceneUuid, GetMaterialAssetSubId(materialUid));
auto materialSourceData = itr.second;
Outcome<Data::Asset<MaterialAsset>> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", false);
Outcome<Data::Asset<MaterialAsset>> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", false, includeMaterialPropertyNames);
if (result.IsSuccess())
{
context.m_outputMaterialsByUid[materialUid] = { result.GetValue(), materialSourceData.m_name };