Merge branch 'Atom/santorac/RemixableMaterialTypes' into Atom/santorac/RemixableMaterialTypes2

This commit is contained in:
santorac
2021-09-28 22:14:23 -07:00
860 changed files with 25089 additions and 12205 deletions
@@ -0,0 +1,38 @@
/*
* 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 <Atom/RPI.Edit/Material/MaterialTypeSourceData.h>
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
namespace AZ
{
class ReflectContext;
namespace RPI
{
//! The property connection itself is rather simple, but we need this custom serializer to provide backward compatibility
//! for when the "id" key was changed to "name". If the JSON serialization system is ever updated to provide built-in
//! support for versioning, then we can probably remove this class.
class JsonMaterialPropertyConnectionSerializer
: public BaseJsonSerializer
{
public:
AZ_RTTI(JsonMaterialPropertyConnectionSerializer, "{2B7F00CF-51F7-4409-9C0E-914E59696FB9}", BaseJsonSerializer);
AZ_CLASS_ALLOCATOR_DECL;
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
JsonDeserializerContext& context) override;
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue,
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context) override;
};
} // namespace RPI
} // namespace AZ
@@ -0,0 +1,38 @@
/*
* 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 <Atom/RPI.Edit/Material/MaterialTypeSourceData.h>
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
namespace AZ
{
class ReflectContext;
namespace RPI
{
//! The property group itself is rather simple, but we need this custom serializer to provide backward compatibility
//! for when the "id" key was changed to "name". If the JSON serialization system is ever updated to provide built-in
//! support for versioning, then we can probably remove this class.
class JsonMaterialPropertyGroupSerializer
: public BaseJsonSerializer
{
public:
AZ_RTTI(JsonMaterialPropertyGroupSerializer, "{74C56BBC-2084-46AF-9393-04C2FBDF6B20}", BaseJsonSerializer);
AZ_CLASS_ALLOCATOR_DECL;
JsonSerializationResult::Result Load(void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
JsonDeserializerContext& context) override;
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue,
const void* defaultValue, const Uuid& valueTypeId, JsonSerializerContext& context) override;
};
} // namespace RPI
} // namespace AZ
@@ -15,6 +15,13 @@
namespace AZ
{
class JsonDeserializerContext;
namespace JsonSerializationResult
{
union ResultCode;
}
namespace RPI
{
class MaterialTypeSourceData;
@@ -35,6 +42,17 @@ namespace AZ
//! @param filePath a relative path if document is provided, an absolute path if document is not provided.
//! @param document the loaded json document.
AZ::Outcome<MaterialTypeSourceData> LoadMaterialTypeSourceData(const AZStd::string& filePath, const rapidjson::Value* document = nullptr);
//! Utility function for custom JSON serializers to report results as "Skipped" when encountering keys that aren't recognized
//! as part of the custom format.
//! @param acceptedFieldNames an array of names that are recognized by the custom format
//! @param acceptedFieldNameCount the number of elements in @acceptedFieldNames
//! @param object the JSON object being loaded
//! @param context the common JsonDeserializerContext that is central to the serialization process
//! @param result the ResultCode that well be updated with the Outcomes "Skipped" if an unrecognized field is encountered
void CheckForUnrecognizedJsonFields(
const AZStd::string_view* acceptedFieldNames, uint32_t acceptedFieldNameCount,
const rapidjson::Value& object, JsonDeserializerContext& context, JsonSerializationResult::ResultCode& result);
}
}
}
@@ -40,7 +40,7 @@ namespace AZ
//! by ShaderVariantAssetBuilder this is 1+.
static uint32_t MakeAssetProductSubId(
uint32_t rhiApiUniqueIndex, uint32_t supervariantIndex, ShaderVariantStableId variantStableId,
uint32_t subProductType = ShaderVariantAssetSubProductType);
uint32_t subProductType = 0);
ShaderVariantAsset() = default;
~ShaderVariantAsset() = default;