mirror of
https://github.com/leozide/leocad
synced 2025-01-19 22:26:27 +01:00
Fixed serializing area light grid.
This commit is contained in:
parent
d50f8f5796
commit
ec2a9bce87
1 changed files with 23 additions and 5 deletions
|
@ -28,7 +28,7 @@ lcObject::~lcObject()
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void SaveFloatValue(QTextStream& Stream, const T& Value)
|
static void SaveValue(QTextStream& Stream, const T& Value)
|
||||||
{
|
{
|
||||||
constexpr int Count = sizeof(T) / sizeof(float);
|
constexpr int Count = sizeof(T) / sizeof(float);
|
||||||
|
|
||||||
|
@ -36,8 +36,17 @@ static void SaveFloatValue(QTextStream& Stream, const T& Value)
|
||||||
Stream << ((const float*)&Value)[ValueIndex] << ' ';
|
Stream << ((const float*)&Value)[ValueIndex] << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void SaveValue(QTextStream& Stream, const lcVector2i& Value)
|
||||||
|
{
|
||||||
|
constexpr int Count = sizeof(lcVector2i) / sizeof(int);
|
||||||
|
|
||||||
|
for (int ValueIndex = 0; ValueIndex < Count; ValueIndex++)
|
||||||
|
Stream << ((const int*)&Value)[ValueIndex] << ' ';
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void LoadFloatValue(QTextStream& Stream, T& Value)
|
static void LoadValue(QTextStream& Stream, T& Value)
|
||||||
{
|
{
|
||||||
constexpr int Count = sizeof(T) / sizeof(float);
|
constexpr int Count = sizeof(T) / sizeof(float);
|
||||||
|
|
||||||
|
@ -45,6 +54,15 @@ static void LoadFloatValue(QTextStream& Stream, T& Value)
|
||||||
Stream >> ((float*)&Value)[ValueIdx];
|
Stream >> ((float*)&Value)[ValueIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void LoadValue(QTextStream& Stream, lcVector2i& Value)
|
||||||
|
{
|
||||||
|
constexpr int Count = sizeof(lcVector2i) / sizeof(int);
|
||||||
|
|
||||||
|
for (int ValueIdx = 0; ValueIdx < Count; ValueIdx++)
|
||||||
|
Stream >> ((int*)&Value)[ValueIdx];
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void lcObjectKeyArray<T>::SaveKeysLDraw(QTextStream& Stream, const char* ObjectName, const char* VariableName) const
|
void lcObjectKeyArray<T>::SaveKeysLDraw(QTextStream& Stream, const char* ObjectName, const char* VariableName) const
|
||||||
{
|
{
|
||||||
|
@ -52,7 +70,7 @@ void lcObjectKeyArray<T>::SaveKeysLDraw(QTextStream& Stream, const char* ObjectN
|
||||||
{
|
{
|
||||||
Stream << QLatin1String("0 !LEOCAD ") << ObjectName << ' ' << VariableName << "_KEY " << Key.Step << ' ';
|
Stream << QLatin1String("0 !LEOCAD ") << ObjectName << ' ' << VariableName << "_KEY " << Key.Step << ' ';
|
||||||
|
|
||||||
SaveFloatValue(Stream, Key.Value);
|
SaveValue(Stream, Key.Value);
|
||||||
|
|
||||||
Stream << QLatin1String("\r\n");
|
Stream << QLatin1String("\r\n");
|
||||||
}
|
}
|
||||||
|
@ -180,7 +198,7 @@ void lcObject::SaveAttribute(QTextStream& Stream, const T& Variable, const lcObj
|
||||||
{
|
{
|
||||||
Stream << QLatin1String("0 !LEOCAD ") << ObjectName << ' ' << VariableName << ' ';
|
Stream << QLatin1String("0 !LEOCAD ") << ObjectName << ' ' << VariableName << ' ';
|
||||||
|
|
||||||
SaveFloatValue(Stream, Variable);
|
SaveValue(Stream, Variable);
|
||||||
|
|
||||||
Stream << QLatin1String("\r\n");
|
Stream << QLatin1String("\r\n");
|
||||||
}
|
}
|
||||||
|
@ -193,7 +211,7 @@ bool lcObject::LoadAttribute(QTextStream& Stream, const QString& Token, T& Varia
|
||||||
{
|
{
|
||||||
if (Token == VariableName)
|
if (Token == VariableName)
|
||||||
{
|
{
|
||||||
LoadFloatValue(Stream, Variable);
|
LoadValue(Stream, Variable);
|
||||||
Keys.ChangeKey(Variable, 1, true);
|
Keys.ChangeKey(Variable, 1, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue