summaryrefslogtreecommitdiff
path: root/lsrlytexporter.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-05-09 03:42:43 +0200
committerTreeki <treeki@gmail.com>2013-05-09 03:42:43 +0200
commited869b55411d51a829e5b502cbbf41cd450458e1 (patch)
treef35c77684a5a62d4eec569aa49d7c31fd3cc0241 /lsrlytexporter.cpp
parent9ab95a0f0efa2fa1d15da6bd6c2b5e923bb1af42 (diff)
downloadLayoutStudio-ed869b55411d51a829e5b502cbbf41cd450458e1.tar.gz
LayoutStudio-ed869b55411d51a829e5b502cbbf41cd450458e1.zip
fix pattern animsprivate-nw4r-exporter
Diffstat (limited to '')
-rw-r--r--lsrlytexporter.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/lsrlytexporter.cpp b/lsrlytexporter.cpp
index 42fb587..29338a4 100644
--- a/lsrlytexporter.cpp
+++ b/lsrlytexporter.cpp
@@ -5,6 +5,7 @@
#include <QDir>
#include <QFile>
#include <QSet>
+#include <QBitArray>
#include <QMapIterator>
static void collectPanesForList(QList<LYTPane *> *list, LYTPane *pane) {
@@ -1058,6 +1059,8 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) {
thing.hermites.append(newKey);
}
}
+
+ thing.refRes = anim->importedFiles;
}
}
}
@@ -1105,6 +1108,11 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) {
"Image", "Palette"
};
+ // FOR TEXPATS
+ QStringList originalRes = tuIter.value().refRes;
+ QVector<int> mappings;
+ QStringList newResList;
+
switch (type) {
case LYTAnimPiece::PaneAnim:
aw.writeStartElement("animPainSRTTarget");
@@ -1137,7 +1145,27 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) {
aw.writeAttribute("id", QString::number(ak>>8));
aw.writeAttribute("target", PatTargets[ak&0xFF]);
- //foreach (const QString &bee, )
+ QBitArray whichUsed;
+ whichUsed.resize(originalRes.size());
+ mappings.resize(originalRes.size());
+
+ foreach (const LYTAnimStepKey &key, tuIter.value().steps)
+ whichUsed.setBit(key.value);
+
+ for (int i = 0; i < originalRes.size(); i++) {
+ if (whichUsed.testBit(i)) {
+ mappings.insert(i, newResList.count());
+ newResList.append(originalRes.at(i));
+ }
+ }
+
+ foreach (const QString &bee, newResList) {
+ aw.writeEmptyElement("refRes");
+ QString bee2 = bee;
+ bee2.replace(".tpl", "");
+ aw.writeAttribute("name", bee2);
+ }
+
break;
}
@@ -1151,7 +1179,10 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) {
foreach (const LYTAnimStepKey &key, tuIter.value().steps) {
aw.writeEmptyElement("key");
aw.writeAttribute("frame", QString::number(key.frame));
- aw.writeAttribute("value", QString::number(key.value));
+ int manipValue = key.value;
+ if (type == LYTAnimPiece::TexPatAnim)
+ manipValue = mappings.at(manipValue);
+ aw.writeAttribute("value", QString::number(manipValue));
aw.writeAttribute("slopeType", "Step");
}