29 lines
719 B
C++
29 lines
719 B
C++
#pragma once
|
|
|
|
#include "asset_base.hpp"
|
|
|
|
#include <ryml_std.hpp>
|
|
#include <unordered_map>
|
|
#include <string_view>
|
|
|
|
struct Prefab : public AssetBase
|
|
{
|
|
public:
|
|
static constexpr std::array<std::string_view, 1> Extensions = { ".prefab" };
|
|
|
|
public:
|
|
std::unordered_map<int64_t, ryml::Tree> Data;
|
|
|
|
public:
|
|
template <typename ParsedProject>
|
|
void Parse(ParsedProject& project, std::string& content)
|
|
{
|
|
using ObjectTypesT = typename ParsedProject::ObjectTypes;
|
|
|
|
auto names = ObjectTypesT::get_names();
|
|
ParseSceneYaml(content, false, names, [this](std::string_view componentName, int64_t ID, ryml::Tree&& tree)
|
|
{
|
|
Data.emplace(ID, std::move(tree));
|
|
});
|
|
}
|
|
}; |