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,72 @@
/*
* 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/GraphData/IBlendShapeData.h>
#include <SceneAPI/SceneData/GraphData/SkinMeshData.h>
#include <SceneAPI/SceneData/Rules/BlendShapeRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(BlendShapeRule, AZ::SystemAllocator, 0)
SceneNodeSelectionList& BlendShapeRule::GetNodeSelectionList()
{
return m_blendShapes;
}
DataTypes::ISceneNodeSelectionList& BlendShapeRule::GetSceneNodeSelectionList()
{
return m_blendShapes;
}
const DataTypes::ISceneNodeSelectionList& BlendShapeRule::GetSceneNodeSelectionList() const
{
return m_blendShapes;
}
void BlendShapeRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<BlendShapeRule, DataTypes::IBlendShapeRule>()->Version(1)
->Field("blendShapes", &BlendShapeRule::m_blendShapes);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<BlendShapeRule>("Blend shapes", "Select mesh targets to configure blend shapes at a later time using Lumberyard.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ_CRC("ManifestName", 0x5215b349), &BlendShapeRule::m_blendShapes, "Select blend shapes",
"Select 1 or more meshes to include in the skin group for later use with the blend shape system.")
->Attribute("FilterName", "blend shapes")
->Attribute("FilterType", DataTypes::IBlendShapeData::TYPEINFO_Uuid())
->Attribute("NarrowSelection", true);
}
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,52 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/vector.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IBlendShapeRule.h>
#include <SceneAPI/SceneData/ManifestBase/SceneNodeSelectionList.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class SCENE_DATA_CLASS BlendShapeRule
: public DataTypes::IBlendShapeRule
{
public:
AZ_RTTI(BlendShapeRule, "{E9D04F75-735B-484B-A6F1-5B91F92B36B4}", DataTypes::IBlendShapeRule);
AZ_CLASS_ALLOCATOR_DECL
SCENE_DATA_API ~BlendShapeRule() override = default;
SCENE_DATA_API SceneNodeSelectionList& GetNodeSelectionList();
SCENE_DATA_API DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() override;
SCENE_DATA_API const DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList() const override;
static void Reflect(ReflectContext* context);
protected:
SceneNodeSelectionList m_blendShapes;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,56 @@
/*
* 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/SceneData/Rules/CommentRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(CommentRule, AZ::SystemAllocator, 0)
const AZStd::string& CommentRule::GetComment() const
{
return m_comment;
}
void CommentRule::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<CommentRule, DataTypes::ICommentRule>()->Version(1)
->Field("comment", &CommentRule::m_comment);
AZ::EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<CommentRule>("Comment", "Add an optional comment to the asset's properties.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement("MultiLineEdit", &CommentRule::m_comment, "", "Text for the comment.")
->Attribute("PlaceholderText", "Add comment text here");
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,49 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ICommentRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class CommentRule
: public DataTypes::ICommentRule
{
public:
AZ_RTTI(CommentRule, "{9A20AC53-04B3-4A2F-A43F-338456974874}", DataTypes::ICommentRule);
AZ_CLASS_ALLOCATOR_DECL
~CommentRule() override = default;
const AZStd::string& GetComment() const override;
static void Reflect(ReflectContext* context);
protected:
AZStd::string m_comment;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,97 @@
/*
* 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/GraphData/IMeshData.h>
#include <SceneAPI/SceneData/Rules/LodRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
const size_t LodRule::m_maxLods;
AZ_CLASS_ALLOCATOR_IMPL(LodRule, SystemAllocator, 0)
SceneNodeSelectionList& LodRule::GetNodeSelectionList(size_t index)
{
if (index < m_maxLods)
{
return m_nodeSelectionLists[index];
}
return *m_nodeSelectionLists.end();
}
DataTypes::ISceneNodeSelectionList& LodRule::GetSceneNodeSelectionList(size_t index)
{
if (index < m_maxLods)
{
return m_nodeSelectionLists[index];
}
return *m_nodeSelectionLists.end();
}
const DataTypes::ISceneNodeSelectionList& LodRule::GetSceneNodeSelectionList(size_t index) const
{
if (index < m_maxLods)
{
return m_nodeSelectionLists[index];
}
return *m_nodeSelectionLists.end();
}
size_t LodRule::GetLodCount() const
{
return m_nodeSelectionLists.size();
}
void LodRule::AddLod()
{
if (m_nodeSelectionLists.size() < m_nodeSelectionLists.capacity())
{
m_nodeSelectionLists.push_back(SceneNodeSelectionList());
}
}
void LodRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<LodRule, DataTypes::ILodRule>()->Version(1)
->Field("nodeSelectionList", &LodRule::m_nodeSelectionLists);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<LodRule>("Level of Detail", "Set up the level of detail for the meshes in this group.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(AZ_CRC("AutoExpand", 0x306ff5c0), true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(Edit::UIHandlers::Default, &LodRule::m_nodeSelectionLists, "Lod Meshes", "Select the meshes to assign to each level of detail.")
->ElementAttribute(AZ_CRC("FilterName", 0xf49ce62e), "Lod meshes")
->ElementAttribute(AZ_CRC("FilterType", 0x2661cf01), DataTypes::IMeshData::TYPEINFO_Uuid());
}
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,59 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/fixed_vector.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ILodRule.h>
#include <SceneAPI/SceneData/ManifestBase/SceneNodeSelectionList.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class LodRule
: public DataTypes::ILodRule
{
public:
AZ_RTTI(LodRule, "{6E796AC8-1484-4909-860A-6D3F22A7346F}", DataTypes::ILodRule);
AZ_CLASS_ALLOCATOR_DECL
~LodRule() override = default;
SceneNodeSelectionList& GetNodeSelectionList(size_t index);
DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList(size_t index) override;
const DataTypes::ISceneNodeSelectionList& GetSceneNodeSelectionList(size_t index) const override;
size_t GetLodCount() const override;
void AddLod();
static void Reflect(ReflectContext* context);
//The engine supports 6 total lods. 1 for the base model then 5 more lods.
//The rule only captures lods past level 0 so this is set to 5.
static const size_t m_maxLods = 5;
protected:
AZStd::fixed_vector<SceneNodeSelectionList, m_maxLods> m_nodeSelectionLists;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,68 @@
/*
* 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/SceneData/Rules/MaterialRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(MaterialRule, SystemAllocator, 0)
MaterialRule::MaterialRule()
: m_removeMaterials(false)
, m_updateMaterials(false)
{
}
bool MaterialRule::RemoveUnusedMaterials() const
{
return m_removeMaterials;
}
bool MaterialRule::UpdateMaterials() const
{
return m_updateMaterials;
}
void MaterialRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<MaterialRule, DataTypes::IMaterialRule>()->Version(2)
->Field("updateMaterials", &MaterialRule::m_updateMaterials)
->Field("removeMaterials", &MaterialRule::m_removeMaterials);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<MaterialRule>("Material", "Determine whether to accept material updates from the source files.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(Edit::UIHandlers::Default, &MaterialRule::m_updateMaterials, "Update materials", "Checking this box will accept changes made in the source file into the Lumberyard asset.")
->DataElement(Edit::UIHandlers::Default, &MaterialRule::m_removeMaterials, "Remove unused materials","Detects and removes material files from the game project that are not present in the source file.");
}
}
} // namespace SceneData
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,51 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMaterialRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class MaterialRule
: public DataTypes::IMaterialRule
{
public:
AZ_RTTI(MaterialRule, "{35620013-A27C-4F6D-87BF-72F11688ACAD}", DataTypes::IMaterialRule);
AZ_CLASS_ALLOCATOR_DECL
MaterialRule();
~MaterialRule() override = default;
bool RemoveUnusedMaterials() const override;
bool UpdateMaterials() const override;
static void Reflect(ReflectContext* context);
protected:
bool m_removeMaterials;
bool m_updateMaterials;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,119 @@
/*
* 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/SceneData/Rules/OriginRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
const AZStd::string OriginRule::c_defaultWorldUIString = "World";
AZ_CLASS_ALLOCATOR_IMPL(OriginRule, SystemAllocator, 0)
OriginRule::OriginRule()
: m_rotation(Quaternion::CreateIdentity())
, m_translation(Vector3::CreateZero())
, m_scale(1.0f)
{
}
const AZStd::string& OriginRule::GetOriginNodeName() const
{
return m_originNodeName;
}
bool OriginRule::UseRootAsOrigin() const
{
return m_originNodeName == c_defaultWorldUIString;
}
const Quaternion& OriginRule::GetRotation() const
{
return m_rotation;
}
const Vector3& OriginRule::GetTranslation() const
{
return m_translation;
}
float OriginRule::GetScale() const
{
return m_scale;
}
void OriginRule::SetOriginNodeName(const AZStd::string& originNodeName)
{
m_originNodeName = originNodeName;
}
void OriginRule::SetRotation(const Quaternion& rotation)
{
m_rotation = rotation;
}
void OriginRule::SetTranslation(const Vector3& translation)
{
m_translation = translation;
}
void OriginRule::SetScale(float scale)
{
m_scale = scale;
}
void OriginRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<OriginRule, DataTypes::IOriginRule>()->Version(1)
->Field("originNodeName", &OriginRule::m_originNodeName)
->Field("translation", &OriginRule::m_translation)
->Field("rotation", &OriginRule::m_rotation)
->Field("scale", &OriginRule::m_scale);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<OriginRule>("Origin", "Configure where the mesh will load relative to world origin.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement("NodeListSelection", &OriginRule::m_originNodeName, "Relative Origin Node",
"Select a Node from the scene as the origin for this export. 'World' will export from the Root Scene Node.")
->Attribute("DisabledOption", c_defaultWorldUIString)
->Attribute("DefaultToDisabled", true)
->Attribute("ExcludeEndPoints", true)
->DataElement(Edit::UIHandlers::Default, &OriginRule::m_translation, "Translation", "Moves the group along the given vector.")
->DataElement(Edit::UIHandlers::Default, &OriginRule::m_rotation, "Rotation", "Rotates the group after translation.")
->Attribute(Edit::Attributes::LabelForX, "P")
->Attribute(Edit::Attributes::LabelForY, "R")
->Attribute(Edit::Attributes::LabelForZ, "Y")
->DataElement(Edit::UIHandlers::Default, &OriginRule::m_scale, "Scale", "Scales the group up or down after translation and rotation.")
->Attribute(Edit::Attributes::Min, 0.0001)
->Attribute(Edit::Attributes::Max, 1000.0);
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,66 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IOriginRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class OriginRule
: public DataTypes::IOriginRule
{
public:
AZ_RTTI(OriginRule, "{90AECE4A-58D4-411C-9CDE-59B54C59354E}", DataTypes::IOriginRule);
AZ_CLASS_ALLOCATOR_DECL
OriginRule();
~OriginRule() override = default;
const AZStd::string& GetOriginNodeName() const override;
bool UseRootAsOrigin() const override;
const Quaternion& GetRotation() const override;
const Vector3& GetTranslation() const override;
float GetScale() const override;
void SetOriginNodeName(const AZStd::string& originNodeName);
void SetRotation(const Quaternion& rotation);
void SetTranslation(const Vector3& translation);
void SetScale(float scale);
static void Reflect(ReflectContext* context);
static const AZStd::string c_defaultWorldUIString;
protected:
AZStd::string m_originNodeName;
Quaternion m_rotation;
Vector3 m_translation;
float m_scale;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,52 @@
/*
* 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/SceneData/Rules/ScriptProcessorRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
const AZStd::string& ScriptProcessorRule::GetScriptFilename() const
{
return m_scriptFilename;
}
void ScriptProcessorRule::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (serializeContext)
{
serializeContext->Class<ScriptProcessorRule, DataTypes::IScriptProcessorRule>()->Version(1)
->Field("scriptFilename", &ScriptProcessorRule::m_scriptFilename);
AZ::EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<ScriptProcessorRule>("ScriptProcessorRule", "Script rule settings to process a scene asset file")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(0, &ScriptProcessorRule::m_scriptFilename, "scriptFilename",
"Relative path to scene processor Python script.");
}
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,49 @@
/*
* 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 <SceneAPI/SceneCore/DataTypes/Rules/IScriptProcessorRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace SceneData
{
class ScriptProcessorRule
: public DataTypes::IScriptProcessorRule
{
public:
AZ_RTTI(ScriptProcessorRule, "{E61EDCBC-867A-4A6A-B49D-C87E60D3EC33}", DataTypes::IScriptProcessorRule);
AZ_CLASS_ALLOCATOR(ScriptProcessorRule, AZ::SystemAllocator, 0)
~ScriptProcessorRule() override = default;
const AZStd::string& GetScriptFilename() const override;
inline void SetScriptFilename(AZStd::string scriptFilename)
{
m_scriptFilename = AZStd::move(scriptFilename);
}
static void Reflect(ReflectContext* context);
protected:
AZStd::string m_scriptFilename;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,108 @@
/*
* 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/GraphData/IMeshData.h>
#include <SceneAPI/SceneData/Rules/SkeletonProxyRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
void SkeletonProxy::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkeletonProxy>()->Version(1)
->Field("jointName", &SkeletonProxy::m_jointName)
->Field("proxyName", &SkeletonProxy::m_proxyName);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkeletonProxy>("Skeleton proxy", "Select the physics mesh for ragdoll or for hit detection.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(Edit::UIHandlers::Default, &SkeletonProxy::m_jointName, "Joint name", "Select the skeleton joint for this proxy.")
->DataElement(Edit::UIHandlers::Default, &SkeletonProxy::m_proxyName, "Proxy name", "Pick the physics mesh.");
}
}
AZ_CLASS_ALLOCATOR_IMPL(SkeletonProxyGroup, SystemAllocator, 0)
void SkeletonProxyGroup::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkeletonProxyGroup>()->Version(1)
->Field("proxyMaterial", &SkeletonProxyGroup::m_proxyMaterialName)
->Field("skeletonProxies", &SkeletonProxyGroup::m_skeletonProxies);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkeletonProxyGroup>("Skeleton proxy group", "Related group of skeleton physics proxies.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(Edit::UIHandlers::Default, &SkeletonProxyGroup::m_proxyMaterialName, "Proxy material name", "Name the material for the physics mesh.")
->DataElement(Edit::UIHandlers::Default, &SkeletonProxyGroup::m_skeletonProxies, "Skeleton proxies", "Select the physics mesh for ragdoll or for hit detection.");
}
}
AZ_CLASS_ALLOCATOR_IMPL(SkeletonProxyRule, SystemAllocator, 0)
size_t SkeletonProxyRule::GetProxyGroupCount() const
{
return m_proxyGroups.size();
}
void SkeletonProxyRule::Reflect(ReflectContext* context)
{
SkeletonProxyGroup::Reflect(context);
SkeletonProxy::Reflect(context);
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkeletonProxyRule, DataTypes::ISkeletonProxyRule>()->Version(1)
->Field("skeletonProxyGroups", &SkeletonProxyRule::m_proxyGroups);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkeletonProxyRule>("Skeleton proxies", "Select the physics mesh for ragdoll or for hit detection.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(Edit::UIHandlers::Default, &SkeletonProxyRule::m_proxyGroups, "Proxy groups", "Proxy groups");
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,75 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/fixed_vector.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ISkeletonProxyRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
struct SkeletonProxy
{
AZ_RTTI(SkeletonProxy, "{49E188A9-CA04-4B85-9AD8-A0262796EA27}");
virtual ~SkeletonProxy() = default;
AZStd::string m_jointName;
AZStd::string m_proxyName;
static void Reflect(ReflectContext* context);
};
struct SkeletonProxyGroup
{
AZ_RTTI(SkeletonProxyGroup, "{243B8186-EDDB-48C7-BCE7-FC2D1974B58A}");
AZ_CLASS_ALLOCATOR_DECL
virtual ~SkeletonProxyGroup() = default;
AZStd::string m_proxyMaterialName;
AZStd::vector<SkeletonProxy> m_skeletonProxies;
static void Reflect(ReflectContext* context);
};
class SkeletonProxyRule
: public DataTypes::ISkeletonProxyRule
{
public:
AZ_RTTI(SkeletonProxyRule, "{142CF206-FC12-4138-B30C-FFA64EC3BB4E}", DataTypes::ISkeletonProxyRule);
AZ_CLASS_ALLOCATOR_DECL
~SkeletonProxyRule() override = default;
size_t GetProxyGroupCount() const override;
const SkeletonProxyGroup& GetProxyGroup() const;
static void Reflect(ReflectContext* context);
protected:
AZStd::vector<SkeletonProxyGroup> m_proxyGroups;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,121 @@
/*
* 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/SceneData/Rules/SkinMeshAdvancedRule.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexUVData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexColorData.h>
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(SkinMeshAdvancedRule, SystemAllocator, 0)
SkinMeshAdvancedRule::SkinMeshAdvancedRule()
: m_use32bitVertices(false)
, m_useCustomNormals(true)
{
AZ::SceneAPI::Events::AssetImportRequestBus::Broadcast(&AZ::SceneAPI::Events::AssetImportRequestBus::Events::AreCustomNormalsUsed, m_useCustomNormals);
}
void SkinMeshAdvancedRule::SetUse32bitVertices(bool value)
{
m_use32bitVertices = value;
}
bool SkinMeshAdvancedRule::Use32bitVertices() const
{
return m_use32bitVertices;
}
bool SkinMeshAdvancedRule::MergeMeshes() const
{
return true;
}
void SkinMeshAdvancedRule::SetUseCustomNormals(bool value)
{
m_useCustomNormals = value;
}
bool SkinMeshAdvancedRule::UseCustomNormals() const
{
return m_useCustomNormals;
}
void SkinMeshAdvancedRule::SetVertexColorStreamName(const AZStd::string& name)
{
m_vertexColorStreamName = name;
}
void SkinMeshAdvancedRule::SetVertexColorStreamName(AZStd::string&& name)
{
m_vertexColorStreamName = AZStd::move(name);
}
const AZStd::string& SkinMeshAdvancedRule::GetVertexColorStreamName() const
{
return m_vertexColorStreamName;
}
bool SkinMeshAdvancedRule::IsVertexColorStreamDisabled() const
{
return m_vertexColorStreamName == DataTypes::s_advancedDisabledString;
}
void SkinMeshAdvancedRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<SkinMeshAdvancedRule, DataTypes::IMeshAdvancedRule>()->Version(6)
->Field("use32bitVertices", &SkinMeshAdvancedRule::m_use32bitVertices)
->Field("useCustomNormals", &SkinMeshAdvancedRule::m_useCustomNormals)
->Field("vertexColorStreamName", &SkinMeshAdvancedRule::m_vertexColorStreamName);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<SkinMeshAdvancedRule>("Skin (Advanced)", "Configure advanced properties for this skin group.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ::Edit::UIHandlers::RadioButton, &SkinMeshAdvancedRule::m_use32bitVertices, "Vertex Precision",
"Selecting 32-bits of precision increases the accuracy of the position of each vertex which can be useful when the skin is located far from its pivot.\n\n"
"Please note that not all platforms support 32-bit vertices. For more details please see documentation."
)
->Attribute(AZ::Edit::Attributes::FalseText, "16-bit")
->Attribute(AZ::Edit::Attributes::TrueText, "32-bit")
->DataElement(Edit::UIHandlers::Default, &SkinMeshAdvancedRule::m_useCustomNormals, "Use Custom Normals", "Use custom normals from DCC data or average them.")
->DataElement("NodeListSelection", &SkinMeshAdvancedRule::m_vertexColorStreamName, "Vertex Color Stream",
"Select a vertex color stream to enable Vertex Coloring or 'Disable' to turn Vertex Coloring off.\n\n"
"Vertex Coloring works in conjunction with materials. If a material was previously generated,\n"
"changing vertex coloring will require the material to be reset or the material editor to be used\n"
"to enable 'Vertex Coloring'.")
->Attribute("ClassTypeIdFilter", DataTypes::IMeshVertexColorData::TYPEINFO_Uuid())
->Attribute("DisabledOption", DataTypes::s_advancedDisabledString)
->Attribute("UseShortNames", true);
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,64 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/fixed_vector.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class SkinMeshAdvancedRule
: public DataTypes::IMeshAdvancedRule
{
public:
AZ_RTTI(SkinMeshAdvancedRule, "{0116376D-1E3E-472A-A173-112B317E96AD}", DataTypes::IMeshAdvancedRule);
AZ_CLASS_ALLOCATOR_DECL
SkinMeshAdvancedRule();
~SkinMeshAdvancedRule() override = default;
void SetUse32bitVertices(bool value);
bool Use32bitVertices() const override;
bool MergeMeshes() const override;
void SetUseCustomNormals(bool value);
bool UseCustomNormals() const override;
void SetVertexColorStreamName(const AZStd::string& name);
void SetVertexColorStreamName(AZStd::string&& name);
const AZStd::string& GetVertexColorStreamName() const override;
bool IsVertexColorStreamDisabled() const override;
static void Reflect(ReflectContext* context);
protected:
AZStd::string m_vertexColorStreamName;
bool m_use32bitVertices;
bool m_useCustomNormals;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,130 @@
/*
* 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/SceneData/Rules/StaticMeshAdvancedRule.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexUVData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexColorData.h>
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
AZ_CLASS_ALLOCATOR_IMPL(StaticMeshAdvancedRule, SystemAllocator, 0)
StaticMeshAdvancedRule::StaticMeshAdvancedRule()
: m_use32bitVertices(false)
, m_mergeMeshes(true)
, m_useCustomNormals(true)
{
AZ::SceneAPI::Events::AssetImportRequestBus::Broadcast(&AZ::SceneAPI::Events::AssetImportRequestBus::Events::AreCustomNormalsUsed, m_useCustomNormals);
}
void StaticMeshAdvancedRule::SetUse32bitVertices(bool value)
{
m_use32bitVertices = value;
}
bool StaticMeshAdvancedRule::Use32bitVertices() const
{
return m_use32bitVertices;
}
void StaticMeshAdvancedRule::SetMergeMeshes(bool value)
{
m_mergeMeshes = value;
}
bool StaticMeshAdvancedRule::MergeMeshes() const
{
return m_mergeMeshes;
}
void StaticMeshAdvancedRule::SetUseCustomNormals(bool value)
{
m_useCustomNormals = value;
}
bool StaticMeshAdvancedRule::UseCustomNormals() const
{
return m_useCustomNormals;
}
void StaticMeshAdvancedRule::SetVertexColorStreamName(const AZStd::string& name)
{
m_vertexColorStreamName = name;
}
void StaticMeshAdvancedRule::SetVertexColorStreamName(AZStd::string&& name)
{
m_vertexColorStreamName = AZStd::move(name);
}
const AZStd::string& StaticMeshAdvancedRule::GetVertexColorStreamName() const
{
return m_vertexColorStreamName;
}
bool StaticMeshAdvancedRule::IsVertexColorStreamDisabled() const
{
return m_vertexColorStreamName == DataTypes::s_advancedDisabledString;
}
void StaticMeshAdvancedRule::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<StaticMeshAdvancedRule, DataTypes::IMeshAdvancedRule>()->Version(6)
->Field("use32bitVertices", &StaticMeshAdvancedRule::m_use32bitVertices)
->Field("mergeMeshes", &StaticMeshAdvancedRule::m_mergeMeshes)
->Field("useCustomNormals", &StaticMeshAdvancedRule::m_useCustomNormals)
->Field("vertexColorStreamName", &StaticMeshAdvancedRule::m_vertexColorStreamName);
EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<StaticMeshAdvancedRule>("Mesh (Advanced)", "Configure advanced properties for this mesh group.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ::Edit::UIHandlers::RadioButton, &StaticMeshAdvancedRule::m_use32bitVertices, "Vertex Precision",
"Selecting 32-bits of precision increases the accuracy of the position of each vertex which can be useful when the mesh is located far from its pivot.\n\n"
"Please note that not all platforms support 32-bit vertices. For more details please see documentation."
)
->Attribute(AZ::Edit::Attributes::FalseText, "16-bit")
->Attribute(AZ::Edit::Attributes::TrueText, "32-bit")
->DataElement(Edit::UIHandlers::Default, &StaticMeshAdvancedRule::m_mergeMeshes, "Merge Meshes", "Merge all meshes into one single mesh.")
->DataElement(Edit::UIHandlers::Default, &StaticMeshAdvancedRule::m_useCustomNormals, "Use Custom Normals", "Use custom normals from DCC data or average them.")
->DataElement("NodeListSelection", &StaticMeshAdvancedRule::m_vertexColorStreamName, "Vertex Color Stream",
"Select a vertex color stream to enable Vertex Coloring or 'Disable' to turn Vertex Coloring off.\n\n"
"Vertex Coloring works in conjunction with materials. If a material was previously generated,\n"
"changing vertex coloring will require the material to be reset or the material editor to be used\n"
"to enable 'Vertex Coloring'.")
->Attribute("ClassTypeIdFilter", DataTypes::IMeshVertexColorData::TYPEINFO_Uuid())
->Attribute("DisabledOption", DataTypes::s_advancedDisabledString)
->Attribute("UseShortNames", true);
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,66 @@
#pragma once
/*
* 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/Memory/Memory.h>
#include <AzCore/std/containers/fixed_vector.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace SceneData
{
class StaticMeshAdvancedRule
: public DataTypes::IMeshAdvancedRule
{
public:
AZ_RTTI(StaticMeshAdvancedRule, "{AE82749D-A68A-4FE7-A8BA-0F4CE67607AC}", DataTypes::IMeshAdvancedRule);
AZ_CLASS_ALLOCATOR_DECL
StaticMeshAdvancedRule();
~StaticMeshAdvancedRule() override = default;
void SetUse32bitVertices(bool value);
bool Use32bitVertices() const override;
void SetMergeMeshes(bool value);
bool MergeMeshes() const override;
void SetUseCustomNormals(bool value);
bool UseCustomNormals() const override;
void SetVertexColorStreamName(const AZStd::string& name);
void SetVertexColorStreamName(AZStd::string&& name);
const AZStd::string& GetVertexColorStreamName() const override;
bool IsVertexColorStreamDisabled() const override;
static void Reflect(ReflectContext* context);
protected:
AZStd::string m_vertexColorStreamName;
bool m_use32bitVertices;
bool m_mergeMeshes;
bool m_useCustomNormals;
};
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,182 @@
/*
* 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/SceneData/Rules/TangentsRule.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexUVData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexTangentData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexBitangentData.h>
#include <SceneAPI/SceneCore/Containers/SceneGraph.h>
#include <SceneAPI/SceneCore/Containers/Views/SceneGraphChildIterator.h>
#include <SceneAPI/SceneCore/Containers/Views/PairIterator.h>
namespace AZ
{
namespace SceneAPI
{
namespace SceneData
{
TangentsRule::TangentsRule()
: DataTypes::IRule()
, m_tangentSpace(AZ::SceneAPI::DataTypes::TangentSpace::MikkT)
, m_bitangentMethod(AZ::SceneAPI::DataTypes::BitangentMethod::Orthogonal)
, m_uvSetIndex(0)
, m_normalize(true)
{
}
AZ::SceneAPI::DataTypes::TangentSpace TangentsRule::GetTangentSpace() const
{
return m_tangentSpace;
}
AZ::SceneAPI::DataTypes::BitangentMethod TangentsRule::GetBitangentMethod() const
{
return m_bitangentMethod;
}
AZ::u64 TangentsRule::GetUVSetIndex() const
{
return m_uvSetIndex;
}
bool TangentsRule::GetNormalizeVectors() const
{
return m_normalize;
}
// Find UV data.
AZ::SceneAPI::DataTypes::IMeshVertexUVData* TangentsRule::FindUVData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 uvSet)
{
const auto nameContentView = AZ::SceneAPI::Containers::Views::MakePairView(graph.GetNameStorage(), graph.GetContentStorage());
AZ::u64 uvSetIndex = 0;
auto meshChildView = AZ::SceneAPI::Containers::Views::MakeSceneGraphChildView<AZ::SceneAPI::Containers::Views::AcceptEndPointsOnly>(graph, nodeIndex, nameContentView.begin(), true);
for (auto child = meshChildView.begin(); child != meshChildView.end(); ++child)
{
AZ::SceneAPI::DataTypes::IMeshVertexUVData* data = azrtti_cast<AZ::SceneAPI::DataTypes::IMeshVertexUVData*>(child->second.get());
if (data)
{
if (uvSetIndex == uvSet)
{
return data;
}
uvSetIndex++;
}
}
return nullptr;
}
// Find tangent data.
AZ::SceneAPI::DataTypes::IMeshVertexTangentData* TangentsRule::FindTangentData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 setIndex, AZ::SceneAPI::DataTypes::TangentSpace tangentSpace)
{
const auto nameContentView = AZ::SceneAPI::Containers::Views::MakePairView(graph.GetNameStorage(), graph.GetContentStorage());
auto meshChildView = AZ::SceneAPI::Containers::Views::MakeSceneGraphChildView<AZ::SceneAPI::Containers::Views::AcceptEndPointsOnly>(graph, nodeIndex, nameContentView.begin(), true);
for (auto child = meshChildView.begin(); child != meshChildView.end(); ++child)
{
AZ::SceneAPI::DataTypes::IMeshVertexTangentData* data = azrtti_cast<AZ::SceneAPI::DataTypes::IMeshVertexTangentData*>(child->second.get());
if (data)
{
if (setIndex == data->GetTangentSetIndex() && tangentSpace == data->GetTangentSpace())
{
return data;
}
}
}
return nullptr;
}
// Find bitangent data.
AZ::SceneAPI::DataTypes::IMeshVertexBitangentData* TangentsRule::FindBitangentData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 setIndex, AZ::SceneAPI::DataTypes::TangentSpace tangentSpace)
{
const auto nameContentView = AZ::SceneAPI::Containers::Views::MakePairView(graph.GetNameStorage(), graph.GetContentStorage());
auto meshChildView = AZ::SceneAPI::Containers::Views::MakeSceneGraphChildView<AZ::SceneAPI::Containers::Views::AcceptEndPointsOnly>(graph, nodeIndex, nameContentView.begin(), true);
for (auto child = meshChildView.begin(); child != meshChildView.end(); ++child)
{
AZ::SceneAPI::DataTypes::IMeshVertexBitangentData* data = azrtti_cast<AZ::SceneAPI::DataTypes::IMeshVertexBitangentData*>(child->second.get());
if (data)
{
if (setIndex == data->GetBitangentSetIndex() && tangentSpace == data->GetTangentSpace())
{
return data;
}
}
}
return nullptr;
}
AZ::Crc32 TangentsRule::GetNormalizeVisibility() const
{
return (m_tangentSpace == AZ::SceneAPI::DataTypes::TangentSpace::EMotionFX) ? AZ::Edit::PropertyVisibility::Hide : AZ::Edit::PropertyVisibility::Show;
}
AZ::Crc32 TangentsRule::GetOrthogonalVisibility() const
{
return (m_tangentSpace == AZ::SceneAPI::DataTypes::TangentSpace::EMotionFX) ? AZ::Edit::PropertyVisibility::Hide : AZ::Edit::PropertyVisibility::Show;
}
void TangentsRule::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (!serializeContext)
{
return;
}
serializeContext->Class<TangentsRule, DataTypes::IRule>()->Version(1)
->Field("tangentSpace", &TangentsRule::m_tangentSpace)
->Field("bitangentMethod", &TangentsRule::m_bitangentMethod)
->Field("normalize", &TangentsRule::m_normalize)
->Field("uvSetIndex", &TangentsRule::m_uvSetIndex);
AZ::EditContext* editContext = serializeContext->GetEditContext();
if (editContext)
{
editContext->Class<TangentsRule>("Tangents", "Specify how tangents are imported or generated.")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute("AutoExpand", true)
->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &AZ::SceneAPI::SceneData::TangentsRule::m_tangentSpace, "Tangent space", "Specify the tangent space used for normal map baking. Choose 'From Fbx' to extract the tangents and bitangents directly from the Fbx file. When there is no tangents rule or the Fbx has no tangents stored inside it, the 'MikkT' option will be used with orthogonal tangents of unit length, so with the normalize option enabled, using the first UV set.")
->EnumAttribute(AZ::SceneAPI::DataTypes::TangentSpace::FromFbx, "From Fbx")
->EnumAttribute(AZ::SceneAPI::DataTypes::TangentSpace::MikkT, "MikkT")
->EnumAttribute(AZ::SceneAPI::DataTypes::TangentSpace::EMotionFX, "EMotion FX")
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
->DataElement(AZ::Edit::UIHandlers::ComboBox, &AZ::SceneAPI::SceneData::TangentsRule::m_bitangentMethod, "Bitangents", "Set to 'use from tangent space' to use the bitangents generated by the algorithm used or inside the fbx file. This can result in non-orthogonal tangents. Set to 'orthogonal' to skip storing the bitangents and let the engine calculate the bitangents in a way it will be perpendicular to both the normal and tangent.")
->EnumAttribute(AZ::SceneAPI::DataTypes::BitangentMethod::UseFromTangentSpace, "Use from tangent space")
->EnumAttribute(AZ::SceneAPI::DataTypes::BitangentMethod::Orthogonal, "Orthogonal")
->Attribute(AZ::Edit::Attributes::Visibility, &TangentsRule::GetOrthogonalVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &TangentsRule::m_uvSetIndex, "Uv set", "The UV set index to generate the tangents from. A value of 0 means the first uv set, while 1 means the second uv set.")
->Attribute(AZ::Edit::Attributes::Min, 0)
->Attribute(AZ::Edit::Attributes::Max, 1)
->DataElement(AZ::Edit::UIHandlers::Default, &TangentsRule::m_normalize, "Normalize", "Normalize the tangents and bitangents? When disabled the vectors might no be unit length, which can be useful for relief mapping.")
->Attribute(AZ::Edit::Attributes::Visibility, &TangentsRule::GetNormalizeVisibility)
;
}
}
} // SceneData
} // SceneAPI
} // AZ
@@ -0,0 +1,74 @@
/*
* 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/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneData/SceneDataConfiguration.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexTangentData.h>
#include <SceneAPI/SceneCore/Containers/SceneGraph.h>
namespace AZ
{
class ReflectContext;
namespace SceneAPI
{
namespace Containers
{
class Scene;
}
namespace DataTypes
{
class IMeshVertexUVData;
class IMeshVertexTangentData;
class IMeshVertexBitangentData;
}
namespace SceneData
{
class SCENE_DATA_CLASS TangentsRule
: public DataTypes::IRule
{
public:
AZ_RTTI(TangentsRule, "{4BD1CE13-D2EB-4CCF-AB21-4877EF69DE7D}", DataTypes::IRule);
AZ_CLASS_ALLOCATOR(TangentsRule, AZ::SystemAllocator, 0)
SCENE_DATA_API TangentsRule();
SCENE_DATA_API ~TangentsRule() override = default;
SCENE_DATA_API AZ::SceneAPI::DataTypes::TangentSpace GetTangentSpace() const;
SCENE_DATA_API AZ::SceneAPI::DataTypes::BitangentMethod GetBitangentMethod() const;
SCENE_DATA_API AZ::u64 GetUVSetIndex() const;
SCENE_DATA_API bool GetNormalizeVectors() const;
SCENE_DATA_API static AZ::SceneAPI::DataTypes::IMeshVertexUVData* FindUVData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 uvSet);
SCENE_DATA_API static AZ::SceneAPI::DataTypes::IMeshVertexTangentData* FindTangentData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 setIndex, AZ::SceneAPI::DataTypes::TangentSpace tangentSpace);
SCENE_DATA_API static AZ::SceneAPI::DataTypes::IMeshVertexBitangentData* FindBitangentData(AZ::SceneAPI::Containers::SceneGraph& graph, const AZ::SceneAPI::Containers::SceneGraph::NodeIndex& nodeIndex, AZ::u64 setIndex, AZ::SceneAPI::DataTypes::TangentSpace tangentSpace);
static void Reflect(ReflectContext* context);
protected:
AZ::Crc32 GetNormalizeVisibility() const;
AZ::Crc32 GetOrthogonalVisibility() const;
AZ::SceneAPI::DataTypes::TangentSpace m_tangentSpace; /**< Specifies how to handle tangents. Either generate them, or import them. */
AZ::SceneAPI::DataTypes::BitangentMethod m_bitangentMethod; /**< Grab the bitangents from the generator/source or use an orthogonal basis by always calculating them? */
AZ::u64 m_uvSetIndex; /**< Generate the tangents from this UV set. */
bool m_normalize; /**< Normalize the tangent and bitangents? */
};
} // SceneData
} // SceneAPI
} // AZ