Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -23,7 +23,6 @@ namespace AZ
{
namespace Containers
{
size_t RuleContainer::GetRuleCount() const
{
return m_rules.size();
@@ -57,6 +56,13 @@ namespace AZ
}
void RuleContainer::InsertRule(const AZStd::shared_ptr<DataTypes::IRule>& rule, size_t position)
{
AZ_Assert(AZStd::find(m_rules.begin(), m_rules.end(), rule) == m_rules.end(), "Unable to insert rule as it has already been added.");
m_rules.insert(m_rules.begin() + position, rule);
}
void RuleContainer::RemoveRule(size_t index)
{
if (index < m_rules.size())
@@ -76,7 +82,6 @@ namespace AZ
}
}
void RuleContainer::Reflect(ReflectContext* context)
{
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
@@ -156,4 +161,4 @@ namespace AZ
} // Containers
} // SceneAPI
} // AZ
} // AZ
@@ -27,7 +27,6 @@ namespace AZ
{
namespace Containers
{
class RuleContainer
{
public:
@@ -54,6 +53,8 @@ namespace AZ
SCENE_CORE_API void AddRule(const AZStd::shared_ptr<DataTypes::IRule>& rule);
SCENE_CORE_API void AddRule(AZStd::shared_ptr<DataTypes::IRule>&& rule);
SCENE_CORE_API void InsertRule(const AZStd::shared_ptr<DataTypes::IRule>& rule, size_t position);
SCENE_CORE_API void RemoveRule(size_t index);
SCENE_CORE_API void RemoveRule(const AZStd::shared_ptr<DataTypes::IRule>& rule);
@@ -43,6 +43,30 @@ namespace AZ
AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context);
if (behaviorContext)
{
behaviorContext->Class<SceneGraph::NodeIndex>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene.graph")
->Constructor<>()
->Constructor<const SceneGraph::NodeIndex&>()
->Method("AsNumber", &SceneGraph::NodeIndex::AsNumber)
->Method("Distance", &SceneGraph::NodeIndex::Distance)
->Method("IsValid", &SceneGraph::NodeIndex::IsValid)
->Method("Equal", &SceneGraph::NodeIndex::operator==)
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::Equal)
->Method("ToString", [](const SceneGraph::NodeIndex& node) { return AZStd::string::format("%u", node.m_value); })
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::ToString)
;
behaviorContext->Class<SceneGraph::Name>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene.graph")
->Constructor()
->Method("GetPath", &SceneGraph::Name::GetPath)
->Method("GetName", &SceneGraph::Name::GetName)
->Method("ToString", [](const SceneGraph::Name& self){ return self.GetName(); })
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::ToString)
;
behaviorContext->Class<SceneGraph>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene.graph")
@@ -62,41 +86,23 @@ namespace AZ
->Method("GetNodeChild", [](const SceneGraph& self, NodeIndex node) { return self.GetNodeChild(node); })
->Method("GetNodeCount", &SceneGraph::GetNodeCount)
->Method("FindWithPath", [](const SceneGraph& self, const AZStd::string& path)
{
return self.Find(path);
})
{
return self.Find(path);
})
->Method("FindWithRootAndPath", [](const SceneGraph& self, NodeIndex root, const AZStd::string& path)
{
return self.Find(root, path);
})
{
return self.Find(root, path);
})
->Method("GetNodeContent", [](const SceneGraph& self, NodeIndex node) -> GraphObjectProxy*
{
auto graphObject = self.GetNodeContent(node);
if (graphObject)
{
auto graphObject = self.GetNodeContent(node);
if (graphObject)
{
GraphObjectProxy* proxy = aznew GraphObjectProxy(graphObject);
return proxy;
}
return nullptr;
})
;
behaviorContext->Class<SceneGraph::NodeIndex>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene.graph")
->Method("AsNumber", &SceneGraph::NodeIndex::AsNumber)
->Method("Distance", &SceneGraph::NodeIndex::Distance)
->Method("IsValid", &SceneGraph::NodeIndex::IsValid)
->Method("Equal", &SceneGraph::NodeIndex::operator==)
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::Equal)
;
behaviorContext->Class<SceneGraph::Name>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene.graph")
->Method("GetPath", &SceneGraph::Name::GetPath)
->Method("GetName", &SceneGraph::Name::GetName)
;
GraphObjectProxy* proxy = aznew GraphObjectProxy(graphObject);
return proxy;
}
return nullptr;
});
}
}
@@ -69,6 +69,7 @@ namespace AZ
// Type needs to be able to store an index in a NodeHeader (currently 21-bits).
using IndexType = uint32_t;
NodeIndex() = default;
NodeIndex(const NodeIndex& rhs) = default;
NodeIndex& operator=(const NodeIndex& rhs) = default;
@@ -87,10 +88,9 @@ namespace AZ
private:
static const IndexType INVALID_INDEX = static_cast<IndexType>(-1);
inline NodeIndex();
inline explicit NodeIndex(IndexType value);
IndexType m_value;
IndexType m_value = NodeIndex::INVALID_INDEX;
};
// NodeHeader contains the relationship a node has with its surrounding nodes and additional information about a node.
@@ -22,11 +22,6 @@ namespace AZ
//
// NodeIndex
//
SceneGraph::NodeIndex::NodeIndex()
: m_value(NodeIndex::INVALID_INDEX)
{
}
bool SceneGraph::NodeIndex::IsValid() const
{
return m_value != NodeIndex::INVALID_INDEX;
@@ -104,7 +104,7 @@ namespace AZ
RootIterator& operator++();
RootIterator operator++(int);
const Iterator& GetBaseIterator();
const Iterator& GetBaseIterator() const;
protected:
Iterator m_iterator;
Function m_converter;
@@ -46,7 +46,7 @@ namespace AZ
}
template<typename Iterator, typename ReturnType>
const Iterator& ConvertIterator<Iterator, ReturnType, void>::GetBaseIterator()
const Iterator& ConvertIterator<Iterator, ReturnType, void>::GetBaseIterator() const
{
return m_iterator;
}
@@ -85,7 +85,7 @@ namespace AZ
RootIterator& operator++();
RootIterator operator++(int);
const Iterator& GetBaseIterator();
const Iterator& GetBaseIterator() const;
protected:
// Pseudo default constructor.
@@ -59,7 +59,7 @@ namespace AZ
}
template<typename Iterator>
auto FilterIterator<Iterator, void>::GetBaseIterator()->const Iterator&
auto FilterIterator<Iterator, void>::GetBaseIterator() const -> const Iterator&
{
return m_iterator;
}
@@ -44,6 +44,8 @@ namespace AZ
Iterator cbegin() const;
Iterator cend() const;
[[nodiscard]] bool empty() const;
private:
Iterator m_begin;
Iterator m_end;
@@ -59,4 +61,4 @@ namespace AZ
} // SceneAPI
} // AZ
#include <SceneAPI/SceneCore/Containers/Views/View.inl>
#include <SceneAPI/SceneCore/Containers/Views/View.inl>
@@ -62,6 +62,12 @@ namespace AZ
{
return m_end;
}
template<typename Iterator>
[[nodiscard]] bool View<Iterator>::empty() const
{
return m_begin == m_end;
}
}; // Views
} // Containers
} // SceneAPI
@@ -37,7 +37,12 @@ namespace AZ
Diffuse,
Specular,
Bump,
Normal
Normal,
Metallic,
Roughness,
AmbientOcclusion,
Emissive,
BaseColor
};
~IMaterialData() override = default;
@@ -52,6 +57,24 @@ namespace AZ
output.Write("EmissiveColor", GetEmissiveColor());
output.Write("Opacity", GetOpacity());
output.Write("Shininess", GetShininess());
output.Write("UseColorMap", GetUseColorMap());
output.Write("BaseColor", GetBaseColor());
output.Write("UseMetallicMap", GetUseMetallicMap());
output.Write("MetallicFactor", GetMetallicFactor());
output.Write("UseRoughnessMap", GetUseRoughnessMap());
output.Write("RoughnessFactor", GetRoughnessFactor());
output.Write("UseEmissiveMap", GetUseEmissiveMap());
output.Write("EmissiveIntensity", GetEmissiveIntensity());
output.Write("UseAOMap", GetUseAOMap());
output.Write("DiffuseTexture", GetTexture(TextureMapType::Diffuse).c_str());
output.Write("SpecularTexture", GetTexture(TextureMapType::Specular).c_str());
output.Write("BumpTexture", GetTexture(TextureMapType::Bump).c_str());
output.Write("NormalTexture", GetTexture(TextureMapType::Normal).c_str());
output.Write("MetallicTexture", GetTexture(TextureMapType::Metallic).c_str());
output.Write("RoughnessTexture", GetTexture(TextureMapType::Roughness).c_str());
output.Write("AmbientOcclusionTexture", GetTexture(TextureMapType::AmbientOcclusion).c_str());
output.Write("EmissiveTexture", GetTexture(TextureMapType::Emissive).c_str());
output.Write("BaseColorTexture", GetTexture(TextureMapType::BaseColor).c_str());
}
virtual const AZStd::string& GetMaterialName() const = 0;
@@ -63,6 +86,16 @@ namespace AZ
virtual const AZ::Vector3& GetEmissiveColor() const = 0;
virtual float GetOpacity() const = 0;
virtual float GetShininess() const = 0;
virtual bool GetUseColorMap() const = 0;
virtual const AZ::Vector3& GetBaseColor() const = 0;
virtual bool GetUseMetallicMap() const = 0;
virtual float GetMetallicFactor() const = 0;
virtual bool GetUseRoughnessMap() const = 0;
virtual float GetRoughnessFactor() const = 0;
virtual bool GetUseEmissiveMap() const = 0;
virtual float GetEmissiveIntensity() const = 0;
virtual bool GetUseAOMap() const = 0;
virtual uint64_t GetUniqueId() const = 0;
};
@@ -44,6 +44,7 @@ namespace AZ
float m_channels[4];
};
Color() = default;
Color(float r, float g, float b, float a)
: red(r), green(g), blue(b), alpha(a)
{
@@ -53,6 +54,30 @@ namespace AZ
{
return m_channels[static_cast<AZ::u8>(channel)];
}
bool IsClose(const Color& c, float tolerance = AZ::Constants::Tolerance) const
{
return (c - (*this)).Abs().IsLessEqualThan(tolerance);
}
bool IsLessEqualThan(float tolerance) const
{
return AZStd::all_of(AZStd::begin(m_channels), AZStd::end(m_channels), [tolerance] (float channel) { return channel <= tolerance; } );
}
Color& Abs()
{
for (float& channel : m_channels)
{
channel = std::abs(channel);
}
return *this;
}
Color operator-(const Color& rhs) const
{
return Color(red - rhs.red, green - rhs.green, blue - rhs.blue, alpha - rhs.alpha);
}
};
class IMeshVertexColorData
@@ -0,0 +1,47 @@
/*
* 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/Serialization/SerializeContext.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h>
namespace AZ
{
class ReflectContext;
}
namespace AZ::SceneAPI::DataTypes
{
class ICoordinateSystemRule
: public IRule
{
public:
AZ_RTTI(ICoordinateSystemRule, "{78136748-AC4B-4FC6-B9D8-C5820D67D29F}", IRule);
enum CoordinateSystem : int
{
ZUpPositiveYForward = 0,
ZUpNegativeYForward = 1
};
virtual ~ICoordinateSystemRule() override = default;
virtual void UpdateCoordinateSystemConverter() = 0;
virtual void SetTargetCoordinateSystem(CoordinateSystem targetCoordinateSystem) = 0;
virtual CoordinateSystem GetTargetCoordinateSystem() const = 0;
virtual const CoordinateSystemConverter& GetCoordinateSystemConverter() const = 0;
};
} // namespace AZ::SceneAPI::DataTypes
@@ -12,33 +12,26 @@
*
*/
#include <AzCore/std/string/string.h>
#include <AzCore/RTTI/RTTI.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
namespace AZ
{
class Quaternion;
class Vector3;
namespace SceneAPI
{
namespace DataTypes
{
class IOriginRule
class ISkinRule
: public IRule
{
public:
AZ_RTTI(IOriginRule, "{9FB042DF-1C7F-4815-BC83-BF8D94F907C5}", IRule);
AZ_RTTI(ISkinRule, "{5496ECAF-B096-4455-AE72-D55C5B675443}", IRule);
~ISkinRule() override = default;
virtual ~IOriginRule() override = default;
virtual const AZStd::string& GetOriginNodeName() const = 0;
virtual bool UseRootAsOrigin() const = 0;
virtual const AZ::Quaternion& GetRotation() const = 0;
virtual const AZ::Vector3& GetTranslation() const = 0;
virtual float GetScale() const = 0;
virtual AZ::u32 GetMaxWeightsPerVertex() const = 0;
virtual float GetWeightThreshold() const = 0;
};
} // DataTypes
} // SceneAPI
} // AZ
}
}
}
@@ -1,92 +0,0 @@
/*
* 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/RTTI/RTTI.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
#include <SceneAPI/SceneCore/DataTypes/ManifestBase/ISceneNodeSelectionList.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
/*!
The author of the touch bendable asset will be able to define stiffness, damping and thickness
as attributes per bone. Adding those kind of attributes to a node is supported
by DCC tools and the FBX API (FbxProperty), but SceneAPI doesn't support parsing those attributes into the
Scene Nodes or IGraphObjects. In the meantime, and while parsing Extra Atrributes is not supported by SceneAPI, the
content author should manually set the values in this Modifier. The values will be applied to all bones.
The ShouldOverride*() methods are put in place so in the future the content author can override
all the attributes at once without re-exporting assets from the DCC tools.
This is more of a convenience.
If the original asset doesn't have any of these attributes in the bones, then the values
of this rule will be applied to the root bone. Children bones will copy the parents attributes
for all unspecified attributes.
*/
class ITouchBendingRule
: public IRule
{
public:
AZ_RTTI(ITouchBendingRule, "{2FE2B499-DB71-4D69-8944-6DE2396D6E78}", IRule);
~ITouchBendingRule() override = default;
virtual const AZStd::string& GetRootBoneName() const = 0;
/*!
The returned list contains only one mesh in 99.99% of the cases.
The mesh is supposed to be the proximity trigger mesh.
Most of the time the content author would want the proximity trigger mesh
to be as simple as possible for performance reasons. So, something like a simple
cube that covers the main render mesh is the ideal thing to do for collision detection.
The selected proximity mesh is stored in a list, because there can be extreme cases
where several meshes can define the proximity trigger volume. They will all be combined
into a single submesh into the exported CGF file, at the expense of performance when the
engine calculates if a vegetation mesh is being touched or not.
*/
virtual ISceneNodeSelectionList& GetSceneNodeSelectionList() = 0;
virtual const ISceneNodeSelectionList& GetSceneNodeSelectionList() const = 0;
///If true, The stifness parameter for all the bones
///in the tree will be set to GetOverrideStiffness(), replacing
///the value set by the Author of the asset.
virtual bool ShouldOverrideStiffness() const = 0;
///A value from 0.0f to 1.0f.
///0.0 means no stiffness, the tree will look like a sad willow.
///Segments (bones) of the tree would never return to its original pose
///after being pushed by a Collider.
virtual float GetOverrideStiffness() const = 0;
///If true, The Damping parameter for all the bones
///in the tree will be set to GetOverrideDamping(), replacing
///the value set by the Author of the asset.
virtual bool ShouldOverrideDamping() const = 0;
///A value from 0.0 to 1.0. 0.0 means no damping, lots of back and forth movement around its original pose.
///1.0 means maximum damping, the segment will quickly converge back to its original pose.
virtual float GetOverrideDamping() const = 0;
///If true, The thickness parameter for all the bones
///in the tree will be set to GetOverrideThickness(), replacing
///the value set by the Author of the asset.
virtual bool ShouldOverrideThickness() const = 0;
///If you imagine the Segment (or Bone) to be a cylinder, this is its radius in meters.
virtual float GetOverrideThickness() const = 0;
}; //class ITouchBendingRule
} //namespace DataTypes
} // namespace SceneAPI
} // namespace AZ
@@ -40,7 +40,6 @@
#include <SceneAPI/SceneCore/DataTypes/Rules/ICommentRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMaterialRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IOriginRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ILodRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ISkeletonProxyRule.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IAnimationData.h>
@@ -166,7 +165,6 @@ namespace AZ
context->Class<AZ::SceneAPI::DataTypes::ICommentRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
context->Class<AZ::SceneAPI::DataTypes::IMaterialRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
context->Class<AZ::SceneAPI::DataTypes::IMeshAdvancedRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
context->Class<AZ::SceneAPI::DataTypes::IOriginRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
context->Class<AZ::SceneAPI::DataTypes::ILodRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
context->Class<AZ::SceneAPI::DataTypes::ISkeletonProxyRule, AZ::SceneAPI::DataTypes::IRule>()->Version(1);
// Register graph data interfaces
@@ -18,58 +18,18 @@ namespace AZ::SceneAPI::Events
// PreGenerateEventContext
/////////////
PreGenerateEventContext::PreGenerateEventContext(Containers::Scene& scene, const char* platformIdentifier)
GenerateEventBaseContext::GenerateEventBaseContext(Containers::Scene& scene, const char* platformIdentifier)
: m_scene(scene)
, m_platformIdentifier(platformIdentifier)
{
}
Containers::Scene& PreGenerateEventContext::GetScene() const
Containers::Scene& GenerateEventBaseContext::GetScene() const
{
return m_scene;
}
const char* PreGenerateEventContext::GetPlatformIdentifier() const
{
return m_platformIdentifier;
}
/////////////
// GenerateEventContext
/////////////
GenerateEventContext::GenerateEventContext(Containers::Scene& scene, const char* platformIdentifier)
: m_scene(scene)
, m_platformIdentifier(platformIdentifier)
{
}
Containers::Scene& GenerateEventContext::GetScene() const
{
return m_scene;
}
const char* GenerateEventContext::GetPlatformIdentifier() const
{
return m_platformIdentifier;
}
/////////////
// PostGenerateEventContext
/////////////
PostGenerateEventContext::PostGenerateEventContext(Containers::Scene& scene, const char* platformIdentifier)
: m_scene(scene)
, m_platformIdentifier(platformIdentifier)
{
}
Containers::Scene& PostGenerateEventContext::GetScene() const
{
return m_scene;
}
const char* PostGenerateEventContext::GetPlatformIdentifier() const
const char* GenerateEventBaseContext::GetPlatformIdentifier() const
{
return m_platformIdentifier;
}
@@ -24,13 +24,13 @@ namespace AZ::SceneAPI::Events
{
class ExportProductList;
// Signals the scene generation step is about to happen
class PreGenerateEventContext
class GenerateEventBaseContext
: public ICallContext
{
public:
AZ_RTTI(PreGenerateEventContext, "{0D1AB113-D35E-4C35-9820-E7B22F37D90C}", ICallContext)
SCENE_CORE_API PreGenerateEventContext(Containers::Scene& scene, const char* platformIdentifier);
AZ_RTTI(GenerateEventBaseContext, "{1717EB67-33A1-4516-8167-746093F7AEB6}", ICallContext)
SCENE_CORE_API GenerateEventBaseContext(Containers::Scene& scene, const char* platformIdentifier);
SCENE_CORE_API Containers::Scene& GetScene() const;
SCENE_CORE_API const char* GetPlatformIdentifier() const;
@@ -46,49 +46,57 @@ namespace AZ::SceneAPI::Events
const char* m_platformIdentifier = nullptr;
};
// Signals that all appropriate objects should be generated into the Scene
class GenerateEventContext
: public ICallContext
// Signals the scene generation step is about to happen
class PreGenerateEventContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(GenerateEventContext, "{B53CCBBF-965A-4709-AD33-AFD5F3AE8580}", ICallContext)
AZ_RTTI(PreGenerateEventContext, "{0D1AB113-D35E-4C35-9820-E7B22F37D90C}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
SCENE_CORE_API GenerateEventContext(Containers::Scene& scene, const char* platformIdentifier);
// Signals that new data such as procedurally generated objects should be added to the Scene
class GenerateEventContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(GenerateEventContext, "{B53CCBBF-965A-4709-AD33-AFD5F3AE8580}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
SCENE_CORE_API Containers::Scene& GetScene() const;
SCENE_CORE_API const char* GetPlatformIdentifier() const;
// Signals that new LODs should be added to the Scene
class GenerateLODEventContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(GenerateLODEventContext, "{2E3A6B98-1409-4895-8092-B7F8A410EF0D}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
private:
Containers::Scene& m_scene;
/**
* The platform identifier is configured in the AssetProcessorPlatformConfig.ini and is data driven
* it is generally a value like "pc" or "ios" or such.
* this const char* points at memory owned by the caller but it will always survive for the duration of the call.
*/
const char* m_platformIdentifier = nullptr;
// Signals that any new data, such as tangents and bitangents, should be added to the Scene
class GenerateAdditionEventContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(GenerateAdditionEventContext, "{105106FE-9ED7-48E6-9EA8-C7268BE8C625}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
// Signals that data simplification / complexity reduction should be run
class GenerateSimplificationEventContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(GenerateSimplificationEventContext, "{77F44B7F-C5BC-4411-B53F-E4307691841B}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
// Signals that the generation step is complete
class PostGenerateEventContext
: public ICallContext
: public GenerateEventBaseContext
{
public:
AZ_RTTI(PostGenerateEventContext, "{3EE65CBF-6C0E-425A-9ECC-3CC8FC4372F7}", ICallContext)
SCENE_CORE_API PostGenerateEventContext(Containers::Scene& scene, const char* platformIdentifier);
SCENE_CORE_API Containers::Scene& GetScene() const;
SCENE_CORE_API const char* GetPlatformIdentifier() const;
private:
Containers::Scene& m_scene;
/**
* The platform identifier is configured in the AssetProcessorPlatformConfig.ini and is data driven
* it is generally a value like "pc" or "ios" or such.
* this const char* points at memory owned by the caller but it will always survive for the duration of the call.
*/
const char* m_platformIdentifier = nullptr;
AZ_RTTI(PostGenerateEventContext, "{3EE65CBF-6C0E-425A-9ECC-3CC8FC4372F7}", GenerateEventBaseContext)
using GenerateEventBaseContext::GenerateEventBaseContext;
};
} // namespace AZ::SceneAPI::Events
@@ -36,7 +36,6 @@
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexColorData.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/ISceneNodeGroup.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ITouchBendingRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMaterialRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/ILodRule.h>
#include <SceneAPI/SceneCore/DataTypes/DataTypeUtilities.h>
@@ -284,13 +283,6 @@ namespace AZ
int physicsMaterialFlags = 0;
AZStd::vector<AZStd::string> targetNodes;
AZStd::shared_ptr<const DataTypes::ITouchBendingRule> touchBendingRule = rules.FindFirstByType<DataTypes::ITouchBendingRule>();
if (touchBendingRule)
{
targetNodes = Utilities::SceneGraphSelector::GenerateTargetNodes(sceneGraph,
touchBendingRule->GetSceneNodeSelectionList(), Utilities::SceneGraphSelector::IsMesh);
physicsMaterialFlags = AZ::GFxFramework::EMaterialFlags::MTL_FLAG_NODRAW_TOUCHBENDING;
}
for (auto& nodeName : targetNodes)
{
auto index = sceneGraph.Find(nodeName);
@@ -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 <gmock/gmock.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IBlendShapeData.h>
namespace AZ::SceneAPI::DataTypes
{
class MockIBlendShapeData
: public IBlendShapeData
{
public:
MOCK_CONST_METHOD0(GetUsedControlPointCount, size_t());
MOCK_CONST_METHOD1(GetControlPointIndex, int(int));
MOCK_CONST_METHOD1(GetUsedPointIndexForControlPoint, int(int));
MOCK_CONST_METHOD0(GetVertexCount, unsigned int());
MOCK_CONST_METHOD0(GetFaceCount, unsigned int());
MOCK_CONST_METHOD1(GetPosition, const AZ::Vector3&(unsigned int index));
MOCK_CONST_METHOD1(GetNormal, const AZ::Vector3&(unsigned int index));
MOCK_CONST_METHOD2(GetFaceVertexIndex, unsigned int(unsigned int face, unsigned int vertexIndex));
};
} // namespace AZ::SceneAPI::DataTypes
@@ -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 <gmock/gmock.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IBlendShapeRule.h>
namespace AZ::SceneAPI::DataTypes { class IMockSceneNodeSelectionList; }
namespace AZ::SceneAPI::DataTypes
{
class MockIBlendShapeRule
: public IBlendShapeRule
{
public:
ISceneNodeSelectionList& GetSceneNodeSelectionList() override
{
return const_cast<ISceneNodeSelectionList&>(static_cast<const MockIBlendShapeRule*>(this)->GetSceneNodeSelectionList());
}
MOCK_CONST_METHOD0(GetSceneNodeSelectionList, const ISceneNodeSelectionList&());
};
} // namespace AZ::SceneAPI::DataTypes
@@ -0,0 +1,204 @@
/*
* 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/SceneCore/Utilities/CoordinateSystemConverter.h>
#include <AzCore/Math/Matrix3x3.h>
namespace AZ::SceneAPI
{
// Default constructor, initializes so that it basically does no conversion.
CoordinateSystemConverter::CoordinateSystemConverter()
: m_sourceTransform(AZ::Transform::CreateIdentity())
, m_targetTransform(AZ::Transform::CreateIdentity())
, m_conversionTransform(AZ::Transform::CreateIdentity())
, m_conversionTransformInversed(AZ::Transform::CreateIdentity())
, m_needsConversion(false)
, m_sourceRightHanded(CheckIfIsRightHanded(m_sourceTransform))
, m_targetRightHanded(CheckIfIsRightHanded(m_targetTransform))
{
m_targetBasisIndices[0] = 0;
m_targetBasisIndices[1] = 1;
m_targetBasisIndices[2] = 2;
}
CoordinateSystemConverter::CoordinateSystemConverter(const AZ::Vector3 sourceBasisVectors[3], const AZ::Vector3 targetBasisVectors[3], const AZ::u32 targetBasisIndices[3])
{
const AZ::Matrix3x3 sourceMatrix3x3 = AZ::Matrix3x3::CreateFromColumns(sourceBasisVectors[0], sourceBasisVectors[1], sourceBasisVectors[2]);
m_sourceTransform = AZ::Transform::CreateFromMatrix3x3(sourceMatrix3x3);
AZ_Assert(m_sourceTransform.IsOrthogonal(), "Invalid source transformation, basis vectors have to be orthogonal.");
const AZ::Matrix3x3 targetMatrix3x3 = AZ::Matrix3x3::CreateFromColumns(targetBasisVectors[0], targetBasisVectors[1], targetBasisVectors[2]);
m_targetTransform = AZ::Transform::CreateFromMatrix3x3(targetMatrix3x3);
AZ_Assert(m_targetTransform.IsOrthogonal(), "Invalid target transformation, basis vectors have to be orthogonal.");
m_conversionTransform = m_targetTransform * m_sourceTransform.GetInverse();
m_conversionTransformInversed = m_conversionTransform.GetInverse();
m_targetBasisIndices[0] = targetBasisIndices[0];
m_targetBasisIndices[1] = targetBasisIndices[1];
m_targetBasisIndices[2] = targetBasisIndices[2];
m_needsConversion = (m_sourceTransform != m_targetTransform);
m_sourceRightHanded = CheckIfIsRightHanded(m_sourceTransform);
m_targetRightHanded = CheckIfIsRightHanded(m_targetTransform);
}
const CoordinateSystemConverter CoordinateSystemConverter::CreateFromBasisVectors(const AZ::Vector3 sourceBasisVectors[3], const AZ::Vector3 targetBasisVectors[3], const AZ::u32 targetBasisIndices[3])
{
return CoordinateSystemConverter(sourceBasisVectors, targetBasisVectors, targetBasisIndices);
}
const CoordinateSystemConverter CoordinateSystemConverter::CreateFromTransforms(const AZ::Transform& sourceTransform, const AZ::Transform& targetTransform, const AZ::u32 targetBasisIndices[3])
{
AZ::Vector3 sourceBasisVectors[3];
sourceBasisVectors[0] = sourceTransform.GetBasisX();
sourceBasisVectors[1] = sourceTransform.GetBasisY();
sourceBasisVectors[2] = sourceTransform.GetBasisZ();
AZ::Vector3 targetBasisVectors[3];
targetBasisVectors[0] = targetTransform.GetBasisX();
targetBasisVectors[1] = targetTransform.GetBasisY();
targetBasisVectors[2] = targetTransform.GetBasisZ();
return CoordinateSystemConverter(sourceBasisVectors, targetBasisVectors, targetBasisIndices);
}
bool CoordinateSystemConverter::CheckIfIsRightHanded(const AZ::Transform& transform) const
{
const AZ::Vector3 right = transform.GetBasisX();
const AZ::Vector3 up = transform.GetBasisY();
const AZ::Vector3 forward = transform.GetBasisZ();
return ((right.Cross(up)).Dot(forward) <= 0.0f);
}
//-------------------------------------------------------------------------
// Conversions
//-------------------------------------------------------------------------
AZ::Quaternion CoordinateSystemConverter::ConvertQuaternion(const AZ::Quaternion& input) const
{
if (!m_needsConversion)
{
return input;
}
const AZ::Vector3 vec = ConvertVector3( input.GetImaginary() );
float w = input.GetW();
if (m_sourceRightHanded != m_targetRightHanded)
{
w = -w;
}
return AZ::Quaternion(vec.GetX(), vec.GetY(), vec.GetZ(), w);
}
AZ::Vector3 CoordinateSystemConverter::ConvertVector3(const AZ::Vector3& input) const
{
if (!m_needsConversion)
{
return input;
}
return m_conversionTransform.TransformPoint(input);
}
AZ::Transform CoordinateSystemConverter::ConvertTransform(const AZ::Transform& input) const
{
if (!m_needsConversion)
{
return input;
}
return input * m_conversionTransform;
}
AZ::Matrix3x4 CoordinateSystemConverter::ConvertMatrix3x4(const AZ::Matrix3x4 & input) const
{
if (!m_needsConversion)
{
return input;
}
return input * AZ::Matrix3x4::CreateFromTransform(m_conversionTransform);
}
// Convert a scale value, which never flips some axis or so, just switches them.
// Think of two coordinate systems, where for example the Z axis is inverted in one of them, the scale will remain the same, in both systems.
// However, if we swap Y and Z, the scale Y and Z still have to be swapped.
AZ::Vector3 CoordinateSystemConverter::ConvertScale(const AZ::Vector3& input) const
{
if (!m_needsConversion)
{
return input;
}
return AZ::Vector3( input.GetElement(m_targetBasisIndices[0]),
input.GetElement(m_targetBasisIndices[1]),
input.GetElement(m_targetBasisIndices[2]) );
}
//-------------------------------------------------------------------------
// Inverse Conversions
//-------------------------------------------------------------------------
AZ::Quaternion CoordinateSystemConverter::InverseConvertQuaternion(const AZ::Quaternion& input) const
{
if (!m_needsConversion)
{
return input;
}
const AZ::Vector3 vec = InverseConvertVector3( input.GetImaginary() );
float w = input.GetW();
if (m_sourceRightHanded != m_targetRightHanded)
{
w = -w;
}
return AZ::Quaternion(vec.GetX(), vec.GetY(), vec.GetZ(), w);
}
AZ::Vector3 CoordinateSystemConverter::InverseConvertVector3(const AZ::Vector3& input) const
{
if (!m_needsConversion)
{
return input;
}
return m_conversionTransformInversed.TransformPoint(input);
}
AZ::Transform CoordinateSystemConverter::InverseConvertTransform(const AZ::Transform& input) const
{
if (!m_needsConversion)
{
return input;
}
return input * m_conversionTransformInversed;
}
AZ::Vector3 CoordinateSystemConverter::InverseConvertScale(const AZ::Vector3& input) const
{
return ConvertScale(input);
}
} // namespace AZ::SceneAPI
@@ -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/Math/Transform.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Quaternion.h>
#include <SceneAPI/SceneCore/SceneCoreConfiguration.h>
namespace AZ::SceneAPI
{
class SCENE_CORE_API CoordinateSystemConverter
{
public:
CoordinateSystemConverter();
static const CoordinateSystemConverter CreateFromBasisVectors(const AZ::Vector3 sourceBasisVectors[3], const AZ::Vector3 targetBasisVectors[3], const AZ::u32 targetBasisIndices[3]);
static const CoordinateSystemConverter CreateFromTransforms(const AZ::Transform& sourceTransform, const AZ::Transform& targetTransform, const AZ::u32 targetBasisIndices[3]);
// Inline get data.
bool IsConversionNeeded() const { return m_needsConversion; }
bool IsSourceRightHanded() const { return m_sourceRightHanded; }
bool IsTargetRightHanded() const { return m_targetRightHanded; }
const AZ::Transform GetSourceTransform() const { return m_sourceTransform; }
const AZ::Transform GetTargetTransform() const { return m_targetTransform; }
const AZ::Transform GetConversionTransform() const { return m_conversionTransform; }
const AZ::Transform GetInverseConversionTransform() const { return m_conversionTransformInversed; }
// Conversion methods.
AZ::Quaternion ConvertQuaternion(const AZ::Quaternion& input) const;
AZ::Vector3 ConvertVector3(const AZ::Vector3& input) const;
AZ::Vector3 ConvertScale(const AZ::Vector3& input) const;
AZ::Transform ConvertTransform(const AZ::Transform& input) const;
AZ::Matrix3x4 ConvertMatrix3x4(const AZ::Matrix3x4 & input) const;
// Inverse conversion methods.
AZ::Quaternion InverseConvertQuaternion(const AZ::Quaternion& input) const;
AZ::Vector3 InverseConvertVector3(const AZ::Vector3& input) const;
AZ::Vector3 InverseConvertScale(const AZ::Vector3& input) const;
AZ::Transform InverseConvertTransform(const AZ::Transform& input) const;
// Helper methods.
bool CheckIfIsRightHanded(const AZ::Transform& transform) const;
private:
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
AZ::Transform m_sourceTransform;
AZ::Transform m_targetTransform;
AZ::Transform m_conversionTransform;
AZ::Transform m_conversionTransformInversed;
AZ_POP_DISABLE_OVERRIDE_WARNING
AZ::u32 m_targetBasisIndices[3];
bool m_needsConversion;
bool m_sourceRightHanded;
bool m_targetRightHanded;
CoordinateSystemConverter(const AZ::Vector3 sourceBasisVectors[3], const AZ::Vector3 targetBasisVectors[3], const AZ::u32 targetBasisIndices[3]);
};
} // namespace AZ::SceneAPI
@@ -44,7 +44,18 @@ namespace AZ
return object && object->RTTI_IsTypeOf(DataTypes::IMeshData::TYPEINFO_Uuid());
}
AZStd::vector<AZStd::string> SceneGraphSelector::GenerateTargetNodes(const Containers::SceneGraph& graph, const DataTypes::ISceneNodeSelectionList& list, NodeFilterFunction nodeFilter)
Containers::SceneGraph::NodeIndex SceneGraphSelector::RemapToOptimizedMesh(const Containers::SceneGraph& graph, const Containers::SceneGraph::NodeIndex& index)
{
const auto& nodeName = graph.GetNodeName(index);
const AZStd::string optimizedName = AZStd::string(nodeName.GetPath(), nodeName.GetPathLength()) + "_optimized";
if (auto optimizedIndex = graph.Find(optimizedName); optimizedIndex.IsValid())
{
return optimizedIndex;
}
return index;
}
AZStd::vector<AZStd::string> SceneGraphSelector::GenerateTargetNodes(const Containers::SceneGraph& graph, const DataTypes::ISceneNodeSelectionList& list, NodeFilterFunction nodeFilter, NodeRemapFunction nodeRemap)
{
AZStd::vector<AZStd::string> targetNodes;
AZStd::set<AZStd::string> selectedNodesSet;
@@ -52,8 +63,8 @@ namespace AZ
CopySelectionToSet(selectedNodesSet, unselectedNodesSet, list);
CorrectRootNode(graph, selectedNodesSet, unselectedNodesSet);
auto nodeIterator = graph.ConvertToHierarchyIterator(graph.GetRoot());
auto view = Containers::Views::MakeSceneGraphDownwardsView<Containers::Views::BreadthFirst>(graph, nodeIterator, graph.GetContentStorage().cbegin(), true);
const auto nodeIterator = graph.ConvertToHierarchyIterator(graph.GetRoot());
const auto view = Containers::Views::MakeSceneGraphDownwardsView<Containers::Views::BreadthFirst>(graph, nodeIterator, graph.GetContentStorage().cbegin(), true);
if (view.begin() == view.end())
{
return targetNodes;
@@ -62,15 +73,24 @@ namespace AZ
{
Containers::SceneGraph::NodeIndex index = graph.ConvertToNodeIndex(it.GetHierarchyIterator());
AZStd::string currentNodeName = graph.GetNodeName(index).GetPath();
if (unselectedNodesSet.find(currentNodeName) != unselectedNodesSet.end())
if (unselectedNodesSet.contains(currentNodeName))
{
continue;
}
if (selectedNodesSet.find(currentNodeName) != selectedNodesSet.end())
if (selectedNodesSet.contains(currentNodeName))
{
if (nodeFilter(graph, index))
{
targetNodes.push_back(currentNodeName);
Containers::SceneGraph::NodeIndex remappedIndex = nodeRemap(graph, index);
if (remappedIndex == index)
{
targetNodes.emplace_back(AZStd::move(currentNodeName));
}
else
{
const Containers::SceneGraph::Name& nodeName = graph.GetNodeName(remappedIndex);
targetNodes.emplace_back(nodeName.GetPath(), nodeName.GetPathLength());
}
}
continue;
}
@@ -79,16 +99,25 @@ namespace AZ
if (parentIndex.IsValid())
{
AZStd::string parentNodeName = graph.GetNodeName(parentIndex).GetPath();
if (unselectedNodesSet.find(parentNodeName) != unselectedNodesSet.end())
if (unselectedNodesSet.contains(parentNodeName))
{
unselectedNodesSet.insert(currentNodeName);
}
else if (selectedNodesSet.find(parentNodeName) != selectedNodesSet.end())
else if (selectedNodesSet.contains(parentNodeName))
{
selectedNodesSet.insert(currentNodeName);
if (nodeFilter(graph, index))
{
targetNodes.push_back(currentNodeName);
Containers::SceneGraph::NodeIndex remappedIndex = nodeRemap(graph, index);
if (remappedIndex == index)
{
targetNodes.emplace_back(AZStd::move(currentNodeName));
}
else
{
const Containers::SceneGraph::Name& nodeName = graph.GetNodeName(remappedIndex);
targetNodes.emplace_back(nodeName.GetPath(), nodeName.GetPathLength());
}
}
}
else
@@ -159,12 +188,12 @@ namespace AZ
Containers::SceneGraph::NodeIndex index = graph.ConvertToNodeIndex(it.GetHierarchyIterator());
AZStd::string currentNodeName = it->first.GetPath();
// Check if item is already registered and if so add it to the appropriate list.
if (unselectedNodesSet.find(currentNodeName) != unselectedNodesSet.end())
if (unselectedNodesSet.contains(currentNodeName))
{
list.RemoveSelectedNode(AZStd::move(currentNodeName));
continue;
}
if (selectedNodesSet.find(currentNodeName) != selectedNodesSet.end())
if (selectedNodesSet.contains(currentNodeName))
{
list.AddSelectedNode(AZStd::move(currentNodeName));
continue;
@@ -176,7 +205,7 @@ namespace AZ
if (parentIndex.IsValid())
{
AZStd::string parentNodeName = graph.GetNodeName(parentIndex).GetPath();
if (unselectedNodesSet.find(parentNodeName) != unselectedNodesSet.end())
if (unselectedNodesSet.contains(parentNodeName))
{
unselectedNodesSet.insert(currentNodeName);
list.RemoveSelectedNode(AZStd::move(currentNodeName));
@@ -208,7 +237,7 @@ namespace AZ
AZStd::string currentNodeName = it->first.GetPath();
if (nodeFilter(graph, index))
{
if (targetNodes.find(currentNodeName) != targetNodes.end())
if (targetNodes.contains(currentNodeName))
{
list.AddSelectedNode(currentNodeName);
}
@@ -18,39 +18,38 @@
#include <AzCore/std/containers/unordered_set.h>
#include <SceneAPI/SceneCore/Containers/SceneGraph.h>
namespace AZ
namespace AZ::SceneAPI::DataTypes { class ISceneNodeSelectionList; }
namespace AZ::SceneAPI::Utilities
{
namespace SceneAPI
// SceneGraphSelector provides utilities including converting selected and unselected node lists
// in the MeshGroup into the final target node list.
class SceneGraphSelector
{
namespace DataTypes
public:
using NodeFilterFunction = bool(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index);
using NodeRemapFunction = Containers::SceneGraph::NodeIndex(const Containers::SceneGraph& graph, const Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static AZStd::vector<AZStd::string> GenerateTargetNodes(const Containers::SceneGraph& graph, const DataTypes::ISceneNodeSelectionList& list,
NodeFilterFunction nodeFilter, NodeRemapFunction nodeRemap = NoRemap);
SCENE_CORE_API static void SelectAll(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UnselectAll(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UpdateNodeSelection(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UpdateTargetNodes(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list,
const AZStd::unordered_set<AZStd::string>& targetNodes, NodeFilterFunction nodeFilter);
SCENE_CORE_API static bool IsTreeViewType(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static bool IsMesh(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static bool IsMeshObject(const AZStd::shared_ptr<const DataTypes::IGraphObject>& object);
SCENE_CORE_API static Containers::SceneGraph::NodeIndex NoRemap(const Containers::SceneGraph& /*graph*/, const Containers::SceneGraph::NodeIndex& index)
{
class ISceneNodeSelectionList;
return index;
}
namespace Utilities
{
// SceneGraphSelector provides utilities including converting selected and unselected node lists
// in the MeshGroup into the final target node list.
class SceneGraphSelector
{
public:
using NodeFilterFunction = AZStd::function<bool(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index)>;
SCENE_CORE_API static Containers::SceneGraph::NodeIndex RemapToOptimizedMesh(const Containers::SceneGraph& graph, const Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static AZStd::vector<AZStd::string> GenerateTargetNodes(const Containers::SceneGraph& graph, const DataTypes::ISceneNodeSelectionList& list,
NodeFilterFunction nodeFilter);
SCENE_CORE_API static void SelectAll(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UnselectAll(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UpdateNodeSelection(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list);
SCENE_CORE_API static void UpdateTargetNodes(const Containers::SceneGraph& graph, DataTypes::ISceneNodeSelectionList& list,
const AZStd::unordered_set<AZStd::string>& targetNodes, NodeFilterFunction nodeFilter);
SCENE_CORE_API static bool IsTreeViewType(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static bool IsMesh(const Containers::SceneGraph& graph, Containers::SceneGraph::NodeIndex& index);
SCENE_CORE_API static bool IsMeshObject(const AZStd::shared_ptr<const DataTypes::IGraphObject>& object);
private:
static void CopySelectionToSet(AZStd::set<AZStd::string>& selected, AZStd::set<AZStd::string>& unselected, const DataTypes::ISceneNodeSelectionList& list);
static void CorrectRootNode(const Containers::SceneGraph& graph, AZStd::set<AZStd::string>& selected, AZStd::set<AZStd::string>& unselected);
};
}
}
}
private:
static void CopySelectionToSet(AZStd::set<AZStd::string>& selected, AZStd::set<AZStd::string>& unselected, const DataTypes::ISceneNodeSelectionList& list);
static void CorrectRootNode(const Containers::SceneGraph& graph, AZStd::set<AZStd::string>& selected, AZStd::set<AZStd::string>& unselected);
};
}
@@ -43,12 +43,12 @@ set(FILES
DataTypes/Rules/ICommentRule.h
DataTypes/Rules/ILodRule.h
DataTypes/Rules/IMeshAdvancedRule.h
DataTypes/Rules/IOriginRule.h
DataTypes/Rules/IMaterialRule.h
DataTypes/Rules/IScriptProcessorRule.h
DataTypes/Rules/ISkeletonProxyRule.h
DataTypes/Rules/ITouchBendingRule.h
DataTypes/Rules/ICoordinateSystemRule.h
DataTypes/Rules/IClothRule.h
DataTypes/Rules/ISkinRule.h
Components/BehaviorComponent.h
Components/BehaviorComponent.cpp
Components/ExportingComponent.h
@@ -123,6 +123,8 @@ set(FILES
Import/ManifestImportRequestHandler.cpp
Export/MtlMaterialExporter.h
Export/MtlMaterialExporter.cpp
Utilities/CoordinateSystemConverter.h
Utilities/CoordinateSystemConverter.cpp
Utilities/SceneGraphSelector.h
Utilities/SceneGraphSelector.cpp
Utilities/FileUtilities.h