mirror of https://github.com/AxioDL/metaforce.git
Reinstate particle viewer with self-cooking capability
This commit is contained in:
parent
81de11f2c3
commit
cd020790e5
|
@ -33,8 +33,8 @@ static const hecl::SystemChar* MomErr[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr uint32_t MomErrCount = std::extent<decltype(MomErr)>::value;
|
constexpr uint32_t MomErrCount = std::extent<decltype(MomErr)>::value;
|
||||||
SpecBase::SpecBase(hecl::Database::Project& project, bool pc)
|
SpecBase::SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
|
||||||
: m_project(project), m_pc(pc),
|
: hecl::Database::IDataSpec(specEntry), m_project(project), m_pc(pc),
|
||||||
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
|
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
|
||||||
|
|
||||||
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
|
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
|
||||||
|
@ -114,13 +114,13 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
||||||
extractFromDisc(*m_disc, info.force, progress);
|
extractFromDisc(*m_disc, info.force, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpecBase::canCook(const hecl::ProjectPath& path)
|
bool SpecBase::canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok)
|
||||||
{
|
{
|
||||||
if (!checkPathPrefix(path))
|
if (!checkPathPrefix(path))
|
||||||
return false;
|
return false;
|
||||||
if (hecl::IsPathBlend(path))
|
if (hecl::IsPathBlend(path))
|
||||||
{
|
{
|
||||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
if (!conn.openBlend(path))
|
if (!conn.openBlend(path))
|
||||||
return false;
|
return false;
|
||||||
if (conn.getBlendType() != hecl::BlenderConnection::BlendType::None)
|
if (conn.getBlendType() != hecl::BlenderConnection::BlendType::None)
|
||||||
|
@ -141,13 +141,14 @@ bool SpecBase::canCook(const hecl::ProjectPath& path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::ProjectPath& path,
|
const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::ProjectPath& path,
|
||||||
const hecl::Database::DataSpecEntry* oldEntry)
|
const hecl::Database::DataSpecEntry* oldEntry,
|
||||||
|
hecl::BlenderToken& btok)
|
||||||
{
|
{
|
||||||
if (!checkPathPrefix(path))
|
if (!checkPathPrefix(path))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (hecl::IsPathBlend(path))
|
if (hecl::IsPathBlend(path))
|
||||||
{
|
{
|
||||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
if (!conn.openBlend(path))
|
if (!conn.openBlend(path))
|
||||||
{
|
{
|
||||||
Log.report(logvisor::Error, _S("unable to cook '%s'"),
|
Log.report(logvisor::Error, _S("unable to cook '%s'"),
|
||||||
|
@ -167,12 +168,12 @@ const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::Proj
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
||||||
bool fast, FCookProgress progress)
|
bool fast, hecl::BlenderToken& btok, FCookProgress progress)
|
||||||
{
|
{
|
||||||
DataSpec::g_curSpec = this;
|
DataSpec::g_curSpec = this;
|
||||||
if (hecl::IsPathBlend(path))
|
if (hecl::IsPathBlend(path))
|
||||||
{
|
{
|
||||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
if (!conn.openBlend(path))
|
if (!conn.openBlend(path))
|
||||||
return;
|
return;
|
||||||
switch (conn.getBlendType())
|
switch (conn.getBlendType())
|
||||||
|
|
|
@ -16,11 +16,12 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||||
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
|
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
|
||||||
void doExtract(const ExtractPassInfo& info, FProgress progress);
|
void doExtract(const ExtractPassInfo& info, FProgress progress);
|
||||||
|
|
||||||
bool canCook(const hecl::ProjectPath& path);
|
bool canCook(const hecl::ProjectPath& path, hecl::BlenderToken& btok);
|
||||||
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
|
const hecl::Database::DataSpecEntry* overrideDataSpec(const hecl::ProjectPath& path,
|
||||||
const hecl::Database::DataSpecEntry* oldEntry);
|
const hecl::Database::DataSpecEntry* oldEntry,
|
||||||
|
hecl::BlenderToken& btok);
|
||||||
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
||||||
bool fast, FCookProgress progress);
|
bool fast, hecl::BlenderToken& btok, FCookProgress progress);
|
||||||
|
|
||||||
bool canPackage(const PackagePassInfo& info);
|
bool canPackage(const PackagePassInfo& info);
|
||||||
void gatherDependencies(const PackagePassInfo& info,
|
void gatherDependencies(const PackagePassInfo& info,
|
||||||
|
@ -72,7 +73,7 @@ struct SpecBase : hecl::Database::IDataSpec
|
||||||
/* Project accessor */
|
/* Project accessor */
|
||||||
hecl::Database::Project& getProject() const {return m_project;}
|
hecl::Database::Project& getProject() const {return m_project;}
|
||||||
|
|
||||||
SpecBase(hecl::Database::Project& project, bool pc);
|
SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc);
|
||||||
protected:
|
protected:
|
||||||
hecl::Database::Project& m_project;
|
hecl::Database::Project& m_project;
|
||||||
bool m_pc;
|
bool m_pc;
|
||||||
|
|
|
@ -34,8 +34,8 @@ struct SpecMP1 : SpecBase
|
||||||
hecl::ProjectPath m_cookPath;
|
hecl::ProjectPath m_cookPath;
|
||||||
PAKRouter<DNAMP1::PAKBridge> m_pakRouter;
|
PAKRouter<DNAMP1::PAKBridge> m_pakRouter;
|
||||||
|
|
||||||
SpecMP1(hecl::Database::Project& project, bool pc)
|
SpecMP1(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
|
||||||
: SpecBase(project, pc),
|
: SpecBase(specEntry, project, pc),
|
||||||
m_workPath(project.getProjectWorkingPath(), _S("MP1")),
|
m_workPath(project.getProjectWorkingPath(), _S("MP1")),
|
||||||
m_cookPath(project.getProjectCookedPath(SpecEntMP1), _S("MP1")),
|
m_cookPath(project.getProjectCookedPath(SpecEntMP1), _S("MP1")),
|
||||||
m_pakRouter(*this, m_workPath, m_cookPath) {}
|
m_pakRouter(*this, m_workPath, m_cookPath) {}
|
||||||
|
@ -356,7 +356,7 @@ hecl::Database::DataSpecEntry SpecEntMP1 =
|
||||||
_S("MP1"),
|
_S("MP1"),
|
||||||
_S("Data specification for original Metroid Prime engine"),
|
_S("Data specification for original Metroid Prime engine"),
|
||||||
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
||||||
-> hecl::Database::IDataSpec* {return new struct SpecMP1(project, false);}
|
-> hecl::Database::IDataSpec* {return new struct SpecMP1(&SpecEntMP1, project, false);}
|
||||||
};
|
};
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP1PC =
|
hecl::Database::DataSpecEntry SpecEntMP1PC =
|
||||||
|
@ -367,7 +367,7 @@ hecl::Database::DataSpecEntry SpecEntMP1PC =
|
||||||
-> hecl::Database::IDataSpec*
|
-> hecl::Database::IDataSpec*
|
||||||
{
|
{
|
||||||
if (tool != hecl::Database::DataSpecTool::Extract)
|
if (tool != hecl::Database::DataSpecTool::Extract)
|
||||||
return new struct SpecMP1(project, true);
|
return new struct SpecMP1(&SpecEntMP1PC, project, true);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,8 +29,8 @@ struct SpecMP2 : SpecBase
|
||||||
hecl::ProjectPath m_cookPath;
|
hecl::ProjectPath m_cookPath;
|
||||||
PAKRouter<DNAMP2::PAKBridge> m_pakRouter;
|
PAKRouter<DNAMP2::PAKBridge> m_pakRouter;
|
||||||
|
|
||||||
SpecMP2(hecl::Database::Project& project, bool pc)
|
SpecMP2(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
|
||||||
: SpecBase(project, pc),
|
: SpecBase(specEntry, project, pc),
|
||||||
m_workPath(project.getProjectWorkingPath(), _S("MP2")),
|
m_workPath(project.getProjectWorkingPath(), _S("MP2")),
|
||||||
m_cookPath(project.getProjectCookedPath(SpecEntMP2), _S("MP2")),
|
m_cookPath(project.getProjectCookedPath(SpecEntMP2), _S("MP2")),
|
||||||
m_pakRouter(*this, m_workPath, m_cookPath) {}
|
m_pakRouter(*this, m_workPath, m_cookPath) {}
|
||||||
|
@ -307,7 +307,7 @@ hecl::Database::DataSpecEntry SpecEntMP2
|
||||||
_S("MP2"),
|
_S("MP2"),
|
||||||
_S("Data specification for original Metroid Prime 2 engine"),
|
_S("Data specification for original Metroid Prime 2 engine"),
|
||||||
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
||||||
-> hecl::Database::IDataSpec* {return new struct SpecMP2(project, false);}
|
-> hecl::Database::IDataSpec* {return new struct SpecMP2(&SpecEntMP2, project, false);}
|
||||||
);
|
);
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP2PC =
|
hecl::Database::DataSpecEntry SpecEntMP2PC =
|
||||||
|
@ -318,7 +318,7 @@ hecl::Database::DataSpecEntry SpecEntMP2PC =
|
||||||
-> hecl::Database::IDataSpec*
|
-> hecl::Database::IDataSpec*
|
||||||
{
|
{
|
||||||
if (tool != hecl::Database::DataSpecTool::Extract)
|
if (tool != hecl::Database::DataSpecTool::Extract)
|
||||||
return new struct SpecMP2(project, true);
|
return new struct SpecMP2(&SpecEntMP2PC, project, true);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,8 +42,8 @@ struct SpecMP3 : SpecBase
|
||||||
hecl::ProjectPath m_feCookPath;
|
hecl::ProjectPath m_feCookPath;
|
||||||
PAKRouter<DNAMP3::PAKBridge> m_fePakRouter;
|
PAKRouter<DNAMP3::PAKBridge> m_fePakRouter;
|
||||||
|
|
||||||
SpecMP3(hecl::Database::Project& project, bool pc)
|
SpecMP3(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
|
||||||
: SpecBase(project, pc),
|
: SpecBase(specEntry, project, pc),
|
||||||
m_workPath(project.getProjectWorkingPath(), _S("MP3")),
|
m_workPath(project.getProjectWorkingPath(), _S("MP3")),
|
||||||
m_cookPath(project.getProjectCookedPath(SpecEntMP3), _S("MP3")),
|
m_cookPath(project.getProjectCookedPath(SpecEntMP3), _S("MP3")),
|
||||||
m_pakRouter(*this, m_workPath, m_cookPath),
|
m_pakRouter(*this, m_workPath, m_cookPath),
|
||||||
|
@ -491,7 +491,7 @@ hecl::Database::DataSpecEntry SpecEntMP3
|
||||||
_S("MP3"),
|
_S("MP3"),
|
||||||
_S("Data specification for original Metroid Prime 3 engine"),
|
_S("Data specification for original Metroid Prime 3 engine"),
|
||||||
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
||||||
-> hecl::Database::IDataSpec* {return new struct SpecMP3(project, false);}
|
-> hecl::Database::IDataSpec* {return new struct SpecMP3(&SpecEntMP3, project, false);}
|
||||||
);
|
);
|
||||||
|
|
||||||
hecl::Database::DataSpecEntry SpecEntMP3PC =
|
hecl::Database::DataSpecEntry SpecEntMP3PC =
|
||||||
|
@ -502,7 +502,7 @@ hecl::Database::DataSpecEntry SpecEntMP3PC =
|
||||||
-> hecl::Database::IDataSpec*
|
-> hecl::Database::IDataSpec*
|
||||||
{
|
{
|
||||||
if (tool != hecl::Database::DataSpecTool::Extract)
|
if (tool != hecl::Database::DataSpecTool::Extract)
|
||||||
return new struct SpecMP3(project, true);
|
return new struct SpecMP3(&SpecEntMP3PC, project, true);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -244,12 +244,9 @@ void ProjectResourceFactoryBase::BackgroundIndexProc()
|
||||||
|
|
||||||
void ProjectResourceFactoryBase::CancelBackgroundIndex()
|
void ProjectResourceFactoryBase::CancelBackgroundIndex()
|
||||||
{
|
{
|
||||||
if (m_backgroundRunning)
|
m_backgroundRunning = false;
|
||||||
{
|
if (m_backgroundIndexTh.joinable())
|
||||||
m_backgroundRunning = false;
|
m_backgroundIndexTh.join();
|
||||||
if (m_backgroundIndexTh.joinable())
|
|
||||||
m_backgroundIndexTh.join();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectResourceFactoryBase::BeginBackgroundIndex
|
void ProjectResourceFactoryBase::BeginBackgroundIndex
|
||||||
|
@ -273,7 +270,7 @@ hecl::ProjectPath ProjectResourceFactoryBase::GetCookedPath(const hecl::ProjectP
|
||||||
{
|
{
|
||||||
const hecl::Database::DataSpecEntry* spec = m_origSpec;
|
const hecl::Database::DataSpecEntry* spec = m_origSpec;
|
||||||
if (pcTarget)
|
if (pcTarget)
|
||||||
spec = m_cookSpec->overrideDataSpec(working, m_pcSpec);
|
spec = m_cookSpec->overrideDataSpec(working, m_pcSpec, hecl::SharedBlenderToken);
|
||||||
if (!spec)
|
if (!spec)
|
||||||
return {};
|
return {};
|
||||||
return working.getCookedPath(*spec);
|
return working.getCookedPath(*spec);
|
||||||
|
@ -281,7 +278,7 @@ hecl::ProjectPath ProjectResourceFactoryBase::GetCookedPath(const hecl::ProjectP
|
||||||
|
|
||||||
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working)
|
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working)
|
||||||
{
|
{
|
||||||
return m_clientProc.syncCook(working) == 0;
|
return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::SharedBlenderToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn ProjectResourceFactoryBase::SyncMakeObject(const SObjectTag& tag,
|
CFactoryFnReturn ProjectResourceFactoryBase::SyncMakeObject(const SObjectTag& tag,
|
||||||
|
@ -348,7 +345,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const hecl::ProjectPath&
|
||||||
m_cookedPath.getModtime() < path.getModtime())
|
m_cookedPath.getModtime() < path.getModtime())
|
||||||
{
|
{
|
||||||
/* Start a background cook here */
|
/* Start a background cook here */
|
||||||
m_cookTransaction = m_parent.m_clientProc.addCookTransaction(path);
|
m_cookTransaction = m_parent.m_clientProc.addCookTransaction(path, m_parent.m_cookSpec.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ public:
|
||||||
|
|
||||||
void AsyncIdle();
|
void AsyncIdle();
|
||||||
void Shutdown() {CancelBackgroundIndex();}
|
void Shutdown() {CancelBackgroundIndex();}
|
||||||
|
|
||||||
|
~ProjectResourceFactoryBase() {Shutdown();}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class IObj;
|
||||||
class IFactory
|
class IFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IFactory() {}
|
virtual ~IFactory() = default;
|
||||||
virtual std::unique_ptr<IObj> Build(const SObjectTag&, const CVParamTransfer&)=0;
|
virtual std::unique_ptr<IObj> Build(const SObjectTag&, const CVParamTransfer&)=0;
|
||||||
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)=0;
|
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)=0;
|
||||||
virtual void CancelBuild(const SObjectTag&)=0;
|
virtual void CancelBuild(const SObjectTag&)=0;
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 1a1b41c6c491322427927939beb69a45d56b8bac
|
Subproject commit fe207bf42c08164a83420e8ed82ad7f009972307
|
Loading…
Reference in New Issue