metaforce/DataSpec/DNAMP2/CINF.hpp

63 lines
2.2 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-13 07:29:00 +00:00
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
2020-03-17 22:56:14 +00:00
#include "DNAMP2.hpp"
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAMP2 {
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
struct CINF : BigDNA {
AT_DECL_DNA
Value<atUint32> boneCount;
struct Bone : BigDNA {
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2018-12-08 05:30:43 +00:00
Value<atUint32> id;
Value<atUint32> parentId;
Value<atVec3f> origin;
Value<atVec4f> q1;
Value<atVec4f> q2;
Value<atUint32> linkedCount;
Vector<atUint32, AT_DNA_COUNT(linkedCount)> linked;
};
Vector<Bone, AT_DNA_COUNT(boneCount)> bones;
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
Value<atUint32> boneIdCount;
Vector<atUint32, AT_DNA_COUNT(boneIdCount)> boneIds;
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
Value<atUint32> nameCount;
struct Name : BigDNA {
AT_DECL_DNA
String<-1> name;
Value<atUint32> boneId;
};
Vector<Name, AT_DNA_COUNT(nameCount)> names;
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
atUint32 getInternalBoneIdxFromId(atUint32 id) const;
atUint32 getBoneIdxFromId(atUint32 id) const;
const std::string* getBoneNameFromId(atUint32 id) const;
void sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const;
2020-04-10 03:20:20 +00:00
template <class PAKBridge>
void sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKBridge::PAKType::IDType& cinfId) const;
template <class UniqueID>
static std::string GetCINFArmatureName(const UniqueID& cinfId);
2020-03-17 22:56:14 +00:00
CINF() = default;
using Armature = hecl::blender::Armature;
using BlenderBone = hecl::blender::Bone;
int RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap);
CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap);
2020-04-10 03:20:20 +00:00
template <class PAKBridge>
2020-03-17 22:56:14 +00:00
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
2020-04-10 03:20:20 +00:00
PAKRouter<PAKBridge>& pakRouter, const typename PAKBridge::PAKType::Entry& entry, bool force,
hecl::blender::Token& btok, std::function<void(const hecl::SystemChar*)> fileChanged);
2020-03-17 22:56:14 +00:00
static bool Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath,
const hecl::blender::Armature& armature);
2018-12-08 05:30:43 +00:00
};
2015-08-13 07:29:00 +00:00
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAMP2