14d2e38b90
Here we inttroduce a new struct ModelMaterialSlot which formalizes the concept of material slot, with an ID, display name, and default material assignment. The ID still comes from the MaterialUid like before. The display name is built-in, rather than being parsed out from the asset file name. And the default material assignment can be any material asset, it doesn't have to come from the FBX (or other scene file). This commit is just the preliminary set of changes. Cursory testing shows that it works pretty well but more testing is needed (and likely some fixes) before merging. Here is what's left to do... Add serialization version converters to preserve prior prefab data. See if we can get rid of GetLabelByAssetId function only rely on the display name inside ModelMaterialSlot. I'm not sure if the condition for enabling the "Edit Material Instance..." context menu item is correct. Test actors Lots more testing in general Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
48 lines
1.7 KiB
C++
48 lines
1.7 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
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AzCore/std/string/string.h>
|
|
#include <AzCore/std/containers/vector.h>
|
|
|
|
#include <AzCore/Asset/AssetCommon.h>
|
|
|
|
namespace AZ
|
|
{
|
|
namespace Render
|
|
{
|
|
namespace EditorMaterialComponentExporter
|
|
{
|
|
//! Attemts to generate a display label for a material slot by parsing its file name
|
|
AZStd::string GetLabelByAssetId(const AZ::Data::AssetId& assetId);
|
|
|
|
//! Generates a destination file path for exporting material source data
|
|
AZStd::string GetExportPathByAssetId(const AZ::Data::AssetId& assetId);
|
|
|
|
struct ExportItem
|
|
{
|
|
bool m_enabled = true;
|
|
bool m_exists = false;
|
|
bool m_overwrite = false;
|
|
AZ::Data::AssetId m_originalAssetId; //!< AssetId of the original built-in material, which will be exported.
|
|
AZStd::string m_exportPath;
|
|
};
|
|
|
|
using ExportItemsContainer = AZStd::vector<ExportItem>;
|
|
|
|
//! Generates and opens a dialog for configuring material data export paths and actions.
|
|
//! Note this will not modify the m_originalAssetId field in each ExportItem.
|
|
bool OpenExportDialog(ExportItemsContainer& exportItems);
|
|
|
|
//! Attemts to construct and save material source data from a product asset
|
|
bool ExportMaterialSourceData(const ExportItem& exportItem);
|
|
} // namespace EditorMaterialComponentExporter
|
|
} // namespace Render
|
|
} // namespace AZ
|