Much better YAML-read for particles

This commit is contained in:
Jack Andersen 2016-02-02 13:41:55 -10:00
parent 009450ea79
commit 69d85afc23
3 changed files with 346 additions and 443 deletions

View File

@ -4,102 +4,77 @@ namespace Retro
{ {
namespace DNAParticle namespace DNAParticle
{ {
static LogVisor::LogModule Log("Retro::ParticleCommon ");
void RealElementFactory::read(Athena::io::YAMLDocReader& r) void RealElementFactory::read(Athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("LFTW")) const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{ {
m_elem.reset(new struct RELifetimeTween);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CNST"))
{
m_elem.reset(new struct REConstant);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CHAN"))
{
m_elem.reset(new struct RETimeChain);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("ADD_"))
{
m_elem.reset(new struct REAdd);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CLMP"))
{
m_elem.reset(new struct REClamp);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYE"))
{
m_elem.reset(new struct REKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("IRND"))
{
m_elem.reset(new struct REInitialRandom);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYP"))
{
m_elem.reset(new struct REKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("RAND"))
{
m_elem.reset(new struct RERandom);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("MULT"))
{
m_elem.reset(new struct REMultiply);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("PULS"))
{
m_elem.reset(new struct REPulse);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("SCAL"))
{
m_elem.reset(new struct RETimeScale);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("RLPT"))
{
m_elem.reset(new struct RELifetimePercent);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("SINE"))
{
m_elem.reset(new struct RESineWave);
m_elem->read(r);
r.leaveSubRecord();
}
else
m_elem.reset(); m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
Log.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('LFTW'):
m_elem.reset(new struct RELifetimeTween);
break;
case SBIG('CNST'):
m_elem.reset(new struct REConstant);
break;
case SBIG('CHAN'):
m_elem.reset(new struct RETimeChain);
break;
case SBIG('ADD_'):
m_elem.reset(new struct REAdd);
break;
case SBIG('CLMP'):
m_elem.reset(new struct REClamp);
break;
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct REKeyframeEmitter);
break;
case SBIG('IRND'):
m_elem.reset(new struct REInitialRandom);
break;
case SBIG('RAND'):
m_elem.reset(new struct RERandom);
break;
case SBIG('MULT'):
m_elem.reset(new struct REMultiply);
break;
case SBIG('PULS'):
m_elem.reset(new struct REPulse);
break;
case SBIG('SCAL'):
m_elem.reset(new struct RETimeScale);
break;
case SBIG('RLPT'):
m_elem.reset(new struct RELifetimePercent);
break;
case SBIG('SINE'):
m_elem.reset(new struct RESineWave);
break;
default:
m_elem.reset();
return;
}
r.enterSubRecord(elem.first.c_str());
m_elem->read(r);
r.leaveSubRecord();
} }
void RealElementFactory::write(Athena::io::YAMLDocWriter& w) const void RealElementFactory::write(Athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -170,7 +145,7 @@ void RealElementFactory::write(Athena::io::IStreamWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else
@ -180,105 +155,76 @@ void RealElementFactory::write(Athena::io::IStreamWriter& w) const
void IntElementFactory::read(Athena::io::YAMLDocReader& r) void IntElementFactory::read(Athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("KEYE")) const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{ {
m_elem.reset(new struct IEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("DETH"))
{
m_elem.reset(new struct IEDeath);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CLMP"))
{
m_elem.reset(new struct IEClamp);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CHAN"))
{
m_elem.reset(new struct IETimeChain);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("ADD_"))
{
m_elem.reset(new struct IEAdd);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CNST"))
{
m_elem.reset(new struct IEConstant);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("IMPL"))
{
m_elem.reset(new struct IEImpulse);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("ILPT"))
{
m_elem.reset(new struct IELifetimePercent);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("IRND"))
{
m_elem.reset(new struct IEInitialRandom);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("PULS"))
{
m_elem.reset(new struct IEPulse);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("MULT"))
{
m_elem.reset(new struct IEMultiply);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYP"))
{
m_elem.reset(new struct IEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("SPAH"))
{
m_elem.reset(new struct IESampleAndHold);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("RAND"))
{
m_elem.reset(new struct IERandom);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("TSCL"))
{
m_elem.reset(new struct IETimeScale);
m_elem->read(r);
r.leaveSubRecord();
}
else
m_elem.reset(); m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
Log.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct IEKeyframeEmitter);
break;
case SBIG('DETH'):
m_elem.reset(new struct IEDeath);
break;
case SBIG('CLMP'):
m_elem.reset(new struct IEClamp);
break;
case SBIG('CHAN'):
m_elem.reset(new struct IETimeChain);
break;
case SBIG('ADD_'):
m_elem.reset(new struct IEAdd);
break;
case SBIG('CNST'):
m_elem.reset(new struct IEConstant);
break;
case SBIG('IMPL'):
m_elem.reset(new struct IEImpulse);
break;
case SBIG('ILPT'):
m_elem.reset(new struct IELifetimePercent);
break;
case SBIG('IRND'):
m_elem.reset(new struct IEInitialRandom);
break;
case SBIG('PULS'):
m_elem.reset(new struct IEPulse);
break;
case SBIG('MULT'):
m_elem.reset(new struct IEMultiply);
break;
case SBIG('SPAH'):
m_elem.reset(new struct IESampleAndHold);
break;
case SBIG('RAND'):
m_elem.reset(new struct IERandom);
break;
case SBIG('TSCL'):
m_elem.reset(new struct IETimeScale);
break;
default:
m_elem.reset();
return;
}
r.enterSubRecord(elem.first.c_str());
m_elem->read(r);
r.leaveSubRecord();
} }
void IntElementFactory::write(Athena::io::YAMLDocWriter& w) const void IntElementFactory::write(Athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -352,7 +298,7 @@ void IntElementFactory::write(Athena::io::IStreamWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else
@ -361,87 +307,67 @@ void IntElementFactory::write(Athena::io::IStreamWriter& w) const
void VectorElementFactory::read(Athena::io::YAMLDocReader& r) void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("CONE")) const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{ {
m_elem.reset(new struct VECone);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CHAN"))
{
m_elem.reset(new struct VETimeChain);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("ANGC"))
{
m_elem.reset(new struct VEAngleCone);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("ADD_"))
{
m_elem.reset(new struct VEAdd);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CCLU"))
{
m_elem.reset(new struct VECircleCluster);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CNST"))
{
m_elem.reset(new struct VEConstant);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CIRC"))
{
m_elem.reset(new struct VECircle);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYE"))
{
m_elem.reset(new struct VEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYP"))
{
m_elem.reset(new struct VEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("MULT"))
{
m_elem.reset(new struct VEMultiply);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("RTOV"))
{
m_elem.reset(new struct VERealToVector);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("PULS"))
{
m_elem.reset(new struct VEPulse);
m_elem->read(r);
r.leaveSubRecord();
}
else
m_elem.reset(); m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
Log.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('CONE'):
m_elem.reset(new struct VECone);
break;
case SBIG('CHAN'):
m_elem.reset(new struct VETimeChain);
break;
case SBIG('ANGC'):
m_elem.reset(new struct VEAngleCone);
break;
case SBIG('ADD_'):
m_elem.reset(new struct VEAdd);
break;
case SBIG('CCLU'):
m_elem.reset(new struct VECircleCluster);
break;
case SBIG('CNST'):
m_elem.reset(new struct VEConstant);
break;
case SBIG('CIRC'):
m_elem.reset(new struct VECircle);
break;
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct VEKeyframeEmitter);
break;
case SBIG('MULT'):
m_elem.reset(new struct VEMultiply);
break;
case SBIG('RTOV'):
m_elem.reset(new struct VERealToVector);
break;
case SBIG('PULS'):
m_elem.reset(new struct VEPulse);
break;
default:
m_elem.reset();
return;
}
r.enterSubRecord(elem.first.c_str());
m_elem->read(r);
r.leaveSubRecord();
} }
void VectorElementFactory::write(Athena::io::YAMLDocWriter& w) const void VectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -506,7 +432,7 @@ void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else
@ -516,57 +442,52 @@ void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
void ColorElementFactory::read(Athena::io::YAMLDocReader& r) void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("KEYE")) const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{ {
m_elem.reset(new struct CEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CNST"))
{
m_elem.reset(new struct CEConstant);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CHAN"))
{
m_elem.reset(new struct CETimeChain);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CFDE"))
{
m_elem.reset(new struct CEFadeEnd);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("FADE"))
{
m_elem.reset(new struct CEFade);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("KEYP"))
{
m_elem.reset(new struct CEKeyframeEmitter);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("PULS"))
{
m_elem.reset(new struct CEPulse);
m_elem->read(r);
r.leaveSubRecord();
}
else
m_elem.reset(); m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
Log.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct CEKeyframeEmitter);
break;
case SBIG('CNST'):
m_elem.reset(new struct CEConstant);
break;
case SBIG('CHAN'):
m_elem.reset(new struct CETimeChain);
break;
case SBIG('CFDE'):
m_elem.reset(new struct CEFadeEnd);
break;
case SBIG('FADE'):
m_elem.reset(new struct CEFade);
break;
case SBIG('PULS'):
m_elem.reset(new struct CEPulse);
break;
default:
m_elem.reset();
return;
}
r.enterSubRecord(elem.first.c_str());
m_elem->read(r);
r.leaveSubRecord();
} }
void ColorElementFactory::write(Athena::io::YAMLDocWriter& w) const void ColorElementFactory::write(Athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -616,7 +537,7 @@ void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else
@ -626,87 +547,69 @@ void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r) void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("IMPL")) const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{ {
m_elem.reset(new struct MVEImplosion);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("EMPL"))
{
m_elem.reset(new struct MVEExponentialImplosion);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CHAN"))
{
m_elem.reset(new struct MVETimeChain);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("BNCE"))
{
m_elem.reset(new struct MVEBounce);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("CNST"))
{
m_elem.reset(new struct MVEConstant);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("GRAV"))
{
m_elem.reset(new struct MVEGravity);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("EXPL"))
{
m_elem.reset(new struct MVEExplode);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("SPOS"))
{
m_elem.reset(new struct MVESetPosition);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("LMPL"))
{
m_elem.reset(new struct MVELinearImplosion);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("PULS"))
{
m_elem.reset(new struct MVEPulse);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("WIND"))
{
m_elem.reset(new struct MVEWind);
m_elem->read(r);
r.leaveSubRecord();
}
else if (r.enterSubRecord("SWRL"))
{
m_elem.reset(new struct MVESwirl);
m_elem->read(r);
r.leaveSubRecord();
}
else
m_elem.reset(); m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
Log.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('IMPL'):
m_elem.reset(new struct MVEImplosion);
break;
case SBIG('EMPL'):
m_elem.reset(new struct MVEExponentialImplosion);
break;
case SBIG('CHAN'):
m_elem.reset(new struct MVETimeChain);
break;
case SBIG('BNCE'):
m_elem.reset(new struct MVEBounce);
break;
case SBIG('CNST'):
m_elem.reset(new struct MVEConstant);
break;
case SBIG('GRAV'):
m_elem.reset(new struct MVEGravity);
break;
case SBIG('EXPL'):
m_elem.reset(new struct MVEExplode);
break;
case SBIG('SPOS'):
m_elem.reset(new struct MVESetPosition);
break;
case SBIG('LMPL'):
m_elem.reset(new struct MVELinearImplosion);
break;
case SBIG('PULS'):
m_elem.reset(new struct MVEPulse);
break;
case SBIG('WIND'):
m_elem.reset(new struct MVEWind);
break;
case SBIG('SWRL'):
m_elem.reset(new struct MVESwirl);
break;
default:
m_elem.reset();
return;
}
r.enterSubRecord(elem.first.c_str());
m_elem->read(r);
r.leaveSubRecord();
} }
void ModVectorElementFactory::write(Athena::io::YAMLDocWriter& w) const void ModVectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -773,7 +676,7 @@ void ModVectorElementFactory::write(Athena::io::IStreamWriter& w) const
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else

View File

@ -10,14 +10,14 @@ namespace DNAParticle
struct IElement : BigYAML struct IElement : BigYAML
{ {
enum class ClassID : uint32_t enum class EClassID : uint32_t
{ {
NONE = 'NONE', NONE = 'NONE',
CNST = 'CNST' CNST = 'CNST'
}; };
Delete _d; Delete _d;
virtual ~IElement() = default; virtual ~IElement() = default;
virtual const char* ClassName() const=0; virtual const char* ClassID() const=0;
}; };
struct IRealElement : IElement {Delete _d;}; struct IRealElement : IElement {Delete _d;};
@ -92,14 +92,14 @@ struct RELifetimeTween : IRealElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "LFTW";} const char* ClassID() const {return "LFTW";}
}; };
struct REConstant : IRealElement struct REConstant : IRealElement
{ {
DECL_YAML DECL_YAML
Value<float> val; Value<float> val;
const char* ClassName() const {return "CNST";} const char* ClassID() const {return "CNST";}
}; };
struct RETimeChain : IRealElement struct RETimeChain : IRealElement
@ -108,7 +108,7 @@ struct RETimeChain : IRealElement
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CHAN";} const char* ClassID() const {return "CHAN";}
}; };
struct REAdd : IRealElement struct REAdd : IRealElement
@ -116,7 +116,7 @@ struct REAdd : IRealElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "ADD_";} const char* ClassID() const {return "ADD_";}
}; };
struct REClamp : IRealElement struct REClamp : IRealElement
@ -125,7 +125,7 @@ struct REClamp : IRealElement
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
const char* ClassName() const {return "CLMP";} const char* ClassID() const {return "CLMP";}
}; };
struct REKeyframeEmitter : IRealElement struct REKeyframeEmitter : IRealElement
@ -139,7 +139,7 @@ struct REKeyframeEmitter : IRealElement
Value<atUint32> f; Value<atUint32> f;
Value<atUint32> count; Value<atUint32> count;
Vector<float, DNA_COUNT(count)> keys; Vector<float, DNA_COUNT(count)> keys;
const char* ClassName() const {return percentage ? "KEYP" : "KEYE";} const char* ClassID() const {return percentage ? "KEYP" : "KEYE";}
}; };
struct REInitialRandom : IRealElement struct REInitialRandom : IRealElement
@ -147,7 +147,7 @@ struct REInitialRandom : IRealElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "IRND";} const char* ClassID() const {return "IRND";}
}; };
struct RERandom : IRealElement struct RERandom : IRealElement
@ -155,7 +155,7 @@ struct RERandom : IRealElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "RAND";} const char* ClassID() const {return "RAND";}
}; };
struct REMultiply : IRealElement struct REMultiply : IRealElement
@ -163,7 +163,7 @@ struct REMultiply : IRealElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "MULT";} const char* ClassID() const {return "MULT";}
}; };
struct REPulse : IRealElement struct REPulse : IRealElement
@ -173,21 +173,21 @@ struct REPulse : IRealElement
IntElementFactory b; IntElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
const char* ClassName() const {return "PULS";} const char* ClassID() const {return "PULS";}
}; };
struct RETimeScale : IRealElement struct RETimeScale : IRealElement
{ {
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
const char* ClassName() const {return "SCAL";} const char* ClassID() const {return "SCAL";}
}; };
struct RELifetimePercent : IRealElement struct RELifetimePercent : IRealElement
{ {
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
const char* ClassName() const {return "RLPT";} const char* ClassID() const {return "RLPT";}
}; };
struct RESineWave : IRealElement struct RESineWave : IRealElement
@ -196,7 +196,7 @@ struct RESineWave : IRealElement
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
const char* ClassName() const {return "SINE";} const char* ClassID() const {return "SINE";}
}; };
struct IEKeyframeEmitter : IIntElement struct IEKeyframeEmitter : IIntElement
@ -210,7 +210,7 @@ struct IEKeyframeEmitter : IIntElement
Value<atUint32> f; Value<atUint32> f;
Value<atUint32> count; Value<atUint32> count;
Vector<atUint32, DNA_COUNT(count)> keys; Vector<atUint32, DNA_COUNT(count)> keys;
const char* ClassName() const {return percentage ? "KEYP" : "KEYE";} const char* ClassID() const {return percentage ? "KEYP" : "KEYE";}
}; };
struct IEDeath : IIntElement struct IEDeath : IIntElement
@ -218,7 +218,7 @@ struct IEDeath : IIntElement
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
const char* ClassName() const {return "DETH";} const char* ClassID() const {return "DETH";}
}; };
struct IEClamp : IIntElement struct IEClamp : IIntElement
@ -227,7 +227,7 @@ struct IEClamp : IIntElement
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CLMP";} const char* ClassID() const {return "CLMP";}
}; };
struct IETimeChain : IIntElement struct IETimeChain : IIntElement
@ -236,7 +236,7 @@ struct IETimeChain : IIntElement
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CHAN";} const char* ClassID() const {return "CHAN";}
}; };
struct IEAdd : IIntElement struct IEAdd : IIntElement
@ -244,28 +244,28 @@ struct IEAdd : IIntElement
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
const char* ClassName() const {return "ADD_";} const char* ClassID() const {return "ADD_";}
}; };
struct IEConstant : IIntElement struct IEConstant : IIntElement
{ {
DECL_YAML DECL_YAML
Value<atUint32> val; Value<atUint32> val;
const char* ClassName() const {return "CNST";} const char* ClassID() const {return "CNST";}
}; };
struct IEImpulse : IIntElement struct IEImpulse : IIntElement
{ {
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
const char* ClassName() const {return "IMPL";} const char* ClassID() const {return "IMPL";}
}; };
struct IELifetimePercent : IIntElement struct IELifetimePercent : IIntElement
{ {
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
const char* ClassName() const {return "ILPT";} const char* ClassID() const {return "ILPT";}
}; };
struct IEInitialRandom : IIntElement struct IEInitialRandom : IIntElement
@ -273,7 +273,7 @@ struct IEInitialRandom : IIntElement
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
const char* ClassName() const {return "IRND";} const char* ClassID() const {return "IRND";}
}; };
struct IEPulse : IIntElement struct IEPulse : IIntElement
@ -283,7 +283,7 @@ struct IEPulse : IIntElement
IntElementFactory b; IntElementFactory b;
IntElementFactory c; IntElementFactory c;
IntElementFactory d; IntElementFactory d;
const char* ClassName() const {return "PULS";} const char* ClassID() const {return "PULS";}
}; };
struct IEMultiply : IIntElement struct IEMultiply : IIntElement
@ -291,7 +291,7 @@ struct IEMultiply : IIntElement
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
const char* ClassName() const {return "MULT";} const char* ClassID() const {return "MULT";}
}; };
struct IESampleAndHold : IIntElement struct IESampleAndHold : IIntElement
@ -300,7 +300,7 @@ struct IESampleAndHold : IIntElement
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "SPAH";} const char* ClassID() const {return "SPAH";}
}; };
struct IERandom : IIntElement struct IERandom : IIntElement
@ -308,14 +308,14 @@ struct IERandom : IIntElement
DECL_YAML DECL_YAML
IntElementFactory a; IntElementFactory a;
IntElementFactory b; IntElementFactory b;
const char* ClassName() const {return "RAND";} const char* ClassID() const {return "RAND";}
}; };
struct IETimeScale : IIntElement struct IETimeScale : IIntElement
{ {
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
const char* ClassName() const {return "TSCL";} const char* ClassID() const {return "TSCL";}
}; };
struct VECone : IVectorElement struct VECone : IVectorElement
@ -323,7 +323,7 @@ struct VECone : IVectorElement
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "CONE";} const char* ClassID() const {return "CONE";}
}; };
struct VETimeChain : IVectorElement struct VETimeChain : IVectorElement
@ -332,7 +332,7 @@ struct VETimeChain : IVectorElement
VectorElementFactory a; VectorElementFactory a;
VectorElementFactory b; VectorElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CHAN";} const char* ClassID() const {return "CHAN";}
}; };
struct VEAngleCone : IVectorElement struct VEAngleCone : IVectorElement
@ -343,7 +343,7 @@ struct VEAngleCone : IVectorElement
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
RealElementFactory e; RealElementFactory e;
const char* ClassName() const {return "ANGC";} const char* ClassID() const {return "ANGC";}
}; };
struct VEAdd : IVectorElement struct VEAdd : IVectorElement
@ -351,7 +351,7 @@ struct VEAdd : IVectorElement
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
VectorElementFactory b; VectorElementFactory b;
const char* ClassName() const {return "ADD_";} const char* ClassID() const {return "ADD_";}
}; };
struct VECircleCluster : IVectorElement struct VECircleCluster : IVectorElement
@ -361,7 +361,7 @@ struct VECircleCluster : IVectorElement
VectorElementFactory b; VectorElementFactory b;
IntElementFactory c; IntElementFactory c;
RealElementFactory d; RealElementFactory d;
const char* ClassName() const {return "CCLU";} const char* ClassID() const {return "CCLU";}
}; };
struct VEConstant : IVectorElement struct VEConstant : IVectorElement
@ -370,7 +370,7 @@ struct VEConstant : IVectorElement
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
const char* ClassName() const {return "CNST";} const char* ClassID() const {return "CNST";}
}; };
struct VECircle : IVectorElement struct VECircle : IVectorElement
@ -381,7 +381,7 @@ struct VECircle : IVectorElement
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
RealElementFactory e; RealElementFactory e;
const char* ClassName() const {return "CIRC";} const char* ClassID() const {return "CIRC";}
}; };
struct VEKeyframeEmitter : IVectorElement struct VEKeyframeEmitter : IVectorElement
@ -395,7 +395,7 @@ struct VEKeyframeEmitter : IVectorElement
Value<atUint32> f; Value<atUint32> f;
Value<atUint32> count; Value<atUint32> count;
Vector<atVec3f, DNA_COUNT(count)> keys; Vector<atVec3f, DNA_COUNT(count)> keys;
const char* ClassName() const {return percentage ? "KEYP" : "KEYE";} const char* ClassID() const {return percentage ? "KEYP" : "KEYE";}
}; };
struct VEMultiply : IVectorElement struct VEMultiply : IVectorElement
@ -403,14 +403,14 @@ struct VEMultiply : IVectorElement
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
VectorElementFactory b; VectorElementFactory b;
const char* ClassName() const {return "MULT";} const char* ClassID() const {return "MULT";}
}; };
struct VERealToVector : IVectorElement struct VERealToVector : IVectorElement
{ {
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
const char* ClassName() const {return "RTOV";} const char* ClassID() const {return "RTOV";}
}; };
struct VEPulse : IVectorElement struct VEPulse : IVectorElement
@ -420,7 +420,7 @@ struct VEPulse : IVectorElement
IntElementFactory b; IntElementFactory b;
VectorElementFactory c; VectorElementFactory c;
VectorElementFactory d; VectorElementFactory d;
const char* ClassName() const {return "PULS";} const char* ClassID() const {return "PULS";}
}; };
struct CEKeyframeEmitter : IColorElement struct CEKeyframeEmitter : IColorElement
@ -434,7 +434,7 @@ struct CEKeyframeEmitter : IColorElement
Value<atUint32> f; Value<atUint32> f;
Value<atUint32> count; Value<atUint32> count;
Vector<atVec4f, DNA_COUNT(count)> keys; Vector<atVec4f, DNA_COUNT(count)> keys;
const char* ClassName() const {return percentage ? "KEYP" : "KEYE";} const char* ClassID() const {return percentage ? "KEYP" : "KEYE";}
}; };
struct CEConstant : IColorElement struct CEConstant : IColorElement
@ -444,7 +444,7 @@ struct CEConstant : IColorElement
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
const char* ClassName() const {return "CNST";} const char* ClassID() const {return "CNST";}
}; };
struct CETimeChain : IColorElement struct CETimeChain : IColorElement
@ -453,7 +453,7 @@ struct CETimeChain : IColorElement
ColorElementFactory a; ColorElementFactory a;
ColorElementFactory b; ColorElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CHAN";} const char* ClassID() const {return "CHAN";}
}; };
struct CEFadeEnd : IColorElement struct CEFadeEnd : IColorElement
@ -463,7 +463,7 @@ struct CEFadeEnd : IColorElement
ColorElementFactory b; ColorElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
const char* ClassName() const {return "CFDE";} const char* ClassID() const {return "CFDE";}
}; };
struct CEFade : IColorElement struct CEFade : IColorElement
@ -472,7 +472,7 @@ struct CEFade : IColorElement
ColorElementFactory a; ColorElementFactory a;
ColorElementFactory b; ColorElementFactory b;
RealElementFactory c; RealElementFactory c;
const char* ClassName() const {return "FADE";} const char* ClassID() const {return "FADE";}
}; };
struct CEPulse : IColorElement struct CEPulse : IColorElement
@ -482,7 +482,7 @@ struct CEPulse : IColorElement
IntElementFactory b; IntElementFactory b;
ColorElementFactory c; ColorElementFactory c;
ColorElementFactory d; ColorElementFactory d;
const char* ClassName() const {return "PULS";} const char* ClassID() const {return "PULS";}
}; };
struct MVEImplosion : IModVectorElement struct MVEImplosion : IModVectorElement
@ -492,9 +492,9 @@ struct MVEImplosion : IModVectorElement
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
Value<ClassID> boolCls = ClassID::CNST; Value<EClassID> boolCls = EClassID::CNST;
Value<bool> boolVal; Value<bool> boolVal;
const char* ClassName() const {return "IMPL";} const char* ClassID() const {return "IMPL";}
}; };
struct MVEExponentialImplosion : IModVectorElement struct MVEExponentialImplosion : IModVectorElement
@ -504,9 +504,9 @@ struct MVEExponentialImplosion : IModVectorElement
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
Value<ClassID> boolCls = ClassID::CNST; Value<EClassID> boolCls = EClassID::CNST;
Value<bool> boolVal; Value<bool> boolVal;
const char* ClassName() const {return "EMPL";} const char* ClassID() const {return "EMPL";}
}; };
struct MVETimeChain : IModVectorElement struct MVETimeChain : IModVectorElement
@ -515,7 +515,7 @@ struct MVETimeChain : IModVectorElement
ModVectorElementFactory a; ModVectorElementFactory a;
ModVectorElementFactory b; ModVectorElementFactory b;
IntElementFactory c; IntElementFactory c;
const char* ClassName() const {return "CHAN";} const char* ClassID() const {return "CHAN";}
}; };
struct MVEBounce : IModVectorElement struct MVEBounce : IModVectorElement
@ -525,9 +525,9 @@ struct MVEBounce : IModVectorElement
VectorElementFactory b; VectorElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
Value<ClassID> boolCls = ClassID::CNST; Value<EClassID> boolCls = EClassID::CNST;
Value<bool> boolVal; Value<bool> boolVal;
const char* ClassName() const {return "BNCE";} const char* ClassID() const {return "BNCE";}
}; };
struct MVEConstant : IModVectorElement struct MVEConstant : IModVectorElement
@ -536,14 +536,14 @@ struct MVEConstant : IModVectorElement
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
const char* ClassName() const {return "CNST";} const char* ClassID() const {return "CNST";}
}; };
struct MVEGravity : IModVectorElement struct MVEGravity : IModVectorElement
{ {
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
const char* ClassName() const {return "GRAV";} const char* ClassID() const {return "GRAV";}
}; };
struct MVEExplode : IModVectorElement struct MVEExplode : IModVectorElement
@ -551,14 +551,14 @@ struct MVEExplode : IModVectorElement
DECL_YAML DECL_YAML
RealElementFactory a; RealElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "EXPL";} const char* ClassID() const {return "EXPL";}
}; };
struct MVESetPosition : IModVectorElement struct MVESetPosition : IModVectorElement
{ {
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
const char* ClassName() const {return "SPOS";} const char* ClassID() const {return "SPOS";}
}; };
struct MVELinearImplosion : IModVectorElement struct MVELinearImplosion : IModVectorElement
@ -568,9 +568,9 @@ struct MVELinearImplosion : IModVectorElement
RealElementFactory b; RealElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
Value<ClassID> boolCls = ClassID::CNST; Value<EClassID> boolCls = EClassID::CNST;
Value<bool> boolVal; Value<bool> boolVal;
const char* ClassName() const {return "LMPL";} const char* ClassID() const {return "LMPL";}
}; };
struct MVEPulse : IModVectorElement struct MVEPulse : IModVectorElement
@ -580,7 +580,7 @@ struct MVEPulse : IModVectorElement
IntElementFactory b; IntElementFactory b;
ModVectorElementFactory c; ModVectorElementFactory c;
ModVectorElementFactory d; ModVectorElementFactory d;
const char* ClassName() const {return "PULS";} const char* ClassID() const {return "PULS";}
}; };
struct MVEWind : IModVectorElement struct MVEWind : IModVectorElement
@ -588,7 +588,7 @@ struct MVEWind : IModVectorElement
DECL_YAML DECL_YAML
VectorElementFactory a; VectorElementFactory a;
RealElementFactory b; RealElementFactory b;
const char* ClassName() const {return "WIND";} const char* ClassID() const {return "WIND";}
}; };
struct MVESwirl : IModVectorElement struct MVESwirl : IModVectorElement
@ -598,7 +598,7 @@ struct MVESwirl : IModVectorElement
VectorElementFactory b; VectorElementFactory b;
RealElementFactory c; RealElementFactory c;
RealElementFactory d; RealElementFactory d;
const char* ClassName() const {return "SWRL";} const char* ClassID() const {return "SWRL";}
}; };
template <class IDType> template <class IDType>
@ -665,7 +665,7 @@ struct UVEAnimTexture : IUVElement
IntElementFactory c; IntElementFactory c;
IntElementFactory d; IntElementFactory d;
IntElementFactory e; IntElementFactory e;
Value<ClassID> boolCls = ClassID::CNST; Value<EClassID> boolCls = EClassID::CNST;
Value<bool> boolVal; Value<bool> boolVal;
void read(Athena::io::YAMLDocReader& r) void read(Athena::io::YAMLDocReader& r)
{ {
@ -704,12 +704,12 @@ struct UVEAnimTexture : IUVElement
e.read(r); e.read(r);
r.leaveSubRecord(); r.leaveSubRecord();
} }
boolCls = ClassID::NONE; boolCls = EClassID::NONE;
if (r.enterSubRecord("bool")) if (r.enterSubRecord("bool"))
{ {
if (r.enterSubRecord("CNST")) if (r.enterSubRecord("CNST"))
{ {
boolCls = ClassID::CNST; boolCls = EClassID::CNST;
boolVal = r.readBool(nullptr); boolVal = r.readBool(nullptr);
r.leaveSubRecord(); r.leaveSubRecord();
} }
@ -730,7 +730,7 @@ struct UVEAnimTexture : IUVElement
d.write(w); d.write(w);
e.write(w); e.write(w);
w.enterSubRecord("bool"); w.enterSubRecord("bool");
if (boolCls == ClassID::CNST) if (boolCls == EClassID::CNST)
{ {
w.enterSubRecord("CNST"); w.enterSubRecord("CNST");
w.writeBool(nullptr, boolVal); w.writeBool(nullptr, boolVal);
@ -748,7 +748,7 @@ struct UVEAnimTexture : IUVElement
__isz = c.binarySize(__isz); __isz = c.binarySize(__isz);
__isz = d.binarySize(__isz); __isz = d.binarySize(__isz);
__isz = e.binarySize(__isz); __isz = e.binarySize(__isz);
if (boolCls == ClassID::CNST) if (boolCls == EClassID::CNST)
__isz += 1; __isz += 1;
return __isz; return __isz;
} }
@ -764,11 +764,11 @@ struct UVEAnimTexture : IUVElement
c.read(r); c.read(r);
d.read(r); d.read(r);
e.read(r); e.read(r);
boolCls = ClassID::NONE; boolCls = EClassID::NONE;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST')) if (clsId == SBIG('CNST'))
{ {
boolCls = ClassID::CNST; boolCls = EClassID::CNST;
boolVal = r.readBool(); boolVal = r.readBool();
} }
} }
@ -786,7 +786,7 @@ struct UVEAnimTexture : IUVElement
c.write(w); c.write(w);
d.write(w); d.write(w);
e.write(w); e.write(w);
if (boolCls == ClassID::CNST) if (boolCls == EClassID::CNST)
{ {
w.writeBytes((atInt8*)"CNST", 4); w.writeBytes((atInt8*)"CNST", 4);
w.writeBool(boolVal); w.writeBool(boolVal);
@ -824,7 +824,7 @@ struct UVElementFactory : BigYAML
{ {
if (m_elem) if (m_elem)
{ {
w.enterSubRecord(m_elem->ClassName()); w.enterSubRecord(m_elem->ClassID());
m_elem->write(w); m_elem->write(w);
w.leaveSubRecord(); w.leaveSubRecord();
} }
@ -861,7 +861,7 @@ struct UVElementFactory : BigYAML
{ {
if (m_elem) if (m_elem)
{ {
w.writeBytes((atInt8*)m_elem->ClassName(), 4); w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w); m_elem->write(w);
} }
else else

2
hecl

@ -1 +1 @@
Subproject commit af0acd9fe8a7678e052697db2b7ff175d1f91abc Subproject commit ee25e81af5b7b2d125808960d1c430f6bc722e75