Add serialized output version (xml) of debug scene graph (#3437)

* Add serialized output version (xml) of debug scene graph

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix line endings

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix line endings

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Update fbx unit tests to check for dbgsg.xml file

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add dbgsg.xml comparison

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Move dbgsg files to SceneDebug sub folder

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add shaderball.dbgsg.xml and multiple_mesh_multiple_material_override.dbgsg.xml

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add shaderball dbgsg.xml product.

Update code to look in SceneDebug for dbgsg files
Fix extension concatenation

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Remove unnecessary dbgsg.xml file

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
amzn-mike
2021-10-26 11:07:22 -05:00
committed by GitHub
parent 81acd559d0
commit ee6ceba5ce
27 changed files with 21893 additions and 31 deletions
@@ -15,6 +15,7 @@
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/optional.h>
#include <cinttypes>
#include <AzCore/std/any.h>
namespace AZ
{
@@ -34,15 +35,63 @@ namespace AZ
namespace AZ::SceneAPI::Utilities
{
constexpr int SceneGraphVersion = 1;
struct DebugNode
{
AZ_TYPE_INFO(DebugNode, "{490B9D4C-1847-46EB-BEBC-49812E104626}");
AZStd::string m_name;
AZStd::string m_path;
AZStd::string m_type;
DebugNode() = default;
DebugNode(AZStd::string name, AZStd::string path, AZStd::string type)
: m_name(AZStd::move(name)),
m_path(AZStd::move(path)),
m_type(AZStd::move(type))
{
}
static void Reflect(AZ::ReflectContext* context);
using DataItem = AZStd::pair<AZStd::string, AZStd::any>;
AZStd::vector<DataItem> m_data;
};
struct DebugSceneGraph
{
AZ_TYPE_INFO(DebugSceneGraph, "{375F6558-5709-409F-881E-8ED575D56C92}");
int m_version = SceneGraphVersion;
AZStd::string m_productName;
AZStd::string m_sceneName;
AZStd::vector<DebugNode> m_nodes;
static void Reflect(AZ::ReflectContext* context);
};
class DebugOutput
{
public:
DebugOutput(DebugNode node) : m_currentNode(AZStd::move(node)){}
template<typename T>
void Write(const char* name, const AZStd::vector<T>& data);
template<typename T>
void Write(const char* name, const AZStd::vector<AZStd::vector<T>>& data);
template<typename T>
void AddToNode(const char* name, const T& data)
{
if (!m_pauseNodeData)
{
m_currentNode.m_data.emplace_back(name, AZStd::make_any<AZStd::decay_t<T>>(data));
}
}
SCENE_CORE_API void Write(const char* name, const char* data);
SCENE_CORE_API void WriteArray(const char* name, const unsigned int* data, int size);
SCENE_CORE_API void Write(const char* name, const AZStd::string& data);
@@ -57,11 +106,15 @@ namespace AZ::SceneAPI::Utilities
SCENE_CORE_API void Write(const char* name, AZStd::optional<AZ::Vector3> data);
SCENE_CORE_API const AZStd::string& GetOutput() const;
SCENE_CORE_API DebugNode GetDebugNode() const;
SCENE_CORE_API static void BuildDebugSceneGraph(const char* outputFolder, AZ::SceneAPI::Events::ExportProductList& productList, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene, AZStd::string productName);
protected:
AZStd::string m_output;
DebugSceneGraph m_graph;
DebugNode m_currentNode;
bool m_pauseNodeData = false; // If true, don't append any data to the DebugNode. Useful when a Write function calls other Write functions
};
}