2015-08-08 04:49:42 +00:00
|
|
|
#ifndef _DNAMP1_ANCS_HPP_
|
|
|
|
#define _DNAMP1_ANCS_HPP_
|
|
|
|
|
2015-08-13 07:29:00 +00:00
|
|
|
#include <map>
|
2015-08-08 04:49:42 +00:00
|
|
|
#include "../DNACommon/DNACommon.hpp"
|
2015-08-11 23:32:02 +00:00
|
|
|
#include "../DNACommon/ANCS.hpp"
|
|
|
|
#include "CMDLMaterials.hpp"
|
|
|
|
#include "BlenderConnection.hpp"
|
2015-08-13 07:29:00 +00:00
|
|
|
#include "CINF.hpp"
|
|
|
|
#include "CSKR.hpp"
|
|
|
|
#include "ANIM.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "athena/FileReader.hpp"
|
2015-08-08 04:49:42 +00:00
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace DataSpec
|
2015-08-08 04:49:42 +00:00
|
|
|
{
|
|
|
|
namespace DNAMP1
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ANCS : BigYAML
|
|
|
|
{
|
2015-08-13 07:29:00 +00:00
|
|
|
using CINFType = CINF;
|
|
|
|
using CSKRType = CSKR;
|
|
|
|
using ANIMType = ANIM;
|
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
ANCS(const UniqueID32& ancsId) : animationSet(ancsId) {}
|
|
|
|
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
Value<atUint16> version;
|
|
|
|
|
|
|
|
struct CharacterSet : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint16> version;
|
|
|
|
Value<atUint32> characterCount;
|
|
|
|
struct CharacterInfo : BigYAML
|
2016-04-06 01:44:07 +00:00
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
|
|
|
|
|
|
|
atUint32 idx;
|
|
|
|
std::string name;
|
|
|
|
UniqueID32 cmdl;
|
2016-04-06 01:44:07 +00:00
|
|
|
AuxiliaryID32 cskr = _S("skin");
|
|
|
|
AuxiliaryID32 cinf = {_S("layout"), _S(".blend")};
|
2015-08-08 04:49:42 +00:00
|
|
|
|
|
|
|
struct Animation : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint32> animIdx;
|
|
|
|
String<-1> strA;
|
|
|
|
String<-1> strB;
|
|
|
|
};
|
|
|
|
std::vector<Animation> animations;
|
|
|
|
|
|
|
|
struct PASDatabase : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint32> magic;
|
|
|
|
Value<atUint32> animStateCount;
|
|
|
|
Value<atUint32> defaultState;
|
|
|
|
struct AnimState : BigYAML
|
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
|
|
|
atUint32 id;
|
|
|
|
|
|
|
|
struct ParmInfo : BigYAML
|
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class DataType
|
2015-08-08 04:49:42 +00:00
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
Int32 = 0,
|
|
|
|
UInt32 = 1,
|
|
|
|
Float = 2,
|
|
|
|
Bool = 3,
|
|
|
|
Enum = 4
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
union Parm
|
|
|
|
{
|
|
|
|
atInt32 int32;
|
|
|
|
atUint32 uint32;
|
|
|
|
float float32;
|
|
|
|
bool bool1;
|
|
|
|
Parm() : int32(0) {}
|
|
|
|
Parm(atInt32 val) : int32(val) {}
|
|
|
|
Parm(atUint32 val) : uint32(val) {}
|
|
|
|
Parm(float val) : float32(val) {}
|
|
|
|
Parm(bool val) : bool1(val) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
atUint32 parmType;
|
|
|
|
atUint32 unk1;
|
|
|
|
float unk2;
|
|
|
|
Parm parmVals[2];
|
|
|
|
};
|
|
|
|
std::vector<ParmInfo> parmInfos;
|
|
|
|
|
|
|
|
struct AnimInfo
|
|
|
|
{
|
|
|
|
atUint32 id;
|
|
|
|
std::vector<ParmInfo::Parm> parmVals;
|
|
|
|
};
|
|
|
|
std::vector<AnimInfo> animInfos;
|
|
|
|
};
|
2015-08-08 23:24:17 +00:00
|
|
|
Vector<AnimState, DNA_COUNT(animStateCount)> animStates;
|
2015-08-08 04:49:42 +00:00
|
|
|
} pasDatabase;
|
|
|
|
|
|
|
|
struct ParticleResData
|
|
|
|
{
|
|
|
|
std::vector<UniqueID32> part;
|
|
|
|
std::vector<UniqueID32> swhc;
|
|
|
|
std::vector<UniqueID32> unk;
|
|
|
|
std::vector<UniqueID32> elsc;
|
|
|
|
} partResData;
|
|
|
|
|
2015-08-08 23:24:17 +00:00
|
|
|
atUint32 unk1 = 0;
|
2015-08-08 04:49:42 +00:00
|
|
|
|
|
|
|
struct ActionAABB : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
String<-1> name;
|
|
|
|
Value<atVec3f> aabb[2];
|
|
|
|
};
|
|
|
|
std::vector<ActionAABB> animAABBs;
|
|
|
|
|
|
|
|
struct Effect : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
String<-1> name;
|
|
|
|
Value<atUint32> compCount;
|
|
|
|
struct EffectComponent : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
String<-1> name;
|
2015-08-23 06:42:29 +00:00
|
|
|
DNAFourCC type;
|
2015-08-08 04:49:42 +00:00
|
|
|
UniqueID32 id;
|
|
|
|
String<-1> name2;
|
|
|
|
Value<float> unk1;
|
|
|
|
Value<atUint32> unk2;
|
|
|
|
Value<atUint32> unk3;
|
|
|
|
};
|
|
|
|
Vector<EffectComponent, DNA_COUNT(compCount)> comps;
|
|
|
|
};
|
|
|
|
std::vector<Effect> effects;
|
|
|
|
|
2015-09-26 03:12:08 +00:00
|
|
|
UniqueID32 cmdlOverlay;
|
2016-04-06 01:44:07 +00:00
|
|
|
AuxiliaryID32 cskrOverlay = _S("skin");
|
2015-08-08 04:49:42 +00:00
|
|
|
|
|
|
|
std::vector<atUint32> animIdxs;
|
|
|
|
};
|
2015-08-08 23:24:17 +00:00
|
|
|
Vector<CharacterInfo, DNA_COUNT(characterCount)> characters;
|
2015-08-08 04:49:42 +00:00
|
|
|
} characterSet;
|
|
|
|
|
|
|
|
struct AnimationSet : BigYAML
|
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
2016-04-06 01:44:07 +00:00
|
|
|
const UniqueID32& m_ancsId;
|
|
|
|
AnimationSet(const UniqueID32& ancsId)
|
|
|
|
: m_ancsId(ancsId), defaultTransition(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
|
|
|
|
struct IMetaAnim : BigYAML
|
|
|
|
{
|
|
|
|
Delete expl;
|
2015-09-29 21:50:47 +00:00
|
|
|
virtual ~IMetaAnim() {}
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class Type
|
2015-08-08 04:49:42 +00:00
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
Primitive = 0,
|
|
|
|
Blend = 1,
|
|
|
|
PhaseBlend = 2,
|
|
|
|
Random = 3,
|
|
|
|
Sequence = 4
|
2015-08-08 04:49:42 +00:00
|
|
|
} m_type;
|
|
|
|
const char* m_typeStr;
|
2016-04-06 01:44:07 +00:00
|
|
|
const UniqueID32& m_ancsId;
|
|
|
|
IMetaAnim(Type type, const char* typeStr, const UniqueID32& ancsId)
|
|
|
|
: m_type(type), m_typeStr(typeStr), m_ancsId(ancsId) {}
|
2015-09-29 02:00:28 +00:00
|
|
|
virtual void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)=0;
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimFactory : BigYAML
|
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
2016-04-06 01:44:07 +00:00
|
|
|
const UniqueID32& m_ancsId;
|
2015-08-08 04:49:42 +00:00
|
|
|
std::unique_ptr<IMetaAnim> m_anim;
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimFactory(const UniqueID32& ancsId) : m_ancsId(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimPrimitive : IMetaAnim
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimPrimitive(const UniqueID32& ancsId) : IMetaAnim(Type::Primitive, "Primitive", ancsId) {}
|
|
|
|
|
|
|
|
Delete _d;
|
2015-08-08 04:49:42 +00:00
|
|
|
UniqueID32 animId;
|
|
|
|
Value<atUint32> animIdx;
|
|
|
|
String<-1> animName;
|
|
|
|
Value<float> unk1;
|
|
|
|
Value<atUint32> unk2;
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
void read(athena::io::IStreamReader& __dna_reader)
|
|
|
|
{
|
|
|
|
/* animId */
|
|
|
|
animId.read(__dna_reader);
|
|
|
|
/* animIdx */
|
|
|
|
animIdx = __dna_reader.readUint32Big();
|
|
|
|
/* animName */
|
|
|
|
animName = __dna_reader.readString(-1);
|
|
|
|
/* unk1 */
|
|
|
|
unk1 = __dna_reader.readFloatBig();
|
|
|
|
/* unk2 */
|
|
|
|
unk2 = __dna_reader.readUint32Big();
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::IStreamWriter& __dna_writer) const
|
|
|
|
{
|
|
|
|
/* animId */
|
|
|
|
animId.write(__dna_writer);
|
|
|
|
/* animIdx */
|
|
|
|
__dna_writer.writeUint32Big(animIdx);
|
|
|
|
/* animName */
|
|
|
|
__dna_writer.writeString(animName, -1);
|
|
|
|
/* unk1 */
|
|
|
|
__dna_writer.writeFloatBig(unk1);
|
|
|
|
/* unk2 */
|
|
|
|
__dna_writer.writeUint32Big(unk2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void read(athena::io::YAMLDocReader& __dna_docin)
|
|
|
|
{
|
|
|
|
/* animId */
|
|
|
|
__dna_docin.enumerate("animId", animId);
|
|
|
|
/* animIdx */
|
|
|
|
animIdx = __dna_docin.readUint32("animIdx");
|
|
|
|
/* animName */
|
|
|
|
animName = __dna_docin.readString("animName");
|
|
|
|
/* unk1 */
|
|
|
|
unk1 = __dna_docin.readFloat("unk1");
|
|
|
|
/* unk2 */
|
|
|
|
unk2 = __dna_docin.readUint32("unk2");
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
|
|
|
{
|
|
|
|
/* animId */
|
|
|
|
DNAANCS::WriteOutAnimId(__dna_docout, m_ancsId, animName);
|
|
|
|
/* animIdx */
|
|
|
|
__dna_docout.writeUint32("animIdx", animIdx);
|
|
|
|
/* animName */
|
|
|
|
__dna_docout.writeString("animName", animName);
|
|
|
|
/* unk1 */
|
|
|
|
__dna_docout.writeFloat("unk1", unk1);
|
|
|
|
/* unk2 */
|
|
|
|
__dna_docout.writeUint32("unk2", unk2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char* DNAType()
|
|
|
|
{
|
|
|
|
return "DataSpec::DNAMP1::ANCS::AnimationSet::MetaAnimPrimitive";
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz = animId.binarySize(__isz);
|
|
|
|
__isz += animName.size() + 1;
|
|
|
|
return __isz + 12;
|
|
|
|
}
|
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
2015-10-27 00:32:12 +00:00
|
|
|
out[animIdx] = {animName, animId, UniqueID32(), false};
|
2015-08-11 23:32:02 +00:00
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimBlend : IMetaAnim
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimBlend(const UniqueID32& ancsId)
|
|
|
|
: IMetaAnim(Type::Blend, "Blend", ancsId), animA(ancsId), animB(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
MetaAnimFactory animA;
|
|
|
|
MetaAnimFactory animB;
|
|
|
|
Value<float> unkFloat;
|
|
|
|
Value<atUint8> unk;
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
animA.m_anim->gatherPrimitives(out);
|
|
|
|
animB.m_anim->gatherPrimitives(out);
|
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimPhaseBlend : IMetaAnim
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimPhaseBlend(const UniqueID32& ancsId)
|
|
|
|
: IMetaAnim(Type::PhaseBlend, "PhaseBlend", ancsId), animA(ancsId), animB(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
MetaAnimFactory animA;
|
|
|
|
MetaAnimFactory animB;
|
|
|
|
Value<float> unkFloat;
|
|
|
|
Value<atUint8> unk;
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
animA.m_anim->gatherPrimitives(out);
|
|
|
|
animB.m_anim->gatherPrimitives(out);
|
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimRandom : IMetaAnim
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimRandom(const UniqueID32& ancsId) : IMetaAnim(Type::Random, "Random", ancsId) {}
|
|
|
|
Delete _d;
|
2015-08-08 04:49:42 +00:00
|
|
|
Value<atUint32> animCount;
|
|
|
|
struct Child : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
MetaAnimFactory anim;
|
|
|
|
Value<atUint32> probability;
|
2016-04-06 01:44:07 +00:00
|
|
|
Child(const UniqueID32& ancsId) : anim(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
Vector<Child, DNA_COUNT(animCount)> children;
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
void read(athena::io::IStreamReader& __dna_reader)
|
|
|
|
{
|
|
|
|
/* animCount */
|
|
|
|
animCount = __dna_reader.readUint32Big();
|
|
|
|
/* children */
|
|
|
|
children.clear();
|
|
|
|
children.reserve(animCount);
|
|
|
|
for (size_t i=0 ; i<animCount ; ++i)
|
|
|
|
{
|
|
|
|
children.emplace_back(m_ancsId);
|
|
|
|
children.back().read(__dna_reader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::IStreamWriter& __dna_writer) const
|
|
|
|
{
|
|
|
|
/* animCount */
|
|
|
|
__dna_writer.writeUint32Big(animCount);
|
|
|
|
/* children */
|
|
|
|
__dna_writer.enumerate(children);
|
|
|
|
}
|
|
|
|
|
|
|
|
void read(athena::io::YAMLDocReader& __dna_docin)
|
|
|
|
{
|
|
|
|
/* animCount squelched */
|
|
|
|
/* children */
|
|
|
|
size_t childCount;
|
|
|
|
__dna_docin.enterSubVector("children", childCount);
|
|
|
|
animCount = childCount;
|
|
|
|
children.clear();
|
|
|
|
children.reserve(childCount);
|
|
|
|
for (size_t i=0 ; i<childCount ; ++i)
|
|
|
|
{
|
|
|
|
children.emplace_back(m_ancsId);
|
|
|
|
__dna_docin.enterSubRecord(nullptr);
|
|
|
|
children.back().read(__dna_docin);
|
|
|
|
__dna_docin.leaveSubRecord();
|
|
|
|
}
|
|
|
|
__dna_docin.leaveSubVector();
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
|
|
|
{
|
|
|
|
/* animCount squelched */
|
|
|
|
/* children */
|
|
|
|
__dna_docout.enumerate("children", children);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char* DNAType()
|
|
|
|
{
|
|
|
|
return "DataSpec::DNAMP1::ANCS::AnimationSet::MetaAnimRandom";
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz = __EnumerateSize(__isz, children);
|
|
|
|
return __isz + 4;
|
|
|
|
}
|
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
for (const auto& child : children)
|
|
|
|
child.anim.m_anim->gatherPrimitives(out);
|
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaAnimSequence : IMetaAnim
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaAnimSequence(const UniqueID32& ancsId) : IMetaAnim(Type::Sequence, "Sequence", ancsId) {}
|
|
|
|
Delete _d;
|
2015-08-08 04:49:42 +00:00
|
|
|
Value<atUint32> animCount;
|
|
|
|
Vector<MetaAnimFactory, DNA_COUNT(animCount)> children;
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
void read(athena::io::IStreamReader& __dna_reader)
|
|
|
|
{
|
|
|
|
/* animCount */
|
|
|
|
animCount = __dna_reader.readUint32Big();
|
|
|
|
/* children */
|
|
|
|
children.clear();
|
|
|
|
children.reserve(animCount);
|
|
|
|
for (size_t i=0 ; i<animCount ; ++i)
|
|
|
|
{
|
|
|
|
children.emplace_back(m_ancsId);
|
|
|
|
children.back().read(__dna_reader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::IStreamWriter& __dna_writer) const
|
|
|
|
{
|
|
|
|
/* animCount */
|
|
|
|
__dna_writer.writeUint32Big(animCount);
|
|
|
|
/* children */
|
|
|
|
__dna_writer.enumerate(children);
|
|
|
|
}
|
|
|
|
|
|
|
|
void read(athena::io::YAMLDocReader& __dna_docin)
|
|
|
|
{
|
|
|
|
/* animCount squelched */
|
|
|
|
/* children */
|
|
|
|
size_t childCount;
|
|
|
|
__dna_docin.enterSubVector("children", childCount);
|
|
|
|
animCount = childCount;
|
|
|
|
children.clear();
|
|
|
|
children.reserve(childCount);
|
|
|
|
for (size_t i=0 ; i<childCount ; ++i)
|
|
|
|
{
|
|
|
|
children.emplace_back(m_ancsId);
|
|
|
|
__dna_docin.enterSubRecord(nullptr);
|
|
|
|
children.back().read(__dna_docin);
|
|
|
|
__dna_docin.leaveSubRecord();
|
|
|
|
}
|
|
|
|
__dna_docin.leaveSubVector();
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
|
|
|
{
|
|
|
|
/* animCount squelched */
|
|
|
|
/* children */
|
|
|
|
__dna_docout.enumerate("children", children);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char* DNAType()
|
|
|
|
{
|
|
|
|
return "DataSpec::DNAMP1::ANCS::AnimationSet::MetaAnimSequence";
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz = __EnumerateSize(__isz, children);
|
|
|
|
return __isz + 4;
|
|
|
|
}
|
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
for (const auto& child : children)
|
|
|
|
child.m_anim->gatherPrimitives(out);
|
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Animation : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
String<-1> name;
|
|
|
|
MetaAnimFactory metaAnim;
|
2016-04-06 01:44:07 +00:00
|
|
|
Animation(const UniqueID32& ancsId) : metaAnim(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
std::vector<Animation> animations;
|
|
|
|
|
|
|
|
struct IMetaTrans : BigYAML
|
|
|
|
{
|
|
|
|
Delete expl;
|
2015-09-29 21:50:47 +00:00
|
|
|
virtual ~IMetaTrans() {}
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class Type
|
2015-08-08 04:49:42 +00:00
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
MetaAnim = 0,
|
|
|
|
Trans = 1,
|
|
|
|
PhaseTrans = 2,
|
|
|
|
NoTrans = 3,
|
2015-08-08 04:49:42 +00:00
|
|
|
} m_type;
|
|
|
|
const char* m_typeStr;
|
2016-04-06 01:44:07 +00:00
|
|
|
const UniqueID32& m_ancsId;
|
|
|
|
IMetaTrans(Type type, const char* typeStr, const UniqueID32& ancsId)
|
|
|
|
: m_type(type), m_typeStr(typeStr), m_ancsId(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaTransFactory : BigYAML
|
|
|
|
{
|
2015-08-08 23:24:17 +00:00
|
|
|
DECL_YAML
|
2015-08-08 04:49:42 +00:00
|
|
|
Delete expl;
|
2016-04-06 01:44:07 +00:00
|
|
|
const UniqueID32& m_ancsId;
|
2015-08-08 04:49:42 +00:00
|
|
|
std::unique_ptr<IMetaTrans> m_trans;
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaTransFactory(const UniqueID32& ancsId) : m_ancsId(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
struct MetaTransMetaAnim : IMetaTrans
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaTransMetaAnim(const UniqueID32& ancsId)
|
|
|
|
: IMetaTrans(Type::MetaAnim, "MetaAnim", ancsId), anim(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
MetaAnimFactory anim;
|
|
|
|
};
|
|
|
|
struct MetaTransTrans : IMetaTrans
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaTransTrans(const UniqueID32& ancsId)
|
|
|
|
: IMetaTrans(Type::Trans, "Trans", ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
Value<float> time;
|
|
|
|
Value<atUint32> unk1;
|
|
|
|
Value<atUint8> unk2;
|
|
|
|
Value<atUint8> unk3;
|
|
|
|
Value<atUint32> unk4;
|
|
|
|
};
|
|
|
|
struct MetaTransPhaseTrans : IMetaTrans
|
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
MetaTransPhaseTrans(const UniqueID32& ancsId)
|
|
|
|
: IMetaTrans(Type::PhaseTrans, "PhaseTrans", ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
DECL_YAML
|
|
|
|
Value<float> time;
|
|
|
|
Value<atUint32> unk1;
|
|
|
|
Value<atUint8> unk2;
|
|
|
|
Value<atUint8> unk3;
|
|
|
|
Value<atUint32> unk4;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Transition : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint32> unk;
|
|
|
|
Value<atUint32> animIdxA;
|
|
|
|
Value<atUint32> animIdxB;
|
|
|
|
MetaTransFactory metaTrans;
|
2016-04-06 01:44:07 +00:00
|
|
|
Transition(const UniqueID32& ancsId) : metaTrans(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
std::vector<Transition> transitions;
|
2015-08-08 23:24:17 +00:00
|
|
|
MetaTransFactory defaultTransition;
|
2015-08-08 04:49:42 +00:00
|
|
|
|
|
|
|
struct AdditiveAnimationInfo : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint32> animIdx;
|
|
|
|
Value<float> unk1;
|
|
|
|
Value<float> unk2;
|
|
|
|
};
|
|
|
|
std::vector<AdditiveAnimationInfo> additiveAnims;
|
|
|
|
|
|
|
|
float floatA = 0.0;
|
|
|
|
float floatB = 0.0;
|
|
|
|
|
|
|
|
struct HalfTransition : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
Value<atUint32> animIdx;
|
|
|
|
MetaTransFactory metaTrans;
|
2016-04-06 01:44:07 +00:00
|
|
|
HalfTransition(const UniqueID32& ancsId) : metaTrans(ancsId) {}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
std::vector<HalfTransition> halfTransitions;
|
|
|
|
|
|
|
|
struct AnimationResources : BigYAML
|
|
|
|
{
|
|
|
|
DECL_YAML
|
|
|
|
UniqueID32 animId;
|
|
|
|
UniqueID32 evntId;
|
|
|
|
};
|
2015-08-08 04:58:50 +00:00
|
|
|
std::vector<AnimationResources> animResources;
|
2015-08-08 04:49:42 +00:00
|
|
|
} animationSet;
|
2015-08-08 23:24:17 +00:00
|
|
|
|
2015-08-11 23:32:02 +00:00
|
|
|
void getCharacterResInfo(std::vector<DNAANCS::CharacterResInfo<UniqueID32>>& out) const
|
|
|
|
{
|
|
|
|
out.clear();
|
|
|
|
out.reserve(characterSet.characters.size());
|
|
|
|
for (const CharacterSet::CharacterInfo& ci : characterSet.characters)
|
|
|
|
{
|
|
|
|
out.emplace_back();
|
|
|
|
DNAANCS::CharacterResInfo<UniqueID32>& chOut = out.back();
|
|
|
|
chOut.name = ci.name;
|
|
|
|
chOut.cmdl = ci.cmdl;
|
|
|
|
chOut.cskr = ci.cskr;
|
|
|
|
chOut.cinf = ci.cinf;
|
2015-09-27 02:24:03 +00:00
|
|
|
|
|
|
|
if (ci.cmdlOverlay)
|
|
|
|
chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay));
|
2015-08-11 23:32:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void getAnimationResInfo(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) const
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
out.clear();
|
|
|
|
for (const AnimationSet::Animation& ai : animationSet.animations)
|
|
|
|
ai.metaAnim.m_anim->gatherPrimitives(out);
|
2015-10-27 00:32:12 +00:00
|
|
|
for (auto& anim : out)
|
|
|
|
{
|
|
|
|
for (const AnimationSet::AnimationResources& res : animationSet.animResources)
|
|
|
|
{
|
|
|
|
if (res.animId == anim.second.animId)
|
|
|
|
{
|
|
|
|
anim.second.evntId = res.evntId;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-11 23:32:02 +00:00
|
|
|
}
|
|
|
|
|
2016-04-06 01:44:07 +00:00
|
|
|
void fixupPaths(const UniqueID32& ancsId)
|
|
|
|
{
|
|
|
|
for (CharacterSet::CharacterInfo& character : characterSet.characters)
|
|
|
|
{
|
|
|
|
character.cskr = character.cmdl;
|
|
|
|
character.cinf = ancsId;
|
|
|
|
character.cskrOverlay = character.cmdlOverlay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-06 21:44:57 +00:00
|
|
|
static bool Extract(const SpecBase& dataSpec,
|
2015-08-11 23:32:02 +00:00
|
|
|
PAKEntryReadStream& rs,
|
2016-03-04 23:04:53 +00:00
|
|
|
const hecl::ProjectPath& outPath,
|
2015-08-11 23:32:02 +00:00
|
|
|
PAKRouter<PAKBridge>& pakRouter,
|
|
|
|
const PAK::Entry& entry,
|
2015-09-03 01:45:15 +00:00
|
|
|
bool force,
|
2016-04-01 04:25:00 +00:00
|
|
|
hecl::BlenderToken& btok,
|
2016-03-04 23:04:53 +00:00
|
|
|
std::function<void(const hecl::SystemChar*)> fileChanged)
|
2015-08-08 23:24:17 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
|
|
|
|
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
|
|
|
|
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
|
|
|
|
hecl::ProjectPath::Type blendType = blendPath.getPathType();
|
2015-08-15 04:12:15 +00:00
|
|
|
|
|
|
|
if (force ||
|
2016-03-04 23:04:53 +00:00
|
|
|
yamlType == hecl::ProjectPath::Type::None ||
|
|
|
|
blendType == hecl::ProjectPath::Type::None)
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
2016-04-06 01:44:07 +00:00
|
|
|
ANCS ancs(entry.id);
|
2015-08-15 04:12:15 +00:00
|
|
|
ancs.read(rs);
|
2016-04-06 01:44:07 +00:00
|
|
|
ancs.fixupPaths(entry.id);
|
2015-08-15 04:12:15 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
if (force || yamlType == hecl::ProjectPath::Type::None)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
FILE* fp = hecl::Fopen(yamlPath.getAbsolutePath().c_str(), _S("wb"));
|
2015-08-15 04:12:15 +00:00
|
|
|
ancs.toYAMLFile(fp);
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
if (force || blendType == hecl::ProjectPath::Type::None)
|
2015-08-15 04:12:15 +00:00
|
|
|
{
|
2016-04-01 04:25:00 +00:00
|
|
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
2016-01-14 22:42:44 +00:00
|
|
|
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>
|
2015-09-06 21:44:57 +00:00
|
|
|
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
|
2015-08-15 04:12:15 +00:00
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2015-08-08 23:24:17 +00:00
|
|
|
}
|
2015-10-23 00:45:26 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
static bool Cook(const hecl::ProjectPath& outPath,
|
|
|
|
const hecl::ProjectPath& inPath,
|
2015-10-23 00:45:26 +00:00
|
|
|
const DNAANCS::Actor& actor)
|
|
|
|
{
|
2015-10-24 01:23:45 +00:00
|
|
|
/* Search for yaml */
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
|
|
|
|
if (yamlPath.getPathType() != hecl::ProjectPath::Type::File)
|
|
|
|
Log.report(logvisor::Fatal, _S("'%s' not found as file"),
|
2015-10-24 01:23:45 +00:00
|
|
|
yamlPath.getRelativePath().c_str());
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
athena::io::FileReader yamlReader(yamlPath.getAbsolutePath());
|
2015-10-24 01:23:45 +00:00
|
|
|
if (!BigYAML::ValidateFromYAMLFile<ANCS>(yamlReader))
|
2016-03-04 23:04:53 +00:00
|
|
|
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
|
2015-10-24 01:23:45 +00:00
|
|
|
yamlPath.getRelativePath().c_str());
|
2016-04-06 01:44:07 +00:00
|
|
|
ANCS ancs(UniqueID32::kInvalidId);
|
2015-10-24 01:23:45 +00:00
|
|
|
ancs.read(yamlReader);
|
|
|
|
|
|
|
|
|
2015-10-23 00:45:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-08-08 04:49:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _DNAMP1_ANCS_HPP_
|