mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 11:07:44 +00:00
Explicit Asset ID refactor
This commit is contained in:
@@ -19,34 +19,24 @@ class YAMLDocWriter;
|
||||
|
||||
namespace DataSpec {
|
||||
|
||||
template <typename IDType>
|
||||
class IDRestorer {
|
||||
std::vector<std::pair<IDType, IDType>> m_newToOrig;
|
||||
std::vector<std::pair<IDType, IDType>> m_origToNew;
|
||||
|
||||
public:
|
||||
IDRestorer(const hecl::ProjectPath& yamlPath, const hecl::Database::Project& project);
|
||||
IDType newToOriginal(IDType id) const;
|
||||
IDType originalToNew(IDType id) const;
|
||||
};
|
||||
|
||||
struct SpecBase : hecl::Database::IDataSpec {
|
||||
/* HECL Adaptors */
|
||||
void setThreadProject();
|
||||
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
|
||||
void doExtract(const ExtractPassInfo& info, const hecl::MultiProgressPrinter& progress);
|
||||
void setThreadProject() override;
|
||||
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps) override;
|
||||
void doExtract(const ExtractPassInfo& info, const hecl::MultiProgressPrinter& progress) override;
|
||||
|
||||
bool canCook(const hecl::ProjectPath& path, hecl::blender::Token& btok);
|
||||
bool canCook(const hecl::ProjectPath& path, hecl::blender::Token& btok) override;
|
||||
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
|
||||
const hecl::Database::DataSpecEntry* oldEntry) const;
|
||||
const hecl::Database::DataSpecEntry* oldEntry) const override;
|
||||
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath, bool fast, hecl::blender::Token& btok,
|
||||
FCookProgress progress);
|
||||
FCookProgress progress) override;
|
||||
|
||||
bool canPackage(const hecl::ProjectPath& path);
|
||||
bool canPackage(const hecl::ProjectPath& path) override;
|
||||
void doPackage(const hecl::ProjectPath& path, const hecl::Database::DataSpecEntry* entry, bool fast,
|
||||
hecl::blender::Token& btok, const hecl::MultiProgressPrinter& progress, hecl::ClientProcess* cp);
|
||||
hecl::blender::Token& btok, const hecl::MultiProgressPrinter& progress,
|
||||
hecl::ClientProcess* cp) override;
|
||||
|
||||
void interruptCook();
|
||||
void interruptCook() override;
|
||||
|
||||
/* Extract handlers */
|
||||
virtual bool checkStandaloneID(const char* id) const = 0;
|
||||
@@ -72,9 +62,13 @@ struct SpecBase : hecl::Database::IDataSpec {
|
||||
/* Pre-cook handlers */
|
||||
virtual bool validateYAMLDNAType(athena::io::IStreamReader& fp) const = 0;
|
||||
|
||||
std::optional<hecl::blender::World> compileWorldFromDir(const hecl::ProjectPath& dir,
|
||||
hecl::blender::Token& btok) const;
|
||||
|
||||
/* Cook handlers */
|
||||
using BlendStream = hecl::blender::DataStream;
|
||||
using Mesh = hecl::blender::Mesh;
|
||||
using Armature = hecl::blender::Armature;
|
||||
using ColMesh = hecl::blender::ColMesh;
|
||||
using PathMesh = hecl::blender::PathMesh;
|
||||
using Light = hecl::blender::Light;
|
||||
@@ -84,6 +78,8 @@ struct SpecBase : hecl::Database::IDataSpec {
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookColMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookArmature(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
|
||||
@@ -95,7 +91,7 @@ struct SpecBase : hecl::Database::IDataSpec {
|
||||
virtual void cookGuiFrame(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds,
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in, athena::io::IStreamReader& fin,
|
||||
FCookProgress progress) = 0;
|
||||
hecl::blender::Token& btok, FCookProgress progress) = 0;
|
||||
virtual void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress) = 0;
|
||||
virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress) = 0;
|
||||
virtual void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds,
|
||||
@@ -166,7 +162,7 @@ protected:
|
||||
bool m_pc;
|
||||
hecl::ProjectPath m_masterShader;
|
||||
|
||||
std::unordered_map<urde::SObjectTag, hecl::ProjectPath> m_tagToPath;
|
||||
std::unordered_multimap<urde::SObjectTag, hecl::ProjectPath> m_tagToPath;
|
||||
std::unordered_map<hecl::Hash, urde::SObjectTag> m_pathToTag;
|
||||
std::unordered_map<std::string, urde::SObjectTag> m_catalogNameToTag;
|
||||
std::unordered_map<urde::SObjectTag, std::unordered_set<std::string>> m_catalogTagToNames;
|
||||
@@ -178,6 +174,8 @@ protected:
|
||||
bool m_backgroundRunning = false;
|
||||
|
||||
void readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter);
|
||||
void insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObjectTag& tag,
|
||||
const hecl::ProjectPath& path, bool dump = true);
|
||||
bool addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter);
|
||||
void backgroundIndexRecursiveProc(const hecl::ProjectPath& path, athena::io::YAMLDocWriter& cacheWriter,
|
||||
athena::io::YAMLDocWriter& nameWriter, int level);
|
||||
|
||||
Reference in New Issue
Block a user