#pragma once #include #include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/ANCS.hpp" #include "CMDLMaterials.hpp" #include "CINF.hpp" #include "CSKR.hpp" #include "ANIM.hpp" #include "../DNAMP1/ANCS.hpp" namespace DataSpec::DNAMP2 { struct ANCS : BigDNA { using CINFType = CINF; using CSKRType = CSKR; using ANIMType = ANIM; AT_DECL_DNA_YAML Value version; struct CharacterSet : BigDNA { AT_DECL_DNA_YAML Value version; Value characterCount; struct CharacterInfo : BigDNA { AT_DECL_EXPLICIT_DNA_YAML using MP1CharacterInfo = DNAMP1::ANCS::CharacterSet::CharacterInfo; atUint32 idx; std::string name; UniqueID32 cmdl; UniqueID32 cskr; UniqueID32 cinf; struct Animation : BigDNA { AT_DECL_DNA_YAML Value animIdx; String<-1> strA; }; std::vector animations; MP1CharacterInfo::PASDatabase pasDatabase; struct ParticleResData { std::vector part; std::vector swhc; std::vector unk; std::vector elsc; std::vector spsc; std::vector unk2; } partResData; atUint32 unk1 = 0; std::vector animAABBs; struct Effect : BigDNA { AT_DECL_DNA_YAML String<-1> name; Value compCount; struct EffectComponent : BigDNA { AT_DECL_DNA_YAML String<-1> name; DNAFourCC type; UniqueID32 id; Value unkMP2; Value unk1; Value unk2; Value unk3; }; Vector comps; }; std::vector effects; UniqueID32 cmdlIce; UniqueID32 cskrIce; std::vector animIdxs; atUint32 unk4; atUint8 unk5; struct Extents : BigDNA { AT_DECL_DNA_YAML Value animIdx; Value aabb[2]; }; std::vector extents; }; Vector characters; } characterSet; struct AnimationSet : BigDNA { AT_DECL_DNA_YAML Delete expl; using MP1AnimationSet = DNAMP1::ANCS::AnimationSet; std::vector animations; std::vector transitions; MP1AnimationSet::MetaTransFactory defaultTransition; std::vector additiveAnims; float floatA = 0.0; float floatB = 0.0; std::vector halfTransitions; struct EVNT : BigDNA { AT_DECL_EXPLICIT_DNA_YAML atUint32 version; struct EventBase : BigDNA { AT_DECL_DNA_YAML Value unk0; String<-1> name; Value type; Value startTime; Value unk1; Value idx; Value unk2; Value unk3; Value unk4; Value unk5; }; struct LoopEvent : EventBase { AT_DECL_DNA_YAML Value flag; }; Value loopEventCount; Vector loopEvents; struct UEVTEvent : EventBase { AT_DECL_DNA_YAML Value uevtType; String<-1> boneName; }; Value uevtEventCount; Vector uevtEvents; struct EffectEvent : EventBase { AT_DECL_DNA_YAML Value frameCount; DNAFourCC effectType; UniqueID32 effectId; Value boneId; Value scale; Value parentMode; }; Value effectEventCount; Vector effectEvents; struct SFXEvent : EventBase { AT_DECL_DNA_YAML Value soundId; Value smallNum; Value bigNum; Value sfxUnk1; Value sfxUnk2; Value sfxUnk3; Value sfxUnk4; }; Value sfxEventCount; Vector sfxEvents; }; std::vector evnts; } animationSet; void getCharacterResInfo(std::vector>& out) const { out.clear(); out.reserve(characterSet.characters.size()); for (const CharacterSet::CharacterInfo& ci : characterSet.characters) { out.emplace_back(); DNAANCS::CharacterResInfo& chOut = out.back(); chOut.name = ci.name; chOut.cmdl = ci.cmdl; chOut.cskr = ci.cskr; chOut.cinf = ci.cinf; if (ci.cmdlIce) chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce)); } } void getAnimationResInfo(PAKRouter* pakRouter, std::map>& out) const { out.clear(); for (const DNAMP1::ANCS::AnimationSet::Animation& ai : animationSet.animations) ai.metaAnim.m_anim->gatherPrimitives(nullptr, out); for (const DNAMP1::ANCS::AnimationSet::Transition& ti : animationSet.transitions) if (ti.metaTrans.m_trans) ti.metaTrans.m_trans->gatherPrimitives(nullptr, out); if (animationSet.defaultTransition.m_trans) animationSet.defaultTransition.m_trans->gatherPrimitives(nullptr, out); } static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath, PAKRouter& pakRouter, const DNAMP2::PAK::Entry& entry, bool force, hecl::blender::Token& btok, std::function fileChanged) { hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true); hecl::ProjectPath::Type yamlType = yamlPath.getPathType(); hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true); hecl::ProjectPath::Type blendType = blendPath.getPathType(); if (force || yamlType == hecl::ProjectPath::Type::None || blendType == hecl::ProjectPath::Type::None) { ANCS ancs; ancs.read(rs); if (force || yamlType == hecl::ProjectPath::Type::None) { athena::io::FileWriter writer(yamlPath.getAbsolutePath()); athena::io::ToYAMLStream(ancs, writer); } if (force || blendType == hecl::ProjectPath::Type::None) { hecl::blender::Connection& conn = btok.getBlenderConnection(); DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4>( conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force); } } return true; } }; } // namespace DataSpec::DNAMP2