mirror of https://github.com/AxioDL/metaforce.git
EVNT extraction fix
This commit is contained in:
parent
427f5d8786
commit
3147b49b3d
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ static bool IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa
|
|||
zeus::CVector3f& intersect)
|
||||
{
|
||||
float det = (pa1.x - pa2.x) * (pb1.y - pb2.y) - (pa1.y - pa2.y) * (pb1.x - pb2.x);
|
||||
if (std::fabs(det) < 0.01f)
|
||||
if (std::fabs(det) < 0.000001f)
|
||||
return false;
|
||||
float c0 = pa1.x * pa2.y - pa1.y * pa2.x;
|
||||
float c1 = pb1.x * pb2.y - pb1.y * pb2.x;
|
||||
|
@ -184,13 +184,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
|
||||
m_lastPos.toVec2f() + dvb, projPt.toVec2f() + dvb, intersect1);
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good1 = false;
|
||||
|
||||
zeus::CVector3f intersect2;
|
||||
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
|
||||
m_lastPos.toVec2f() - dvb, projPt.toVec2f() - dvb, intersect2);
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good2 = false;
|
||||
|
||||
if (good1 && good2)
|
||||
|
@ -231,13 +231,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
|
||||
m_lastPos.toVec2f() + dvb, projPt.toVec2f() + dvb, intersect1);
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good1 = false;
|
||||
|
||||
zeus::CVector3f intersect2;
|
||||
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
|
||||
m_lastPos.toVec2f() - dvb, projPt.toVec2f() - dvb, intersect2);
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good2 = false;
|
||||
|
||||
if (good1 && good2)
|
||||
|
@ -307,13 +307,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
|
||||
m_lastPos.toVec2f() + dvb, m_firstPos.toVec2f() + dvb, intersect1);
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good1 = false;
|
||||
|
||||
zeus::CVector3f intersect2;
|
||||
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
|
||||
m_lastPos.toVec2f() - dvb, m_firstPos.toVec2f() - dvb, intersect2);
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
|
||||
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
|
||||
good2 = false;
|
||||
|
||||
if (m_textured)
|
||||
|
@ -367,13 +367,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
|
|||
zeus::CVector3f intersect1;
|
||||
bool good1 = IntersectLines(m_lastPos.toVec2f() + dva, m_firstPos.toVec2f() + dva,
|
||||
m_firstPos.toVec2f() + dvb, m_secondPos.toVec2f() + dvb, intersect1);
|
||||
if ((intersect1.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 4.f)
|
||||
if ((intersect1.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 2.f)
|
||||
good1 = false;
|
||||
|
||||
zeus::CVector3f intersect2;
|
||||
bool good2 = IntersectLines(m_lastPos.toVec2f() - dva, m_firstPos.toVec2f() - dva,
|
||||
m_firstPos.toVec2f() - dvb, m_secondPos.toVec2f() - dvb, intersect2);
|
||||
if ((intersect2.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 4.f)
|
||||
if ((intersect2.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 2.f)
|
||||
good2 = false;
|
||||
|
||||
if (m_textured)
|
||||
|
|
|
@ -575,7 +575,7 @@ float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatri
|
|||
void CActor::EnsureRendered(const CStateManager& mgr) const
|
||||
{
|
||||
zeus::CAABox aabb = GetSortingBounds(mgr);
|
||||
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.origin), aabb);
|
||||
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]), aabb);
|
||||
}
|
||||
|
||||
void CActor::EnsureRendered(const CStateManager& stateMgr, const zeus::CVector3f& pos,
|
||||
|
|
|
@ -31,7 +31,6 @@ void CScriptActorKeyframe::Accept(IVisitor& visitor)
|
|||
|
||||
void CScriptActorKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
|
||||
if (msg == EScriptObjectMessage::Action)
|
||||
{
|
||||
if (GetActive())
|
||||
|
|
|
@ -52,9 +52,11 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
|
|||
CActor::SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
|
||||
CMaterialList(EMaterialTypes::Solid),
|
||||
CMaterialList(EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision, EMaterialTypes::Platform)));
|
||||
xf8_24_movable = false;
|
||||
if (HasModelData() && ModelData()->HasAnimData())
|
||||
ModelData()->AnimationData()->EnableLooping(true);
|
||||
if (x304_treeGroupContainer)
|
||||
x314_treeGroup = std::make_unique<CCollidableOBBTreeGroup>(x304_treeGroupContainer->GetObj(), x68_material);
|
||||
|
||||
}
|
||||
|
||||
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
|
Loading…
Reference in New Issue