Tried making magic asset parser. To be contondered.
This commit is contained in:
parent
556e33d56f
commit
fdf1559f09
BIN
tools/asset_assess/asset_assess.ico
Normal file
BIN
tools/asset_assess/asset_assess.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
22
tools/asset_assess/asset_assess.pro
Normal file
22
tools/asset_assess/asset_assess.pro
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
QT += core widgets gui multimedia
|
||||||
|
|
||||||
|
RC_ICONS = asset_assess.ico
|
||||||
|
|
||||||
|
CONFIG += c++17
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h
|
||||||
|
|
||||||
|
LIBS += \
|
||||||
|
-L$$OUT_PWD/../../libs -lassets
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
$$PWD/../../libs/assets
|
||||||
|
|
||||||
|
DEPENDPATH += \
|
||||||
|
$$PWD/../../libs/assets
|
||||||
|
|
||||||
11
tools/asset_assess/main.cpp
Normal file
11
tools/asset_assess/main.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
83
tools/asset_assess/mainwindow.cpp
Normal file
83
tools/asset_assess/mainwindow.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "animparts.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow{parent} {
|
||||||
|
setWindowTitle("Asset Assess");
|
||||||
|
setMinimumSize(250, 150);
|
||||||
|
|
||||||
|
mTextEdit = new QPlainTextEdit(this);
|
||||||
|
mTextEdit->setAcceptDrops(false);
|
||||||
|
mTextEdit->setPlaceholderText("Drag .*_raw file here...");
|
||||||
|
|
||||||
|
setCentralWidget(mTextEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::LogLine(const QString &aLogText)
|
||||||
|
{
|
||||||
|
if (mTextEdit->toPlainText().isEmpty()) {
|
||||||
|
mTextEdit->setPlainText(aLogText);
|
||||||
|
} else {
|
||||||
|
mTextEdit->setPlainText(mTextEdit->toPlainText() + "\r\n" + aLogText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
|
||||||
|
const QMimeData *mimeData = event->mimeData();
|
||||||
|
bool goodDrag = true;
|
||||||
|
if (mimeData->hasUrls()) {
|
||||||
|
qDebug() << mimeData->urls();
|
||||||
|
} else {
|
||||||
|
goodDrag = false;
|
||||||
|
}
|
||||||
|
if (goodDrag) {
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dragMoveEvent(QDragMoveEvent *event) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dragLeaveEvent(QDragLeaveEvent *event) {
|
||||||
|
Q_UNUSED(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dropEvent(QDropEvent *event) {
|
||||||
|
const QMimeData *mimeData = event->mimeData();
|
||||||
|
if (mimeData->hasUrls()) {
|
||||||
|
foreach (const QUrl &url, mimeData->urls()) {
|
||||||
|
const QString fileName = url.toString().split('/').last();
|
||||||
|
LogLine(QString("Processing %1").arg(fileName));
|
||||||
|
|
||||||
|
QFile file(url.toLocalFile());
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
LogLine(QString("Failed to open %1").arg(fileName));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LogLine(QString("Opened %1").arg(fileName));
|
||||||
|
|
||||||
|
QDataStream dataStream(file.readAll());
|
||||||
|
dataStream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
LogLine(QString("Created data stream"));
|
||||||
|
|
||||||
|
if (fileName.contains(".xanim_raw")) {
|
||||||
|
LogLine(QString("Opening XANIM raw file"));
|
||||||
|
|
||||||
|
XAnimParts animParts;
|
||||||
|
dataStream >> animParts;
|
||||||
|
LogLine(XAnimPartsToString(animParts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
tools/asset_assess/mainwindow.h
Normal file
36
tools/asset_assess/mainwindow.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QDragEnterEvent>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
void LogLine(const QString &aLogText);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
QPlainTextEdit *mTextEdit;
|
||||||
|
};
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
Loading…
x
Reference in New Issue
Block a user