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,208 @@
/*
* 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 <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneData/Groups/AnimationGroup.h>
#include <SceneAPI/SceneData/GraphData/RootBoneData.h>
namespace AZ
{
namespace SceneAPI
{
void DataTypes::IAnimationGroup::PerBoneCompression::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
serializeContext->Class<IAnimationGroup::PerBoneCompression>()->Version(1)
->Field("boneNamePattern", &IAnimationGroup::PerBoneCompression::m_boneNamePattern)
->Field("compressionStrength", &IAnimationGroup::PerBoneCompression::m_compressionStrength)
;
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<IAnimationGroup::PerBoneCompression>("Compression Override", "Compression settings for an individual bone.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->DataElement("NodeListSelection", &IAnimationGroup::PerBoneCompression::m_boneNamePattern, "Bone name/pattern", "Bone name or pattern with wildcards, e.g. \"*arm*\".")
->Attribute("ClassTypeIdFilter", AZ::SceneAPI::DataTypes::IBoneData::TYPEINFO_Uuid())
->Attribute(AZ::Edit::Attributes::ComboBoxEditable, true)
->DataElement(Edit::UIHandlers::Slider, &IAnimationGroup::PerBoneCompression::m_compressionStrength, "Strength", "Compression strength to use for the specified bone.")
->Attribute(AZ::Edit::Attributes::Min, 0.f)
->Attribute(AZ::Edit::Attributes::Max, 1.f)
;
}
}
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(AnimationGroup, SystemAllocator, 0)
AnimationGroup::AnimationGroup()
: m_id(Uuid::CreateRandom())
, m_startFrame(0)
, m_endFrame(0)
, m_defaultCompressionStrength(0.1f)
{
}
const AZStd::string& AnimationGroup::GetName() const
{
return m_name;
}
void AnimationGroup::SetName(const AZStd::string& name)
{
m_name = name;
}
void AnimationGroup::SetName(AZStd::string&& name)
{
m_name = AZStd::move(name);
}
const Uuid& AnimationGroup::GetId() const
{
return m_id;
}
void AnimationGroup::OverrideId(const Uuid& id)
{
m_id = id;
}
Containers::RuleContainer& AnimationGroup::GetRuleContainer()
{
return m_rules;
}
const Containers::RuleContainer& AnimationGroup::GetRuleContainerConst() const
{
return m_rules;
}
const AZStd::string& AnimationGroup::GetSelectedRootBone() const
{
return m_selectedRootBone;
}
uint32_t AnimationGroup::GetStartFrame() const
{
return m_startFrame;
}
uint32_t AnimationGroup::GetEndFrame() const
{
return m_endFrame;
}
const float AnimationGroup::GetDefaultCompressionStrength() const
{
return m_defaultCompressionStrength;
}
const DataTypes::IAnimationGroup::PerBoneCompressionList& AnimationGroup::GetPerBoneCompression() const
{
return m_perBoneCompression;
}
void AnimationGroup::SetSelectedRootBone(const AZStd::string& selectedRootBone)
{
m_selectedRootBone = selectedRootBone;
}
void AnimationGroup::SetStartFrame(uint32_t frame)
{
m_startFrame = frame;
}
void AnimationGroup::SetEndFrame(uint32_t frame)
{
m_endFrame = frame;
}
void AnimationGroup::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
DataTypes::IAnimationGroup::PerBoneCompression::Reflect(context);
serializeContext->Class<AnimationGroup, DataTypes::IAnimationGroup>()->Version(3, VersionConverter)
->Field("name", &AnimationGroup::m_name)
->Field("id", &AnimationGroup::m_id)
->Field("selectedRootBone", &AnimationGroup::m_selectedRootBone)
->Field("startFrame", &AnimationGroup::m_startFrame)
->Field("endFrame", &AnimationGroup::m_endFrame)
->Field("defaultCompressionStrength", &AnimationGroup::m_defaultCompressionStrength)
->Field("perBoneCompression", &AnimationGroup::m_perBoneCompression)
->Field("rules", &AnimationGroup::m_rules)
;
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<AnimationGroup>("Animation group", "Configure animation data exporting.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &AnimationGroup::m_name, "Group name",
"Name for the group. This name will also be used as the name for the generated file.")
->Attribute("FilterType", DataTypes::IAnimationGroup::TYPEINFO_Uuid())
->DataElement("NodeListSelection", &AnimationGroup::m_selectedRootBone, "Select root bone", "The root bone of the animation that will be exported.")
->Attribute("ClassTypeIdFilter", AZ::SceneAPI::DataTypes::IBoneData::TYPEINFO_Uuid())
->DataElement(Edit::UIHandlers::Default, &AnimationGroup::m_startFrame, "Start frame", "The start frame of the animation that will be exported.")
->DataElement(Edit::UIHandlers::Default, &AnimationGroup::m_endFrame, "End frame", "The end frame of the animation that will be exported.")
->DataElement(Edit::UIHandlers::Default, &AnimationGroup::m_rules, "", "Add or remove rules to fine-tune the export process.")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->ClassElement(Edit::ClassElements::Group, "Compression")
->DataElement(Edit::UIHandlers::Slider, &AnimationGroup::m_defaultCompressionStrength, "Default strength", "Default compression strength to use by default for all bones.")
->Attribute(AZ::Edit::Attributes::Min, 0.f)
->Attribute(AZ::Edit::Attributes::Max, 1.f)
->DataElement(Edit::UIHandlers::Default, &AnimationGroup::m_perBoneCompression, "Bone/group overrides", "Compression strength overrides for specific bones, or bone groups (using wildcards).")
;
}
}
bool AnimationGroup::VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement)
{
const unsigned int version = classElement.GetVersion();
bool result = true;
// Replaced vector<IRule> with RuleContainer.
if (version == 1)
{
result = result && Containers::RuleContainer::VectorToRuleContainerConverter(context, classElement);
}
// Added a uuid "id" as the unique identifier to replace the file name.
// Setting it to null by default and expecting a behavior to patch this when additional information is available.
if (version <= 2)
{
result = result && classElement.AddElementWithData<AZ::Uuid>(context, "id", AZ::Uuid::CreateNull()) != -1;
}
return result;
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,71 @@
/*
* 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/Memory/Memory.h>
#include <SceneAPI/SceneCore/Containers/RuleContainer.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/IAnimationGroup.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace SceneData
{
class AnimationGroup
: public DataTypes::IAnimationGroup
{
public:
AZ_RTTI(AnimationGroup, "{982E0030-8131-43E9-BA8C-23775A3B7219}", DataTypes::IAnimationGroup);
AZ_CLASS_ALLOCATOR_DECL
AnimationGroup();
~AnimationGroup() override = default;
const AZStd::string& GetName() const override;
void SetName(const AZStd::string& name);
void SetName(AZStd::string&& name);
const Uuid& GetId() const override;
void OverrideId(const Uuid& id);
Containers::RuleContainer& GetRuleContainer() override;
const Containers::RuleContainer& GetRuleContainerConst() const;
const AZStd::string& GetSelectedRootBone() const override;
uint32_t GetStartFrame() const override;
uint32_t GetEndFrame() const override;
const float GetDefaultCompressionStrength() const override;
const DataTypes::IAnimationGroup::PerBoneCompressionList& GetPerBoneCompression() const override;
void SetSelectedRootBone(const AZStd::string& selectedRootBone) override;
void SetStartFrame(uint32_t frame) override;
void SetEndFrame(uint32_t frame) override;
static void Reflect(ReflectContext* context);
static bool VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement);
protected:
DataTypes::IAnimationGroup::PerBoneCompressionList m_perBoneCompression;
Containers::RuleContainer m_rules;
AZStd::string m_selectedRootBone;
AZStd::string m_name;
Uuid m_id;
uint32_t m_startFrame;
uint32_t m_endFrame;
float m_defaultCompressionStrength;
};
}
}
}
@@ -0,0 +1,135 @@
/*
* 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 <algorithm>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <SceneAPI/SceneData/Groups/MeshGroup.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshData.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneUI/RowWidgets/ManifestVectorHandler.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
MeshGroup::MeshGroup()
: m_id(Uuid::CreateRandom())
{
}
const AZStd::string& MeshGroup::GetName() const
{
return m_name;
}
void MeshGroup::SetName(const AZStd::string& name)
{
m_name = name;
}
void MeshGroup::SetName(AZStd::string&& name)
{
m_name = AZStd::move(name);
}
const Uuid& MeshGroup::GetId() const
{
return m_id;
}
void MeshGroup::OverrideId(const Uuid& id)
{
m_id = id;
}
Containers::RuleContainer& MeshGroup::GetRuleContainer()
{
return m_rules;
}
const Containers::RuleContainer& MeshGroup::GetRuleContainerConst() const
{
return m_rules;
}
DataTypes::ISceneNodeSelectionList& MeshGroup::GetSceneNodeSelectionList()
{
return m_nodeSelectionList;
}
const DataTypes::ISceneNodeSelectionList& MeshGroup::GetSceneNodeSelectionList() const
{
return m_nodeSelectionList;
}
void MeshGroup::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<MeshGroup, DataTypes::IMeshGroup>()
->Version(3, VersionConverter)
->Field("name", &MeshGroup::m_name)
->Field("nodeSelectionList", &MeshGroup::m_nodeSelectionList)
->Field("rules", &MeshGroup::m_rules)
->Field("id", &MeshGroup::m_id);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<MeshGroup>("Mesh group", "Name and configure 1 or more meshes from your source file.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &MeshGroup::m_name, "Name mesh",
"Name the mesh as you want it to appear in the Lumberyard Asset Browser.")
->Attribute("FilterType", DataTypes::IMeshGroup::TYPEINFO_Uuid())
->DataElement(Edit::UIHandlers::Default, &MeshGroup::m_nodeSelectionList, "Select meshes", "Select 1 or more meshes to add to this asset in the Lumberyard Asset Browser.")
->Attribute("FilterName", "meshes")
->Attribute("FilterType", DataTypes::IMeshData::TYPEINFO_Uuid())
->DataElement(Edit::UIHandlers::Default, &MeshGroup::m_rules, "", "Add or remove rules to fine-tune the export process.")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20));
}
}
bool MeshGroup::VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement)
{
const unsigned int version = classElement.GetVersion();
// Replaced vector<IRule> with RuleContainer.
bool result = true;
if (version == 1)
{
result = result && Containers::RuleContainer::VectorToRuleContainerConverter(context, classElement);
}
// Added a uuid "id" as the unique identifier to replace the file name.
// Setting it to null by default and expecting a behavior to patch this when additional information is available.
if (version <= 2)
{
result = result && classElement.AddElementWithData<AZ::Uuid>(context, "id", AZ::Uuid::CreateNull()) != -1;
}
return result;
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,69 @@
/*
* 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/Memory/Memory.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/SceneCore/Containers/RuleContainer.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/IMeshGroup.h>
#include <SceneAPI/SceneData/ManifestBase/SceneNodeSelectionList.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class MeshGroup
: public DataTypes::IMeshGroup
{
public:
AZ_RTTI(MeshGroup, "{07B356B7-3635-40B5-878A-FAC4EFD5AD86}", DataTypes::IMeshGroup);
AZ_CLASS_ALLOCATOR(MeshGroup, SystemAllocator, 0)
MeshGroup();
~MeshGroup() override = default;
const AZStd::string& GetName() const override;
void SetName(const AZStd::string& name);
void SetName(AZStd::string&& name) override;
const Uuid& GetId() const override;
void OverrideId(const Uuid& id) override;
Containers::RuleContainer& GetRuleContainer() override;
const Containers::RuleContainer& GetRuleContainerConst() const override;
DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() override;
const DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() const override;
static void Reflect(AZ::ReflectContext* context);
static bool VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement);
protected:
SceneNodeSelectionList m_nodeSelectionList;
Containers::RuleContainer m_rules;
AZStd::string m_name;
Uuid m_id;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,135 @@
/*
* 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 <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneData/Groups/SkeletonGroup.h>
#include <SceneAPI/SceneData/GraphData/RootBoneData.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(SkeletonGroup, SystemAllocator, 0)
SkeletonGroup::SkeletonGroup()
: m_id(Uuid::CreateRandom())
{
}
const AZStd::string& SkeletonGroup::GetName() const
{
return m_name;
}
void SkeletonGroup::SetName(const AZStd::string& name)
{
m_name = name;
}
void SkeletonGroup::SetName(AZStd::string&& name)
{
m_name = AZStd::move(name);
}
const Uuid& SkeletonGroup::GetId() const
{
return m_id;
}
void SkeletonGroup::OverrideId(const Uuid& id)
{
m_id = id;
}
Containers::RuleContainer& SkeletonGroup::GetRuleContainer()
{
return m_rules;
}
const Containers::RuleContainer& SkeletonGroup::GetRuleContainerConst() const
{
return m_rules;
}
const AZStd::string& SkeletonGroup::GetSelectedRootBone() const
{
return m_selectedRootBone;
}
void SkeletonGroup::SetSelectedRootBone(const AZStd::string& selectedRootBone)
{
m_selectedRootBone = selectedRootBone;
}
void SkeletonGroup::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkeletonGroup, DataTypes::ISkeletonGroup>()->Version(3, VersionConverter)
->Field("name", &SkeletonGroup::m_name)
->Field("selectedRootBone", &SkeletonGroup::m_selectedRootBone)
->Field("rules", &SkeletonGroup::m_rules)
->Field("id", &SkeletonGroup::m_id);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkeletonGroup>("Skeleton group", "Name and configure a skeleton from your source file.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &SkeletonGroup::m_name, "Name skeleton",
"Name the skeleton as you want it to appear in the Lumberyard Asset Browser.")
->Attribute("FilterType", DataTypes::ISkeletonGroup::TYPEINFO_Uuid())
->DataElement("NodeListSelection", &SkeletonGroup::m_selectedRootBone, "Select root bone", "Select the root bone of the skeleton.")
->Attribute("ClassTypeIdFilter", AZ::SceneData::GraphData::RootBoneData::TYPEINFO_Uuid())
->DataElement(Edit::UIHandlers::Default, &SkeletonGroup::m_rules, "", "Add or remove rules to fine-tune the export process.")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20));
}
}
bool SkeletonGroup::VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement)
{
const unsigned int version = classElement.GetVersion();
bool result = true;
// Replaced vector<IRule> with RuleContainer.
if (version == 1)
{
result = result && Containers::RuleContainer::VectorToRuleContainerConverter(context, classElement);
}
// Added a uuid "id" as the unique identifier to replace the file name.
// Setting it to null by default and expecting a behavior to patch this when additional information is available.
if (version <= 2)
{
result = result && classElement.AddElementWithData<AZ::Uuid>(context, "id", AZ::Uuid::CreateNull()) != -1;
}
return result;
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,63 @@
/*
* 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/Memory/Memory.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/containers/vector.h>
#include <SceneAPI/SceneCore/Containers/RuleContainer.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/ISkeletonGroup.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace SceneData
{
class SkeletonGroup
: public DataTypes::ISkeletonGroup
{
public:
AZ_RTTI(SkeletonGroup, "{F5F8D1BF-3A24-45E8-8C3F-6A682CA02520}", DataTypes::ISkeletonGroup);
AZ_CLASS_ALLOCATOR_DECL
SkeletonGroup();
~SkeletonGroup() override = default;
const AZStd::string& GetName() const override;
void SetName(const AZStd::string& name);
void SetName(AZStd::string&& name);
const Uuid& GetId() const override;
void OverrideId(const Uuid& id);
Containers::RuleContainer& GetRuleContainer();
const Containers::RuleContainer& GetRuleContainerConst() const;
const AZStd::string& GetSelectedRootBone() const override;
void SetSelectedRootBone(const AZStd::string& selectedRootBone) override;
static void Reflect(ReflectContext* context);
static bool VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement);
protected:
Containers::RuleContainer m_rules;
AZStd::string m_name;
AZStd::string m_selectedRootBone;
Uuid m_id;
};
}
}
}
@@ -0,0 +1,141 @@
/*
* 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 <SceneAPI/SceneData/Groups/SkinGroup.h>
#include <SceneAPI/SceneCore/Containers/Views/SceneGraphChildIterator.h>
#include <SceneAPI/SceneCore/Containers/Utilities/Filters.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/ISkinWeightData.h>
#include <SceneAPI/SceneData/Behaviors/SkinGroup.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(SkinGroup, AZ::SystemAllocator, 0)
SkinGroup::SkinGroup()
: m_id(Uuid::CreateRandom())
{
}
const AZStd::string& SkinGroup::GetName() const
{
return m_name;
}
void SkinGroup::SetName(const AZStd::string& name)
{
m_name = name;
}
void SkinGroup::SetName(AZStd::string&& name)
{
m_name = AZStd::move(name);
}
const Uuid& SkinGroup::GetId() const
{
return m_id;
}
void SkinGroup::OverrideId(const Uuid& id)
{
m_id = id;
}
Containers::RuleContainer& SkinGroup::GetRuleContainer()
{
return m_rules;
}
const Containers::RuleContainer& SkinGroup::GetRuleContainerConst() const
{
return m_rules;
}
DataTypes::ISceneNodeSelectionList& SkinGroup::GetSceneNodeSelectionList()
{
return m_nodeSelectionList;
}
const DataTypes::ISceneNodeSelectionList& SkinGroup::GetSceneNodeSelectionList() const
{
return m_nodeSelectionList;
}
void SkinGroup::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkinGroup, DataTypes::ISkinGroup>()->Version(3, VersionConverter)
->Field("name", &SkinGroup::m_name)
->Field("nodeSelectionList", &SkinGroup::m_nodeSelectionList)
->Field("rules", &SkinGroup::m_rules)
->Field("id", &SkinGroup::m_id);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkinGroup>("Skin group", "Name and configure 1 or more skins from your source file.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &SkinGroup::m_name, "Name skin",
"Name the skin as you want it to appear in the Lumberyard Asset Browser.")
->Attribute("FilterType", DataTypes::ISkinGroup::TYPEINFO_Uuid())
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &SkinGroup::m_nodeSelectionList, "Select skins", "Select 1 or more skins to add to this asset in the Lumberyard Asset Browser.")
->Attribute("FilterName", "skins")
->Attribute("FilterVirtualType", Behaviors::SkinGroup::s_skinVirtualType)
->DataElement(Edit::UIHandlers::Default, &SkinGroup::m_rules, "", "Add or remove rules to fine-tune the export process.")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20));
}
}
bool SkinGroup::VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement)
{
const unsigned int version = classElement.GetVersion();
bool result = true;
// Replaced vector<IRule> with RuleContainer.
if (version == 1)
{
result = result && Containers::RuleContainer::VectorToRuleContainerConverter(context, classElement);
}
// Added a uuid "id" as the unique identifier to replace the file name.
// Setting it to null by default and expecting a behavior to patch this when additional information is available.
if (version <= 2)
{
result = result && classElement.AddElementWithData<AZ::Uuid>(context, "id", AZ::Uuid::CreateNull()) != -1;
}
return result;
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,71 @@
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/SceneCore/Containers/RuleContainer.h>
#include <SceneAPI/SceneCore/Containers/SceneGraph.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/ISkinGroup.h>
#include <SceneAPI/SceneData/ManifestBase/SceneNodeSelectionList.h>
namespace AZ
{
class ReflectContex;
namespace SceneAPI
{
namespace DataTypes
{
class IRule;
}
namespace SceneData
{
class SkinGroup : public DataTypes::ISkinGroup
{
public:
AZ_RTTI(SkinGroup, "{A3217B13-79EA-4487-9A13-5D382EA9077A}", DataTypes::ISkinGroup);
AZ_CLASS_ALLOCATOR_DECL
SkinGroup();
~SkinGroup() override = default;
const AZStd::string& GetName() const override;
void SetName(const AZStd::string& name);
void SetName(AZStd::string&& name);
const Uuid& GetId() const override;
void OverrideId(const Uuid& id);
Containers::RuleContainer& GetRuleContainer();
const Containers::RuleContainer& GetRuleContainerConst() const;
DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() override;
const DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() const override;
static void Reflect(AZ::ReflectContext* context);
static bool VersionConverter(SerializeContext& context, SerializeContext::DataElementNode& classElement);
protected:
SceneNodeSelectionList m_nodeSelectionList;
Containers::RuleContainer m_rules;
AZStd::string m_name;
Uuid m_id;
};
} // SceneData
} // SceneAPI
} // AZ