2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

EVNT extraction fix

This commit is contained in:
Jack Andersen
2018-10-27 15:22:55 -10:00
parent 427f5d8786
commit 3147b49b3d
9 changed files with 49 additions and 37 deletions

View File

@@ -266,6 +266,9 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
os.format("actor_action = actor_data.actions.add()\n"
"actor_action.name = '%s'\n", id.second.name.c_str());
/* Extract EVNT if present */
anim.extractEVNT(id.second, outPath, pakRouter, force);
}
}
conn.saveBlend();

View File

@@ -1115,31 +1115,6 @@ bool ANCS::Extract(const SpecBase& dataSpec,
}
}
/* Extract EVNTs */
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animRes;
ancs.getAnimationResInfo(&pakRouter, animRes);
for (const auto& res : animRes)
{
if (res.second.evntId)
{
hecl::SystemStringConv sysStr(res.second.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() +
_SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None)
{
EVNT evnt;
if (pakRouter.lookupAndReadDNA(res.second.evntId, evnt, true))
{
athena::io::FileWriter writer(evntYamlPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
}
}
}
}
return true;
}

View File

@@ -4,6 +4,8 @@
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
#include "EVNT.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
namespace DataSpec::DNAMP1
{
@@ -208,6 +210,29 @@ struct ANIM : BigDNA
return m_anim->looping;
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID32>& animInfo,
const hecl::ProjectPath& outPath, PAKRouter<PAKBridge>& pakRouter, bool force) const
{
if (m_anim->evnt)
{
hecl::SystemStringConv sysStr(animInfo.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() +
_SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None)
{
EVNT evnt;
if (pakRouter.lookupAndReadDNA(m_anim->evnt, evnt, true))
{
athena::io::FileWriter writer(evntYamlPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
}
}
}
}
using BlenderAction = hecl::blender::Action;
ANIM() = default;

View File

@@ -4,6 +4,7 @@
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
namespace DataSpec::DNAMP2
{
@@ -185,6 +186,9 @@ struct ANIM : BigDNA
m_anim->sendANIMToBlender(os, rig);
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID32>& animInfo,
const hecl::ProjectPath& outPath, PAKRouter<PAKBridge>& pakRouter, bool force) const {}
};
}

View File

@@ -4,6 +4,7 @@
#include "DataSpec/DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
namespace DataSpec::DNAMP3
{
@@ -90,6 +91,9 @@ struct ANIM : BigDNA
m_anim->sendANIMToBlender(os, rig, additive);
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID64>& animInfo,
const hecl::ProjectPath& outPath, PAKRouter<PAKBridge>& pakRouter, bool force) const {}
};
}