Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,29 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "AssetParser.h"
namespace AZ
{
namespace RC
{
AssetParser::AssetParser(const AZStd::string& assetName)
: m_assetName(assetName)
{
}
AssetBuilderSDK::ProductPathDependencySet AssetParser::GetProductDependencies(const AZStd::string& /*fullPath*/)
{
return {};
}
} // namespace RC
} // namespace AZ
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/std/string/string.h>
#include <AzCore/std/containers/vector.h>
#include "AssetBuilderSDK/AssetBuilderSDK.h"
namespace AZ
{
namespace RC
{
class AssetParser
{
public:
AssetParser(const AZStd::string& assetName);
virtual ~AssetParser() {}
virtual AssetBuilderSDK::ProductPathDependencySet GetProductDependencies(const AZStd::string& fullPath);
protected:
AZStd::string m_assetName;
};
} // namespace RC
} // namespace AZ
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "ProductInfoCreator.h"
#include <CryPath.h>
#include <QFileInfo>
namespace AZ
{
namespace RC
{
ProductInfoCreator::ProductInfoCreator()
{
m_productAssetType = AZ::Data::AssetType::CreateNull();
}
AssetBuilderSDK::JobProduct ProductInfoCreator::GenerateProductInfo(const AZStd::string& sourceFile, const AZStd::string& fullPath)
{
AZStd::unique_ptr<AssetParser> legacyAssetParser = CreateLegacyAssetParser(sourceFile);
AZStd::string fileName = QFileInfo(sourceFile.c_str()).fileName().toUtf8().constData();
AssetBuilderSDK::JobProduct product(fileName, m_productAssetType);
product.m_pathDependencies = legacyAssetParser->GetProductDependencies(fullPath);
product.m_dependenciesHandled = true; // We've populated the dependencies immediately above so it's OK to tell the AP we've handled dependencies
return product;
}
AZStd::unique_ptr<AssetParser> ProductInfoCreator::CreateLegacyAssetParser(const AZStd::string& sourceFile)
{
AZStd::string fileExtension(PathUtil::GetExt(sourceFile.c_str()));
// Use the file extension to select the correct asset parser.
/*Sample code:
if (fileExtension == "font" || fileExtension == "fontfamily")
{
m_productAssetType = fontAssetType;
return AZStd::unique_ptr<AssetParser>(new FontAssetParser(sourceFile));
}*/
return AZStd::unique_ptr<AssetParser>(new AssetParser(sourceFile));
}
} // namespace RC
} // namespace AZ
@@ -0,0 +1,42 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include "AssetParser.h"
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AssetBuilderSDK/AssetBuilderSDK.h>
namespace AZ
{
namespace RC
{
static AZ::Data::AssetType fontAssetType("{57767D37-0EBE-43BE-8F60-AB36D2056EF8}"); // form UiAssetTypes.h
class ProductInfoCreator
{
public:
ProductInfoCreator();
AssetBuilderSDK::JobProduct GenerateProductInfo(const AZStd::string& sourceFile, const AZStd::string& fullPath);
protected:
virtual AZStd::unique_ptr<AssetParser> CreateLegacyAssetParser(const AZStd::string& sourceFile);
AZ::Data::AssetType m_productAssetType;
};
} // namespace RC
} // namespace AZ