From 59399f983473e5a31e794c6f604e3e714f0e524d Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 13:20:08 +1200 Subject: [PATCH 01/35] Convert --- mlMainWindow.cpp | 25 ++++++++++++++++++++++++- mlMainWindow.h | 32 +++++++++++++++++++------------- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index e7e67ec..0dc0d47 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -325,6 +325,10 @@ mlMainWindow::mlMainWindow() connect(mDvarsButton, SIGNAL(clicked()), this, SLOT(OnEditDvars())); ActionsLayout->addWidget(mDvarsButton); + mConvertButton = new QPushButton("Convert"); + connect(mConvertButton, SIGNAL(clicked()), this, SLOT(OnConvertButton())); + ActionsLayout->addWidget(mConvertButton); + mIgnoreErrorsWidget = new QCheckBox("Ignore Errors"); ActionsLayout->addWidget(mIgnoreErrorsWidget); @@ -518,6 +522,8 @@ void mlMainWindow::UpdateDB() void mlMainWindow::StartBuildThread(const QList>& Commands) { + if(mBuildThread == NULL) + { mBuildButton->setText("Cancel"); mOutputWidget->clear(); @@ -525,6 +531,11 @@ void mlMainWindow::StartBuildThread(const QList>& Co connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); mBuildThread->start(); + } + else + { + QMessageBox::information(this,"Build In Progress","There is already a build in progress, please wait.",QMessageBox::Button::Ok); + } } void mlMainWindow::StartConvertThread(QStringList& pathList, QString& outputDir, bool allowOverwrite) @@ -1549,11 +1560,23 @@ void mlMainWindow::BuildOutputReady(QString Output) void mlMainWindow::BuildFinished() { + mConvertButton->setDisabled(false); + mBuildButton->setText("Build"); mBuildThread->deleteLater(); mBuildThread = NULL; } +void mlMainWindow::OnConvertButton() +{ + mConvertButton->setDisabled(true); + + QList> Commands; + Commands.append(QPair(QString("%1/bin/linker_modtools.exe").arg(mToolsPath), QStringList() << "-language" << "english" << "-convertall" << "-verbose")); + + StartBuildThread(Commands); +} + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); @@ -1599,4 +1622,4 @@ void Export2BinGroupBox::dropEvent(QDropEvent* event) void Export2BinGroupBox::dragLeaveEvent(QDragLeaveEvent* event) { event->accept(); -} +} \ No newline at end of file diff --git a/mlMainWindow.h b/mlMainWindow.h index e91eba2..392d9e4 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -117,6 +117,7 @@ protected slots: void BuildFinished(); void ContextMenuRequested(); void SteamUpdate(); + void OnConvertButton(); protected: void closeEvent(QCloseEvent* Event); @@ -135,6 +136,9 @@ protected slots: void InitExport2BinGUI(); + bool mTreyarchTheme; + quint64 mFileId; + QAction* mActionFileNew; QAction* mActionFileAssetEditor; QAction* mActionFileLevelEditor; @@ -146,45 +150,47 @@ protected slots: QAction* mActionHelpAbout; QTreeWidget* mFileListWidget; + QPlainTextEdit* mOutputWidget; QPushButton* mBuildButton; QPushButton* mDvarsButton; + QPushButton* mConvertButton; + QCheckBox* mCompileEnabledWidget; - QComboBox* mCompileModeWidget; QCheckBox* mLightEnabledWidget; - QComboBox* mLightQualityWidget; QCheckBox* mLinkEnabledWidget; QCheckBox* mRunEnabledWidget; - QLineEdit* mRunOptionsWidget; QCheckBox* mIgnoreErrorsWidget; + QCheckBox* mExport2BinOverwriteWidget; + + QComboBox* mCompileModeWidget; + QComboBox* mLightQualityWidget; + + QLineEdit* mRunOptionsWidget; + QLineEdit* mExport2BinTargetDirWidget; mlBuildThread* mBuildThread; + mlConvertThread* mConvertThread; QDockWidget* mExport2BinGUIWidget; - QCheckBox* mExport2BinOverwriteWidget; - QLineEdit* mExport2BinTargetDirWidget; - bool mTreyarchTheme; QString mBuildLanguage; - - QStringList mShippedMapList; - QTimer mTimer; - - quint64 mFileId; QString mTitle; QString mDescription; QString mThumbnail; QString mWorkshopFolder; QString mFolderName; QString mType; - QStringList mTags; - QString mGamePath; QString mToolsPath; + QStringList mShippedMapList; + QStringList mTags; QStringList mRunDvars; + + QTimer mTimer; }; class Export2BinGroupBox : public QGroupBox From a2d5af6d412e84eae31eaf5b3b25ea39ede51e53 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 14:24:12 +1200 Subject: [PATCH 02/35] Convert --- mlMainWindow.cpp | 166 +++++++++++++++++++++++++++++++++-------------- mlMainWindow.h | 11 +++- 2 files changed, 127 insertions(+), 50 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 0dc0d47..d0a8e3e 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -27,16 +27,16 @@ const int AppId = 311210; const char* gLanguages[] = { "english", "french", "italian", "spanish", "german", "portuguese", "russian", "polish", "japanese", "traditionalchinese", "simplifiedchinese", "englisharabic" }; const char* gTags[] = { "Animation", "Audio", "Character", "Map", "Mod", "Mode", "Model", "Multiplayer", "Scorestreak", "Skin", "Specialist", "Texture", "UI", "Vehicle", "Visual Effect", "Weapon", "WIP", "Zombies" }; dvar_s gDvars[] = { - {"ai_disableSpawn", "Disable AI from spawning", DVAR_VALUE_BOOL}, - {"developer", "Run developer mode", DVAR_VALUE_INT, 0, 2}, - {"g_password", "Password for your server", DVAR_VALUE_STRING}, - {"logfile", "Console log information written to current fs_game", DVAR_VALUE_INT, 0, 2}, - {"scr_mod_enable_devblock", "Developer blocks are executed in mods ", DVAR_VALUE_BOOL}, - {"connect", "Connect to a specific server", DVAR_VALUE_STRING, NULL, NULL, true}, - {"set_gametype", "Set a gametype to load with map", DVAR_VALUE_STRING, NULL, NULL, true}, - {"splitscreen", "Enable splitscreen", DVAR_VALUE_BOOL}, - {"splitscreen_playerCount", "Allocate the number of instances for splitscreen", DVAR_VALUE_INT, 0, 2} - }; + {"ai_disableSpawn", "Disable AI from spawning", DVAR_VALUE_BOOL}, + {"developer", "Run developer mode", DVAR_VALUE_INT, 0, 2}, + {"g_password", "Password for your server", DVAR_VALUE_STRING}, + {"logfile", "Console log information written to current fs_game", DVAR_VALUE_INT, 0, 2}, + {"scr_mod_enable_devblock", "Developer blocks are executed in mods ", DVAR_VALUE_BOOL}, + {"connect", "Connect to a specific server", DVAR_VALUE_STRING, NULL, NULL, true}, + {"set_gametype", "Set a gametype to load with map", DVAR_VALUE_STRING, NULL, NULL, true}, + {"splitscreen", "Enable splitscreen", DVAR_VALUE_BOOL}, + {"splitscreen_playerCount", "Allocate the number of instances for splitscreen", DVAR_VALUE_INT, 0, 2} +}; enum mlItemType { ML_ITEM_UNKNOWN, @@ -254,7 +254,7 @@ mlMainWindow::mlMainWindow() setWindowIcon(QIcon(":/resources/ModLauncher.png")); setWindowTitle("Black Ops III Mod Tools Launcher"); - + resize(1024, 768); CreateActions(); @@ -463,7 +463,7 @@ void mlMainWindow::InitExport2BinGUI() mExport2BinOverwriteWidget = new QCheckBox("&Overwrite Existing Files", widget); gridLayout->addWidget(mExport2BinOverwriteWidget, 1, 0); - + QSettings Settings; mExport2BinOverwriteWidget->setChecked(Settings.value("Export2Bin_OverwriteFiles", true).toBool()); @@ -524,17 +524,17 @@ void mlMainWindow::StartBuildThread(const QList>& Co { if(mBuildThread == NULL) { - mBuildButton->setText("Cancel"); - mOutputWidget->clear(); + mBuildButton->setText("Cancel"); + mOutputWidget->clear(); - mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); - connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); - connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); - mBuildThread->start(); + mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); + connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); + connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); + mBuildThread->start(); } else { - QMessageBox::information(this,"Build In Progress","There is already a build in progress, please wait.",QMessageBox::Button::Ok); + QMessageBox::information(this,"Task In Progress","There is already a something running. Please wait.",QMessageBox::Button::Ok); } } @@ -1143,6 +1143,11 @@ void mlMainWindow::OnEditOptions() Checkbox->setChecked(Settings.value("UseDarkTheme", false).toBool()); Layout->addWidget(Checkbox); + QCheckBox* InBuiltEditor = new QCheckBox("Use Inbult Zone Editor"); + InBuiltEditor->setToolTip("Toggle between using default zone file editor, or the inbult one. (BETA)"); + InBuiltEditor->setChecked(Settings.value("InBuiltEditor",false).toBool()); + Layout->addWidget(InBuiltEditor); + QHBoxLayout* LanguageLayout = new QHBoxLayout(); LanguageLayout->addWidget(new QLabel("Build Language:")); @@ -1173,10 +1178,11 @@ void mlMainWindow::OnEditOptions() mBuildLanguage = LanguageCombo->currentText(); mTreyarchTheme = Checkbox->isChecked(); + mUseBuiltInEditor = InBuiltEditor->isChecked(); Settings.setValue("BuildLanguage", mBuildLanguage); Settings.setValue("UseDarkTheme", mTreyarchTheme); - + Settings.setValue("InBuiltEditor",mUseBuiltInEditor); UpdateTheme(); } @@ -1322,26 +1328,26 @@ void mlMainWindow::UpdateWorkshopItem() SteamUGC()->SetItemTags(UpdateHandle, &Tags); - SteamAPICall_t SteamAPICall = SteamUGC()->SubmitItemUpdate(UpdateHandle, ""); - mSteamCallResultUpdateItem.Set(SteamAPICall, this, &mlMainWindow::OnUpdateItemResult); - - QProgressDialog Dialog(this); - Dialog.setLabelText(QString("Uploading workshop item '%1'...").arg(QString::number(mFileId))); - Dialog.setCancelButton(NULL); - Dialog.setWindowModality(Qt::WindowModal); - Dialog.show(); - - for (;;) - { - uint64 Processed, Total; - if (SteamUGC()->GetItemUpdateProgress(SteamAPICall, &Processed, &Total) == k_EItemUpdateStatusInvalid) - break; - - Dialog.setMaximum(Total); - Dialog.setValue(Processed); - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - Sleep(100); - } + SteamAPICall_t SteamAPICall = SteamUGC()->SubmitItemUpdate(UpdateHandle, ""); + mSteamCallResultUpdateItem.Set(SteamAPICall, this, &mlMainWindow::OnUpdateItemResult); + + QProgressDialog Dialog(this); + Dialog.setLabelText(QString("Uploading workshop item '%1'...").arg(QString::number(mFileId))); + Dialog.setCancelButton(NULL); + Dialog.setWindowModality(Qt::WindowModal); + Dialog.show(); + + for (;;) + { + uint64 Processed, Total; + if (SteamUGC()->GetItemUpdateProgress(SteamAPICall, &Processed, &Total) == k_EItemUpdateStatusInvalid) + break; + + Dialog.setMaximum(Total); + Dialog.setValue(Processed); + QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); + Sleep(100); + } } void mlMainWindow::OnCreateItemResult(CreateItemResult_t* CreateItemResult, bool IOFailure) @@ -1391,19 +1397,27 @@ void mlMainWindow::OnOpenZoneFile() QList ItemList = mFileListWidget->selectedItems(); if (ItemList.isEmpty()) return; - + QTreeWidgetItem* Item = ItemList[0]; if (Item->data(0, Qt::UserRole).toInt() == ML_ITEM_MAP) { QString MapName = Item->text(0); - ShellExecute(NULL, "open", QString("\"%1/usermaps/%2/zone_source/%3.zone\"").arg(mGamePath, MapName, MapName).toLatin1().constData(), "", NULL, SW_SHOWDEFAULT); + mZonePath = QString("%1/usermaps/%2/zone_source/%3.zone").arg(mGamePath, MapName, MapName); + if(mUseBuiltInEditor) + OpenZoneEditor(); + else + ShellExecute(NULL, "open", mZonePath.toLatin1().constData(), "", NULL, SW_SHOWDEFAULT); } else { QString ModName = Item->parent()->text(0); QString ZoneName = Item->text(0); - ShellExecute(NULL, "open", (QString("\"%1/mods/%2/zone_source/%3.zone\"").arg(mGamePath, ModName, ZoneName)).toLatin1().constData(), "", NULL, SW_SHOWDEFAULT); + mZonePath = QString("%1/mods/%2/zone_source/%3.zone").arg(mGamePath, ModName, ZoneName); + if(mUseBuiltInEditor) + OpenZoneEditor(); + else + ShellExecute(NULL, "open", mZonePath.toLatin1().constData(), "", NULL, SW_SHOWDEFAULT); } } @@ -1560,8 +1574,6 @@ void mlMainWindow::BuildOutputReady(QString Output) void mlMainWindow::BuildFinished() { - mConvertButton->setDisabled(false); - mBuildButton->setText("Build"); mBuildThread->deleteLater(); mBuildThread = NULL; @@ -1569,14 +1581,70 @@ void mlMainWindow::BuildFinished() void mlMainWindow::OnConvertButton() { - mConvertButton->setDisabled(true); - QList> Commands; Commands.append(QPair(QString("%1/bin/linker_modtools.exe").arg(mToolsPath), QStringList() << "-language" << "english" << "-convertall" << "-verbose")); StartBuildThread(Commands); } +void mlMainWindow::OpenZoneEditor() +{ + InitZoneEditor(); + mZoneEditorGUIWidget->show(); +} + +void mlMainWindow::InitZoneEditor() +{ + QDockWidget *Dock = new QDockWidget(this,NULL); + QWidget* Widget = new QWidget(Dock); + QGridLayout* GridLayout = new QGridLayout(); + mZoneTextEdit = new QPlainTextEdit(); + QPushButton* ZoneSave = new QPushButton(); + + Dock->resize(QSize(460, 480)); + Dock->setWindowTitle("Zone Editor"); + Dock->setFloating(true); + Dock->setWidget(Widget); + + Widget->setLayout(GridLayout); + + ZoneSave->setText("Save"); + connect(ZoneSave, SIGNAL(clicked()), this, SLOT(OnSaveZone())); + + QFile ZoneFile(mZonePath); + if(!ZoneFile.open(QIODevice::ReadOnly)) + QMessageBox::information(this, "Error!", ZoneFile.errorString()); + + QTextStream Read(&ZoneFile); + while(!Read.atEnd()) { + mZoneTextEdit->appendPlainText(Read.readLine()); + } + ZoneFile.close(); + + GridLayout->addWidget(mZoneTextEdit,0,0); + GridLayout->addWidget(ZoneSave,1,0); + + mZoneEditorGUIWidget = Dock; +} + +void mlMainWindow::OnSaveZone() +{ + QFile ZoneFile(mZonePath); + ZoneFile.open(QIODevice::ReadWrite); + if(ZoneFile.isOpen()) + { + QTextStream Out(&ZoneFile); + Out << mZoneTextEdit->toPlainText(); + ZoneFile.close(); + mZoneEditorGUIWidget->close(); + return; + } + else + { + QMessageBox::warning(this,"Failed To Save Zone!","Failed To Save!: "+ZoneFile.errorString(),QMessageBox::Ok); + } +} + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); @@ -1606,7 +1674,7 @@ void Export2BinGroupBox::dropEvent(QDropEvent* event) { pathList.append(urlList.at(i).toLocalFile()); } - + QProcess* Process = new QProcess(); connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); @@ -1614,7 +1682,7 @@ void Export2BinGroupBox::dropEvent(QDropEvent* event) QString outputDir = parentWindow->mExport2BinTargetDirWidget->text(); parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); - + event->acceptProposedAction(); } } diff --git a/mlMainWindow.h b/mlMainWindow.h index 392d9e4..b07f04f 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -117,7 +117,10 @@ protected slots: void BuildFinished(); void ContextMenuRequested(); void SteamUpdate(); + void OnConvertButton(); + void OpenZoneEditor(); + void OnSaveZone(); protected: void closeEvent(QCloseEvent* Event); @@ -135,8 +138,11 @@ protected slots: void CreateToolBar(); void InitExport2BinGUI(); + void InitZoneEditor(); bool mTreyarchTheme; + bool mUseBuiltInEditor; + quint64 mFileId; QAction* mActionFileNew; @@ -152,6 +158,7 @@ protected slots: QTreeWidget* mFileListWidget; QPlainTextEdit* mOutputWidget; + QPlainTextEdit* mZoneTextEdit; QPushButton* mBuildButton; QPushButton* mDvarsButton; @@ -175,6 +182,7 @@ protected slots: mlConvertThread* mConvertThread; QDockWidget* mExport2BinGUIWidget; + QDockWidget* mZoneEditorGUIWidget; QString mBuildLanguage; QString mTitle; @@ -185,6 +193,7 @@ protected slots: QString mType; QString mGamePath; QString mToolsPath; + QString mZonePath; QStringList mShippedMapList; QStringList mTags; @@ -205,4 +214,4 @@ class Export2BinGroupBox : public QGroupBox public: Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); -}; +}; \ No newline at end of file From 432815f920b571907d99043bd44e22a284e9d097 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 15:23:50 +1200 Subject: [PATCH 03/35] Stuff --- mlMainWindow.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++- mlMainWindow.h | 32 ++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index d0a8e3e..96df577 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -352,7 +352,8 @@ mlMainWindow::mlMainWindow() connect(&mTimer, SIGNAL(timeout()), this, SLOT(SteamUpdate())); mTimer.start(1000); - + SyntaxTimer.setSingleShot(true); + connect(&SyntaxTimer,SIGNAL(timeout()),this,SLOT(UpdateSyntax())); PopulateFileList(); } @@ -1609,7 +1610,9 @@ void mlMainWindow::InitZoneEditor() Widget->setLayout(GridLayout); ZoneSave->setText("Save"); + connect(ZoneSave, SIGNAL(clicked()), this, SLOT(OnSaveZone())); + connect(mZoneTextEdit, SIGNAL(textChanged()),this,SLOT(OnTextChanged())); QFile ZoneFile(mZonePath); if(!ZoneFile.open(QIODevice::ReadOnly)) @@ -1619,6 +1622,7 @@ void mlMainWindow::InitZoneEditor() while(!Read.atEnd()) { mZoneTextEdit->appendPlainText(Read.readLine()); } + ZoneFile.close(); GridLayout->addWidget(mZoneTextEdit,0,0); @@ -1645,6 +1649,17 @@ void mlMainWindow::OnSaveZone() } } +void mlMainWindow::OnTextChanged() +{ + SyntaxTimer.start(500); +} + +void mlMainWindow::UpdateSyntax() +{ + Syntax* highlighter = new Syntax(mZoneTextEdit->document()); +} + + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); @@ -1690,4 +1705,74 @@ void Export2BinGroupBox::dropEvent(QDropEvent* event) void Export2BinGroupBox::dragLeaveEvent(QDragLeaveEvent* event) { event->accept(); +} + +Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) +{ + SyntaxRule CurrentRule; + + //SyntaxFormat.setForeground("#63a058"); + QStringList Patterns; + Patterns << "col_map" << "gfx_map" << "fx" << "sound" << "scriptparsetree" << "rawfile" << "scriptbundle" << "xcam"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + + foreach (const QString &pattern, Patterns) { + CurrentRule.RegExPattern = QRegExp(pattern); + CurrentRule.CharFormat = SyntaxFormat; + Rules.append(CurrentRule); + } + classFormat.setFontWeight(QFont::Bold); + classFormat.setForeground(Qt::darkMagenta); + CurrentRule.RegExPattern = QRegExp("\\bQ[A-Za-z]+\\b"); + CurrentRule.CharFormat = classFormat; + Rules.append(CurrentRule); + + quotationFormat.setForeground(Qt::darkGreen); + CurrentRule.RegExPattern = QRegExp("\".*\""); + CurrentRule.CharFormat = quotationFormat; + Rules.append(CurrentRule); + + functionFormat.setFontItalic(true); + functionFormat.setForeground(Qt::blue); + CurrentRule.RegExPattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); + CurrentRule.CharFormat = functionFormat; + Rules.append(CurrentRule); + singleLineCommentFormat.setForeground(Qt::red); + CurrentRule.RegExPattern = QRegExp("//[^\n]*"); + CurrentRule.CharFormat = singleLineCommentFormat; + Rules.append(CurrentRule); + + multiLineCommentFormat.setForeground(Qt::red); + + commentStartExpression = QRegExp("/\\*"); + commentEndExpression = QRegExp("\\*/"); +} + +void Syntax::highlightBlock(const QString &text) +{ + foreach (const SyntaxRule &rule, Rules) { + QRegExp expression(rule.RegExPattern); + int index = expression.indexIn(text); + while (index >= 0) { + int length = expression.matchedLength(); + setFormat(index, length, rule.CharFormat); + index = expression.indexIn(text, index + length); + } + } + setCurrentBlockState(0); + int startIndex = 0; + if (previousBlockState() != 1) + startIndex = commentStartExpression.indexIn(text); + while (startIndex >= 0) { + int endIndex = commentEndExpression.indexIn(text, startIndex); + int commentLength; + if (endIndex == -1) { + setCurrentBlockState(1); + commentLength = text.length() - startIndex; + } else { + commentLength = endIndex - startIndex + + commentEndExpression.matchedLength(); + } + setFormat(startIndex, commentLength, multiLineCommentFormat); + startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); + } } \ No newline at end of file diff --git a/mlMainWindow.h b/mlMainWindow.h index b07f04f..3b3880e 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -121,6 +121,8 @@ protected slots: void OnConvertButton(); void OpenZoneEditor(); void OnSaveZone(); + void OnTextChanged(); + void UpdateSyntax(); protected: void closeEvent(QCloseEvent* Event); @@ -200,6 +202,7 @@ protected slots: QStringList mRunDvars; QTimer mTimer; + QTimer SyntaxTimer; }; class Export2BinGroupBox : public QGroupBox @@ -214,4 +217,33 @@ class Export2BinGroupBox : public QGroupBox public: Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); +}; + +class Syntax : public QSyntaxHighlighter +{ + Q_OBJECT + +public: + Syntax(QTextDocument *parent = 0); + +protected: + void highlightBlock(const QString &text) override; + +private: + struct SyntaxRule + { + QRegExp RegExPattern; + QTextCharFormat CharFormat; + }; + QVector Rules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat SyntaxFormat; + QTextCharFormat classFormat; + QTextCharFormat singleLineCommentFormat; + QTextCharFormat multiLineCommentFormat; + QTextCharFormat quotationFormat; + QTextCharFormat functionFormat; }; \ No newline at end of file From f8cd67b13c19aac1a65169cdb4793ce59af679c7 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 16:38:51 +1200 Subject: [PATCH 04/35] Basic Syntax Highlighting --- mlMainWindow.cpp | 44 ++++++++++++++++++++++---------------------- mlMainWindow.h | 12 ++++++------ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 96df577..1e26e18 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -243,6 +243,7 @@ mlMainWindow::mlMainWindow() mBuildThread = NULL; mBuildLanguage = Settings.value("BuildLanguage", "english").toString(); mTreyarchTheme = Settings.value("UseDarkTheme", false).toBool(); + mUseBuiltInEditor= Settings.value("InBuiltEditor",false).toBool(); // Qt prefers '/' over '\\' mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); @@ -1711,38 +1712,37 @@ Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) { SyntaxRule CurrentRule; - //SyntaxFormat.setForeground("#63a058"); + KeyWordFormat.setForeground(QColor("#63a058")); QStringList Patterns; - Patterns << "col_map" << "gfx_map" << "fx" << "sound" << "scriptparsetree" << "rawfile" << "scriptbundle" << "xcam"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). - foreach (const QString &pattern, Patterns) { - CurrentRule.RegExPattern = QRegExp(pattern); - CurrentRule.CharFormat = SyntaxFormat; + foreach (const QString &Pattern, Patterns) { + CurrentRule.RegExPattern = QRegExp(Pattern); + CurrentRule.CharFormat = KeyWordFormat; Rules.append(CurrentRule); } - classFormat.setFontWeight(QFont::Bold); - classFormat.setForeground(Qt::darkMagenta); - CurrentRule.RegExPattern = QRegExp("\\bQ[A-Za-z]+\\b"); - CurrentRule.CharFormat = classFormat; + + IncludeFormat.setForeground(QColor("#fc8eac")); + CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. + CurrentRule.CharFormat = IncludeFormat; Rules.append(CurrentRule); - quotationFormat.setForeground(Qt::darkGreen); - CurrentRule.RegExPattern = QRegExp("\".*\""); - CurrentRule.CharFormat = quotationFormat; + QuoteFormat.setForeground(QColor("#6c6999")); + CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". + CurrentRule.CharFormat = QuoteFormat; Rules.append(CurrentRule); - functionFormat.setFontItalic(true); - functionFormat.setForeground(Qt::blue); - CurrentRule.RegExPattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); - CurrentRule.CharFormat = functionFormat; + SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); + CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. + CurrentRule.CharFormat = SingleLineCommentFormat; Rules.append(CurrentRule); - singleLineCommentFormat.setForeground(Qt::red); - CurrentRule.RegExPattern = QRegExp("//[^\n]*"); - CurrentRule.CharFormat = singleLineCommentFormat; + + PreProcessor.setForeground(QColor("#a09c85")); + CurrentRule.RegExPattern = QRegExp(">[^\n]*"); + CurrentRule.CharFormat = PreProcessor; Rules.append(CurrentRule); - multiLineCommentFormat.setForeground(Qt::red); - + MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); commentStartExpression = QRegExp("/\\*"); commentEndExpression = QRegExp("\\*/"); } @@ -1772,7 +1772,7 @@ void Syntax::highlightBlock(const QString &text) commentLength = endIndex - startIndex + commentEndExpression.matchedLength(); } - setFormat(startIndex, commentLength, multiLineCommentFormat); + setFormat(startIndex, commentLength, MultiLineCommentFormat); startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); } } \ No newline at end of file diff --git a/mlMainWindow.h b/mlMainWindow.h index 3b3880e..204cdee 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -240,10 +240,10 @@ class Syntax : public QSyntaxHighlighter QRegExp commentStartExpression; QRegExp commentEndExpression; - QTextCharFormat SyntaxFormat; - QTextCharFormat classFormat; - QTextCharFormat singleLineCommentFormat; - QTextCharFormat multiLineCommentFormat; - QTextCharFormat quotationFormat; - QTextCharFormat functionFormat; + QTextCharFormat KeyWordFormat; + QTextCharFormat QuoteFormat; + QTextCharFormat SingleLineCommentFormat; + QTextCharFormat MultiLineCommentFormat; + QTextCharFormat IncludeFormat; + QTextCharFormat PreProcessor; }; \ No newline at end of file From 16f206e592379c9e1410cb644d97ec3425ddcd43 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 17:18:38 +1200 Subject: [PATCH 05/35] Added Cancel button to Zone editor at requet by SE2Dev --- mlMainWindow.cpp | 35 ++++++++++++++++++++++++----------- mlMainWindow.h | 3 +++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 1e26e18..b044795 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1602,6 +1602,7 @@ void mlMainWindow::InitZoneEditor() QGridLayout* GridLayout = new QGridLayout(); mZoneTextEdit = new QPlainTextEdit(); QPushButton* ZoneSave = new QPushButton(); + QPushButton* ZoneCancel = new QPushButton(); Dock->resize(QSize(460, 480)); Dock->setWindowTitle("Zone Editor"); @@ -1611,45 +1612,57 @@ void mlMainWindow::InitZoneEditor() Widget->setLayout(GridLayout); ZoneSave->setText("Save"); + ZoneCancel->setText("Cancel"); connect(ZoneSave, SIGNAL(clicked()), this, SLOT(OnSaveZone())); + connect(ZoneCancel,SIGNAL(clicked()),this,SLOT(OnCancelZone())); connect(mZoneTextEdit, SIGNAL(textChanged()),this,SLOT(OnTextChanged())); - QFile ZoneFile(mZonePath); - if(!ZoneFile.open(QIODevice::ReadOnly)) - QMessageBox::information(this, "Error!", ZoneFile.errorString()); + ZoneFile = new QFile(mZonePath); + if(!ZoneFile->open(QIODevice::ReadOnly)) + QMessageBox::information(this, "Error!", ZoneFile->errorString()); - QTextStream Read(&ZoneFile); + QTextStream Read(ZoneFile); while(!Read.atEnd()) { mZoneTextEdit->appendPlainText(Read.readLine()); } - ZoneFile.close(); + ZoneFile->close(); GridLayout->addWidget(mZoneTextEdit,0,0); GridLayout->addWidget(ZoneSave,1,0); + GridLayout->addWidget(ZoneCancel,2,0); mZoneEditorGUIWidget = Dock; } void mlMainWindow::OnSaveZone() { - QFile ZoneFile(mZonePath); - ZoneFile.open(QIODevice::ReadWrite); - if(ZoneFile.isOpen()) + ZoneFile = new QFile(mZonePath); + ZoneFile->open(QIODevice::ReadWrite); + if(ZoneFile->isOpen()) { - QTextStream Out(&ZoneFile); + QTextStream Out(ZoneFile); Out << mZoneTextEdit->toPlainText(); - ZoneFile.close(); + ZoneFile->close(); mZoneEditorGUIWidget->close(); return; } else { - QMessageBox::warning(this,"Failed To Save Zone!","Failed To Save!: "+ZoneFile.errorString(),QMessageBox::Ok); + QMessageBox::warning(this,"Failed To Save Zone!","Failed To Save!: "+ZoneFile->errorString(),QMessageBox::Ok); } } +void mlMainWindow::OnCancelZone() +{ + if(ZoneFile->isOpen()) + ZoneFile->close(); + + mZoneEditorGUIWidget->close(); + return; +} + void mlMainWindow::OnTextChanged() { SyntaxTimer.start(500); diff --git a/mlMainWindow.h b/mlMainWindow.h index 204cdee..45393f3 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -123,6 +123,7 @@ protected slots: void OnSaveZone(); void OnTextChanged(); void UpdateSyntax(); + void OnCancelZone(); protected: void closeEvent(QCloseEvent* Event); @@ -203,6 +204,8 @@ protected slots: QTimer mTimer; QTimer SyntaxTimer; + + QFile* ZoneFile; }; class Export2BinGroupBox : public QGroupBox From d0ca540b833e702d0aa82185dbc718f32232948e Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 19:17:19 +1200 Subject: [PATCH 06/35] Cleaned up some code, added devmap dvar --- mlMainWindow.cpp | 18 ++++++++++++++---- mlMainWindow.h | 1 - 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index b044795..4511a9c 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -26,6 +26,8 @@ const int AppId = 311210; const char* gLanguages[] = { "english", "french", "italian", "spanish", "german", "portuguese", "russian", "polish", "japanese", "traditionalchinese", "simplifiedchinese", "englisharabic" }; const char* gTags[] = { "Animation", "Audio", "Character", "Map", "Mod", "Mode", "Model", "Multiplayer", "Scorestreak", "Skin", "Specialist", "Texture", "UI", "Vehicle", "Visual Effect", "Weapon", "WIP", "Zombies" }; +QStringList mShippedMapList; + dvar_s gDvars[] = { {"ai_disableSpawn", "Disable AI from spawning", DVAR_VALUE_BOOL}, {"developer", "Run developer mode", DVAR_VALUE_INT, 0, 2}, @@ -35,7 +37,8 @@ dvar_s gDvars[] = { {"connect", "Connect to a specific server", DVAR_VALUE_STRING, NULL, NULL, true}, {"set_gametype", "Set a gametype to load with map", DVAR_VALUE_STRING, NULL, NULL, true}, {"splitscreen", "Enable splitscreen", DVAR_VALUE_BOOL}, - {"splitscreen_playerCount", "Allocate the number of instances for splitscreen", DVAR_VALUE_INT, 0, 2} + {"splitscreen_playerCount", "Allocate the number of instances for splitscreen", DVAR_VALUE_INT, 0, 2}, + {"devmap","Launch to this map using devmap",DVAR_VALUE_COMBO,0,0,true}, }; enum mlItemType { @@ -440,6 +443,8 @@ void mlMainWindow::CreateToolBar() ToolBar->addAction(mActionFileLevelEditor); ToolBar->addAction(mActionFileExport2Bin); + ToolBar->setMovable(false); + addToolBar(Qt::TopToolBarArea, ToolBar); } @@ -1263,6 +1268,9 @@ void mlMainWindow::OnEditDvars() case DVAR_VALUE_STRING: dvarValue = Dvar::setDvarSetting(dvar, (QLineEdit*)widget); break; + case DVAR_VALUE_COMBO: + dvarValue = Dvar::setDvarSetting(dvar,(QComboBox*)widget); + break; } if(!dvarValue.toLatin1().isEmpty()) @@ -1271,11 +1279,14 @@ void mlMainWindow::OnEditDvars() mRunDvars << "+set" << dvarName; else // hack for cmds mRunDvars << QString("+%1").arg(dvarName); + mRunDvars << dvarValue; } size++; ++it; } + + } void mlMainWindow::UpdateWorkshopItem() @@ -1629,9 +1640,9 @@ void mlMainWindow::InitZoneEditor() ZoneFile->close(); - GridLayout->addWidget(mZoneTextEdit,0,0); + GridLayout->addWidget(mZoneTextEdit,0,0,1,2); GridLayout->addWidget(ZoneSave,1,0); - GridLayout->addWidget(ZoneCancel,2,0); + GridLayout->addWidget(ZoneCancel,1,1); mZoneEditorGUIWidget = Dock; } @@ -1673,7 +1684,6 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } - Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); diff --git a/mlMainWindow.h b/mlMainWindow.h index 45393f3..963b0ea 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -198,7 +198,6 @@ protected slots: QString mToolsPath; QString mZonePath; - QStringList mShippedMapList; QStringList mTags; QStringList mRunDvars; From 8c7de0260378bf0326f6b0a8f0b01b7d3e28cda7 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 22:03:45 +1200 Subject: [PATCH 07/35] zone file wasn't saving, damn QT with the file handling --- mlMainWindow.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 4511a9c..81e4c53 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1650,19 +1650,20 @@ void mlMainWindow::InitZoneEditor() void mlMainWindow::OnSaveZone() { ZoneFile = new QFile(mZonePath); - ZoneFile->open(QIODevice::ReadWrite); - if(ZoneFile->isOpen()) + if(ZoneFile->open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream Out(ZoneFile); - Out << mZoneTextEdit->toPlainText(); - ZoneFile->close(); - mZoneEditorGUIWidget->close(); - return; + Out << (mZoneTextEdit->toPlainText()); + Out.flush(); + mOutputWidget->appendPlainText(Out.readLine()); } else { QMessageBox::warning(this,"Failed To Save Zone!","Failed To Save!: "+ZoneFile->errorString(),QMessageBox::Ok); } + + ZoneFile->close(); + mZoneEditorGUIWidget->close(); } void mlMainWindow::OnCancelZone() From ed14baae678c84040dc94aa0dcd63774bb559772 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 6 May 2017 23:08:25 +1200 Subject: [PATCH 08/35] added some dvar stuff, added map dvar, witch populates normal maps, then gives the ability to enter a custom one in. --- dvar.cpp | 16 ++++++++++++++++ dvar.h | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dvar.cpp b/dvar.cpp index be01b1e..87a9606 100644 --- a/dvar.cpp +++ b/dvar.cpp @@ -12,6 +12,7 @@ Dvar::Dvar(dvar_s _dvar, QTreeWidget *_dvarTree) : dvar(_dvar) QCheckBox* checkBox; QSpinBox* spinBox; QLineEdit* textBox; + QComboBox* comboBox; switch(this->dvar.type) { @@ -36,6 +37,13 @@ Dvar::Dvar(dvar_s _dvar, QTreeWidget *_dvarTree) : dvar(_dvar) textBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); _dvarTree->setItemWidget(Item, 1, textBox); break; + case DVAR_VALUE_COMBO: + comboBox = new QComboBox(); + QStringList mShippedMapList; + mShippedMapList << "mp_aerospace" << "mp_apartments" << "mp_arena" << "mp_banzai" << "mp_biodome" << "mp_chinatown" << "mp_city" << "mp_conduit" << "mp_crucible" << "mp_cryogen" << "mp_ethiopia" << "mp_freerun_01" << "mp_freerun_02" << "mp_freerun_03" << "mp_freerun_04" << "mp_havoc" << "mp_infection" << "mp_kung_fu" << "mp_metro" << "mp_miniature" << "mp_nuketown_x" << "mp_redwood" << "mp_rise" << "mp_rome" << "mp_ruins" << "mp_sector" << "mp_shrine" << "mp_skyjacked" << "mp_spire" << "mp_stronghold" << "mp_veiled" << "mp_waterpark" << "mp_western" << "zm_castle" << "zm_factory" << "zm_genesis" << "zm_island" << "zm_levelcommon" << "zm_stalingrad" << "zm_zod"; + comboBox->addItems(mShippedMapList); + comboBox->setEditable(true); + _dvarTree->setItemWidget(Item,1,comboBox); } } @@ -78,3 +86,11 @@ QString Dvar::setDvarSetting(dvar_s _dvar, QLineEdit* _lineEdit) return Settings.value(QString("dvar_%1").arg(_dvar.name)).toString(); } + +QString Dvar::setDvarSetting(dvar_s _dvar, QComboBox* _lineEdit) +{ + QSettings Settings; + Settings.setValue(QString("dvar_%1").arg(_dvar.name), _lineEdit->currentText()); + return Settings.value(QString("dvar_%1").arg(_dvar.name)).toString(); + +} \ No newline at end of file diff --git a/dvar.h b/dvar.h index 14def60..dd9c87a 100644 --- a/dvar.h +++ b/dvar.h @@ -4,7 +4,8 @@ enum DvarType { DVAR_VALUE_BOOL, DVAR_VALUE_INT, - DVAR_VALUE_STRING + DVAR_VALUE_STRING, + DVAR_VALUE_COMBO }; struct dvar_s @@ -21,6 +22,7 @@ class Dvar { private: dvar_s dvar; + public: Dvar(); @@ -30,6 +32,7 @@ class Dvar static QString setDvarSetting(dvar_s, QCheckBox*); static QString setDvarSetting(dvar_s, QSpinBox*); static QString setDvarSetting(dvar_s, QLineEdit*); + static QString setDvarSetting(dvar_s, QComboBox*); static dvar_s findDvar(QString, QTreeWidget*, dvar_s*, int); }; From 5f15bdc6aed57a4ee24a9f54a26901f7012f8f1b Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 12 May 2017 18:52:37 +1200 Subject: [PATCH 09/35] Fix maps not compiling and a few other bug fixes (reverted back code) --- ModLauncher.vcxproj | 12 ++++++++--- mlMainWindow.cpp | 46 ++++++++++++++++++++++++------------------ mlMainWindow.h | 21 +++++++++++++++++++ resources.qrc | 1 + resources/devhead.png | Bin 0 -> 18500 bytes 5 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 resources/devhead.png diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index 8afec35..d1e2aa9 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -70,7 +70,7 @@ Application false - v120 + v110 false @@ -107,6 +107,8 @@ $(ProjectName)_d$(TA_EXECUTABLE_SUFFIX) true $(TA_TOOLS_PATH)\bin\ + D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) + D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) false @@ -126,12 +128,16 @@ $(TA_TOOLS_PATH)\bin\ + D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) + D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) $(Platform)\$(Configuration)\ $(ProjectName)$(TA_EXECUTABLE_SUFFIX) $(TA_TOOLS_PATH)\bin\ + D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) + D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) @@ -420,7 +426,7 @@ Moc%27ing mlMainWindow.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUSE_CUSTOM_QT=1 -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" @@ -460,7 +466,7 @@ - + \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 81e4c53..73fd0ed 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -95,8 +95,7 @@ void mlBuildThread::run() mSuccess = Success; } -mlConvertThread::mlConvertThread(QStringList& Files, QString& OutputDir, bool IgnoreErrors, bool OverwriteFiles) - : mFiles(Files), mOutputDir(OutputDir), mSuccess(false), mCancel(false), mIgnoreErrors(IgnoreErrors), mOverwrite(OverwriteFiles) +mlConvertThread::mlConvertThread(QStringList& Files, QString& OutputDir, bool IgnoreErrors, bool OverwriteFiles) : mFiles(Files), mOutputDir(OutputDir), mSuccess(false), mCancel(false), mIgnoreErrors(IgnoreErrors), mOverwrite(OverwriteFiles) { } @@ -249,10 +248,16 @@ mlMainWindow::mlMainWindow() mUseBuiltInEditor= Settings.value("InBuiltEditor",false).toBool(); // Qt prefers '/' over '\\' - mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); - mGamePath.chop(1); - mToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); - mToolsPath.chop(1); + // Deemed Broken by Johnatohn - + /* + mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); + mGamePath.chop(1); + mToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); + mToolsPath.chop(1); + */ + mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); + mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); + UpdateTheme(); @@ -266,6 +271,8 @@ mlMainWindow::mlMainWindow() CreateToolBar(); mExport2BinGUIWidget = NULL; + mGDTCreatorGUIWidget = NULL; + mZoneEditorGUIWidget = NULL; QSplitter* CentralWidget = new QSplitter(); CentralWidget->setOrientation(Qt::Vertical); @@ -380,10 +387,14 @@ void mlMainWindow::CreateActions() mActionFileLevelEditor->setToolTip("Level Editor"); connect(mActionFileLevelEditor, SIGNAL(triggered()), this, SLOT(OnFileLevelEditor())); - mActionFileExport2Bin = new QAction(QIcon(":/resources/Export2Bin.png"), "&Export2Bin GUI", this); + mActionFileExport2Bin = new QAction(QIcon(":/resources/devhead.png"), "&Export2Bin GUI", this); mActionFileExport2Bin->setShortcut(QKeySequence("Ctrl+E")); connect(mActionFileExport2Bin, SIGNAL(triggered()), this, SLOT(OnFileExport2Bin())); + mActionCreateGdt = new QAction(QIcon(":/resources/Export2Bin.png"), "&GDT Creator", this); + mActionCreateGdt->setShortcut(QKeySequence("Ctrl+G")); + connect(mActionCreateGdt, SIGNAL(triggered()), this, SLOT(OnFileGDTCreator())); + mActionFileExit = new QAction("E&xit", this); connect(mActionFileExit, SIGNAL(triggered()), this, SLOT(close())); @@ -400,6 +411,7 @@ void mlMainWindow::CreateActions() mActionHelpAbout = new QAction("&About...", this); connect(mActionHelpAbout, SIGNAL(triggered()), this, SLOT(OnHelpAbout())); + } void mlMainWindow::CreateMenu() @@ -442,6 +454,7 @@ void mlMainWindow::CreateToolBar() ToolBar->addAction(mActionFileAssetEditor); ToolBar->addAction(mActionFileLevelEditor); ToolBar->addAction(mActionFileExport2Bin); + ToolBar->addAction(mActionCreateGdt); ToolBar->setMovable(false); @@ -529,20 +542,12 @@ void mlMainWindow::UpdateDB() void mlMainWindow::StartBuildThread(const QList>& Commands) { - if(mBuildThread == NULL) - { mBuildButton->setText("Cancel"); - mOutputWidget->clear(); mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); mBuildThread->start(); - } - else - { - QMessageBox::information(this,"Task In Progress","There is already a something running. Please wait.",QMessageBox::Button::Ok); - } } void mlMainWindow::StartConvertThread(QStringList& pathList, QString& outputDir, bool allowOverwrite) @@ -859,10 +864,10 @@ void mlMainWindow::OnEditBuild() else Args << "-navmesh" << "-navvolume"; - Args << "-loadFrom" << QString("%1/map_source/%2/%3.map").arg(mGamePath, MapName.left(2), MapName); - Args << QString("%1/share/raw/maps/%2/%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); + Args << "-loadFrom" << QString("%1\\map_source\\%2\\%3.map").arg(mGamePath, MapName.left(2), MapName); + Args << QString("%1\\share\\raw\\maps\\%2\\%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); - Commands.append(QPair(QString("%1/bin/cod2map64.exe").arg(mToolsPath), Args)); + Commands.append(QPair(QString("%1\\bin\\cod2map64.exe").arg(mToolsPath), Args)); } if (mLightEnabledWidget->isChecked()) @@ -1637,7 +1642,7 @@ void mlMainWindow::InitZoneEditor() while(!Read.atEnd()) { mZoneTextEdit->appendPlainText(Read.readLine()); } - + ZoneFile->close(); GridLayout->addWidget(mZoneTextEdit,0,0,1,2); @@ -1685,6 +1690,7 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); @@ -1760,7 +1766,7 @@ Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. CurrentRule.CharFormat = SingleLineCommentFormat; Rules.append(CurrentRule); - + PreProcessor.setForeground(QColor("#a09c85")); CurrentRule.RegExPattern = QRegExp(">[^\n]*"); CurrentRule.CharFormat = PreProcessor; diff --git a/mlMainWindow.h b/mlMainWindow.h index 963b0ea..7085841 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -80,6 +80,7 @@ class mlMainWindow : public QMainWindow Q_OBJECT friend class Export2BinGroupBox; + friend class GDTCreatorGroupBox; public: mlMainWindow(); @@ -142,6 +143,7 @@ protected slots: void InitExport2BinGUI(); void InitZoneEditor(); + void InitCreatorGUIWidget(); bool mTreyarchTheme; bool mUseBuiltInEditor; @@ -157,6 +159,7 @@ protected slots: QAction* mActionEditPublish; QAction* mActionEditOptions; QAction* mActionHelpAbout; + QAction* mActionCreateGdt; QTreeWidget* mFileListWidget; @@ -173,12 +176,15 @@ protected slots: QCheckBox* mRunEnabledWidget; QCheckBox* mIgnoreErrorsWidget; QCheckBox* mExport2BinOverwriteWidget; + QCheckBox* mGDTCreateOverwriteWidget; + QCheckBox* mOpenAPEAfterCreation; QComboBox* mCompileModeWidget; QComboBox* mLightQualityWidget; QLineEdit* mRunOptionsWidget; QLineEdit* mExport2BinTargetDirWidget; + QLineEdit* mGDTCreateTargetDir; mlBuildThread* mBuildThread; @@ -186,6 +192,7 @@ protected slots: QDockWidget* mExport2BinGUIWidget; QDockWidget* mZoneEditorGUIWidget; + QDockWidget* mGDTCreatorGUIWidget; QString mBuildLanguage; QString mTitle; @@ -221,6 +228,20 @@ class Export2BinGroupBox : public QGroupBox Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); }; +class GDTCreatorGroupBox : public QGroupBox +{ +private: + mlMainWindow* parentWindow; + +protected: + void dragEnterEvent(QDragEnterEvent* event); + void dragLeaveEvent(QDragLeaveEvent* event); + void dropEvent(QDropEvent *event); + +public: + GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); +}; + class Syntax : public QSyntaxHighlighter { Q_OBJECT diff --git a/resources.qrc b/resources.qrc index f718214..f274793 100644 --- a/resources.qrc +++ b/resources.qrc @@ -11,5 +11,6 @@ stylesheet/stylesheet/checkbox.png stylesheet/stylesheet/down_arrow.png stylesheet/stylesheet/handle.png + resources/devhead.png diff --git a/resources/devhead.png b/resources/devhead.png new file mode 100644 index 0000000000000000000000000000000000000000..ce7890c442a5b9cdb8daaf43775115704c212ac9 GIT binary patch literal 18500 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 D%${Kx literal 0 HcmV?d00001 From 097e744b0c645b5662ce591e2473a418851ebf0c Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 12 May 2017 19:50:23 +1200 Subject: [PATCH 10/35] adding fast gdt creator, so you don't need to fluff around in APE, but you can auto open APE after creating it to fine tune your settings, basically making it easier for people who export models --- mlMainWindow.cpp | 118 ++++++++++++++++--- mlMainWindow.h | 3 +- resources.qrc | 2 +- resources/{Export2Bin.png => GDTCreator.png} | Bin 4 files changed, 107 insertions(+), 16 deletions(-) rename resources/{Export2Bin.png => GDTCreator.png} (100%) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 73fd0ed..cde9e37 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -250,10 +250,10 @@ mlMainWindow::mlMainWindow() // Qt prefers '/' over '\\' // Deemed Broken by Johnatohn - /* - mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); - mGamePath.chop(1); - mToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); - mToolsPath.chop(1); + mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); + mGamePath.chop(1); + mToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); + mToolsPath.chop(1); */ mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); @@ -391,7 +391,7 @@ void mlMainWindow::CreateActions() mActionFileExport2Bin->setShortcut(QKeySequence("Ctrl+E")); connect(mActionFileExport2Bin, SIGNAL(triggered()), this, SLOT(OnFileExport2Bin())); - mActionCreateGdt = new QAction(QIcon(":/resources/Export2Bin.png"), "&GDT Creator", this); + mActionCreateGdt = new QAction(QIcon(":/resources/GDTCreator.png"), "&GDT Creator", this); mActionCreateGdt->setShortcut(QKeySequence("Ctrl+G")); connect(mActionCreateGdt, SIGNAL(triggered()), this, SLOT(OnFileGDTCreator())); @@ -513,6 +513,33 @@ void mlMainWindow::InitExport2BinGUI() mExport2BinGUIWidget = dock; } +void mlMainWindow::InitGDTCreator() +{ + QDockWidget *dock = new QDockWidget(this, NULL); + dock->setWindowTitle("Quick GDT Creator"); + dock->setFloating(true); + + QWidget* widget = new QWidget(dock); + QGridLayout* gridLayout = new QGridLayout(); + widget->setLayout(gridLayout); + dock->setWidget(widget); + + GDTCreatorGroupBox* groupBox = new GDTCreatorGroupBox(dock, this); + gridLayout->addWidget(groupBox, 0, 0); + + QLabel* label = new QLabel("Drag Files Here", groupBox); + label->setAlignment(Qt::AlignCenter); + QVBoxLayout* groupBoxLayout = new QVBoxLayout(groupBox); + groupBoxLayout->addWidget(label); + groupBox->setLayout(groupBoxLayout); + //Do things + groupBox->setAcceptDrops(true); + + dock->resize(QSize(256, 256)); + + mGDTCreatorGUIWidget = dock; +} + void mlMainWindow::closeEvent(QCloseEvent* Event) { QSettings Settings; @@ -542,12 +569,12 @@ void mlMainWindow::UpdateDB() void mlMainWindow::StartBuildThread(const QList>& Commands) { - mBuildButton->setText("Cancel"); + mBuildButton->setText("Cancel"); - mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); - connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); - connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); - mBuildThread->start(); + mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); + connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); + connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); + mBuildThread->start(); } void mlMainWindow::StartConvertThread(QStringList& pathList, QString& outputDir, bool allowOverwrite) @@ -676,6 +703,17 @@ void mlMainWindow::OnFileExport2Bin() mExport2BinGUIWidget->isVisible() ? mExport2BinGUIWidget->hide() : mExport2BinGUIWidget->show(); } +void mlMainWindow::OnFileGDTCreator() +{ + if (mGDTCreatorGUIWidget == NULL) + { + InitGDTCreator(); + mGDTCreatorGUIWidget->hide(); + } + + mGDTCreatorGUIWidget->isVisible() ? mGDTCreatorGUIWidget->hide() : mGDTCreatorGUIWidget->show(); +} + void mlMainWindow::OnFileNew() { QDir TemplatesFolder(QString("%1/rex/templates").arg(mToolsPath)); @@ -865,7 +903,7 @@ void mlMainWindow::OnEditBuild() Args << "-navmesh" << "-navvolume"; Args << "-loadFrom" << QString("%1\\map_source\\%2\\%3.map").arg(mGamePath, MapName.left(2), MapName); - Args << QString("%1\\share\\raw\\maps\\%2\\%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); + Args << QString("%1\\share\\raw\\maps\\%2\\%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); Commands.append(QPair(QString("%1\\bin\\cod2map64.exe").arg(mToolsPath), Args)); } @@ -1155,7 +1193,7 @@ void mlMainWindow::OnEditOptions() Checkbox->setChecked(Settings.value("UseDarkTheme", false).toBool()); Layout->addWidget(Checkbox); - QCheckBox* InBuiltEditor = new QCheckBox("Use Inbult Zone Editor"); + QCheckBox* InBuiltEditor = new QCheckBox("Use Built-In Zone Editor"); InBuiltEditor->setToolTip("Toggle between using default zone file editor, or the inbult one. (BETA)"); InBuiltEditor->setChecked(Settings.value("InBuiltEditor",false).toBool()); Layout->addWidget(InBuiltEditor); @@ -1607,8 +1645,13 @@ void mlMainWindow::OnConvertButton() void mlMainWindow::OpenZoneEditor() { - InitZoneEditor(); - mZoneEditorGUIWidget->show(); + if (mZoneEditorGUIWidget == NULL) + { + InitZoneEditor(); + mZoneEditorGUIWidget->hide(); + } + + mZoneEditorGUIWidget->isVisible() ? mZoneEditorGUIWidget->hide() : mZoneEditorGUIWidget->show(); } void mlMainWindow::InitZoneEditor() @@ -1691,6 +1734,53 @@ void mlMainWindow::UpdateSyntax() } +GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) +{ + this->setAcceptDrops(true); +} + +void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) +{ + event->acceptProposedAction(); +} + +void GDTCreatorGroupBox::dropEvent(QDropEvent* event) +{ + const QMimeData* mimeData = event->mimeData(); + + if (parentWindow == NULL) + { + return; + } + + if (mimeData->hasUrls()) + { + QStringList pathList; + QList urlList = mimeData->urls(); + + QDir working_dir(parentWindow->mToolsPath); + for (int i = 0; i < urlList.size(); i++) + { + pathList.append(urlList.at(i).toLocalFile()); + } + + QProcess* Process = new QProcess(); + connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); + + bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); + + QString outputDir = parentWindow->mGDTCreateTargetDir->text(); + parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); + + event->acceptProposedAction(); + } +} + +void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) +{ + event->accept(); +} + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); diff --git a/mlMainWindow.h b/mlMainWindow.h index 7085841..68af8b9 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -102,6 +102,7 @@ protected slots: void OnFileAssetEditor(); void OnFileLevelEditor(); void OnFileExport2Bin(); + void OnFileGDTCreator(); void OnEditBuild(); void OnEditPublish(); void OnEditOptions(); @@ -143,7 +144,7 @@ protected slots: void InitExport2BinGUI(); void InitZoneEditor(); - void InitCreatorGUIWidget(); + void InitGDTCreator(); bool mTreyarchTheme; bool mUseBuiltInEditor; diff --git a/resources.qrc b/resources.qrc index f274793..86714c3 100644 --- a/resources.qrc +++ b/resources.qrc @@ -2,7 +2,6 @@ resources/AssetEditor.png resources/BlackOps3.png - resources/Export2Bin.png resources/Radiant.png resources/ModLauncher.png resources/Go.png @@ -12,5 +11,6 @@ stylesheet/stylesheet/down_arrow.png stylesheet/stylesheet/handle.png resources/devhead.png + resources/GDTCreator.png diff --git a/resources/Export2Bin.png b/resources/GDTCreator.png similarity index 100% rename from resources/Export2Bin.png rename to resources/GDTCreator.png From 682afea7c5dc83a5ff5eded52f5ee2ca90e68faa Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 12 May 2017 20:15:09 +1200 Subject: [PATCH 11/35] don't want people using my settings, so I am removing my vcxprof file --- ModLauncher.vcxproj | 472 -------------------------------------------- 1 file changed, 472 deletions(-) delete mode 100644 ModLauncher.vcxproj diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj deleted file mode 100644 index d1e2aa9..0000000 --- a/ModLauncher.vcxproj +++ /dev/null @@ -1,472 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - External_Release - Win32 - - - External_Release - x64 - - - Release - Win32 - - - Release - x64 - - - - {5703602A-18C8-4781-8435-404AEFCAFEAA} - Qt4VSv1.0 - ModLauncher - - - - Application - true - v110 - - - - - Application - true - v110 - - - - Application - false - v110 - false - - - - - Application - false - v120 - false - - - - Application - false - v110 - false - - - - Application - false - v110 - false - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(TA_TOOLS_PATH)\bin\ - $(Platform)\$(Configuration)\ - $(ProjectName)$(TA_EXECUTABLE_SUFFIX) - - - $(Platform)\$(Configuration)\ - $(ProjectName)_d$(TA_EXECUTABLE_SUFFIX) - true - $(TA_TOOLS_PATH)\bin\ - D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) - D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) - - - false - $(TA_TOOLS_PATH)\bin\ - $(Platform)\$(Configuration)\ - $(ProjectName)$(TA_EXECUTABLE_SUFFIX) - - - false - $(TA_TOOLS_PATH)\bin\ - $(Platform)\$(Configuration)\ - $(ProjectName)$(TA_EXECUTABLE_SUFFIX) - - - $(Platform)\$(Configuration)\ - $(ProjectName)$(TA_EXECUTABLE_SUFFIX) - - - $(TA_TOOLS_PATH)\bin\ - D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) - D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) - - - $(Platform)\$(Configuration)\ - $(ProjectName)$(TA_EXECUTABLE_SUFFIX) - - $(TA_TOOLS_PATH)\bin\ - D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) - D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) - - - - Use - Level1 - Disabled - WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) - - - $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) - true - - - Windows - true - - - - - Use - Level1 - Disabled - WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) - - - $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) - true - - - Windows - true - $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64; - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - mainCRTStartup - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - Level1 - Use - MaxSpeed - - - true - USE_CUSTOM_QT=1;UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) - - - $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) - true - - - Windows - true - true - true - $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - mainCRTStartup - - - true - - - - - Level1 - Use - MaxSpeed - - - true - UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) - - - $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) - true - - - Windows - true - true - true - $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - mainCRTStartup - - - true - - - - - - - Performing Custom Build Tools - - - - - - - Performing Custom Build Tools - - - - - - - - - Performing Custom Build Tools - Performing Custom Build Tools - - - - - - - - - - - - - Performing Custom Build Tools - Performing Custom Build Tools - - - - - - - - - - - - - - true - true - true - true - - - true - true - true - true - - - - - - - - - - - - - - - - - true - true - true - true - - - - - Create - Create - Create - Create - Create - Create - - - - - - - - - - Performing Custom Build Tools - - - - - - - Performing Custom Build Tools - - - - - - - - - Performing Custom Build Tools - Performing Custom Build Tools - - - - - - - - - - - - - Performing Custom Build Tools - Performing Custom Build Tools - - - - - - - - - - - - - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing mlMainWindow.h... - GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-fstdafx.h" "-f../../mlMainWindow.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing mlMainWindow.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing mlMainWindow.h... - Moc%27ing mlMainWindow.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing mlMainWindow.h... - Moc%27ing mlMainWindow.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUSE_CUSTOM_QT=1 -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" - - - - - %(FullPath);%(AdditionalInputs) - Rcc%27ing %(Identity)... - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - %(FullPath);%(AdditionalInputs) - Rcc%27ing %(Identity)... - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - %(FullPath);%(AdditionalInputs) - %(FullPath);%(AdditionalInputs) - Rcc%27ing %(Identity)... - Rcc%27ing %(Identity)... - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - %(FullPath);%(AdditionalInputs) - %(FullPath);%(AdditionalInputs) - Rcc%27ing %(Identity)... - Rcc%27ing %(Identity)... - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp - - - - - - - - - - - - - - \ No newline at end of file From 9381940f0c695d3f691a030e60da5ca88bfd3b39 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 17:13:47 +1200 Subject: [PATCH 12/35] csv editor --- ModLauncher.sln | 2 +- ModLauncher.vcxproj | 468 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 ModLauncher.vcxproj diff --git a/ModLauncher.sln b/ModLauncher.sln index 246b1f0..27a9883 100644 --- a/ModLauncher.sln +++ b/ModLauncher.sln @@ -21,6 +21,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = external + Qt5Version = qt EndGlobalSection EndGlobal diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj new file mode 100644 index 0000000..5eb13aa --- /dev/null +++ b/ModLauncher.vcxproj @@ -0,0 +1,468 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + External_Release + Win32 + + + External_Release + x64 + + + Release + Win32 + + + Release + x64 + + + + {5703602A-18C8-4781-8435-404AEFCAFEAA} + Qt4VSv1.0 + ModLauncher + + + + Application + true + v110 + + + + + Application + true + v110 + + + + Application + false + v110 + false + + + + + Application + false + v120 + false + + + + Application + false + v110 + false + + + + Application + false + v110 + false + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(Platform)\$(Configuration)\ + $(ProjectName)_d$(TA_EXECUTABLE_SUFFIX) + true + $(TA_TOOLS_PATH)\bin\ + + + false + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + false + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(TA_TOOLS_PATH)\bin\ + + + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + $(TA_TOOLS_PATH)\bin\ + D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) + D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) + + + + Use + Level1 + Disabled + WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + true + + + Windows + true + + + + + Use + Level1 + Disabled + WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64; + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + mainCRTStartup + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level1 + Use + MaxSpeed + + + true + USE_CUSTOM_QT=1;UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) + %(AdditionalDependencies) + mainCRTStartup + + + true + + + + + Level1 + Use + MaxSpeed + + + true + UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) + %(AdditionalDependencies) + mainCRTStartup + + + true + + + + + + + Performing Custom Build Tools + + + + + + + Performing Custom Build Tools + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + + + + + + + true + true + true + true + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + + Performing Custom Build Tools + + + + + + + Performing Custom Build Tools + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + + + + + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + + + + + + + + + + + + + + \ No newline at end of file From a6227ea8b52e4448ee0fab7dd0294966bd41396b Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 17:13:47 +1200 Subject: [PATCH 13/35] csv editor --- ModLauncher.sln | 2 +- ModLauncher.vcxproj | 468 ++++++++++++++++++++++++++++++++++++++++++++ mlMainWindow.cpp | 2 +- 3 files changed, 470 insertions(+), 2 deletions(-) create mode 100644 ModLauncher.vcxproj diff --git a/ModLauncher.sln b/ModLauncher.sln index 246b1f0..27a9883 100644 --- a/ModLauncher.sln +++ b/ModLauncher.sln @@ -21,6 +21,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = external + Qt5Version = qt EndGlobalSection EndGlobal diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj new file mode 100644 index 0000000..5eb13aa --- /dev/null +++ b/ModLauncher.vcxproj @@ -0,0 +1,468 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + External_Release + Win32 + + + External_Release + x64 + + + Release + Win32 + + + Release + x64 + + + + {5703602A-18C8-4781-8435-404AEFCAFEAA} + Qt4VSv1.0 + ModLauncher + + + + Application + true + v110 + + + + + Application + true + v110 + + + + Application + false + v110 + false + + + + + Application + false + v120 + false + + + + Application + false + v110 + false + + + + Application + false + v110 + false + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(Platform)\$(Configuration)\ + $(ProjectName)_d$(TA_EXECUTABLE_SUFFIX) + true + $(TA_TOOLS_PATH)\bin\ + + + false + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + false + $(TA_TOOLS_PATH)\bin\ + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + + $(TA_TOOLS_PATH)\bin\ + + + $(Platform)\$(Configuration)\ + $(ProjectName)$(TA_EXECUTABLE_SUFFIX) + + $(TA_TOOLS_PATH)\bin\ + D:\Software\Qt\5.1.0\msvc2012_64\include\QtANGLE;D:\Johnathon\Documents\GitHub\steamworks\sdk\public\steam;$(IncludePath) + D:\Johnathon\Documents\GitHub\steamworks\sdk\redistributable_bin\win64;$(LibraryPath) + + + + Use + Level1 + Disabled + WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + true + + + Windows + true + + + + + Use + Level1 + Disabled + WIN32;_DEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64; + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + mainCRTStartup + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;QT_DLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level1 + Use + MaxSpeed + + + true + USE_CUSTOM_QT=1;UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) + %(AdditionalDependencies) + mainCRTStartup + + + true + + + + + Level1 + Use + MaxSpeed + + + true + UTILS;RELEASE_BUILD;AS_NO_USER_ALLOC;WIN32;QT_DLL;NDEBUG;%(PreprocessorDefinitions) + + + $(TA_CODE_PATH);$(TA_CODE_PATH)\tools;.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(TL_SDK)/Steamworks/sdk-1.37/public/steam;$(SolutionDir)/sdk/public/steam;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + true + $(QTDIR)\lib;$(TA_TOOLS_PATH)\bin;$(TL_SDK)/Steamworks/sdk-1.37/redistributable_bin/win64;$(SolutionDir)/sdk/redistributable_bin/win64;%(AdditionalLibraryDirectories) + %(AdditionalDependencies) + mainCRTStartup + + + true + + + + + + + Performing Custom Build Tools + + + + + + + Performing Custom Build Tools + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + + + + + + + true + true + true + true + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + + Performing Custom Build Tools + + + + + + + Performing Custom Build Tools + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + Performing Custom Build Tools + Performing Custom Build Tools + + + + + + + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL "-fstdafx.h" "-f../../mlMainWindow.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing mlMainWindow.h... + Moc%27ing mlMainWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" "-fstdafx.h" "-f../../mlMainWindow.h" + + + + + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + Rcc%27ing %(Identity)... + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o GeneratedFiles\qrc_%(Filename).cpp + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index cde9e37..a8a2465 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1834,7 +1834,7 @@ Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) KeyWordFormat.setForeground(QColor("#63a058")); QStringList Patterns; - Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :) foreach (const QString &Pattern, Patterns) { CurrentRule.RegExPattern = QRegExp(Pattern); From a22fec7c96c0a6ef30077945351d030fba853718 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 17:24:43 +1200 Subject: [PATCH 14/35] Split Syntax To make mlMainWindow.* less cluttered, I am seperating my code into seperate Headers and CPP files. --- ModLauncher.vcxproj | 45 +++++++++++++++++++++++ ModLauncher.vcxproj.filters | 15 ++++++++ mlMainWindow.cpp | 68 ----------------------------------- mlMainWindow.h | 29 --------------- stdafx.h | 2 ++ syntax.cpp | 71 +++++++++++++++++++++++++++++++++++++ syntax.h | 30 ++++++++++++++++ 7 files changed, 163 insertions(+), 97 deletions(-) create mode 100644 syntax.cpp create mode 100644 syntax.h diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index 5eb13aa..ca621b0 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -312,12 +312,24 @@ true true + + true + true + true + true + true true true true + + true + true + true + true + @@ -338,6 +350,12 @@ true true + + true + true + true + true + @@ -348,6 +366,7 @@ Create Create + @@ -456,6 +475,32 @@ + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing syntax.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DUSE_CUSTOM_QT=1 -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" + diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index e19633a..f9b9da0 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -55,6 +55,18 @@ Source Files + + Source Files + + + Generated Files\External_Release + + + Generated Files\Debug + + + Generated Files\Release + @@ -74,6 +86,9 @@ Source Files + + Source Files + diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index a8a2465..f279298 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1828,71 +1828,3 @@ void Export2BinGroupBox::dragLeaveEvent(QDragLeaveEvent* event) event->accept(); } -Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) -{ - SyntaxRule CurrentRule; - - KeyWordFormat.setForeground(QColor("#63a058")); - QStringList Patterns; - Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :) - - foreach (const QString &Pattern, Patterns) { - CurrentRule.RegExPattern = QRegExp(Pattern); - CurrentRule.CharFormat = KeyWordFormat; - Rules.append(CurrentRule); - } - - IncludeFormat.setForeground(QColor("#fc8eac")); - CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. - CurrentRule.CharFormat = IncludeFormat; - Rules.append(CurrentRule); - - QuoteFormat.setForeground(QColor("#6c6999")); - CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". - CurrentRule.CharFormat = QuoteFormat; - Rules.append(CurrentRule); - - SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); - CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. - CurrentRule.CharFormat = SingleLineCommentFormat; - Rules.append(CurrentRule); - - PreProcessor.setForeground(QColor("#a09c85")); - CurrentRule.RegExPattern = QRegExp(">[^\n]*"); - CurrentRule.CharFormat = PreProcessor; - Rules.append(CurrentRule); - - MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); - commentStartExpression = QRegExp("/\\*"); - commentEndExpression = QRegExp("\\*/"); -} - -void Syntax::highlightBlock(const QString &text) -{ - foreach (const SyntaxRule &rule, Rules) { - QRegExp expression(rule.RegExPattern); - int index = expression.indexIn(text); - while (index >= 0) { - int length = expression.matchedLength(); - setFormat(index, length, rule.CharFormat); - index = expression.indexIn(text, index + length); - } - } - setCurrentBlockState(0); - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = commentStartExpression.indexIn(text); - while (startIndex >= 0) { - int endIndex = commentEndExpression.indexIn(text, startIndex); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + commentEndExpression.matchedLength(); - } - setFormat(startIndex, commentLength, MultiLineCommentFormat); - startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); - } -} \ No newline at end of file diff --git a/mlMainWindow.h b/mlMainWindow.h index 68af8b9..1fa2e4e 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -241,33 +241,4 @@ class GDTCreatorGroupBox : public QGroupBox public: GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); -}; - -class Syntax : public QSyntaxHighlighter -{ - Q_OBJECT - -public: - Syntax(QTextDocument *parent = 0); - -protected: - void highlightBlock(const QString &text) override; - -private: - struct SyntaxRule - { - QRegExp RegExPattern; - QTextCharFormat CharFormat; - }; - QVector Rules; - - QRegExp commentStartExpression; - QRegExp commentEndExpression; - - QTextCharFormat KeyWordFormat; - QTextCharFormat QuoteFormat; - QTextCharFormat SingleLineCommentFormat; - QTextCharFormat MultiLineCommentFormat; - QTextCharFormat IncludeFormat; - QTextCharFormat PreProcessor; }; \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index e4df491..1b5e626 100644 --- a/stdafx.h +++ b/stdafx.h @@ -21,6 +21,8 @@ #include #include "steam_api.h" #include "dvar.h" +#include "syntax.h" class mlMainWindow; class mlExport2BinWidget; +class Syntax; \ No newline at end of file diff --git a/syntax.cpp b/syntax.cpp new file mode 100644 index 0000000..a974914 --- /dev/null +++ b/syntax.cpp @@ -0,0 +1,71 @@ +#include "stdafx.h" + + +Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) +{ + SyntaxRule CurrentRule; + + KeyWordFormat.setForeground(QColor("#63a058")); + QStringList Patterns; + Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + + foreach (const QString &Pattern, Patterns) { + CurrentRule.RegExPattern = QRegExp(Pattern); + CurrentRule.CharFormat = KeyWordFormat; + Rules.append(CurrentRule); + } + + IncludeFormat.setForeground(QColor("#fc8eac")); + CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. + CurrentRule.CharFormat = IncludeFormat; + Rules.append(CurrentRule); + + QuoteFormat.setForeground(QColor("#6c6999")); + CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". + CurrentRule.CharFormat = QuoteFormat; + Rules.append(CurrentRule); + + SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); + CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. + CurrentRule.CharFormat = SingleLineCommentFormat; + Rules.append(CurrentRule); + + PreProcessor.setForeground(QColor("#a09c85")); + CurrentRule.RegExPattern = QRegExp(">[^\n]*"); + CurrentRule.CharFormat = PreProcessor; + Rules.append(CurrentRule); + + MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); + commentStartExpression = QRegExp("/\\*"); + commentEndExpression = QRegExp("\\*/"); +} + +void Syntax::highlightBlock(const QString &text) +{ + foreach (const SyntaxRule &rule, Rules) { + QRegExp expression(rule.RegExPattern); + int index = expression.indexIn(text); + while (index >= 0) { + int length = expression.matchedLength(); + setFormat(index, length, rule.CharFormat); + index = expression.indexIn(text, index + length); + } + } + setCurrentBlockState(0); + int startIndex = 0; + if (previousBlockState() != 1) + startIndex = commentStartExpression.indexIn(text); + while (startIndex >= 0) { + int endIndex = commentEndExpression.indexIn(text, startIndex); + int commentLength; + if (endIndex == -1) { + setCurrentBlockState(1); + commentLength = text.length() - startIndex; + } else { + commentLength = endIndex - startIndex + + commentEndExpression.matchedLength(); + } + setFormat(startIndex, commentLength, MultiLineCommentFormat); + startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); + } +} \ No newline at end of file diff --git a/syntax.h b/syntax.h new file mode 100644 index 0000000..eeda5d7 --- /dev/null +++ b/syntax.h @@ -0,0 +1,30 @@ +#pragma once + +class Syntax : public QSyntaxHighlighter +{ + Q_OBJECT + +public: + Syntax(QTextDocument *parent = 0); + +protected: + void highlightBlock(const QString &text) override; + +private: + struct SyntaxRule + { + QRegExp RegExPattern; + QTextCharFormat CharFormat; + }; + QVector Rules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat KeyWordFormat; + QTextCharFormat QuoteFormat; + QTextCharFormat SingleLineCommentFormat; + QTextCharFormat MultiLineCommentFormat; + QTextCharFormat IncludeFormat; + QTextCharFormat PreProcessor; +}; \ No newline at end of file From b7f5eeca5d5ab9775fc59dffdb1986014b56984b Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 17:27:38 +1200 Subject: [PATCH 15/35] Split GDTCreator Split up GDT creator to reduce clutter. I will add comments to my commits and generally improve code quality. --- GDTCreator.cpp | 48 +++++++++++++++++++++++++++++++++++++ GDTCreator.h | 15 ++++++++++++ ModLauncher.vcxproj | 2 ++ ModLauncher.vcxproj.filters | 6 +++++ mlMainWindow.cpp | 48 ------------------------------------- mlMainWindow.h | 13 ---------- stdafx.h | 4 +++- 7 files changed, 74 insertions(+), 62 deletions(-) create mode 100644 GDTCreator.cpp create mode 100644 GDTCreator.h diff --git a/GDTCreator.cpp b/GDTCreator.cpp new file mode 100644 index 0000000..cb5931b --- /dev/null +++ b/GDTCreator.cpp @@ -0,0 +1,48 @@ +#include "stdafx.h" + +GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) +{ + this->setAcceptDrops(true); +} + +void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) +{ + event->acceptProposedAction(); +} + +void GDTCreatorGroupBox::dropEvent(QDropEvent* event) +{ + const QMimeData* mimeData = event->mimeData(); + + if (parentWindow == NULL) + { + return; + } + + if (mimeData->hasUrls()) + { + QStringList pathList; + QList urlList = mimeData->urls(); + + QDir working_dir(parentWindow->mToolsPath); + for (int i = 0; i < urlList.size(); i++) + { + pathList.append(urlList.at(i).toLocalFile()); + } + + QProcess* Process = new QProcess(); + connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); + + bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); + + QString outputDir = parentWindow->mGDTCreateTargetDir->text(); + parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); + + event->acceptProposedAction(); + } +} + +void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) +{ + event->accept(); +} \ No newline at end of file diff --git a/GDTCreator.h b/GDTCreator.h new file mode 100644 index 0000000..faf6794 --- /dev/null +++ b/GDTCreator.h @@ -0,0 +1,15 @@ +#pragma once + +class GDTCreatorGroupBox : public QGroupBox +{ +private: + mlMainWindow* parentWindow; + +protected: + void dragEnterEvent(QDragEnterEvent* event); + void dragLeaveEvent(QDragLeaveEvent* event); + void dropEvent(QDropEvent *event); + +public: + GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); +}; \ No newline at end of file diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index ca621b0..340d880 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -306,6 +306,7 @@ + true true @@ -475,6 +476,7 @@ + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing syntax.h... diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index f9b9da0..c48fe0a 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -67,6 +67,9 @@ Generated Files\Release + + Source Files + @@ -94,5 +97,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index f279298..26b17fc 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1733,54 +1733,6 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } - -GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) -{ - this->setAcceptDrops(true); -} - -void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) -{ - event->acceptProposedAction(); -} - -void GDTCreatorGroupBox::dropEvent(QDropEvent* event) -{ - const QMimeData* mimeData = event->mimeData(); - - if (parentWindow == NULL) - { - return; - } - - if (mimeData->hasUrls()) - { - QStringList pathList; - QList urlList = mimeData->urls(); - - QDir working_dir(parentWindow->mToolsPath); - for (int i = 0; i < urlList.size(); i++) - { - pathList.append(urlList.at(i).toLocalFile()); - } - - QProcess* Process = new QProcess(); - connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); - - bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); - - QString outputDir = parentWindow->mGDTCreateTargetDir->text(); - parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); - - event->acceptProposedAction(); - } -} - -void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) -{ - event->accept(); -} - Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); diff --git a/mlMainWindow.h b/mlMainWindow.h index 1fa2e4e..0eba1b8 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -229,16 +229,3 @@ class Export2BinGroupBox : public QGroupBox Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); }; -class GDTCreatorGroupBox : public QGroupBox -{ -private: - mlMainWindow* parentWindow; - -protected: - void dragEnterEvent(QDragEnterEvent* event); - void dragLeaveEvent(QDragLeaveEvent* event); - void dropEvent(QDropEvent *event); - -public: - GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); -}; \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index 1b5e626..193fcbb 100644 --- a/stdafx.h +++ b/stdafx.h @@ -22,7 +22,9 @@ #include "steam_api.h" #include "dvar.h" #include "syntax.h" +#include "GDTCreator.h" class mlMainWindow; class mlExport2BinWidget; -class Syntax; \ No newline at end of file +class Syntax; +class GDTCreatorGroupBox; \ No newline at end of file From 604dd0bfb616eb9a8a7fa59b8078317bc5236fcd Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 17:31:54 +1200 Subject: [PATCH 16/35] Re-Added GDT Creator to mlMainWindow Didn't notice it would stop compilation. I might swap it around later. --- GDTCreator.cpp | 48 ------------------------------------- GDTCreator.h | 15 ------------ ModLauncher.vcxproj | 2 -- ModLauncher.vcxproj.filters | 6 ----- mlMainWindow.cpp | 48 +++++++++++++++++++++++++++++++++++++ mlMainWindow.h | 13 ++++++++++ stdafx.h | 4 +--- 7 files changed, 62 insertions(+), 74 deletions(-) delete mode 100644 GDTCreator.cpp delete mode 100644 GDTCreator.h diff --git a/GDTCreator.cpp b/GDTCreator.cpp deleted file mode 100644 index cb5931b..0000000 --- a/GDTCreator.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "stdafx.h" - -GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) -{ - this->setAcceptDrops(true); -} - -void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) -{ - event->acceptProposedAction(); -} - -void GDTCreatorGroupBox::dropEvent(QDropEvent* event) -{ - const QMimeData* mimeData = event->mimeData(); - - if (parentWindow == NULL) - { - return; - } - - if (mimeData->hasUrls()) - { - QStringList pathList; - QList urlList = mimeData->urls(); - - QDir working_dir(parentWindow->mToolsPath); - for (int i = 0; i < urlList.size(); i++) - { - pathList.append(urlList.at(i).toLocalFile()); - } - - QProcess* Process = new QProcess(); - connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); - - bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); - - QString outputDir = parentWindow->mGDTCreateTargetDir->text(); - parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); - - event->acceptProposedAction(); - } -} - -void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) -{ - event->accept(); -} \ No newline at end of file diff --git a/GDTCreator.h b/GDTCreator.h deleted file mode 100644 index faf6794..0000000 --- a/GDTCreator.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -class GDTCreatorGroupBox : public QGroupBox -{ -private: - mlMainWindow* parentWindow; - -protected: - void dragEnterEvent(QDragEnterEvent* event); - void dragLeaveEvent(QDragLeaveEvent* event); - void dropEvent(QDropEvent *event); - -public: - GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); -}; \ No newline at end of file diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index 340d880..ca621b0 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -306,7 +306,6 @@ - true true @@ -476,7 +475,6 @@ - $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing syntax.h... diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index c48fe0a..f9b9da0 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -67,9 +67,6 @@ Generated Files\Release - - Source Files - @@ -97,8 +94,5 @@ Source Files - - Source Files - \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 26b17fc..f279298 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1733,6 +1733,54 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } + +GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) +{ + this->setAcceptDrops(true); +} + +void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) +{ + event->acceptProposedAction(); +} + +void GDTCreatorGroupBox::dropEvent(QDropEvent* event) +{ + const QMimeData* mimeData = event->mimeData(); + + if (parentWindow == NULL) + { + return; + } + + if (mimeData->hasUrls()) + { + QStringList pathList; + QList urlList = mimeData->urls(); + + QDir working_dir(parentWindow->mToolsPath); + for (int i = 0; i < urlList.size(); i++) + { + pathList.append(urlList.at(i).toLocalFile()); + } + + QProcess* Process = new QProcess(); + connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); + + bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); + + QString outputDir = parentWindow->mGDTCreateTargetDir->text(); + parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); + + event->acceptProposedAction(); + } +} + +void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) +{ + event->accept(); +} + Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); diff --git a/mlMainWindow.h b/mlMainWindow.h index 0eba1b8..1fa2e4e 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -229,3 +229,16 @@ class Export2BinGroupBox : public QGroupBox Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); }; +class GDTCreatorGroupBox : public QGroupBox +{ +private: + mlMainWindow* parentWindow; + +protected: + void dragEnterEvent(QDragEnterEvent* event); + void dragLeaveEvent(QDragLeaveEvent* event); + void dropEvent(QDropEvent *event); + +public: + GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); +}; \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index 193fcbb..1b5e626 100644 --- a/stdafx.h +++ b/stdafx.h @@ -22,9 +22,7 @@ #include "steam_api.h" #include "dvar.h" #include "syntax.h" -#include "GDTCreator.h" class mlMainWindow; class mlExport2BinWidget; -class Syntax; -class GDTCreatorGroupBox; \ No newline at end of file +class Syntax; \ No newline at end of file From bfd0bedfbceebc320c8ff004a4a3f8e6e59bf276 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 18:49:24 +1200 Subject: [PATCH 17/35] Reverted Lost Commits I fluffed up Git last night, it broke a lot more than Intended. So here I am back at step one. --- ModLauncher.vcxproj | 46 +----------------------- ModLauncher.vcxproj.filters | 15 -------- mlMainWindow.cpp | 68 +++++++++++++++++++++++++++++++++++ mlMainWindow.h | 29 +++++++++++++++ stdafx.h | 2 -- syntax.cpp | 71 ------------------------------------- syntax.h | 30 ---------------- 7 files changed, 98 insertions(+), 163 deletions(-) delete mode 100644 syntax.cpp delete mode 100644 syntax.h diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index ca621b0..003ae15 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -312,24 +312,12 @@ true true - - true - true - true - true - true true true true - - true - true - true - true - @@ -350,12 +338,6 @@ true true - - true - true - true - true - @@ -366,7 +348,6 @@ Create Create - @@ -475,32 +456,7 @@ - - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -D_DEBUG -D_WINDOWS -DQT_DLL "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DWIN32 -DNDEBUG -D_WINDOWS -DQT_DLL - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing syntax.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../syntax.h" -DUSE_CUSTOM_QT=1 -DUTILS -DRELEASE_BUILD -DAS_NO_USER_ALLOC -DWIN32 -DQT_DLL -DNDEBUG "-I$(TA_CODE_PATH)\." "-I$(TA_CODE_PATH)\tools" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(TL_SDK)\Steamworks\sdk-1.37\public\steam" "-I$(SolutionDir)\sdk\public\steam" - + diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index f9b9da0..e19633a 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -55,18 +55,6 @@ Source Files - - Source Files - - - Generated Files\External_Release - - - Generated Files\Debug - - - Generated Files\Release - @@ -86,9 +74,6 @@ Source Files - - Source Files - diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index f279298..cde9e37 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1828,3 +1828,71 @@ void Export2BinGroupBox::dragLeaveEvent(QDragLeaveEvent* event) event->accept(); } +Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) +{ + SyntaxRule CurrentRule; + + KeyWordFormat.setForeground(QColor("#63a058")); + QStringList Patterns; + Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + + foreach (const QString &Pattern, Patterns) { + CurrentRule.RegExPattern = QRegExp(Pattern); + CurrentRule.CharFormat = KeyWordFormat; + Rules.append(CurrentRule); + } + + IncludeFormat.setForeground(QColor("#fc8eac")); + CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. + CurrentRule.CharFormat = IncludeFormat; + Rules.append(CurrentRule); + + QuoteFormat.setForeground(QColor("#6c6999")); + CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". + CurrentRule.CharFormat = QuoteFormat; + Rules.append(CurrentRule); + + SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); + CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. + CurrentRule.CharFormat = SingleLineCommentFormat; + Rules.append(CurrentRule); + + PreProcessor.setForeground(QColor("#a09c85")); + CurrentRule.RegExPattern = QRegExp(">[^\n]*"); + CurrentRule.CharFormat = PreProcessor; + Rules.append(CurrentRule); + + MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); + commentStartExpression = QRegExp("/\\*"); + commentEndExpression = QRegExp("\\*/"); +} + +void Syntax::highlightBlock(const QString &text) +{ + foreach (const SyntaxRule &rule, Rules) { + QRegExp expression(rule.RegExPattern); + int index = expression.indexIn(text); + while (index >= 0) { + int length = expression.matchedLength(); + setFormat(index, length, rule.CharFormat); + index = expression.indexIn(text, index + length); + } + } + setCurrentBlockState(0); + int startIndex = 0; + if (previousBlockState() != 1) + startIndex = commentStartExpression.indexIn(text); + while (startIndex >= 0) { + int endIndex = commentEndExpression.indexIn(text, startIndex); + int commentLength; + if (endIndex == -1) { + setCurrentBlockState(1); + commentLength = text.length() - startIndex; + } else { + commentLength = endIndex - startIndex + + commentEndExpression.matchedLength(); + } + setFormat(startIndex, commentLength, MultiLineCommentFormat); + startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); + } +} \ No newline at end of file diff --git a/mlMainWindow.h b/mlMainWindow.h index 1fa2e4e..68af8b9 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -241,4 +241,33 @@ class GDTCreatorGroupBox : public QGroupBox public: GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); +}; + +class Syntax : public QSyntaxHighlighter +{ + Q_OBJECT + +public: + Syntax(QTextDocument *parent = 0); + +protected: + void highlightBlock(const QString &text) override; + +private: + struct SyntaxRule + { + QRegExp RegExPattern; + QTextCharFormat CharFormat; + }; + QVector Rules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat KeyWordFormat; + QTextCharFormat QuoteFormat; + QTextCharFormat SingleLineCommentFormat; + QTextCharFormat MultiLineCommentFormat; + QTextCharFormat IncludeFormat; + QTextCharFormat PreProcessor; }; \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index 1b5e626..e4df491 100644 --- a/stdafx.h +++ b/stdafx.h @@ -21,8 +21,6 @@ #include #include "steam_api.h" #include "dvar.h" -#include "syntax.h" class mlMainWindow; class mlExport2BinWidget; -class Syntax; \ No newline at end of file diff --git a/syntax.cpp b/syntax.cpp deleted file mode 100644 index a974914..0000000 --- a/syntax.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "stdafx.h" - - -Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) -{ - SyntaxRule CurrentRule; - - KeyWordFormat.setForeground(QColor("#63a058")); - QStringList Patterns; - Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). - - foreach (const QString &Pattern, Patterns) { - CurrentRule.RegExPattern = QRegExp(Pattern); - CurrentRule.CharFormat = KeyWordFormat; - Rules.append(CurrentRule); - } - - IncludeFormat.setForeground(QColor("#fc8eac")); - CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. - CurrentRule.CharFormat = IncludeFormat; - Rules.append(CurrentRule); - - QuoteFormat.setForeground(QColor("#6c6999")); - CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". - CurrentRule.CharFormat = QuoteFormat; - Rules.append(CurrentRule); - - SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); - CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. - CurrentRule.CharFormat = SingleLineCommentFormat; - Rules.append(CurrentRule); - - PreProcessor.setForeground(QColor("#a09c85")); - CurrentRule.RegExPattern = QRegExp(">[^\n]*"); - CurrentRule.CharFormat = PreProcessor; - Rules.append(CurrentRule); - - MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); - commentStartExpression = QRegExp("/\\*"); - commentEndExpression = QRegExp("\\*/"); -} - -void Syntax::highlightBlock(const QString &text) -{ - foreach (const SyntaxRule &rule, Rules) { - QRegExp expression(rule.RegExPattern); - int index = expression.indexIn(text); - while (index >= 0) { - int length = expression.matchedLength(); - setFormat(index, length, rule.CharFormat); - index = expression.indexIn(text, index + length); - } - } - setCurrentBlockState(0); - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = commentStartExpression.indexIn(text); - while (startIndex >= 0) { - int endIndex = commentEndExpression.indexIn(text, startIndex); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + commentEndExpression.matchedLength(); - } - setFormat(startIndex, commentLength, MultiLineCommentFormat); - startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); - } -} \ No newline at end of file diff --git a/syntax.h b/syntax.h deleted file mode 100644 index eeda5d7..0000000 --- a/syntax.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -class Syntax : public QSyntaxHighlighter -{ - Q_OBJECT - -public: - Syntax(QTextDocument *parent = 0); - -protected: - void highlightBlock(const QString &text) override; - -private: - struct SyntaxRule - { - QRegExp RegExPattern; - QTextCharFormat CharFormat; - }; - QVector Rules; - - QRegExp commentStartExpression; - QRegExp commentEndExpression; - - QTextCharFormat KeyWordFormat; - QTextCharFormat QuoteFormat; - QTextCharFormat SingleLineCommentFormat; - QTextCharFormat MultiLineCommentFormat; - QTextCharFormat IncludeFormat; - QTextCharFormat PreProcessor; -}; \ No newline at end of file From e5173b0197f95a610ed6725340fd0d97a44b8a91 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 18:51:53 +1200 Subject: [PATCH 18/35] Wip Wip --- mlMainWindow.cpp | 69 +++++++++++++++++++++++++++++++++++++++--------- mlMainWindow.h | 4 +++ 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index cde9e37..57523af 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -366,6 +366,8 @@ mlMainWindow::mlMainWindow() SyntaxTimer.setSingleShot(true); connect(&SyntaxTimer,SIGNAL(timeout()),this,SLOT(UpdateSyntax())); PopulateFileList(); + + mRunOptionsWidget->setPlaceholderText("Optional Run Args"); } mlMainWindow::~mlMainWindow() @@ -412,6 +414,13 @@ void mlMainWindow::CreateActions() mActionHelpAbout = new QAction("&About...", this); connect(mActionHelpAbout, SIGNAL(triggered()), this, SLOT(OnHelpAbout())); + mActionOpenDocs = new QAction("&Documentation",this); + connect(mActionOpenDocs, SIGNAL(triggered()),this,SLOT(OnOpenDocs())); + + mActionSaveOutput = new QAction("&Save Console Output",this); + mActionSaveOutput->setShortcut(QKeySequence("CTRL+S")); + connect(mActionSaveOutput,SIGNAL(triggered()),this,SLOT(OnSaveOutput())); + } void mlMainWindow::CreateMenu() @@ -424,6 +433,9 @@ void mlMainWindow::CreateMenu() FileMenu->addAction(mActionFileAssetEditor); FileMenu->addAction(mActionFileLevelEditor); FileMenu->addAction(mActionFileExport2Bin); + FileMenu->addAction(mActionCreateGdt); + FileMenu->addSeparator(); + FileMenu->addAction(mActionSaveOutput); FileMenu->addSeparator(); FileMenu->addAction(mActionFileExit); MenuBar->addAction(FileMenu->menuAction()); @@ -437,6 +449,7 @@ void mlMainWindow::CreateMenu() QMenu* HelpMenu = new QMenu("&Help", MenuBar); HelpMenu->addAction(mActionHelpAbout); + HelpMenu->addAction(mActionOpenDocs); MenuBar->addAction(HelpMenu->menuAction()); setMenuBar(MenuBar); @@ -569,12 +582,19 @@ void mlMainWindow::UpdateDB() void mlMainWindow::StartBuildThread(const QList>& Commands) { + if(mBuildThread == NULL) + { mBuildButton->setText("Cancel"); mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); mBuildThread->start(); + } + else + { + QMessageBox::warning(NULL,"Task In Progress","There Is Already A Task In Progress.\nPlease Wait Or Cancel It!",QMessageBox::Ok); + } } void mlMainWindow::StartConvertThread(QStringList& pathList, QString& outputDir, bool allowOverwrite) @@ -659,6 +679,7 @@ void mlMainWindow::ContextMenuRequested() Menu->addAction(mActionFileLevelEditor); Menu->addAction("Edit Zone File", this, SLOT(OnOpenZoneFile())); + Menu->addAction(QString("Open %1 Folder").arg(ItemType), this, SLOT(OnOpenModRootFolder())); Menu->addSeparator(); @@ -1448,6 +1469,30 @@ void mlMainWindow::OnHelpAbout() QMessageBox::about(this, "About Modtools Launcher", "Treyarch Modtools Launcher\nCopyright 2016 Treyarch"); } +void mlMainWindow::OnOpenDocs() +{ + ShellExecute(NULL,"open",QString("%1/docs_modtools").arg(mGamePath).toLatin1().constData(),"",NULL,SW_SHOWDEFAULT); +} + + +void mlMainWindow::OnSaveOutput() +{ + QFile* Output = new QFile("Console Output.txt"); + if(Output->open(QIODevice::WriteOnly | QIODevice::Text)) + { + QTextStream Out(Output); + Out << (mOutputWidget->toPlainText()); + Out.flush(); + QMessageBox::information(this,"Saved Console Output","Saved Console Output To: Console Output.txt",QMessageBox::Ok); + } + else + { + QMessageBox::warning(this,"Failed To Save Console Output!","Failed To Save!: "+Output->errorString(),QMessageBox::Ok); + } + + Output->close(); +} + void mlMainWindow::OnOpenZoneFile() { QList ItemList = mFileListWidget->selectedItems(); @@ -1703,7 +1748,6 @@ void mlMainWindow::OnSaveZone() QTextStream Out(ZoneFile); Out << (mZoneTextEdit->toPlainText()); Out.flush(); - mOutputWidget->appendPlainText(Out.readLine()); } else { @@ -1746,6 +1790,9 @@ void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) void GDTCreatorGroupBox::dropEvent(QDropEvent* event) { + QDir source_data_folder(QString("%1/source_data").arg(parentWindow->mToolsPath)); + QDir model_export_folder(QString("%1/model_export").arg(parentWindow->mToolsPath)); + const QMimeData* mimeData = event->mimeData(); if (parentWindow == NULL) @@ -1757,21 +1804,19 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) { QStringList pathList; QList urlList = mimeData->urls(); + QString CurrentFile; + - QDir working_dir(parentWindow->mToolsPath); for (int i = 0; i < urlList.size(); i++) - { - pathList.append(urlList.at(i).toLocalFile()); + { + CurrentFile = urlList.at(i).toLocalFile(); + if(!CurrentFile.endsWith(".tiff") || !CurrentFile.endsWith(".tif")) + { + QMessageBox::warning(this,"Incorrect Format!","Please Convert This File To Either XMODEL_BIN, XANIM_BIN, TIFF Or TIF",QMessageBox::Ok); + return; + } } - QProcess* Process = new QProcess(); - connect(Process, SIGNAL(finished(int)), Process, SLOT(deleteLater())); - - bool allowOverwrite = this->parentWindow->mGDTCreateOverwriteWidget->isChecked(); - - QString outputDir = parentWindow->mGDTCreateTargetDir->text(); - parentWindow->StartConvertThread(pathList, outputDir, allowOverwrite); - event->acceptProposedAction(); } } diff --git a/mlMainWindow.h b/mlMainWindow.h index 68af8b9..6507b7c 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -107,7 +107,9 @@ protected slots: void OnEditPublish(); void OnEditOptions(); void OnEditDvars(); + void OnOpenDocs(); void OnHelpAbout(); + void OnSaveOutput(); void OnOpenZoneFile(); void OnOpenModRootFolder(); void OnRunMapOrMod(); @@ -161,6 +163,8 @@ protected slots: QAction* mActionEditOptions; QAction* mActionHelpAbout; QAction* mActionCreateGdt; + QAction* mActionSaveOutput; + QAction* mActionOpenDocs; QTreeWidget* mFileListWidget; From 45b9d12dd6c62921fd13949c5bb678ede787499e Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 20:15:45 +1200 Subject: [PATCH 19/35] Ready Ugh, so much code. So Little Time :/. Getting ready to add basic GDT Creator, and working on better syntax highlight for zone editor.But Iam going to split those up soon enough. --- mlMainWindow.cpp | 43 ++++++++++++++++++++++++++----------------- mlMainWindow.h | 10 ++++++++++ stdafx.h | 1 + 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 57523af..ead6c95 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -246,15 +246,9 @@ mlMainWindow::mlMainWindow() mBuildLanguage = Settings.value("BuildLanguage", "english").toString(); mTreyarchTheme = Settings.value("UseDarkTheme", false).toBool(); mUseBuiltInEditor= Settings.value("InBuiltEditor",false).toBool(); + mOpenAPEAfter = Settings.value("GDTCreate_OpenAPEAfterCreation",false).toBool(); + - // Qt prefers '/' over '\\' - // Deemed Broken by Johnatohn - - /* - mGamePath = QDir::fromNativeSeparators(getenv("TA_GAME_PATH")); - mGamePath.chop(1); - mToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); - mToolsPath.chop(1); - */ mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); @@ -545,6 +539,14 @@ void mlMainWindow::InitGDTCreator() QVBoxLayout* groupBoxLayout = new QVBoxLayout(groupBox); groupBoxLayout->addWidget(label); groupBox->setLayout(groupBoxLayout); + + mOpenAPEAfterCreation = new QCheckBox("&Open APE After Creation", widget); + gridLayout->addWidget(mOpenAPEAfterCreation, 1, 0); + + QSettings Settings; + mOpenAPEAfterCreation->setChecked(Settings.value("GDTCreate_OpenAPEAfterCreation", true).toBool()); + + connect(mOpenAPEAfterCreation, SIGNAL(clicked()), this, SLOT(OnOpenAPEAfterToggle())); //Do things groupBox->setAcceptDrops(true); @@ -1474,7 +1476,6 @@ void mlMainWindow::OnOpenDocs() ShellExecute(NULL,"open",QString("%1/docs_modtools").arg(mGamePath).toLatin1().constData(),"",NULL,SW_SHOWDEFAULT); } - void mlMainWindow::OnSaveOutput() { QFile* Output = new QFile("Console Output.txt"); @@ -1668,6 +1669,13 @@ void mlMainWindow::OnExport2BinToggleOverwriteFiles() Settings.setValue("Export2Bin_OverwriteFiles", mExport2BinOverwriteWidget->isChecked()); } +void mlMainWindow::OnOpenAPEAfterToggle() +{ + QSettings Settings; + Settings.setValue("GDTCreate_OpenAPEAfterCreation", mOpenAPEAfterCreation->isChecked()); + +} + void mlMainWindow::BuildOutputReady(QString Output) { mOutputWidget->appendPlainText(Output); @@ -1777,7 +1785,6 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } - GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); @@ -1875,11 +1882,12 @@ void Export2BinGroupBox::dragLeaveEvent(QDragLeaveEvent* event) Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) { + QSettings Settings; SyntaxRule CurrentRule; KeyWordFormat.setForeground(QColor("#63a058")); QStringList Patterns; - Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor" << "material" << "col_map" << "gfx_map" << "sound"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). foreach (const QString &Pattern, Patterns) { CurrentRule.RegExPattern = QRegExp(Pattern); @@ -1887,27 +1895,28 @@ Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) Rules.append(CurrentRule); } - IncludeFormat.setForeground(QColor("#fc8eac")); + //Make It So I Can Set These Somehow? + IncludeFormat.setForeground(QColor(Settings.value("IncludeFormat_Color", "#fc8eac").toString())); CurrentRule.RegExPattern = QRegExp("#[^\n]*"); //Start With #, Continue To New Line. CurrentRule.CharFormat = IncludeFormat; Rules.append(CurrentRule); - QuoteFormat.setForeground(QColor("#6c6999")); + QuoteFormat.setForeground(QColor(Settings.value("QuoteFormat_Color","#6c6999").toString())); CurrentRule.RegExPattern = QRegExp("\".*\""); //Start With ", Continue To Next ". CurrentRule.CharFormat = QuoteFormat; Rules.append(CurrentRule); - SingleLineCommentFormat.setForeground(QColor("#c0e4ff")); + SingleLineCommentFormat.setForeground(QColor(Settings.value("SingleLineCommentFormat_Color","#c0e4ff").toString())); CurrentRule.RegExPattern = QRegExp("//[^\n]*"); //Start With //, Continue To New Line. CurrentRule.CharFormat = SingleLineCommentFormat; Rules.append(CurrentRule); - PreProcessor.setForeground(QColor("#a09c85")); - CurrentRule.RegExPattern = QRegExp(">[^\n]*"); + PreProcessor.setForeground(QColor(Settings.value("PreProcessor_Color","#a09c85").toString())); + CurrentRule.RegExPattern = QRegExp(">[^\n]*"); //Start with >, Continue To New Line. CurrentRule.CharFormat = PreProcessor; Rules.append(CurrentRule); - MultiLineCommentFormat.setForeground(QColor("#c0e4ff")); + MultiLineCommentFormat.setForeground(QColor(Settings.value("MultiLineCommentFormat_Color","#c0e4ff").toString())); commentStartExpression = QRegExp("/\\*"); commentEndExpression = QRegExp("\\*/"); } diff --git a/mlMainWindow.h b/mlMainWindow.h index 6507b7c..20d3e83 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -117,6 +117,7 @@ protected slots: void OnDelete(); void OnExport2BinChooseDirectory(); void OnExport2BinToggleOverwriteFiles(); + void OnOpenAPEAfterToggle(); void BuildOutputReady(QString Output); void BuildFinished(); void ContextMenuRequested(); @@ -150,7 +151,14 @@ protected slots: bool mTreyarchTheme; bool mUseBuiltInEditor; + bool mOpenAPEAfter; + QString mIncludeFormat; + QString mQuoteFormat; + QString mSingleLineCommentFormat; + QString mPreProcessor; + QString mMultiLineCommentFormat; + quint64 mFileId; QAction* mActionFileNew; @@ -217,6 +225,8 @@ protected slots: QTimer SyntaxTimer; QFile* ZoneFile; + + QColorDialog* SyntaxColorPicker; }; class Export2BinGroupBox : public QGroupBox diff --git a/stdafx.h b/stdafx.h index e4df491..bdb5678 100644 --- a/stdafx.h +++ b/stdafx.h @@ -20,6 +20,7 @@ #include #include "steam_api.h" + #include "dvar.h" class mlMainWindow; From fd515d118f6e23fdaea46a331de34fe9cb282480 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 13 May 2017 21:38:44 +1200 Subject: [PATCH 20/35] Zone Editor Starting to make Zone Editor better. --- mlMainWindow.cpp | 27 ++++++++++++++++++++++++--- mlMainWindow.h | 3 ++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index ead6c95..80eeb11 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1714,9 +1714,29 @@ void mlMainWindow::InitZoneEditor() QGridLayout* GridLayout = new QGridLayout(); mZoneTextEdit = new QPlainTextEdit(); QPushButton* ZoneSave = new QPushButton(); - QPushButton* ZoneCancel = new QPushButton(); + QPushButton* ZoneCancel = new QPushButton(); + QStringList AcceptableFileTypes; + AcceptableFileTypes << "*.gsc" << "*.csc" << "*.gsh"; - Dock->resize(QSize(460, 480)); + mFileTree = new QTreeView(this); + mScriptList = new QFileSystemModel(this); + + mScriptList->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks); + + mScriptList->setNameFilters(AcceptableFileTypes); + mScriptList->setNameFilterDisables(false); + + mScriptList->setRootPath(mToolsPath); + + mFileTree->setModel(mScriptList); + mFileTree->setRootIndex(mScriptList->setRootPath(mToolsPath)); + + for (int x = 1; x < mScriptList->columnCount(); x++) + mFileTree->hideColumn(x); + + + + Dock->resize(QSize(720,720)); Dock->setWindowTitle("Zone Editor"); Dock->setFloating(true); Dock->setWidget(Widget); @@ -1741,7 +1761,8 @@ void mlMainWindow::InitZoneEditor() ZoneFile->close(); - GridLayout->addWidget(mZoneTextEdit,0,0,1,2); + GridLayout->addWidget(mFileTree,0,0); + GridLayout->addWidget(mZoneTextEdit,0,1); GridLayout->addWidget(ZoneSave,1,0); GridLayout->addWidget(ZoneCancel,1,1); diff --git a/mlMainWindow.h b/mlMainWindow.h index 20d3e83..b64628b 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -226,7 +226,8 @@ protected slots: QFile* ZoneFile; - QColorDialog* SyntaxColorPicker; + QFileSystemModel* mScriptList; + QTreeView* mFileTree; }; class Export2BinGroupBox : public QGroupBox From 2ea4fafdac0be9005bbabf9d58ed4f76b00bdc39 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sun, 14 May 2017 15:55:47 +1200 Subject: [PATCH 21/35] My eyes hurt I have been doing so much codingon this recently, I am going to need to take a bit of a break :(. --- mlMainWindow.cpp | 55 ++++++++++++++++++++++++++++++++++++++++-------- mlMainWindow.h | 6 ++++-- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 80eeb11..5b787de 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -247,7 +247,7 @@ mlMainWindow::mlMainWindow() mTreyarchTheme = Settings.value("UseDarkTheme", false).toBool(); mUseBuiltInEditor= Settings.value("InBuiltEditor",false).toBool(); mOpenAPEAfter = Settings.value("GDTCreate_OpenAPEAfterCreation",false).toBool(); - + mUseExpertZone = Settings.value("Expert_ZoneEditor",false).toBool(); mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); @@ -1221,6 +1221,11 @@ void mlMainWindow::OnEditOptions() InBuiltEditor->setChecked(Settings.value("InBuiltEditor",false).toBool()); Layout->addWidget(InBuiltEditor); + QCheckBox* AdvanceEditor = new QCheckBox("Use Advance Zone Editor Features"); + AdvanceEditor->setToolTip("Toggle between basic and advance zone editor features."); + AdvanceEditor->setChecked(Settings.value("Expert_ZoneEditor",false).toBool()); + Layout->addWidget(AdvanceEditor); + QHBoxLayout* LanguageLayout = new QHBoxLayout(); LanguageLayout->addWidget(new QLabel("Build Language:")); @@ -1252,10 +1257,12 @@ void mlMainWindow::OnEditOptions() mBuildLanguage = LanguageCombo->currentText(); mTreyarchTheme = Checkbox->isChecked(); mUseBuiltInEditor = InBuiltEditor->isChecked(); + mUseExpertZone = AdvanceEditor->isChecked(); Settings.setValue("BuildLanguage", mBuildLanguage); Settings.setValue("UseDarkTheme", mTreyarchTheme); Settings.setValue("InBuiltEditor",mUseBuiltInEditor); + Settings.setValue("Expert_ZoneEditor",mUseExpertZone); UpdateTheme(); } @@ -1698,11 +1705,8 @@ void mlMainWindow::OnConvertButton() void mlMainWindow::OpenZoneEditor() { - if (mZoneEditorGUIWidget == NULL) - { - InitZoneEditor(); - mZoneEditorGUIWidget->hide(); - } + InitZoneEditor(); + mZoneEditorGUIWidget->hide(); mZoneEditorGUIWidget->isVisible() ? mZoneEditorGUIWidget->hide() : mZoneEditorGUIWidget->show(); } @@ -1718,7 +1722,7 @@ void mlMainWindow::InitZoneEditor() QStringList AcceptableFileTypes; AcceptableFileTypes << "*.gsc" << "*.csc" << "*.gsh"; - mFileTree = new QTreeView(this); + mFileTree = new QTreeView(); mScriptList = new QFileSystemModel(this); mScriptList->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks); @@ -1734,8 +1738,6 @@ void mlMainWindow::InitZoneEditor() for (int x = 1; x < mScriptList->columnCount(); x++) mFileTree->hideColumn(x); - - Dock->resize(QSize(720,720)); Dock->setWindowTitle("Zone Editor"); Dock->setFloating(true); @@ -1750,6 +1752,9 @@ void mlMainWindow::InitZoneEditor() connect(ZoneCancel,SIGNAL(clicked()),this,SLOT(OnCancelZone())); connect(mZoneTextEdit, SIGNAL(textChanged()),this,SLOT(OnTextChanged())); + connect(mFileTree->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(OnItemSelected(const QItemSelection&,const QItemSelection&))); + + ZoneFile = new QFile(mZonePath); if(!ZoneFile->open(QIODevice::ReadOnly)) QMessageBox::information(this, "Error!", ZoneFile->errorString()); @@ -1769,6 +1774,38 @@ void mlMainWindow::InitZoneEditor() mZoneEditorGUIWidget = Dock; } +void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSelection& Deselected) +{ + + QModelIndex CurrentIndex = mFileTree->currentIndex(); + + QModelIndexList parents; + parents << CurrentIndex; + + while ( parents.last().isValid()) + { + if(parents.last().parent().data().toString() == "raw") + { + //Implement endsWith() yadayadya stuffs. parent folder checking and finally inserting. + } + else + { + QSettings Settings; + if(Settings.value("Expert_ZoneEditor", false).toBool() == false) + { + QMessageBox::critical(this,"Hold On!","I Don't Support Adding Files From Here!\nPlease Use The Raw Folder Or Enable Expert Mode In Settings.",QMessageBox::Ok); + break; + } + else + { + QString result = QInputDialog::getText(0, "What Is This?", "Enter What Type Of Asset This Is:", QLineEdit::Normal,"scriptparsetree,xmodel,materal", new bool()); + mZoneTextEdit->appendPlainText(QString("%1,%2").arg(result,CurrentIndex.data().toString())); //Gotta get loop working, appent strings etc ya know the usual stuff. + } + } + parents << parents.last().parent(); + } +} + void mlMainWindow::OnSaveZone() { ZoneFile = new QFile(mZonePath); diff --git a/mlMainWindow.h b/mlMainWindow.h index b64628b..cb7b814 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -129,6 +129,7 @@ protected slots: void OnTextChanged(); void UpdateSyntax(); void OnCancelZone(); + void OnItemSelected(const QItemSelection&,const QItemSelection&); protected: void closeEvent(QCloseEvent* Event); @@ -152,7 +153,8 @@ protected slots: bool mTreyarchTheme; bool mUseBuiltInEditor; bool mOpenAPEAfter; - + bool mUseExpertZone; + QString mIncludeFormat; QString mQuoteFormat; QString mSingleLineCommentFormat; @@ -285,4 +287,4 @@ class Syntax : public QSyntaxHighlighter QTextCharFormat MultiLineCommentFormat; QTextCharFormat IncludeFormat; QTextCharFormat PreProcessor; -}; \ No newline at end of file +}; From cb79b5dcd7f0ed9ca9304007a3937f6a97973147 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sun, 14 May 2017 19:00:43 +1200 Subject: [PATCH 22/35] Big Huge if Big --- mlMainWindow.cpp | 57 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 5b787de..abce515 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -539,7 +539,7 @@ void mlMainWindow::InitGDTCreator() QVBoxLayout* groupBoxLayout = new QVBoxLayout(groupBox); groupBoxLayout->addWidget(label); groupBox->setLayout(groupBoxLayout); - + mOpenAPEAfterCreation = new QCheckBox("&Open APE After Creation", widget); gridLayout->addWidget(mOpenAPEAfterCreation, 1, 0); @@ -547,7 +547,7 @@ void mlMainWindow::InitGDTCreator() mOpenAPEAfterCreation->setChecked(Settings.value("GDTCreate_OpenAPEAfterCreation", true).toBool()); connect(mOpenAPEAfterCreation, SIGNAL(clicked()), this, SLOT(OnOpenAPEAfterToggle())); - //Do things + //Do things groupBox->setAcceptDrops(true); dock->resize(QSize(256, 256)); @@ -586,12 +586,12 @@ void mlMainWindow::StartBuildThread(const QList>& Co { if(mBuildThread == NULL) { - mBuildButton->setText("Cancel"); + mBuildButton->setText("Cancel"); - mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); - connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); - connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); - mBuildThread->start(); + mBuildThread = new mlBuildThread(Commands, mIgnoreErrorsWidget->isChecked()); + connect(mBuildThread, SIGNAL(OutputReady(QString)), this, SLOT(BuildOutputReady(QString))); + connect(mBuildThread, SIGNAL(finished()), this, SLOT(BuildFinished())); + mBuildThread->start(); } else { @@ -1680,7 +1680,7 @@ void mlMainWindow::OnOpenAPEAfterToggle() { QSettings Settings; Settings.setValue("GDTCreate_OpenAPEAfterCreation", mOpenAPEAfterCreation->isChecked()); - + } void mlMainWindow::BuildOutputReady(QString Output) @@ -1726,11 +1726,11 @@ void mlMainWindow::InitZoneEditor() mScriptList = new QFileSystemModel(this); mScriptList->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks); - + mScriptList->setNameFilters(AcceptableFileTypes); mScriptList->setNameFilterDisables(false); - mScriptList->setRootPath(mToolsPath); + mScriptList->setRootPath(mToolsPath); mFileTree->setModel(mScriptList); mFileTree->setRootIndex(mScriptList->setRootPath(mToolsPath)); @@ -1753,7 +1753,7 @@ void mlMainWindow::InitZoneEditor() connect(mZoneTextEdit, SIGNAL(textChanged()),this,SLOT(OnTextChanged())); connect(mFileTree->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(OnItemSelected(const QItemSelection&,const QItemSelection&))); - + ZoneFile = new QFile(mZonePath); if(!ZoneFile->open(QIODevice::ReadOnly)) @@ -1776,10 +1776,10 @@ void mlMainWindow::InitZoneEditor() void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSelection& Deselected) { - QModelIndex CurrentIndex = mFileTree->currentIndex(); - + QModelIndexList parents; + QStringList AppendableDirs; parents << CurrentIndex; while ( parents.last().isValid()) @@ -1787,6 +1787,7 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel if(parents.last().parent().data().toString() == "raw") { //Implement endsWith() yadayadya stuffs. parent folder checking and finally inserting. + break; } else { @@ -1798,8 +1799,34 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel } else { - QString result = QInputDialog::getText(0, "What Is This?", "Enter What Type Of Asset This Is:", QLineEdit::Normal,"scriptparsetree,xmodel,materal", new bool()); - mZoneTextEdit->appendPlainText(QString("%1,%2").arg(result,CurrentIndex.data().toString())); //Gotta get loop working, appent strings etc ya know the usual stuff. + + QInputDialog AssetType; + QStringList AssetList; + AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle"; + AssetType.setOption(QInputDialog::UseListViewForComboBoxItems); + AssetType.setWindowTitle(tr("Asset Type")); + AssetType.setLabelText(tr("What Is This?:")); + AssetType.setComboBoxItems(AssetList); + int Ret = AssetType.exec(); + + if (Ret != QDialog::Accepted) + break; + + if(!AssetType.textValue().isEmpty()) + { + /* foreach(auto Parent, parents) + { + QString Last = Parent.data().toString(); + if(Last != Parent.data().toString()) + { + + AppendableDirs << Parent.data().toString(); + } + }*/ + + mZoneTextEdit->appendPlainText(QString("%1,%2").arg(AssetType.textValue(),QString(AppendableDirs.join("")+CurrentIndex.data().toString()))); //Gotta get loop working, appent strings etc ya know the usual stuff. + break; + } } } parents << parents.last().parent(); From 656d394725a3bc30130c034f0aaff926ac1e9756 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 19 May 2017 14:39:44 +1200 Subject: [PATCH 23/35] Zone Editor You can now add files by clicking on them in the zone editor. I will also be improving this a lot this weekend, I will also be finally making the GDT creator, check the git cards to see what I have planned. --- mlMainWindow.cpp | 87 ++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index abce515..bacc748 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1719,15 +1719,12 @@ void mlMainWindow::InitZoneEditor() mZoneTextEdit = new QPlainTextEdit(); QPushButton* ZoneSave = new QPushButton(); QPushButton* ZoneCancel = new QPushButton(); - QStringList AcceptableFileTypes; - AcceptableFileTypes << "*.gsc" << "*.csc" << "*.gsh"; mFileTree = new QTreeView(); mScriptList = new QFileSystemModel(this); mScriptList->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks); - mScriptList->setNameFilters(AcceptableFileTypes); mScriptList->setNameFilterDisables(false); mScriptList->setRootPath(mToolsPath); @@ -1776,61 +1773,51 @@ void mlMainWindow::InitZoneEditor() void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSelection& Deselected) { - QModelIndex CurrentIndex = mFileTree->currentIndex(); - - QModelIndexList parents; - QStringList AppendableDirs; - parents << CurrentIndex; + if(mScriptList->hasChildren(mFileTree->currentIndex())) + { + QMessageBox::information(this,"Hold Up!","I Can't Add folders! Please Select A File.",QMessageBox::Ok); + return; + } + + QModelIndexList ParentFolderList; + QStringList ParentFolderStringList; + ParentFolderList << mFileTree->currentIndex(); - while ( parents.last().isValid()) + while (ParentFolderList.last().isValid() && ParentFolderList.last().parent().data().toString() != "raw") { - if(parents.last().parent().data().toString() == "raw") + if(ParentFolderList.last().parent().data().toString() == "raw" || ParentFolderList.last().parent().data().toString() == "Call of Duty Black Ops III") //Don't Process If It's Out Of Raw, or how the hell did you get that far? Maybe I should prmopt them...? { - //Implement endsWith() yadayadya stuffs. parent folder checking and finally inserting. - break; + QMessageBox::question(this,"Hold Up!","Hey! This File Isn't In Raw! Please Move It To Raw.",QMessageBox::No); + return; } - else - { - QSettings Settings; - if(Settings.value("Expert_ZoneEditor", false).toBool() == false) - { - QMessageBox::critical(this,"Hold On!","I Don't Support Adding Files From Here!\nPlease Use The Raw Folder Or Enable Expert Mode In Settings.",QMessageBox::Ok); - break; - } - else - { + ParentFolderList << ParentFolderList.last().parent(); + } + foreach(const QModelIndex &CurrentIndex, ParentFolderList) + { + ParentFolderStringList << CurrentIndex.data(Qt::DisplayRole).toString(); + } - QInputDialog AssetType; - QStringList AssetList; - AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle"; - AssetType.setOption(QInputDialog::UseListViewForComboBoxItems); - AssetType.setWindowTitle(tr("Asset Type")); - AssetType.setLabelText(tr("What Is This?:")); - AssetType.setComboBoxItems(AssetList); - int Ret = AssetType.exec(); + std::reverse(ParentFolderStringList.begin(),ParentFolderStringList.end()); + + QInputDialog AssetType; + QStringList AssetList; + AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle"; + AssetType.setOption(QInputDialog::UseListViewForComboBoxItems); + AssetType.setWindowTitle("Asset Type"); + AssetType.setLabelText("What Is This?:"); + AssetType.setComboBoxItems(AssetList); + int Ret = AssetType.exec(); - if (Ret != QDialog::Accepted) - break; + if (Ret != QDialog::Accepted) + return; - if(!AssetType.textValue().isEmpty()) - { - /* foreach(auto Parent, parents) - { - QString Last = Parent.data().toString(); - if(Last != Parent.data().toString()) - { - - AppendableDirs << Parent.data().toString(); - } - }*/ - - mZoneTextEdit->appendPlainText(QString("%1,%2").arg(AssetType.textValue(),QString(AppendableDirs.join("")+CurrentIndex.data().toString()))); //Gotta get loop working, appent strings etc ya know the usual stuff. - break; - } - } - } - parents << parents.last().parent(); + if(!AssetType.textValue().isEmpty()) + { + mZoneTextEdit->appendPlainText(QString("%1,%2").arg(AssetType.textValue(),ParentFolderStringList.join("/"))); + mOutputWidget->appendPlainText("Done"); } + + } void mlMainWindow::OnSaveZone() From 4b16a2ba0ff9f9ca9adf1c1b6d4c98391c71639d Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 19 May 2017 15:53:09 +1200 Subject: [PATCH 24/35] GDT Code coming along This update adds some stuff to the GDT Creator, it sitll doesn't create the GDT file, but it will next commit, I am just creating a dialog that will prompt similar to the zone editor asking what sort of GDT it should create either xmodel or image --- mlMainWindow.cpp | 61 +++++++++++++++++++++++++++++++----------------- mlMainWindow.h | 1 + 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index bacc748..60fd746 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -532,7 +532,7 @@ void mlMainWindow::InitGDTCreator() dock->setWidget(widget); GDTCreatorGroupBox* groupBox = new GDTCreatorGroupBox(dock, this); - gridLayout->addWidget(groupBox, 0, 0); + gridLayout->addWidget(groupBox, 0, 0,1,0); QLabel* label = new QLabel("Drag Files Here", groupBox); label->setAlignment(Qt::AlignCenter); @@ -540,14 +540,17 @@ void mlMainWindow::InitGDTCreator() groupBoxLayout->addWidget(label); groupBox->setLayout(groupBoxLayout); - mOpenAPEAfterCreation = new QCheckBox("&Open APE After Creation", widget); + mOpenAPEAfterCreation = new QCheckBox("Open APE After Creation", widget); + mAutoCopyAssetsAfterGDTCreation = new QCheckBox("Copy Assets After Creation", widget); //Doesn't Need A Settings. + gridLayout->addWidget(mOpenAPEAfterCreation, 1, 0); + gridLayout->addWidget(mAutoCopyAssetsAfterGDTCreation,1,1); QSettings Settings; mOpenAPEAfterCreation->setChecked(Settings.value("GDTCreate_OpenAPEAfterCreation", true).toBool()); connect(mOpenAPEAfterCreation, SIGNAL(clicked()), this, SLOT(OnOpenAPEAfterToggle())); - //Do things + groupBox->setAcceptDrops(true); dock->resize(QSize(256, 256)); @@ -1485,19 +1488,18 @@ void mlMainWindow::OnOpenDocs() void mlMainWindow::OnSaveOutput() { - QFile* Output = new QFile("Console Output.txt"); + QFile* Output = new QFile("Output.txt"); if(Output->open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream Out(Output); Out << (mOutputWidget->toPlainText()); Out.flush(); - QMessageBox::information(this,"Saved Console Output","Saved Console Output To: Console Output.txt",QMessageBox::Ok); + QMessageBox::information(this,"Saved Console Output","Saved Console Output To: Output.txt",QMessageBox::Ok); } else { QMessageBox::warning(this,"Failed To Save Console Output!","Failed To Save!: "+Output->errorString(),QMessageBox::Ok); } - Output->close(); } @@ -1680,7 +1682,6 @@ void mlMainWindow::OnOpenAPEAfterToggle() { QSettings Settings; Settings.setValue("GDTCreate_OpenAPEAfterCreation", mOpenAPEAfterCreation->isChecked()); - } void mlMainWindow::BuildOutputReady(QString Output) @@ -1857,16 +1858,6 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } -GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) -{ - this->setAcceptDrops(true); -} - -void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) -{ - event->acceptProposedAction(); -} - void GDTCreatorGroupBox::dropEvent(QDropEvent* event) { QDir source_data_folder(QString("%1/source_data").arg(parentWindow->mToolsPath)); @@ -1883,23 +1874,51 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) { QStringList pathList; QList urlList = mimeData->urls(); - QString CurrentFile; - for (int i = 0; i < urlList.size(); i++) { - CurrentFile = urlList.at(i).toLocalFile(); - if(!CurrentFile.endsWith(".tiff") || !CurrentFile.endsWith(".tif")) + QStringList AllowedFileTypes; + AllowedFileTypes << "tiff" << "tif" << "xmodel_bin" << "xanim_bin"; + QFileInfo Current =urlList.at(i).toLocalFile(); + + if(!AllowedFileTypes.contains(Current.suffix())) { QMessageBox::warning(this,"Incorrect Format!","Please Convert This File To Either XMODEL_BIN, XANIM_BIN, TIFF Or TIF",QMessageBox::Ok); return; } + + if(Current.isDir()) + { + QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); + return; + } + + if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked()) + { + QString WorkingDir = QFileInfo(urlList.at(i).toLocalFile()).fileName().split(".",QString::SkipEmptyParts).at(0); + + if(!QDir().exists(WorkingDir)) + QDir().mkpath(QString("%1/%2").arg(model_export_folder.absolutePath(),WorkingDir)); //Make Path + + QFile().copy(urlList.at(i).toLocalFile(),QString("%1/%2/%3").arg(model_export_folder.absolutePath(),WorkingDir,QFileInfo(urlList.at(i).toLocalFile()).fileName())); + } } event->acceptProposedAction(); } } + +GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) +{ + this->setAcceptDrops(true); +} + +void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) +{ + event->acceptProposedAction(); +} + void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) { event->accept(); diff --git a/mlMainWindow.h b/mlMainWindow.h index cb7b814..bc42e46 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -193,6 +193,7 @@ protected slots: QCheckBox* mExport2BinOverwriteWidget; QCheckBox* mGDTCreateOverwriteWidget; QCheckBox* mOpenAPEAfterCreation; + QCheckBox* mAutoCopyAssetsAfterGDTCreation; QComboBox* mCompileModeWidget; QComboBox* mLightQualityWidget; From 0d996b7269cad876d421f57b3ab55bf7937c10be Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 19 May 2017 17:52:47 +1200 Subject: [PATCH 25/35] I mean it makes the GDt But doesn't work at the same time. --- mlMainWindow.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 12 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 60fd746..03fed1e 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1,4 +1,4 @@ -/* +/* * * Copyright 2016 Activision Publishing, Inc. * @@ -542,7 +542,7 @@ void mlMainWindow::InitGDTCreator() mOpenAPEAfterCreation = new QCheckBox("Open APE After Creation", widget); mAutoCopyAssetsAfterGDTCreation = new QCheckBox("Copy Assets After Creation", widget); //Doesn't Need A Settings. - + gridLayout->addWidget(mOpenAPEAfterCreation, 1, 0); gridLayout->addWidget(mAutoCopyAssetsAfterGDTCreation,1,1); @@ -1779,7 +1779,7 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel QMessageBox::information(this,"Hold Up!","I Can't Add folders! Please Select A File.",QMessageBox::Ok); return; } - + QModelIndexList ParentFolderList; QStringList ParentFolderStringList; ParentFolderList << mFileTree->currentIndex(); @@ -1799,7 +1799,7 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel } std::reverse(ParentFolderStringList.begin(),ParentFolderStringList.end()); - + QInputDialog AssetType; QStringList AssetList; AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle"; @@ -1814,11 +1814,11 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel if(!AssetType.textValue().isEmpty()) { - mZoneTextEdit->appendPlainText(QString("%1,%2").arg(AssetType.textValue(),ParentFolderStringList.join("/"))); - mOutputWidget->appendPlainText("Done"); + mZoneTextEdit->appendPlainText(QString("%1,%2").arg(AssetType.textValue(),ParentFolderStringList.join("/"))); + mOutputWidget->appendPlainText("Done"); } - + } void mlMainWindow::OnSaveZone() @@ -1878,32 +1878,124 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) for (int i = 0; i < urlList.size(); i++) { QStringList AllowedFileTypes; - AllowedFileTypes << "tiff" << "tif" << "xmodel_bin" << "xanim_bin"; + AllowedFileTypes << "tiff" << "tif" << "xmodel_bin"; QFileInfo Current =urlList.at(i).toLocalFile(); if(!AllowedFileTypes.contains(Current.suffix())) { - QMessageBox::warning(this,"Incorrect Format!","Please Convert This File To Either XMODEL_BIN, XANIM_BIN, TIFF Or TIF",QMessageBox::Ok); + QMessageBox::warning(this,"Incorrect Format!","Please Convert This File To Either XMODEL_BIN, TIFF Or TIF",QMessageBox::Ok); return; } if(Current.isDir()) { - QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); + QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); //Iterate Through Them In A Later Release. + //I might need to refractor into a func so I can do this though ¯\_(ツ)_/¯ return; } + QString WorkingDir = QFileInfo(urlList.at(i).toLocalFile()).fileName().split(".",QString::SkipEmptyParts).at(0); + QString Path; if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked()) { - QString WorkingDir = QFileInfo(urlList.at(i).toLocalFile()).fileName().split(".",QString::SkipEmptyParts).at(0); - if(!QDir().exists(WorkingDir)) QDir().mkpath(QString("%1/%2").arg(model_export_folder.absolutePath(),WorkingDir)); //Make Path QFile().copy(urlList.at(i).toLocalFile(),QString("%1/%2/%3").arg(model_export_folder.absolutePath(),WorkingDir,QFileInfo(urlList.at(i).toLocalFile()).fileName())); + Path = QString("%1/%2/%3").arg("model_export",WorkingDir,QFileInfo(urlList.at(i).toLocalFile()).fileName()); + } + else + { + Path = urlList.at(i).toLocalFile(); + } + + //Create GDT Now. + QInputDialog GDTType; + QStringList GDTTypeList; + QString GDTTemplate; + + GDTTypeList << "xmodel" << "image"; + GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); + GDTType.setWindowTitle("GDT Creation Type"); + GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(QFileInfo(urlList.at(i).toLocalFile()).fileName())); + GDTType.setComboBoxItems(GDTTypeList); + int Ret = GDTType.exec(); + + if (Ret != QDialog::Accepted) + return; + + //This Doesn't Work, But Also Works.... + if(!GDTType.textValue().isEmpty()) + { + if(GDTType.textValue() == "xmodel" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "xmodel_bin") + { + GDTTemplate = + "{\n" + + QString("\t\"%1\" ( \"xmodel.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + + "\t{\n" + + "\t\t\"filename\" \"" + Path + "\"\n" + + "\t\t\"highLodDist\" \"751\"\n" + + "\t\t\"type\" \"rigid\"\n" + + "\t}\n" + + "}\n"; + QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),WorkingDir.left(WorkingDir.lastIndexOf('_')),".gdt")); + if(xModelFile.open(QFile::ReadWrite)) + { + QTextStream FileWriter(&xModelFile); + FileWriter << GDTTemplate; + FileWriter.flush(); + xModelFile.close(); + } + else + { + QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); + return; + } + } + else + { + QMessageBox::warning(this,"Uh-Oh!","I Can't Create An xModel GDT For This File Type.",QMessageBox::Ok); + return; + } + if (GDTType.textValue() == "image" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tiff" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tif") + { + GDTTemplate = + "{\n" + + QString("\t\"%1\" ( \"image.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + + "\t{\n" + + "\t\t\"baseImage\" \"" + Path +"\"\n" + + "\t\t\"semantic\" \"diffuseMap\"\n" + + "\t\t\"imageType\" \"Texture\"\n" + + "\t\t\"type\" \"image\"\n" + + "\t}\n" + + "}\n"; + QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),WorkingDir.left(WorkingDir.lastIndexOf('_')),".gdt")); + if(xModelFile.open(QFile::ReadWrite)) + { + QTextStream FileWriter(&xModelFile); + FileWriter << GDTTemplate; + FileWriter.flush(); + xModelFile.close(); + } + else + { + QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); + return; + } + + } + else + { + QMessageBox::warning(this,"Uh-Oh!","I Can't Create An Image GDT For This File Type.",QMessageBox::Ok); + return; + } + //Add Material Stuff. } } + if(parentWindow->mOpenAPEAfterCreation->isChecked()) + parentWindow->mActionFileAssetEditor->trigger(); + event->acceptProposedAction(); } } From 70197f16e719433d4a44d6008b382252b10b8f30 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 19 May 2017 19:34:34 +1200 Subject: [PATCH 26/35] GDT Fixes Fixed some whack code in my GDT creator. Maybe I should offload this stuff to it's on .h and .cpp, it's going to use a lot of code... --- mlMainWindow.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 03fed1e..f78f3b7 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -1913,7 +1913,8 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) QInputDialog GDTType; QStringList GDTTypeList; QString GDTTemplate; - + QString FileName; + GDTTypeList << "xmodel" << "image"; GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); GDTType.setWindowTitle("GDT Creation Type"); @@ -1927,6 +1928,19 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) //This Doesn't Work, But Also Works.... if(!GDTType.textValue().isEmpty()) { + FileName = WorkingDir.left(WorkingDir.lastIndexOf('_')); + QInputDialog FileNameInput; + FileNameInput.setWindowTitle("File Name"); + FileNameInput.setLabelText("What Should I Call The GDT?"); + bool Res; + FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); + + if(!Res) + return; + + FileName= FileNameInput.textValue(); + + if(GDTType.textValue() == "xmodel" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "xmodel_bin") { GDTTemplate = @@ -1938,7 +1952,7 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) "\t\t\"type\" \"rigid\"\n" + "\t}\n" + "}\n"; - QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),WorkingDir.left(WorkingDir.lastIndexOf('_')),".gdt")); + QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),FileName,".gdt")); if(xModelFile.open(QFile::ReadWrite)) { QTextStream FileWriter(&xModelFile); @@ -1952,12 +1966,8 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) return; } } - else - { - QMessageBox::warning(this,"Uh-Oh!","I Can't Create An xModel GDT For This File Type.",QMessageBox::Ok); - return; - } - if (GDTType.textValue() == "image" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tiff" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tif") + + if (GDTType.textValue() == "image" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tiff" || QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tif") { GDTTemplate = "{\n" + @@ -1969,7 +1979,7 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) "\t\t\"type\" \"image\"\n" + "\t}\n" + "}\n"; - QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),WorkingDir.left(WorkingDir.lastIndexOf('_')),".gdt")); + QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),FileName,".gdt")); if(xModelFile.open(QFile::ReadWrite)) { QTextStream FileWriter(&xModelFile); @@ -1986,7 +1996,7 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) } else { - QMessageBox::warning(this,"Uh-Oh!","I Can't Create An Image GDT For This File Type.",QMessageBox::Ok); + QMessageBox::warning(this,"Uh-Oh!","I Can't Create A GDT For This File Type.\nPlease make sure you're using xmodel_bin, tif or tiff.",QMessageBox::Ok); return; } //Add Material Stuff. From 39bf2969293b16e22a8438d80cd84447d9c08c9d Mon Sep 17 00:00:00 2001 From: Johnathon Date: Fri, 19 May 2017 20:54:31 +1200 Subject: [PATCH 27/35] Stop / Start / Stop / Start Such is lifein my compile history. This one changes optional rung args to additional compile args for the cod2map stage of compliation. --- mlMainWindow.cpp | 49 ++++++++++++++++++++++++++++++------------------ mlMainWindow.h | 2 +- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index f78f3b7..ee7dc3b 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -252,9 +252,6 @@ mlMainWindow::mlMainWindow() mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); - - UpdateTheme(); - setWindowIcon(QIcon(":/resources/ModLauncher.png")); setWindowTitle("Black Ops III Mod Tools Launcher"); @@ -318,8 +315,7 @@ mlMainWindow::mlMainWindow() mRunEnabledWidget = new QCheckBox("Run"); ActionsLayout->addWidget(mRunEnabledWidget); - mRunOptionsWidget = new QLineEdit(); - mRunOptionsWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + mRunOptionsWidget = new QComboBox(); ActionsLayout->addWidget(mRunOptionsWidget); mBuildButton = new QPushButton("Build"); @@ -359,9 +355,35 @@ mlMainWindow::mlMainWindow() mTimer.start(1000); SyntaxTimer.setSingleShot(true); connect(&SyntaxTimer,SIGNAL(timeout()),this,SLOT(UpdateSyntax())); + PopulateFileList(); - mRunOptionsWidget->setPlaceholderText("Optional Run Args"); + mRunOptionsWidget->addItem("-noWater"); + mRunOptionsWidget->setItemData(0, "Ignores all water brushes", Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-noCurves"); + mRunOptionsWidget->setItemData(1,"Ignores all patch and terrain geometry",Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-noDetail"); + mRunOptionsWidget->setItemData(2,"Ignores all detail brushes",Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-fullDetail"); + mRunOptionsWidget->setItemData(3,"Turns all detail brushes into structural brushes",Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-leakTest"); + mRunOptionsWidget->setItemData(4,"Quits immediately if the map leaked",Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-ModelShadow"); + mRunOptionsWidget->setItemData(5,"Allows model surfaces to cast shadows",Qt::ToolTipRole); + + mRunOptionsWidget->addItem("-NoModelShadow"); + mRunOptionsWidget->setItemData(6,"Prevents model surfaces from casting shadows",Qt::ToolTipRole); + + mRunOptionsWidget->setEditable(true); + mRunOptionsWidget->lineEdit()->setPlaceholderText("Compiler Args"); //Nothing, Hack So You Don't NEED To Supply An Optional Run Arg. + mRunOptionsWidget->setCurrentIndex(-1); + + UpdateTheme(); } mlMainWindow::~mlMainWindow() @@ -921,8 +943,7 @@ void mlMainWindow::OnEditBuild() AddUpdateDBCommand(); QStringList Args; - Args << "-platform" << "pc"; - + Args << "-platform" << "pc" << mRunOptionsWidget->currentText(); if (mCompileModeWidget->currentIndex() == 0) Args << "-onlyents"; else @@ -998,10 +1019,6 @@ void mlMainWindow::OnEditBuild() if (!LastMap.isEmpty()) Args << "+devmap" << LastMap; - QString ExtraOptions = mRunOptionsWidget->text(); - if (!ExtraOptions.isEmpty()) - Args << ExtraOptions.split(' '); - Commands.append(QPair(QString("%1/BlackOps3.exe").arg(mGamePath), Args)); } @@ -1579,10 +1596,6 @@ void mlMainWindow::OnRunMapOrMod() Args << ModName; } - QString ExtraOptions = mRunOptionsWidget->text(); - if (!ExtraOptions.isEmpty()) - Args << ExtraOptions.split(' '); - QList> Commands; Commands.append(QPair(QString("%1/BlackOps3.exe").arg(mGamePath), Args)); StartBuildThread(Commands); @@ -1802,7 +1815,7 @@ void mlMainWindow::OnItemSelected(const QItemSelection& Selected, const QItemSel QInputDialog AssetType; QStringList AssetList; - AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle"; + AssetList << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "xanim" << "material" << "weaponfile" << "sound"; AssetType.setOption(QInputDialog::UseListViewForComboBoxItems); AssetType.setWindowTitle("Asset Type"); AssetType.setLabelText("What Is This?:"); @@ -2080,7 +2093,7 @@ Syntax::Syntax(QTextDocument *parent) : QSyntaxHighlighter(parent) KeyWordFormat.setForeground(QColor("#63a058")); QStringList Patterns; - Patterns << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "actor" << "material" << "col_map" << "gfx_map" << "sound"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). + Patterns << "col_map" << "gfx_map" << "fx" << "scriptparsetree" << "rawfile" << "scriptbundle" << "xmodel" << "xanim" << "material" << "weaponfile" << "sound"; //I Can't Find Docs On All, Would Be Nice To Get The Rest :). foreach (const QString &Pattern, Patterns) { CurrentRule.RegExPattern = QRegExp(Pattern); diff --git a/mlMainWindow.h b/mlMainWindow.h index bc42e46..ae71c7d 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -197,8 +197,8 @@ protected slots: QComboBox* mCompileModeWidget; QComboBox* mLightQualityWidget; + QComboBox* mRunOptionsWidget; - QLineEdit* mRunOptionsWidget; QLineEdit* mExport2BinTargetDirWidget; QLineEdit* mGDTCreateTargetDir; From 9069b8ea94a59d71d6fff2a9c5ae1cffc40deccf Mon Sep 17 00:00:00 2001 From: Johnathon Date: Sat, 20 May 2017 19:04:50 +1200 Subject: [PATCH 28/35] cod2map args Base cod2map args, doesn't work as of yet. --- ModLauncher.vcxproj | 3 +- ModLauncher.vcxproj.filters | 6 ++ cod2map.cpp | 63 ++++++++++++++ cod2map.h | 35 ++++++++ dvar.cpp | 5 +- mlMainWindow.cpp | 158 ++++++++++++++++++++++++++++-------- mlMainWindow.h | 7 +- stdafx.h | 3 +- 8 files changed, 240 insertions(+), 40 deletions(-) create mode 100644 cod2map.cpp create mode 100644 cod2map.h diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index 003ae15..f4254de 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -305,6 +305,7 @@ + true @@ -455,8 +456,8 @@ + - diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index e19633a..1224d48 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -55,6 +55,9 @@ Source Files + + Source Files + @@ -79,5 +82,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/cod2map.cpp b/cod2map.cpp new file mode 100644 index 0000000..153262b --- /dev/null +++ b/cod2map.cpp @@ -0,0 +1,63 @@ +#include "stdafx.h" + +COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) +{ + QString Setting = QString("Setting_%1").arg(Argument.name); + QSettings settings; + + QTreeWidgetItem* Item = new QTreeWidgetItem(ArgumentTree, QStringList() << Argument.name); + Item->setText(0, Argument.name); + Item->setToolTip(0, Argument.description); + + QCheckBox* checkBox; + QSpinBox* spinBox; + QComboBox* comboBox; + + switch(Argument.type) + { + case ARG_VALUE_SET: + checkBox = new QCheckBox(); + checkBox->setChecked(settings.value(Setting, false).toBool()); + checkBox->setToolTip("Boolean value, check to enable or uncheck to disable."); + ArgumentTree->setItemWidget(Item, 1, checkBox); + break; + case ARG_VALUE_NEEDS_COMBO_TEXT: + comboBox = new QComboBox(); + comboBox->setToolTip(QString("String value, leave this blank for it to not be used.")); + comboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + ArgumentTree->setItemWidget(Item, 1, comboBox); + break; + } +} + +COD2MAPArg_s COD2MAP::findSetting(QString _SettingName, QTreeWidget* SettingTree, COD2MAPArg_s* Settings, int SettingsSize) +{ + COD2MAPArg_s Setting; + for(int SettingIdx = 0; SettingIdx < SettingsSize; SettingIdx++) + { + Setting = COD2MAP(Settings[SettingIdx], SettingTree).CurrentArg; + if(Setting.name == _SettingName) + return Setting; + } + return Setting; +} + +QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QCheckBox* _checkBox) +{ + QSettings Settings; + Settings.setValue(QString("Setting_%1").arg(Setting.name), _checkBox->isChecked()); + + return Settings.value(QString("Setting_%1").arg(Setting.name)).toString() == "true" ? "1" : "0"; // another way to do this? +} + +QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QLineEdit* _textBox) +{ + QSettings Settings; + Settings.setValue(QString("Setting_%1").arg(Setting.name), _textBox->text()); + + return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); +} + +COD2MAP::~COD2MAP() +{ +} \ No newline at end of file diff --git a/cod2map.h b/cod2map.h new file mode 100644 index 0000000..2e105e6 --- /dev/null +++ b/cod2map.h @@ -0,0 +1,35 @@ +#pragma once + +enum COD2MAPArgType +{ + ARG_VALUE_SET, // Just Needs To Be Set. + ARG_VALUE_NEEDS_INT_TEXT, //Needs User INT Input. + ARG_VALUE_NEEDS_COMBO_TEXT //Needs User To Choose Strig From List. +}; + +struct COD2MAPArg_s +{ + const char* name; + const char* description; + COD2MAPArgType type; + int minValue; + int maxValue; + bool isSettable;//Is Settable, Needs No Value. E.G. - +}; + +class COD2MAP +{ +private: + COD2MAPArg_s CurrentArg; + + +public: + COD2MAP(); + COD2MAP(COD2MAPArg_s, QTreeWidget*); + ~COD2MAP(); + + static QString setCOD2MAPSetting(COD2MAPArg_s, QCheckBox*); + static QString setCOD2MAPSetting(COD2MAPArg_s, QLineEdit*); + + static COD2MAPArg_s findSetting(QString, QTreeWidget*, COD2MAPArg_s*, int); +}; \ No newline at end of file diff --git a/dvar.cpp b/dvar.cpp index 87a9606..743f46e 100644 --- a/dvar.cpp +++ b/dvar.cpp @@ -39,9 +39,7 @@ Dvar::Dvar(dvar_s _dvar, QTreeWidget *_dvarTree) : dvar(_dvar) break; case DVAR_VALUE_COMBO: comboBox = new QComboBox(); - QStringList mShippedMapList; - mShippedMapList << "mp_aerospace" << "mp_apartments" << "mp_arena" << "mp_banzai" << "mp_biodome" << "mp_chinatown" << "mp_city" << "mp_conduit" << "mp_crucible" << "mp_cryogen" << "mp_ethiopia" << "mp_freerun_01" << "mp_freerun_02" << "mp_freerun_03" << "mp_freerun_04" << "mp_havoc" << "mp_infection" << "mp_kung_fu" << "mp_metro" << "mp_miniature" << "mp_nuketown_x" << "mp_redwood" << "mp_rise" << "mp_rome" << "mp_ruins" << "mp_sector" << "mp_shrine" << "mp_skyjacked" << "mp_spire" << "mp_stronghold" << "mp_veiled" << "mp_waterpark" << "mp_western" << "zm_castle" << "zm_factory" << "zm_genesis" << "zm_island" << "zm_levelcommon" << "zm_stalingrad" << "zm_zod"; - comboBox->addItems(mShippedMapList); + comboBox->addItems(QStringList() << "mp_aerospace" << "mp_apartments" << "mp_arena" << "mp_banzai" << "mp_biodome" << "mp_chinatown" << "mp_city" << "mp_conduit" << "mp_crucible" << "mp_cryogen" << "mp_ethiopia" << "mp_freerun_01" << "mp_freerun_02" << "mp_freerun_03" << "mp_freerun_04" << "mp_havoc" << "mp_infection" << "mp_kung_fu" << "mp_metro" << "mp_miniature" << "mp_nuketown_x" << "mp_redwood" << "mp_rise" << "mp_rome" << "mp_ruins" << "mp_sector" << "mp_shrine" << "mp_skyjacked" << "mp_spire" << "mp_stronghold" << "mp_veiled" << "mp_waterpark" << "mp_western" << "zm_castle" << "zm_factory" << "zm_genesis" << "zm_island" << "zm_levelcommon" << "zm_stalingrad" << "zm_zod"); comboBox->setEditable(true); _dvarTree->setItemWidget(Item,1,comboBox); } @@ -92,5 +90,4 @@ QString Dvar::setDvarSetting(dvar_s _dvar, QComboBox* _lineEdit) QSettings Settings; Settings.setValue(QString("dvar_%1").arg(_dvar.name), _lineEdit->currentText()); return Settings.value(QString("dvar_%1").arg(_dvar.name)).toString(); - } \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index ee7dc3b..a26df2e 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -40,6 +40,54 @@ dvar_s gDvars[] = { {"splitscreen_playerCount", "Allocate the number of instances for splitscreen", DVAR_VALUE_INT, 0, 2}, {"devmap","Launch to this map using devmap",DVAR_VALUE_COMBO,0,0,true}, }; + +COD2MAPArg_s gCod2MapArgs[] = { + { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_VALUE}, + { "-pcToXenon","Copies a PC bsp to a Xenon bsp", ARG_VALUE_SET }, + { "-xenonToPc","Copies a Xenon bsp to a PC bsp", ARG_VALUE_SET }, + {"-v","Verbose; enables extra compilation messages", ARG_VALUE_SET }, + {"-verboseEntities","Includes verbose messages for submodels if '-v' is given", ARG_VALUE_SET }, + {"-onlyEnts","Compile doesn't touch triggers, geometry, or lighting", ARG_VALUE_SET }, + { "-generateMapEntsFile","Generate map entity string file only, ignore reference prefabs", ARG_VALUE_SET }, + {"-blockSize","Grid size for regular BSP splits; 0 uses largest possible", ARG_VALUE_NEEDS_VALUE,0,64,true }, + {"-subdivisions","Divides all geometry on a grid; only works for small maps", ARG_VALUE_SET }, + {"-noSubdivide","Ignores the 'tessSize' setting in all materials", ARG_VALUE_SET }, + { "-staticModelCollMaps","(Legacy support) Use collmaps for static models", ARG_VALUE_SET}, + {"-displayCollMapWarnings","Display missing collmap warnings", ARG_VALUE_SET}, + {"-ignoreModelErrors","Don't error on missing models, just allow them to drop out", ARG_VALUE_SET }, + {"-smoothAngle","Smooth surfaces are only smoothed at angles less than this", ARG_VALUE_SET }, + { "-loadFrom","Reads this map instead, but still writes to ", ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + {"-noCurves","Ignores all patch and terrain geometry", ARG_VALUE_SET }, + {"-noDetail","Ignores all detail brushes", ARG_VALUE_SET}, + {"-fullDetail","Turns all detail brushes into structural brushes", ARG_VALUE_SET}, + { "-leakTest","Quits immediately if the map leaked",ARG_VALUE_SET}, + {"-portalTest","Forces all portal errors to be fatal",ARG_VALUE_SET}, + {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + {"-expandPlayer","Writes a map for Radiant to see player-to-brush collision",ARG_VALUE_SET}, + {"-expandBullet","Writes a map for Radiant to see bullet-to-brush collision",ARG_VALUE_SET}, + {"-debugPortals","Writes a _portals.map showing portal/structural geometry",ARG_VALUE_SET}, + {"-noReorderTris","Disables reordering of optimized triangles for T&L cache",ARG_VALUE_SET}, + {"-listSlowEntities","Lists entities that process in more than this many seconds",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-warnLayerUses","Generates warnings for layer combos used this many or fewer times",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-warnLayerArea","Generates warnings for layer combos used less than this many square inches",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-navmesh","Generates the Havok Navigation Mesh during compile",ARG_VALUE_SET}, + {"-navvolume","Generates the Havok Navigation Volume during compile. Must be generated together with the NavMesh.",ARG_VALUE_SET}, + {"-hkdmp","Creates .hkdmp file of navmesh and navvolume to help diagnose generatio problems.",ARG_VALUE_SET}, + {"-pruneNavMesh","Remove unused navmesh faces that don't exist inside any navmesh triggers.",ARG_VALUE_SET}, + {"-umbraNumThreads","Sets the number of CPU threads Umbra will use when creating tome",ARG_VALUE_NEEDS_VALUE,1,QThread::idealThreadCount(),true }, + {"-umbraSmallestOccluder","Surfaces smaller than this value will not be used as occluders",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-umbraSmallestHole","Geometry gaps smaller than this value are considered solid",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-umbraTileSize","Umbra data block size - smaller values will create larger tomes",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-umbraBackfaceLimit","Reverse percentage of backfaces tested to remove bad detail",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-umbraObjectGroupCost","Groups surfaces together. Will improve in-game speed but degrades occlusion",ARG_VALUE_SET}, + {"-umbraEnableSndbs","Enable use of SNDBS to accelerate Umbra compile",ARG_VALUE_SET}, + {"-useUnstable","Use unstable shaders & techsetdefs",ARG_VALUE_SET}, + {"-spawnTest","Quits immediately if the map has spawn points which intersect with level geop",ARG_VALUE_SET}, + {"-timing","Enable prints for timing and instrumentation",ARG_VALUE_SET}, + {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + {"-noCoalesceCoincidentWindings","Turn off coalescing of coincident/coplanar surfaces",ARG_VALUE_SET} +}; + enum mlItemType { ML_ITEM_UNKNOWN, @@ -315,8 +363,9 @@ mlMainWindow::mlMainWindow() mRunEnabledWidget = new QCheckBox("Run"); ActionsLayout->addWidget(mRunEnabledWidget); - mRunOptionsWidget = new QComboBox(); - ActionsLayout->addWidget(mRunOptionsWidget); + mCOD2MAPOptionsButton = new QPushButton("More Args"); + connect(mCOD2MAPOptionsButton,SIGNAL(clicked()),this,SLOT(OnEditCOD2MAPArgs())); + ActionsLayout->addWidget(mCOD2MAPOptionsButton); mBuildButton = new QPushButton("Build"); connect(mBuildButton, SIGNAL(clicked()), mActionEditBuild, SLOT(trigger())); @@ -355,33 +404,8 @@ mlMainWindow::mlMainWindow() mTimer.start(1000); SyntaxTimer.setSingleShot(true); connect(&SyntaxTimer,SIGNAL(timeout()),this,SLOT(UpdateSyntax())); - - PopulateFileList(); - - mRunOptionsWidget->addItem("-noWater"); - mRunOptionsWidget->setItemData(0, "Ignores all water brushes", Qt::ToolTipRole); - - mRunOptionsWidget->addItem("-noCurves"); - mRunOptionsWidget->setItemData(1,"Ignores all patch and terrain geometry",Qt::ToolTipRole); - - mRunOptionsWidget->addItem("-noDetail"); - mRunOptionsWidget->setItemData(2,"Ignores all detail brushes",Qt::ToolTipRole); - - mRunOptionsWidget->addItem("-fullDetail"); - mRunOptionsWidget->setItemData(3,"Turns all detail brushes into structural brushes",Qt::ToolTipRole); - - mRunOptionsWidget->addItem("-leakTest"); - mRunOptionsWidget->setItemData(4,"Quits immediately if the map leaked",Qt::ToolTipRole); - mRunOptionsWidget->addItem("-ModelShadow"); - mRunOptionsWidget->setItemData(5,"Allows model surfaces to cast shadows",Qt::ToolTipRole); - - mRunOptionsWidget->addItem("-NoModelShadow"); - mRunOptionsWidget->setItemData(6,"Prevents model surfaces from casting shadows",Qt::ToolTipRole); - - mRunOptionsWidget->setEditable(true); - mRunOptionsWidget->lineEdit()->setPlaceholderText("Compiler Args"); //Nothing, Hack So You Don't NEED To Supply An Optional Run Arg. - mRunOptionsWidget->setCurrentIndex(-1); + PopulateFileList(); UpdateTheme(); } @@ -943,7 +967,7 @@ void mlMainWindow::OnEditBuild() AddUpdateDBCommand(); QStringList Args; - Args << "-platform" << "pc" << mRunOptionsWidget->currentText(); + Args << "-platform" << "pc"; if (mCompileModeWidget->currentIndex() == 0) Args << "-onlyents"; else @@ -1304,6 +1328,76 @@ void mlMainWindow::UpdateTheme() } } +void mlMainWindow::OnEditCOD2MAPArgs() +{ + QDialog Dialog(this,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); + Dialog.setWindowTitle("COD2MAP Arguments"); + + QVBoxLayout* Layout = new QVBoxLayout(&Dialog); + + QLabel* Label = new QLabel("These arguments are experimental and will let you tweak what will be parsed to cod2map",&Dialog); + + QTreeWidget* SettingsTree = new QTreeWidget(&Dialog); + SettingsTree->setColumnCount(2); + SettingsTree->header()->setSectionResizeMode(0,QHeaderView::ResizeToContents); + SettingsTree->setHeaderLabels(QStringList() << "Setting" << "Value"); + SettingsTree->setUniformRowHeights(true); + SettingsTree->setRootIsDecorated(false); + + QDialogButtonBox* ButtonBox = new QDialogButtonBox(&Dialog); + ButtonBox->setOrientation(Qt::Horizontal); + ButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + ButtonBox->setCenterButtons(true); + + + Layout->addWidget(Label); + Layout->addWidget(SettingsTree); + Layout->addWidget(ButtonBox); + + for(int SettingIndx = 0; SettingIndx < ARRAYSIZE(gCod2MapArgs); SettingIndx++) + COD2MAP(gCod2MapArgs[SettingIndx], SettingsTree); + + connect(ButtonBox, SIGNAL(accepted()), &Dialog, SLOT(accept())); + connect(ButtonBox, SIGNAL(rejected()), &Dialog, SLOT(reject())); + + if (Dialog.exec() != QDialog::Accepted) + return; + + int size = 0; + QSettings settings; + QString SettingName, SettingValue; + QTreeWidgetItemIterator it(SettingsTree); + + mCod2MapArgs.clear(); + while (*it && size < ARRAYSIZE(gDvars)) + { + QWidget* Widget = SettingsTree->itemWidget(*it, 1); + SettingName = (*it)->data(0, 0).toString(); + COD2MAPArg_s Setting = COD2MAP::findSetting(SettingName, SettingsTree, gCod2MapArgs, ARRAYSIZE(gCod2MapArgs)); + switch(Setting.type) + { + case ARG_VALUE_NEEDS_VALUE: + SettingValue = COD2MAP::setCOD2MAPSetting(Setting, (QLineEdit*)Widget); + break; + case ARG_VALUE_SET: + SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QCheckBox*)Widget); + } + + if(!SettingValue.toLatin1().isEmpty()) + { + if(!Setting.isSettable) + mRunDvars << "+set" << SettingName; + else // hack for cmds + mRunDvars << QString("+%1").arg(SettingName); + + mRunDvars << SettingValue; + } + size++; + ++it; + } +} + + void mlMainWindow::OnEditDvars() { QDialog Dialog(this, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); @@ -1378,8 +1472,6 @@ void mlMainWindow::OnEditDvars() size++; ++it; } - - } void mlMainWindow::UpdateWorkshopItem() @@ -1947,7 +2039,7 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) FileNameInput.setLabelText("What Should I Call The GDT?"); bool Res; FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); - + if(!Res) return; @@ -1979,7 +2071,7 @@ void GDTCreatorGroupBox::dropEvent(QDropEvent* event) return; } } - + if (GDTType.textValue() == "image" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tiff" || QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tif") { GDTTemplate = diff --git a/mlMainWindow.h b/mlMainWindow.h index ae71c7d..da55125 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -107,6 +107,7 @@ protected slots: void OnEditPublish(); void OnEditOptions(); void OnEditDvars(); + void OnEditCOD2MAPArgs(); void OnOpenDocs(); void OnHelpAbout(); void OnSaveOutput(); @@ -149,6 +150,9 @@ protected slots: void InitExport2BinGUI(); void InitZoneEditor(); void InitGDTCreator(); + + void InitCod2MapArgs(); + //void InitLinkerArgs(); Need Docs On This So I can add tool-tips. bool mTreyarchTheme; bool mUseBuiltInEditor; @@ -184,6 +188,7 @@ protected slots: QPushButton* mBuildButton; QPushButton* mDvarsButton; QPushButton* mConvertButton; + QPushButton* mCOD2MAPOptionsButton; QCheckBox* mCompileEnabledWidget; QCheckBox* mLightEnabledWidget; @@ -197,7 +202,6 @@ protected slots: QComboBox* mCompileModeWidget; QComboBox* mLightQualityWidget; - QComboBox* mRunOptionsWidget; QLineEdit* mExport2BinTargetDirWidget; QLineEdit* mGDTCreateTargetDir; @@ -223,6 +227,7 @@ protected slots: QStringList mTags; QStringList mRunDvars; + QStringList mCod2MapArgs; QTimer mTimer; QTimer SyntaxTimer; diff --git a/stdafx.h b/stdafx.h index bdb5678..95dc78a 100644 --- a/stdafx.h +++ b/stdafx.h @@ -22,6 +22,7 @@ #include "steam_api.h" #include "dvar.h" +#include "cod2map.h" class mlMainWindow; -class mlExport2BinWidget; +class mlExport2BinWidget; \ No newline at end of file From 682e191fd81c154e4ef701fa522d826ffd2d9aef Mon Sep 17 00:00:00 2001 From: Johnathon Date: Tue, 23 May 2017 20:29:16 +1200 Subject: [PATCH 29/35] More Args Slowly getting there. --- cod2map.cpp | 20 ++++++++++++++++++-- cod2map.h | 5 +++-- mlMainWindow.cpp | 34 +++++++++++++++++----------------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/cod2map.cpp b/cod2map.cpp index 153262b..e0e7e99 100644 --- a/cod2map.cpp +++ b/cod2map.cpp @@ -10,8 +10,9 @@ COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) Item->setToolTip(0, Argument.description); QCheckBox* checkBox; - QSpinBox* spinBox; + QLineEdit* lineEdit; QComboBox* comboBox; + QSpinBox* spinBox; switch(Argument.type) { @@ -21,12 +22,27 @@ COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) checkBox->setToolTip("Boolean value, check to enable or uncheck to disable."); ArgumentTree->setItemWidget(Item, 1, checkBox); break; - case ARG_VALUE_NEEDS_COMBO_TEXT: + case ARG_VALUE_NEEDS_COMBO: comboBox = new QComboBox(); comboBox->setToolTip(QString("String value, leave this blank for it to not be used.")); comboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); ArgumentTree->setItemWidget(Item, 1, comboBox); break; + case ARG_VALUE_NEEDS_INT: + spinBox = new QSpinBox(); + spinBox->setMinimum(Argument.minValue); + spinBox->setMaximum(Argument.maxValue); + spinBox->setToolTip(QString("Numerical value, leave this blank for it to not be used.")); + spinBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); + ArgumentTree->setItemWidget(Item,1,spinBox); + break; + case ARG_VALUE_NEEDS_STRING: + lineEdit = new QLineEdit(); + spinBox->setToolTip(QString("String value, leave this blank for it to not be used.")); + spinBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); + ArgumentTree->setItemWidget(Item,1,lineEdit); + break; + break; } } diff --git a/cod2map.h b/cod2map.h index 2e105e6..a1f05d9 100644 --- a/cod2map.h +++ b/cod2map.h @@ -3,8 +3,9 @@ enum COD2MAPArgType { ARG_VALUE_SET, // Just Needs To Be Set. - ARG_VALUE_NEEDS_INT_TEXT, //Needs User INT Input. - ARG_VALUE_NEEDS_COMBO_TEXT //Needs User To Choose Strig From List. + ARG_VALUE_NEEDS_INT, //Needs User INT Input. + ARG_VALUE_NEEDS_COMBO, //Needs User To Choose Strig From List. + ARG_VALUE_NEEDS_STRING //Needs String }; struct COD2MAPArg_s diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index a26df2e..9e89fc7 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -42,49 +42,49 @@ dvar_s gDvars[] = { }; COD2MAPArg_s gCod2MapArgs[] = { - { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_VALUE}, - { "-pcToXenon","Copies a PC bsp to a Xenon bsp", ARG_VALUE_SET }, - { "-xenonToPc","Copies a Xenon bsp to a PC bsp", ARG_VALUE_SET }, - {"-v","Verbose; enables extra compilation messages", ARG_VALUE_SET }, + { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_STRING, NULL,NULL,true}, + { "-pcToXenon","Copies a PC bsp to a Xenon bsp", ARG_VALUE_SET, NULL,NULL,true}, + { "-xenonToPc","Copies a Xenon bsp to a PC bsp", ARG_VALUE_SET, NULL,NULL,true }, + {"-v","Verbose; enables extra compilation messages", ARG_VALUE_SET,NULL,NULL,true }, {"-verboseEntities","Includes verbose messages for submodels if '-v' is given", ARG_VALUE_SET }, {"-onlyEnts","Compile doesn't touch triggers, geometry, or lighting", ARG_VALUE_SET }, { "-generateMapEntsFile","Generate map entity string file only, ignore reference prefabs", ARG_VALUE_SET }, - {"-blockSize","Grid size for regular BSP splits; 0 uses largest possible", ARG_VALUE_NEEDS_VALUE,0,64,true }, + {"-blockSize","Grid size for regular BSP splits; 0 uses largest possible", ARG_VALUE_NEEDS_INT,0,64,true }, {"-subdivisions","Divides all geometry on a grid; only works for small maps", ARG_VALUE_SET }, {"-noSubdivide","Ignores the 'tessSize' setting in all materials", ARG_VALUE_SET }, { "-staticModelCollMaps","(Legacy support) Use collmaps for static models", ARG_VALUE_SET}, {"-displayCollMapWarnings","Display missing collmap warnings", ARG_VALUE_SET}, {"-ignoreModelErrors","Don't error on missing models, just allow them to drop out", ARG_VALUE_SET }, {"-smoothAngle","Smooth surfaces are only smoothed at angles less than this", ARG_VALUE_SET }, - { "-loadFrom","Reads this map instead, but still writes to ", ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + { "-loadFrom","Reads this map instead, but still writes to ", ARG_VALUE_NEEDS_STRING,NULL,NULL,true }, {"-noCurves","Ignores all patch and terrain geometry", ARG_VALUE_SET }, {"-noDetail","Ignores all detail brushes", ARG_VALUE_SET}, {"-fullDetail","Turns all detail brushes into structural brushes", ARG_VALUE_SET}, { "-leakTest","Quits immediately if the map leaked",ARG_VALUE_SET}, {"-portalTest","Forces all portal errors to be fatal",ARG_VALUE_SET}, - {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true }, {"-expandPlayer","Writes a map for Radiant to see player-to-brush collision",ARG_VALUE_SET}, {"-expandBullet","Writes a map for Radiant to see bullet-to-brush collision",ARG_VALUE_SET}, {"-debugPortals","Writes a _portals.map showing portal/structural geometry",ARG_VALUE_SET}, {"-noReorderTris","Disables reordering of optimized triangles for T&L cache",ARG_VALUE_SET}, - {"-listSlowEntities","Lists entities that process in more than this many seconds",ARG_VALUE_NEEDS_VALUE,0,120,true }, - {"-warnLayerUses","Generates warnings for layer combos used this many or fewer times",ARG_VALUE_NEEDS_VALUE,0,120,true }, - {"-warnLayerArea","Generates warnings for layer combos used less than this many square inches",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-listSlowEntities","Lists entities that process in more than this many seconds",ARG_VALUE_NEEDS_INT,0,120,true }, + {"-warnLayerUses","Generates warnings for layer combos used this many or fewer times",ARG_VALUE_NEEDS_INT,0,120,true }, + {"-warnLayerArea","Generates warnings for layer combos used less than this many square inches",ARG_VALUE_NEEDS_INT,0,120,true }, {"-navmesh","Generates the Havok Navigation Mesh during compile",ARG_VALUE_SET}, {"-navvolume","Generates the Havok Navigation Volume during compile. Must be generated together with the NavMesh.",ARG_VALUE_SET}, {"-hkdmp","Creates .hkdmp file of navmesh and navvolume to help diagnose generatio problems.",ARG_VALUE_SET}, {"-pruneNavMesh","Remove unused navmesh faces that don't exist inside any navmesh triggers.",ARG_VALUE_SET}, - {"-umbraNumThreads","Sets the number of CPU threads Umbra will use when creating tome",ARG_VALUE_NEEDS_VALUE,1,QThread::idealThreadCount(),true }, - {"-umbraSmallestOccluder","Surfaces smaller than this value will not be used as occluders",ARG_VALUE_NEEDS_VALUE,0,120,true }, - {"-umbraSmallestHole","Geometry gaps smaller than this value are considered solid",ARG_VALUE_NEEDS_VALUE,0,120,true }, - {"-umbraTileSize","Umbra data block size - smaller values will create larger tomes",ARG_VALUE_NEEDS_VALUE,0,120,true }, - {"-umbraBackfaceLimit","Reverse percentage of backfaces tested to remove bad detail",ARG_VALUE_NEEDS_VALUE,0,120,true }, + {"-umbraNumThreads","Sets the number of CPU threads Umbra will use when creating tome",ARG_VALUE_NEEDS_INT,1,QThread::idealThreadCount(),true }, + {"-umbraSmallestOccluder","Surfaces smaller than this value will not be used as occluders",ARG_VALUE_NEEDS_INT,0,120,true }, + {"-umbraSmallestHole","Geometry gaps smaller than this value are considered solid",ARG_VALUE_NEEDS_INT,0,120,true }, + {"-umbraTileSize","Umbra data block size - smaller values will create larger tomes",ARG_VALUE_NEEDS_INT,0,120,true }, + {"-umbraBackfaceLimit","Reverse percentage of backfaces tested to remove bad detail",ARG_VALUE_NEEDS_INT,0,120,true }, {"-umbraObjectGroupCost","Groups surfaces together. Will improve in-game speed but degrades occlusion",ARG_VALUE_SET}, {"-umbraEnableSndbs","Enable use of SNDBS to accelerate Umbra compile",ARG_VALUE_SET}, {"-useUnstable","Use unstable shaders & techsetdefs",ARG_VALUE_SET}, {"-spawnTest","Quits immediately if the map has spawn points which intersect with level geop",ARG_VALUE_SET}, {"-timing","Enable prints for timing and instrumentation",ARG_VALUE_SET}, - {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_VALUE,NULL,NULL,true }, + {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true }, {"-noCoalesceCoincidentWindings","Turn off coalescing of coincident/coplanar surfaces",ARG_VALUE_SET} }; @@ -1376,7 +1376,7 @@ void mlMainWindow::OnEditCOD2MAPArgs() COD2MAPArg_s Setting = COD2MAP::findSetting(SettingName, SettingsTree, gCod2MapArgs, ARRAYSIZE(gCod2MapArgs)); switch(Setting.type) { - case ARG_VALUE_NEEDS_VALUE: + case ARG_VALUE_NEEDS_STRING: SettingValue = COD2MAP::setCOD2MAPSetting(Setting, (QLineEdit*)Widget); break; case ARG_VALUE_SET: From 50961578d76d388ba7f05761d508680082edd34f Mon Sep 17 00:00:00 2001 From: Johnathon Date: Tue, 23 May 2017 20:40:03 +1200 Subject: [PATCH 30/35] More Args Again Confering with SE2Dev, I might work on making the arguments read from a JSON file or something similar so it is more user friendly to add more in future. --- cod2map.cpp | 6 +++--- cod2map.h | 1 + mlMainWindow.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cod2map.cpp b/cod2map.cpp index e0e7e99..83aa067 100644 --- a/cod2map.cpp +++ b/cod2map.cpp @@ -24,6 +24,7 @@ COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) break; case ARG_VALUE_NEEDS_COMBO: comboBox = new QComboBox(); + comboBox->addItems(Argument.DataCollection); comboBox->setToolTip(QString("String value, leave this blank for it to not be used.")); comboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); ArgumentTree->setItemWidget(Item, 1, comboBox); @@ -38,11 +39,10 @@ COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) break; case ARG_VALUE_NEEDS_STRING: lineEdit = new QLineEdit(); - spinBox->setToolTip(QString("String value, leave this blank for it to not be used.")); - spinBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); + lineEdit->setToolTip(QString("String value, leave this blank for it to not be used.")); + lineEdit->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); ArgumentTree->setItemWidget(Item,1,lineEdit); break; - break; } } diff --git a/cod2map.h b/cod2map.h index a1f05d9..00925a5 100644 --- a/cod2map.h +++ b/cod2map.h @@ -16,6 +16,7 @@ struct COD2MAPArg_s int minValue; int maxValue; bool isSettable;//Is Settable, Needs No Value. E.G. - + QStringList DataCollection; //Over Kill? Probably. Bad Practice? Most Defiantly. Do I Care? You bet not. }; class COD2MAP diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 9e89fc7..2301e76 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -62,7 +62,7 @@ COD2MAPArg_s gCod2MapArgs[] = { {"-fullDetail","Turns all detail brushes into structural brushes", ARG_VALUE_SET}, { "-leakTest","Quits immediately if the map leaked",ARG_VALUE_SET}, {"-portalTest","Forces all portal errors to be fatal",ARG_VALUE_SET}, - {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true }, + {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true, QStringList() << "" << "players" << "bullets" << "all" << "none" }, {"-expandPlayer","Writes a map for Radiant to see player-to-brush collision",ARG_VALUE_SET}, {"-expandBullet","Writes a map for Radiant to see bullet-to-brush collision",ARG_VALUE_SET}, {"-debugPortals","Writes a _portals.map showing portal/structural geometry",ARG_VALUE_SET}, @@ -84,7 +84,7 @@ COD2MAPArg_s gCod2MapArgs[] = { {"-useUnstable","Use unstable shaders & techsetdefs",ARG_VALUE_SET}, {"-spawnTest","Quits immediately if the map has spawn points which intersect with level geop",ARG_VALUE_SET}, {"-timing","Enable prints for timing and instrumentation",ARG_VALUE_SET}, - {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true }, + {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true, QStringList() << "" << "default" <<"always" << "never" }, {"-noCoalesceCoincidentWindings","Turn off coalescing of coincident/coplanar surfaces",ARG_VALUE_SET} }; From 1499134b6f2a0e5ad7797837b140d7246d7c66bd Mon Sep 17 00:00:00 2001 From: Johnathon Date: Tue, 23 May 2017 20:51:45 +1200 Subject: [PATCH 31/35] Eh, done for the night Annnd that's all I wrote, I'll get it fully working in the weekend. --- cod2map.cpp | 17 +++++++++++++++++ cod2map.h | 2 ++ mlMainWindow.cpp | 23 ++++++++++++++--------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/cod2map.cpp b/cod2map.cpp index 83aa067..9b1ac58 100644 --- a/cod2map.cpp +++ b/cod2map.cpp @@ -74,6 +74,23 @@ QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QLineEdit* _textBox) return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); } +QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QSpinBox* _spinBox) +{ + QSettings Settings; + Settings.setValue(QString("Setting_%1").arg(Setting.name), _spinBox->value()); + + return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); +} + +QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QComboBox* _comboBox) +{ + QSettings Settings; + Settings.setValue(QString("Setting_%1").arg(Setting.name), _comboBox->currentText()); + + return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); +} + + COD2MAP::~COD2MAP() { } \ No newline at end of file diff --git a/cod2map.h b/cod2map.h index 00925a5..b6d0389 100644 --- a/cod2map.h +++ b/cod2map.h @@ -32,6 +32,8 @@ class COD2MAP static QString setCOD2MAPSetting(COD2MAPArg_s, QCheckBox*); static QString setCOD2MAPSetting(COD2MAPArg_s, QLineEdit*); + static QString setCOD2MAPSetting(COD2MAPArg_s, QSpinBox*); + static QString setCOD2MAPSetting(COD2MAPArg_s, QComboBox*); static COD2MAPArg_s findSetting(QString, QTreeWidget*, COD2MAPArg_s*, int); }; \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index 2301e76..a5de760 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -42,7 +42,7 @@ dvar_s gDvars[] = { }; COD2MAPArg_s gCod2MapArgs[] = { - { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_STRING, NULL,NULL,true}, + { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_COMBO, NULL,NULL,true, QStringList() << "pc"}, { "-pcToXenon","Copies a PC bsp to a Xenon bsp", ARG_VALUE_SET, NULL,NULL,true}, { "-xenonToPc","Copies a Xenon bsp to a PC bsp", ARG_VALUE_SET, NULL,NULL,true }, {"-v","Verbose; enables extra compilation messages", ARG_VALUE_SET,NULL,NULL,true }, @@ -1354,8 +1354,8 @@ void mlMainWindow::OnEditCOD2MAPArgs() Layout->addWidget(SettingsTree); Layout->addWidget(ButtonBox); - for(int SettingIndx = 0; SettingIndx < ARRAYSIZE(gCod2MapArgs); SettingIndx++) - COD2MAP(gCod2MapArgs[SettingIndx], SettingsTree); + for(int SettingIndx = 0; SettingIndx < ARRAYSIZE(gCod2MapArgs); SettingIndx++) + COD2MAP(gCod2MapArgs[SettingIndx], SettingsTree); connect(ButtonBox, SIGNAL(accepted()), &Dialog, SLOT(accept())); connect(ButtonBox, SIGNAL(rejected()), &Dialog, SLOT(reject())); @@ -1381,16 +1381,21 @@ void mlMainWindow::OnEditCOD2MAPArgs() break; case ARG_VALUE_SET: SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QCheckBox*)Widget); + break; + case ARG_VALUE_NEEDS_INT: + SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QSpinBox*)Widget); + break; + case ARG_VALUE_NEEDS_COMBO: + SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QComboBox*)Widget); + break; } if(!SettingValue.toLatin1().isEmpty()) { - if(!Setting.isSettable) - mRunDvars << "+set" << SettingName; - else // hack for cmds - mRunDvars << QString("+%1").arg(SettingName); - - mRunDvars << SettingValue; + if(Setting.isSettable) + mCod2MapArgs << Setting.name; + else if (!Setting.isSettable) + mCod2MapArgs << Setting.name << SettingValue; } size++; ++it; From 69b51b801cf3b3cf108d048938b4a9c9d043b061 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Thu, 25 May 2017 17:26:10 +1200 Subject: [PATCH 32/35] Moving Code Around Just had to move my GDT Creator to it's own file, it's 50/50 atm, I'll move the rest next commit when I get more time. This should make it easier to manage for other people, I'll eventually do the same for my zone editor. --- GDTCreator.cpp | 164 ++++++++++++++++++++++++++++++ GDTCreator.h | 22 ++++ ModLauncher.vcxproj | 2 + ModLauncher.vcxproj.filters | 9 ++ mlMainWindow.cpp | 194 ++++-------------------------------- mlMainWindow.h | 17 +--- stdafx.h | 4 +- 7 files changed, 221 insertions(+), 191 deletions(-) create mode 100644 GDTCreator.cpp create mode 100644 GDTCreator.h diff --git a/GDTCreator.cpp b/GDTCreator.cpp new file mode 100644 index 0000000..e44add0 --- /dev/null +++ b/GDTCreator.cpp @@ -0,0 +1,164 @@ +#include "stdafx.h" +#include "mlMainWindow.h" + +void GDTCreator::dropEvent(QDropEvent* event) +{ + if (parentWindow == NULL) + return; + + source_data_folder = new QDir(QString("%1/source_data").arg(parentWindow->mToolsPath)); + model_export_folder = new QDir(QString("%1/model_export").arg(parentWindow->mToolsPath)); + QStringList AllowedFileTypes = (QStringList() << "tiff" << "tif" << "xmodel_bin"); + + + if (event->mimeData()->hasUrls()) + { + QList FileList = event->mimeData()->urls(); + + for (int i = 0; i < FileList.size(); i++) + { + QFileInfo CurrentFile = FileList.at(i).toLocalFile(); + + if(!AllowedFileTypes.contains(CurrentFile.suffix())) + { + QMessageBox::information(this,"Hold Up!",QString("Sorry, I Don't Support The File Type: %1").arg(CurrentFile.suffix()),QMessageBox::Ok); //¯\_(ツ)_/¯ + return; + } + + if(CurrentFile.isDir()) + { + QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); + //I might need to refractor into a func so I can do this though ¯\_(ツ)_/¯ + return; + } + + QString WorkingDir = QFileInfo(CurrentFile).fileName().split(".",QString::SkipEmptyParts).at(0); + QString Path; + QString SavePath = QString("%1/%2").arg(model_export_folder->absolutePath(),WorkingDir); + + if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked()) + { + if(!QDir().exists(SavePath)) + QDir().mkpath(SavePath); + + QFile().copy(CurrentFile.fileName(),QString("%1/%2/%3").arg(model_export_folder->absolutePath(),WorkingDir,CurrentFile.fileName())); + Path = QString("%1/%2/%3").arg("model_export",WorkingDir,CurrentFile.fileName()); + } + else + { + Path = FileList.at(i).toLocalFile(); + } + + //Create GDT Now. + QInputDialog GDTType; + QString GDTTemplate; + QString FileName; + + GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); + GDTType.setWindowTitle("GDT Creation Type"); + GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(QFileInfo(FileList.at(i).toLocalFile()).fileName())); + GDTType.setComboBoxItems(QStringList() << "xmodel" << "image"); + int Ret = GDTType.exec(); + + if (Ret != QDialog::Accepted) + return; + + //This Doesn't Work, But Also Works.... + if(!GDTType.textValue().isEmpty()) + { + FileName = WorkingDir.left(WorkingDir.lastIndexOf('_')); + QInputDialog FileNameInput; + FileNameInput.setInputMode(QInputDialog::TextInput); + FileNameInput.setWindowTitle("File Name"); + FileNameInput.setLabelText("What Should I Call The GDT?"); + bool Res; + FileName = FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); + + if(!Res) + return; + + parentWindow->mOutputWidget->appendPlainText(QString("HERE: %1").arg(FileName)); + + if (GDTType.textValue() == "image" && QFileInfo(FileList.at(i).toLocalFile()).suffix() == "tiff" || QFileInfo(FileList.at(i).toLocalFile()).suffix() == "tif") + { + GDTTemplate = + "{\n" + + QString("\t\"%1\" ( \"image.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + + "\t{\n" + + "\t\t\"baseImage\" \"" + Path +"\"\n" + + "\t\t\"semantic\" \"diffuseMap\"\n" + + "\t\t\"imageType\" \"Texture\"\n" + + "\t\t\"type\" \"image\"\n" + + "\t}\n" + + "}\n"; + QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),FileName,".gdt")); + if(xModelFile.open(QFile::ReadWrite)) + { + QTextStream FileWriter(&xModelFile); + FileWriter << GDTTemplate; + FileWriter.flush(); + xModelFile.close(); + } + else + { + QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); + return; + } + + } + //Add Material Stuff. + } + } + + if(parentWindow->mOpenAPEAfterCreation->isChecked()) + parentWindow->mActionFileAssetEditor->trigger(); + + event->acceptProposedAction(); + } +} + +GDTCreator::GDTCreator(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) +{ + this->setAcceptDrops(true); +} + +void GDTCreator::dragEnterEvent(QDragEnterEvent* event) +{ + event->acceptProposedAction(); +} + +void GDTCreator::dragLeaveEvent(QDragLeaveEvent* event) +{ + event->accept(); +} + +void GDTCreator::MakeGDT(QString Type, QString Name, QString Extension, QString Path) +{ + QString Template; + QFile* GDTFile; + if(Type == "xmodel" && Extension == "xmodel_bin") + { + Template = + "{\n" + + QString("\t\"%1\" ( \"xmodel.gdf\" )\n").arg(Name) + + "\t{\n" + + "\t\t\"filename\" \"" + Path + "\"\n" + + "\t\t\"highLodDist\" \"751\"\n" + + "\t\t\"type\" \"rigid\"\n" + + "\t}\n" + + "}\n"; + GDTFile = new QFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),Name,".gdt")); + if(GDTFile->open(QFile::ReadWrite)) + { + QTextStream FileWriter(GDTFile); + FileWriter << Template; + FileWriter.flush(); + GDTFile->close(); + } + else + { + QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); + return; + } + } +} \ No newline at end of file diff --git a/GDTCreator.h b/GDTCreator.h new file mode 100644 index 0000000..83b7b5f --- /dev/null +++ b/GDTCreator.h @@ -0,0 +1,22 @@ +#pragma once +#include "mlMainWindow.h" //Hmmm, I Don't Know Why I Need To Force That Here... + +class GDTCreator : public QGroupBox +{ +private: + mlMainWindow* parentWindow; + + QDir* source_data_folder; + QDir* model_export_folder; + + +protected: + void dragEnterEvent(QDragEnterEvent* event); + void dragLeaveEvent(QDragLeaveEvent* event); + void dropEvent(QDropEvent *event); + void MakeGDT(QString, QString, QString, QString); //Type, Extension, Name, Path + + +public: + GDTCreator(QWidget *parent, mlMainWindow* parent_window); +}; diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index f4254de..f14bccd 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -307,6 +307,7 @@ + true true @@ -458,6 +459,7 @@ + diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index 1224d48..1a3aef8 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -29,6 +29,9 @@ {5fc30545-a821-4000-9780-d6dd6c4d03ff} + + {fc29ef6f-4b5c-41e5-ae4f-6db41e4cd3f4} + @@ -58,6 +61,9 @@ Source Files + + Source Files\NewFilter1 + @@ -85,5 +91,8 @@ Source Files + + Source Files\NewFilter1 + \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index a5de760..d99ea2c 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -363,9 +363,10 @@ mlMainWindow::mlMainWindow() mRunEnabledWidget = new QCheckBox("Run"); ActionsLayout->addWidget(mRunEnabledWidget); - mCOD2MAPOptionsButton = new QPushButton("More Args"); + mCOD2MAPOptionsButton = new QPushButton("COD2MAP Args"); connect(mCOD2MAPOptionsButton,SIGNAL(clicked()),this,SLOT(OnEditCOD2MAPArgs())); ActionsLayout->addWidget(mCOD2MAPOptionsButton); + //mCOD2MAPOptionsButton->setEnabled(false); //Broken For Now. Not Fixing Until Weekend When I Have Time. mBuildButton = new QPushButton("Build"); connect(mBuildButton, SIGNAL(clicked()), mActionEditBuild, SLOT(trigger())); @@ -577,7 +578,7 @@ void mlMainWindow::InitGDTCreator() widget->setLayout(gridLayout); dock->setWidget(widget); - GDTCreatorGroupBox* groupBox = new GDTCreatorGroupBox(dock, this); + GDTCreator* groupBox = new GDTCreator(dock, this); gridLayout->addWidget(groupBox, 0, 0,1,0); QLabel* label = new QLabel("Drag Files Here", groupBox); @@ -967,12 +968,17 @@ void mlMainWindow::OnEditBuild() AddUpdateDBCommand(); QStringList Args; - Args << "-platform" << "pc"; - if (mCompileModeWidget->currentIndex() == 0) - Args << "-onlyents"; - else - Args << "-navmesh" << "-navvolume"; + if(!mRunDvars.isEmpty()) + Args << mCod2MapArgs; + else + { + Args << "-platform" << "pc"; + if (mCompileModeWidget->currentIndex() == 0) + Args << "-onlyents"; + else + Args << "-navmesh" << "-navvolume"; + } Args << "-loadFrom" << QString("%1\\map_source\\%2\\%3.map").arg(mGamePath, MapName.left(2), MapName); Args << QString("%1\\share\\raw\\maps\\%2\\%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); @@ -1393,9 +1399,15 @@ void mlMainWindow::OnEditCOD2MAPArgs() if(!SettingValue.toLatin1().isEmpty()) { if(Setting.isSettable) + { mCod2MapArgs << Setting.name; + mOutputWidget->appendPlainText(Setting.name); + } else if (!Setting.isSettable) + { mCod2MapArgs << Setting.name << SettingValue; + mOutputWidget->appendPlainText(QString("%1 %2").arg(SettingName)); + } } size++; ++it; @@ -1968,174 +1980,6 @@ void mlMainWindow::UpdateSyntax() Syntax* highlighter = new Syntax(mZoneTextEdit->document()); } -void GDTCreatorGroupBox::dropEvent(QDropEvent* event) -{ - QDir source_data_folder(QString("%1/source_data").arg(parentWindow->mToolsPath)); - QDir model_export_folder(QString("%1/model_export").arg(parentWindow->mToolsPath)); - - const QMimeData* mimeData = event->mimeData(); - - if (parentWindow == NULL) - { - return; - } - - if (mimeData->hasUrls()) - { - QStringList pathList; - QList urlList = mimeData->urls(); - - for (int i = 0; i < urlList.size(); i++) - { - QStringList AllowedFileTypes; - AllowedFileTypes << "tiff" << "tif" << "xmodel_bin"; - QFileInfo Current =urlList.at(i).toLocalFile(); - - if(!AllowedFileTypes.contains(Current.suffix())) - { - QMessageBox::warning(this,"Incorrect Format!","Please Convert This File To Either XMODEL_BIN, TIFF Or TIF",QMessageBox::Ok); - return; - } - - if(Current.isDir()) - { - QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); //Iterate Through Them In A Later Release. - //I might need to refractor into a func so I can do this though ¯\_(ツ)_/¯ - return; - } - - QString WorkingDir = QFileInfo(urlList.at(i).toLocalFile()).fileName().split(".",QString::SkipEmptyParts).at(0); - QString Path; - if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked()) - { - if(!QDir().exists(WorkingDir)) - QDir().mkpath(QString("%1/%2").arg(model_export_folder.absolutePath(),WorkingDir)); //Make Path - - QFile().copy(urlList.at(i).toLocalFile(),QString("%1/%2/%3").arg(model_export_folder.absolutePath(),WorkingDir,QFileInfo(urlList.at(i).toLocalFile()).fileName())); - Path = QString("%1/%2/%3").arg("model_export",WorkingDir,QFileInfo(urlList.at(i).toLocalFile()).fileName()); - } - else - { - Path = urlList.at(i).toLocalFile(); - } - - //Create GDT Now. - QInputDialog GDTType; - QStringList GDTTypeList; - QString GDTTemplate; - QString FileName; - - GDTTypeList << "xmodel" << "image"; - GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); - GDTType.setWindowTitle("GDT Creation Type"); - GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(QFileInfo(urlList.at(i).toLocalFile()).fileName())); - GDTType.setComboBoxItems(GDTTypeList); - int Ret = GDTType.exec(); - - if (Ret != QDialog::Accepted) - return; - - //This Doesn't Work, But Also Works.... - if(!GDTType.textValue().isEmpty()) - { - FileName = WorkingDir.left(WorkingDir.lastIndexOf('_')); - QInputDialog FileNameInput; - FileNameInput.setWindowTitle("File Name"); - FileNameInput.setLabelText("What Should I Call The GDT?"); - bool Res; - FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); - - if(!Res) - return; - - FileName= FileNameInput.textValue(); - - - if(GDTType.textValue() == "xmodel" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "xmodel_bin") - { - GDTTemplate = - "{\n" + - QString("\t\"%1\" ( \"xmodel.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + - "\t{\n" + - "\t\t\"filename\" \"" + Path + "\"\n" + - "\t\t\"highLodDist\" \"751\"\n" + - "\t\t\"type\" \"rigid\"\n" + - "\t}\n" + - "}\n"; - QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),FileName,".gdt")); - if(xModelFile.open(QFile::ReadWrite)) - { - QTextStream FileWriter(&xModelFile); - FileWriter << GDTTemplate; - FileWriter.flush(); - xModelFile.close(); - } - else - { - QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); - return; - } - } - - if (GDTType.textValue() == "image" && QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tiff" || QFileInfo(urlList.at(i).toLocalFile()).suffix() == "tif") - { - GDTTemplate = - "{\n" + - QString("\t\"%1\" ( \"image.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + - "\t{\n" + - "\t\t\"baseImage\" \"" + Path +"\"\n" + - "\t\t\"semantic\" \"diffuseMap\"\n" + - "\t\t\"imageType\" \"Texture\"\n" + - "\t\t\"type\" \"image\"\n" + - "\t}\n" + - "}\n"; - QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder.absolutePath(),FileName,".gdt")); - if(xModelFile.open(QFile::ReadWrite)) - { - QTextStream FileWriter(&xModelFile); - FileWriter << GDTTemplate; - FileWriter.flush(); - xModelFile.close(); - } - else - { - QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); - return; - } - - } - else - { - QMessageBox::warning(this,"Uh-Oh!","I Can't Create A GDT For This File Type.\nPlease make sure you're using xmodel_bin, tif or tiff.",QMessageBox::Ok); - return; - } - //Add Material Stuff. - } - } - - if(parentWindow->mOpenAPEAfterCreation->isChecked()) - parentWindow->mActionFileAssetEditor->trigger(); - - event->acceptProposedAction(); - } -} - - -GDTCreatorGroupBox::GDTCreatorGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) -{ - this->setAcceptDrops(true); -} - -void GDTCreatorGroupBox::dragEnterEvent(QDragEnterEvent* event) -{ - event->acceptProposedAction(); -} - -void GDTCreatorGroupBox::dragLeaveEvent(QDragLeaveEvent* event) -{ - event->accept(); -} - Export2BinGroupBox::Export2BinGroupBox(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) { this->setAcceptDrops(true); diff --git a/mlMainWindow.h b/mlMainWindow.h index da55125..3ff0cb2 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -80,7 +80,7 @@ class mlMainWindow : public QMainWindow Q_OBJECT friend class Export2BinGroupBox; - friend class GDTCreatorGroupBox; + friend class GDTCreator; public: mlMainWindow(); @@ -252,20 +252,6 @@ class Export2BinGroupBox : public QGroupBox Export2BinGroupBox(QWidget *parent, mlMainWindow* parent_window); }; -class GDTCreatorGroupBox : public QGroupBox -{ -private: - mlMainWindow* parentWindow; - -protected: - void dragEnterEvent(QDragEnterEvent* event); - void dragLeaveEvent(QDragLeaveEvent* event); - void dropEvent(QDropEvent *event); - -public: - GDTCreatorGroupBox(QWidget *parent, mlMainWindow* parent_window); -}; - class Syntax : public QSyntaxHighlighter { Q_OBJECT @@ -294,3 +280,4 @@ class Syntax : public QSyntaxHighlighter QTextCharFormat IncludeFormat; QTextCharFormat PreProcessor; }; + diff --git a/stdafx.h b/stdafx.h index 95dc78a..076e492 100644 --- a/stdafx.h +++ b/stdafx.h @@ -23,6 +23,8 @@ #include "dvar.h" #include "cod2map.h" +#include "GDTCreator.h" class mlMainWindow; -class mlExport2BinWidget; \ No newline at end of file +class mlExport2BinWidget; +//class mlZoneEditorWidget; //Add Later \ No newline at end of file From b84b4f4769b681166906b8bc01d4ab8e85fb1d2b Mon Sep 17 00:00:00 2001 From: Johnathon Date: Thu, 25 May 2017 21:42:42 +1200 Subject: [PATCH 33/35] GDT "creator" nove fully moved The GDT creation suite is now moved fully, it also now copies and works. --- GDTCreator.cpp | 79 +++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/GDTCreator.cpp b/GDTCreator.cpp index e44add0..2e66168 100644 --- a/GDTCreator.cpp +++ b/GDTCreator.cpp @@ -41,7 +41,9 @@ void GDTCreator::dropEvent(QDropEvent* event) if(!QDir().exists(SavePath)) QDir().mkpath(SavePath); - QFile().copy(CurrentFile.fileName(),QString("%1/%2/%3").arg(model_export_folder->absolutePath(),WorkingDir,CurrentFile.fileName())); + QFile().copy(FileList.at(i).toLocalFile(),QString("%1/%2/%3").arg(model_export_folder->absolutePath(),WorkingDir,CurrentFile.fileName())); + + Path = QString("%1/%2/%3").arg("model_export",WorkingDir,CurrentFile.fileName()); } else @@ -56,7 +58,7 @@ void GDTCreator::dropEvent(QDropEvent* event) GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); GDTType.setWindowTitle("GDT Creation Type"); - GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(QFileInfo(FileList.at(i).toLocalFile()).fileName())); + GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(CurrentFile.fileName())); GDTType.setComboBoxItems(QStringList() << "xmodel" << "image"); int Ret = GDTType.exec(); @@ -77,44 +79,17 @@ void GDTCreator::dropEvent(QDropEvent* event) if(!Res) return; - parentWindow->mOutputWidget->appendPlainText(QString("HERE: %1").arg(FileName)); - - if (GDTType.textValue() == "image" && QFileInfo(FileList.at(i).toLocalFile()).suffix() == "tiff" || QFileInfo(FileList.at(i).toLocalFile()).suffix() == "tif") - { - GDTTemplate = - "{\n" + - QString("\t\"%1\" ( \"image.gdf\" )\n").arg(WorkingDir.left(WorkingDir.lastIndexOf('_'))) + - "\t{\n" + - "\t\t\"baseImage\" \"" + Path +"\"\n" + - "\t\t\"semantic\" \"diffuseMap\"\n" + - "\t\t\"imageType\" \"Texture\"\n" + - "\t\t\"type\" \"image\"\n" + - "\t}\n" + - "}\n"; - QFile xModelFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),FileName,".gdt")); - if(xModelFile.open(QFile::ReadWrite)) - { - QTextStream FileWriter(&xModelFile); - FileWriter << GDTTemplate; - FileWriter.flush(); - xModelFile.close(); - } - else - { - QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); - return; - } - - } - //Add Material Stuff. + MakeGDT(GDTType.textValue(), FileName, CurrentFile.suffix(),Path); + } + //Add Material Stuff. } + } - if(parentWindow->mOpenAPEAfterCreation->isChecked()) - parentWindow->mActionFileAssetEditor->trigger(); + if(parentWindow->mOpenAPEAfterCreation->isChecked()) + parentWindow->mActionFileAssetEditor->trigger(); - event->acceptProposedAction(); - } + event->acceptProposedAction(); } GDTCreator::GDTCreator(QWidget* parent, mlMainWindow* parent_window) : QGroupBox(parent), parentWindow(parent_window) @@ -136,6 +111,7 @@ void GDTCreator::MakeGDT(QString Type, QString Name, QString Extension, QString { QString Template; QFile* GDTFile; + if(Type == "xmodel" && Extension == "xmodel_bin") { Template = @@ -147,7 +123,36 @@ void GDTCreator::MakeGDT(QString Type, QString Name, QString Extension, QString "\t\t\"type\" \"rigid\"\n" + "\t}\n" + "}\n"; - GDTFile = new QFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),Name,".gdt")); + + GDTFile = new QFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),Name,"gdt")); + if(GDTFile->open(QFile::ReadWrite)) + { + QTextStream FileWriter(GDTFile); + FileWriter << Template; + FileWriter.flush(); + GDTFile->close(); + } + else + { + QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok); + return; + } + } + else if(Type == "image" && Extension == "tiff" || Extension == "tif") + { + Template = + "{\n" + + QString("\t\"%1\" ( \"image.gdf\" )\n").arg(Name) + + "\t{\n" + + "\t\t\"baseImage\" \"" + Path +"\"\n" + + "\t\t\"semantic\" \"diffuseMap\"\n" + + "\t\t\"imageType\" \"Texture\"\n" + + "\t\t\"type\" \"image\"\n" + + "\t\t\"compressionMethod\" \"uncompressed\"\n" + + "\t}\n" + + "}\n"; + + GDTFile = new QFile(QString("%1/%2.%3").arg(source_data_folder->absolutePath(),Name,"gdt")); if(GDTFile->open(QFile::ReadWrite)) { QTextStream FileWriter(GDTFile); From b1447d20a6e78a45ea787902f4f45562bcfb9e09 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Thu, 25 May 2017 22:40:22 +1200 Subject: [PATCH 34/35] GDT Tune up --- GDTCreator.cpp | 91 ++++++++++++++++++++++--------------- GDTCreator.h | 4 +- ModLauncher.vcxproj.filters | 6 +-- 3 files changed, 60 insertions(+), 41 deletions(-) diff --git a/GDTCreator.cpp b/GDTCreator.cpp index 2e66168..210d116 100644 --- a/GDTCreator.cpp +++ b/GDTCreator.cpp @@ -14,26 +14,32 @@ void GDTCreator::dropEvent(QDropEvent* event) if (event->mimeData()->hasUrls()) { QList FileList = event->mimeData()->urls(); - + QString GDTType, FileName, Path; for (int i = 0; i < FileList.size(); i++) { QFileInfo CurrentFile = FileList.at(i).toLocalFile(); if(!AllowedFileTypes.contains(CurrentFile.suffix())) { - QMessageBox::information(this,"Hold Up!",QString("Sorry, I Don't Support The File Type: %1").arg(CurrentFile.suffix()),QMessageBox::Ok); //¯\_(ツ)_/¯ + QMessageBox::information(this,"Hold Up!",QString("Sorry, I Don't Support The File Type: %1").arg(CurrentFile.suffix()),QMessageBox::Ok); return; - } + } if(CurrentFile.isDir()) { QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok); - //I might need to refractor into a func so I can do this though ¯\_(ツ)_/¯ + /*QDirIterator Iterator(CurrentFile.absolutePath(), QStringList() << "*.tif" << "*.tiff" << "*.xmodel_bin"); + while(Iterator.hasNext()) + { + GDTType = GetGDTType(Iterator.next()); + FileName = GetGDTFileName(Iterator.next().split(".",QString::SkipEmptyParts).at(0)); + + MakeGDT(GDTType,FileName,QFileInfo(Iterator.next()).suffix(), + }*/ return; } QString WorkingDir = QFileInfo(CurrentFile).fileName().split(".",QString::SkipEmptyParts).at(0); - QString Path; QString SavePath = QString("%1/%2").arg(model_export_folder->absolutePath(),WorkingDir); if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked()) @@ -42,47 +48,20 @@ void GDTCreator::dropEvent(QDropEvent* event) QDir().mkpath(SavePath); QFile().copy(FileList.at(i).toLocalFile(),QString("%1/%2/%3").arg(model_export_folder->absolutePath(),WorkingDir,CurrentFile.fileName())); - - Path = QString("%1/%2/%3").arg("model_export",WorkingDir,CurrentFile.fileName()); } else { Path = FileList.at(i).toLocalFile(); } + + GDTType = GetGDTType(CurrentFile); - //Create GDT Now. - QInputDialog GDTType; - QString GDTTemplate; - QString FileName; - - GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); - GDTType.setWindowTitle("GDT Creation Type"); - GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(CurrentFile.fileName())); - GDTType.setComboBoxItems(QStringList() << "xmodel" << "image"); - int Ret = GDTType.exec(); - - if (Ret != QDialog::Accepted) - return; - - //This Doesn't Work, But Also Works.... - if(!GDTType.textValue().isEmpty()) + if(!GDTType.isEmpty()) { - FileName = WorkingDir.left(WorkingDir.lastIndexOf('_')); - QInputDialog FileNameInput; - FileNameInput.setInputMode(QInputDialog::TextInput); - FileNameInput.setWindowTitle("File Name"); - FileNameInput.setLabelText("What Should I Call The GDT?"); - bool Res; - FileName = FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); - - if(!Res) - return; - - MakeGDT(GDTType.textValue(), FileName, CurrentFile.suffix(),Path); - + FileName = GetGDTFileName(WorkingDir); + MakeGDT(GDTType, FileName, CurrentFile.suffix(),Path); } - //Add Material Stuff. } } @@ -166,4 +145,42 @@ void GDTCreator::MakeGDT(QString Type, QString Name, QString Extension, QString return; } } +} + +QString GDTCreator::GetGDTType(QFileInfo CurrentFile) +{ + QInputDialog GDTType; + QString GDTTemplate; + int Ret; + + GDTType.setOption(QInputDialog::UseListViewForComboBoxItems); + GDTType.setWindowTitle("GDT Creation Type"); + GDTType.setLabelText(QString("What Type Of GDT Should I Create?\nAsset: %1").arg(CurrentFile.fileName())); + GDTType.setComboBoxItems(QStringList() << "xmodel" << "image"); + + do + { + Ret = GDTType.exec(); + }while(Ret != QDialog::Accepted); + + if(!GDTType.textValue().isEmpty()) + return GDTType.textValue(); +} + +QString GDTCreator::GetGDTFileName(QString WorkingDir) +{ + QString FileName = WorkingDir.left(WorkingDir.lastIndexOf('_')); + QInputDialog FileNameInput; + FileNameInput.setInputMode(QInputDialog::TextInput); + FileNameInput.setWindowTitle("File Name"); + FileNameInput.setLabelText("What Should I Call The GDT?"); + bool Res; + + do + { + FileName = FileNameInput.getText(this,"File Name","What Should I Call The GDT?",QLineEdit::Normal,FileName, &Res); + }while(Res != true); + + parentWindow->mOutputWidget->appendPlainText(FileName); + return FileName; } \ No newline at end of file diff --git a/GDTCreator.h b/GDTCreator.h index 83b7b5f..7dad6bf 100644 --- a/GDTCreator.h +++ b/GDTCreator.h @@ -14,8 +14,10 @@ class GDTCreator : public QGroupBox void dragEnterEvent(QDragEnterEvent* event); void dragLeaveEvent(QDragLeaveEvent* event); void dropEvent(QDropEvent *event); - void MakeGDT(QString, QString, QString, QString); //Type, Extension, Name, Path + void MakeGDT(QString, QString, QString, QString); //Type, Extension, Name, Path + QString GetGDTType(QFileInfo); //Current File + QString GetGDTFileName(QString); //Working Dir public: GDTCreator(QWidget *parent, mlMainWindow* parent_window); diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index 1a3aef8..042e28f 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -29,7 +29,7 @@ {5fc30545-a821-4000-9780-d6dd6c4d03ff} - + {fc29ef6f-4b5c-41e5-ae4f-6db41e4cd3f4} @@ -62,7 +62,7 @@ Source Files - Source Files\NewFilter1 + Source Files\GDT @@ -92,7 +92,7 @@ Source Files - Source Files\NewFilter1 + Source Files\GDT \ No newline at end of file From 9d5efa4305a75cc72feeff2d995520d2629b0ae0 Mon Sep 17 00:00:00 2001 From: Johnathon Date: Thu, 1 Jun 2017 20:07:35 +1200 Subject: [PATCH 35/35] Pull Request This is a stable build slating what features I deem to be stable enough to enter the main branch. --- ModLauncher.vcxproj | 2 - ModLauncher.vcxproj.filters | 6 -- cod2map.cpp | 96 ----------------------- cod2map.h | 39 ---------- mlMainWindow.cpp | 148 ++---------------------------------- mlMainWindow.h | 14 ++-- stdafx.h | 2 +- 7 files changed, 13 insertions(+), 294 deletions(-) delete mode 100644 cod2map.cpp delete mode 100644 cod2map.h diff --git a/ModLauncher.vcxproj b/ModLauncher.vcxproj index f14bccd..88683eb 100644 --- a/ModLauncher.vcxproj +++ b/ModLauncher.vcxproj @@ -305,7 +305,6 @@ - @@ -457,7 +456,6 @@ - diff --git a/ModLauncher.vcxproj.filters b/ModLauncher.vcxproj.filters index 042e28f..e4e3fc3 100644 --- a/ModLauncher.vcxproj.filters +++ b/ModLauncher.vcxproj.filters @@ -58,9 +58,6 @@ Source Files - - Source Files - Source Files\GDT @@ -88,9 +85,6 @@ Source Files - - Source Files - Source Files\GDT diff --git a/cod2map.cpp b/cod2map.cpp deleted file mode 100644 index 9b1ac58..0000000 --- a/cod2map.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "stdafx.h" - -COD2MAP::COD2MAP(COD2MAPArg_s Argument, QTreeWidget* ArgumentTree) -{ - QString Setting = QString("Setting_%1").arg(Argument.name); - QSettings settings; - - QTreeWidgetItem* Item = new QTreeWidgetItem(ArgumentTree, QStringList() << Argument.name); - Item->setText(0, Argument.name); - Item->setToolTip(0, Argument.description); - - QCheckBox* checkBox; - QLineEdit* lineEdit; - QComboBox* comboBox; - QSpinBox* spinBox; - - switch(Argument.type) - { - case ARG_VALUE_SET: - checkBox = new QCheckBox(); - checkBox->setChecked(settings.value(Setting, false).toBool()); - checkBox->setToolTip("Boolean value, check to enable or uncheck to disable."); - ArgumentTree->setItemWidget(Item, 1, checkBox); - break; - case ARG_VALUE_NEEDS_COMBO: - comboBox = new QComboBox(); - comboBox->addItems(Argument.DataCollection); - comboBox->setToolTip(QString("String value, leave this blank for it to not be used.")); - comboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - ArgumentTree->setItemWidget(Item, 1, comboBox); - break; - case ARG_VALUE_NEEDS_INT: - spinBox = new QSpinBox(); - spinBox->setMinimum(Argument.minValue); - spinBox->setMaximum(Argument.maxValue); - spinBox->setToolTip(QString("Numerical value, leave this blank for it to not be used.")); - spinBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); - ArgumentTree->setItemWidget(Item,1,spinBox); - break; - case ARG_VALUE_NEEDS_STRING: - lineEdit = new QLineEdit(); - lineEdit->setToolTip(QString("String value, leave this blank for it to not be used.")); - lineEdit->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); - ArgumentTree->setItemWidget(Item,1,lineEdit); - break; - } -} - -COD2MAPArg_s COD2MAP::findSetting(QString _SettingName, QTreeWidget* SettingTree, COD2MAPArg_s* Settings, int SettingsSize) -{ - COD2MAPArg_s Setting; - for(int SettingIdx = 0; SettingIdx < SettingsSize; SettingIdx++) - { - Setting = COD2MAP(Settings[SettingIdx], SettingTree).CurrentArg; - if(Setting.name == _SettingName) - return Setting; - } - return Setting; -} - -QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QCheckBox* _checkBox) -{ - QSettings Settings; - Settings.setValue(QString("Setting_%1").arg(Setting.name), _checkBox->isChecked()); - - return Settings.value(QString("Setting_%1").arg(Setting.name)).toString() == "true" ? "1" : "0"; // another way to do this? -} - -QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QLineEdit* _textBox) -{ - QSettings Settings; - Settings.setValue(QString("Setting_%1").arg(Setting.name), _textBox->text()); - - return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); -} - -QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QSpinBox* _spinBox) -{ - QSettings Settings; - Settings.setValue(QString("Setting_%1").arg(Setting.name), _spinBox->value()); - - return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); -} - -QString COD2MAP::setCOD2MAPSetting(COD2MAPArg_s Setting, QComboBox* _comboBox) -{ - QSettings Settings; - Settings.setValue(QString("Setting_%1").arg(Setting.name), _comboBox->currentText()); - - return Settings.value(QString("Setting_%1").arg(Setting.name)).toString(); -} - - -COD2MAP::~COD2MAP() -{ -} \ No newline at end of file diff --git a/cod2map.h b/cod2map.h deleted file mode 100644 index b6d0389..0000000 --- a/cod2map.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -enum COD2MAPArgType -{ - ARG_VALUE_SET, // Just Needs To Be Set. - ARG_VALUE_NEEDS_INT, //Needs User INT Input. - ARG_VALUE_NEEDS_COMBO, //Needs User To Choose Strig From List. - ARG_VALUE_NEEDS_STRING //Needs String -}; - -struct COD2MAPArg_s -{ - const char* name; - const char* description; - COD2MAPArgType type; - int minValue; - int maxValue; - bool isSettable;//Is Settable, Needs No Value. E.G. - - QStringList DataCollection; //Over Kill? Probably. Bad Practice? Most Defiantly. Do I Care? You bet not. -}; - -class COD2MAP -{ -private: - COD2MAPArg_s CurrentArg; - - -public: - COD2MAP(); - COD2MAP(COD2MAPArg_s, QTreeWidget*); - ~COD2MAP(); - - static QString setCOD2MAPSetting(COD2MAPArg_s, QCheckBox*); - static QString setCOD2MAPSetting(COD2MAPArg_s, QLineEdit*); - static QString setCOD2MAPSetting(COD2MAPArg_s, QSpinBox*); - static QString setCOD2MAPSetting(COD2MAPArg_s, QComboBox*); - - static COD2MAPArg_s findSetting(QString, QTreeWidget*, COD2MAPArg_s*, int); -}; \ No newline at end of file diff --git a/mlMainWindow.cpp b/mlMainWindow.cpp index d99ea2c..a8569b3 100644 --- a/mlMainWindow.cpp +++ b/mlMainWindow.cpp @@ -41,53 +41,6 @@ dvar_s gDvars[] = { {"devmap","Launch to this map using devmap",DVAR_VALUE_COMBO,0,0,true}, }; -COD2MAPArg_s gCod2MapArgs[] = { - { "-platform", "Required if not copying a bsp between platforms; specifies target platform",ARG_VALUE_NEEDS_COMBO, NULL,NULL,true, QStringList() << "pc"}, - { "-pcToXenon","Copies a PC bsp to a Xenon bsp", ARG_VALUE_SET, NULL,NULL,true}, - { "-xenonToPc","Copies a Xenon bsp to a PC bsp", ARG_VALUE_SET, NULL,NULL,true }, - {"-v","Verbose; enables extra compilation messages", ARG_VALUE_SET,NULL,NULL,true }, - {"-verboseEntities","Includes verbose messages for submodels if '-v' is given", ARG_VALUE_SET }, - {"-onlyEnts","Compile doesn't touch triggers, geometry, or lighting", ARG_VALUE_SET }, - { "-generateMapEntsFile","Generate map entity string file only, ignore reference prefabs", ARG_VALUE_SET }, - {"-blockSize","Grid size for regular BSP splits; 0 uses largest possible", ARG_VALUE_NEEDS_INT,0,64,true }, - {"-subdivisions","Divides all geometry on a grid; only works for small maps", ARG_VALUE_SET }, - {"-noSubdivide","Ignores the 'tessSize' setting in all materials", ARG_VALUE_SET }, - { "-staticModelCollMaps","(Legacy support) Use collmaps for static models", ARG_VALUE_SET}, - {"-displayCollMapWarnings","Display missing collmap warnings", ARG_VALUE_SET}, - {"-ignoreModelErrors","Don't error on missing models, just allow them to drop out", ARG_VALUE_SET }, - {"-smoothAngle","Smooth surfaces are only smoothed at angles less than this", ARG_VALUE_SET }, - { "-loadFrom","Reads this map instead, but still writes to ", ARG_VALUE_NEEDS_STRING,NULL,NULL,true }, - {"-noCurves","Ignores all patch and terrain geometry", ARG_VALUE_SET }, - {"-noDetail","Ignores all detail brushes", ARG_VALUE_SET}, - {"-fullDetail","Turns all detail brushes into structural brushes", ARG_VALUE_SET}, - { "-leakTest","Quits immediately if the map leaked",ARG_VALUE_SET}, - {"-portalTest","Forces all portal errors to be fatal",ARG_VALUE_SET}, - {"-brushMethod","Brush optimization method (players/bullets/all/none)",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true, QStringList() << "" << "players" << "bullets" << "all" << "none" }, - {"-expandPlayer","Writes a map for Radiant to see player-to-brush collision",ARG_VALUE_SET}, - {"-expandBullet","Writes a map for Radiant to see bullet-to-brush collision",ARG_VALUE_SET}, - {"-debugPortals","Writes a _portals.map showing portal/structural geometry",ARG_VALUE_SET}, - {"-noReorderTris","Disables reordering of optimized triangles for T&L cache",ARG_VALUE_SET}, - {"-listSlowEntities","Lists entities that process in more than this many seconds",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-warnLayerUses","Generates warnings for layer combos used this many or fewer times",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-warnLayerArea","Generates warnings for layer combos used less than this many square inches",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-navmesh","Generates the Havok Navigation Mesh during compile",ARG_VALUE_SET}, - {"-navvolume","Generates the Havok Navigation Volume during compile. Must be generated together with the NavMesh.",ARG_VALUE_SET}, - {"-hkdmp","Creates .hkdmp file of navmesh and navvolume to help diagnose generatio problems.",ARG_VALUE_SET}, - {"-pruneNavMesh","Remove unused navmesh faces that don't exist inside any navmesh triggers.",ARG_VALUE_SET}, - {"-umbraNumThreads","Sets the number of CPU threads Umbra will use when creating tome",ARG_VALUE_NEEDS_INT,1,QThread::idealThreadCount(),true }, - {"-umbraSmallestOccluder","Surfaces smaller than this value will not be used as occluders",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-umbraSmallestHole","Geometry gaps smaller than this value are considered solid",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-umbraTileSize","Umbra data block size - smaller values will create larger tomes",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-umbraBackfaceLimit","Reverse percentage of backfaces tested to remove bad detail",ARG_VALUE_NEEDS_INT,0,120,true }, - {"-umbraObjectGroupCost","Groups surfaces together. Will improve in-game speed but degrades occlusion",ARG_VALUE_SET}, - {"-umbraEnableSndbs","Enable use of SNDBS to accelerate Umbra compile",ARG_VALUE_SET}, - {"-useUnstable","Use unstable shaders & techsetdefs",ARG_VALUE_SET}, - {"-spawnTest","Quits immediately if the map has spawn points which intersect with level geop",ARG_VALUE_SET}, - {"-timing","Enable prints for timing and instrumentation",ARG_VALUE_SET}, - {"-prefabInstancing","Prefab instancing behavior [default|always|never]",ARG_VALUE_NEEDS_COMBO,NULL,NULL,true, QStringList() << "" << "default" <<"always" << "never" }, - {"-noCoalesceCoincidentWindings","Turn off coalescing of coincident/coplanar surfaces",ARG_VALUE_SET} -}; - enum mlItemType { ML_ITEM_UNKNOWN, @@ -168,11 +121,11 @@ void mlConvertThread::run() file = file_info.baseName(); QString ToolsPath = QDir::fromNativeSeparators(getenv("TA_TOOLS_PATH")); - QString ExecutablePath = QString("%1bin/export2bin.exe").arg(ToolsPath); + QString ExecutablePath = QString("%1bin\\export2bin.exe").arg(ToolsPath); QStringList args; //args.append("/v"); // Verbose - args.append("/piped"); + //args.append("/piped"); QString filepath = file_info.absoluteFilePath(); @@ -295,7 +248,6 @@ mlMainWindow::mlMainWindow() mTreyarchTheme = Settings.value("UseDarkTheme", false).toBool(); mUseBuiltInEditor= Settings.value("InBuiltEditor",false).toBool(); mOpenAPEAfter = Settings.value("GDTCreate_OpenAPEAfterCreation",false).toBool(); - mUseExpertZone = Settings.value("Expert_ZoneEditor",false).toBool(); mGamePath = QString(getenv("TA_GAME_PATH")).replace('\\', '/'); mToolsPath = QString(getenv("TA_TOOLS_PATH")).replace('\\', '/'); @@ -363,10 +315,7 @@ mlMainWindow::mlMainWindow() mRunEnabledWidget = new QCheckBox("Run"); ActionsLayout->addWidget(mRunEnabledWidget); - mCOD2MAPOptionsButton = new QPushButton("COD2MAP Args"); - connect(mCOD2MAPOptionsButton,SIGNAL(clicked()),this,SLOT(OnEditCOD2MAPArgs())); - ActionsLayout->addWidget(mCOD2MAPOptionsButton); - //mCOD2MAPOptionsButton->setEnabled(false); //Broken For Now. Not Fixing Until Weekend When I Have Time. + mBuildButton = new QPushButton("Build"); connect(mBuildButton, SIGNAL(clicked()), mActionEditBuild, SLOT(trigger())); @@ -969,16 +918,13 @@ void mlMainWindow::OnEditBuild() QStringList Args; - if(!mRunDvars.isEmpty()) - Args << mCod2MapArgs; - else - { + Args << "-platform" << "pc"; if (mCompileModeWidget->currentIndex() == 0) Args << "-onlyents"; else Args << "-navmesh" << "-navvolume"; - } + Args << "-loadFrom" << QString("%1\\map_source\\%2\\%3.map").arg(mGamePath, MapName.left(2), MapName); Args << QString("%1\\share\\raw\\maps\\%2\\%3.d3dbsp").arg(mGamePath, MapName.left(2), MapName); @@ -1271,10 +1217,6 @@ void mlMainWindow::OnEditOptions() InBuiltEditor->setChecked(Settings.value("InBuiltEditor",false).toBool()); Layout->addWidget(InBuiltEditor); - QCheckBox* AdvanceEditor = new QCheckBox("Use Advance Zone Editor Features"); - AdvanceEditor->setToolTip("Toggle between basic and advance zone editor features."); - AdvanceEditor->setChecked(Settings.value("Expert_ZoneEditor",false).toBool()); - Layout->addWidget(AdvanceEditor); QHBoxLayout* LanguageLayout = new QHBoxLayout(); LanguageLayout->addWidget(new QLabel("Build Language:")); @@ -1307,12 +1249,10 @@ void mlMainWindow::OnEditOptions() mBuildLanguage = LanguageCombo->currentText(); mTreyarchTheme = Checkbox->isChecked(); mUseBuiltInEditor = InBuiltEditor->isChecked(); - mUseExpertZone = AdvanceEditor->isChecked(); Settings.setValue("BuildLanguage", mBuildLanguage); Settings.setValue("UseDarkTheme", mTreyarchTheme); Settings.setValue("InBuiltEditor",mUseBuiltInEditor); - Settings.setValue("Expert_ZoneEditor",mUseExpertZone); UpdateTheme(); } @@ -1334,85 +1274,7 @@ void mlMainWindow::UpdateTheme() } } -void mlMainWindow::OnEditCOD2MAPArgs() -{ - QDialog Dialog(this,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); - Dialog.setWindowTitle("COD2MAP Arguments"); - QVBoxLayout* Layout = new QVBoxLayout(&Dialog); - - QLabel* Label = new QLabel("These arguments are experimental and will let you tweak what will be parsed to cod2map",&Dialog); - - QTreeWidget* SettingsTree = new QTreeWidget(&Dialog); - SettingsTree->setColumnCount(2); - SettingsTree->header()->setSectionResizeMode(0,QHeaderView::ResizeToContents); - SettingsTree->setHeaderLabels(QStringList() << "Setting" << "Value"); - SettingsTree->setUniformRowHeights(true); - SettingsTree->setRootIsDecorated(false); - - QDialogButtonBox* ButtonBox = new QDialogButtonBox(&Dialog); - ButtonBox->setOrientation(Qt::Horizontal); - ButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - ButtonBox->setCenterButtons(true); - - - Layout->addWidget(Label); - Layout->addWidget(SettingsTree); - Layout->addWidget(ButtonBox); - - for(int SettingIndx = 0; SettingIndx < ARRAYSIZE(gCod2MapArgs); SettingIndx++) - COD2MAP(gCod2MapArgs[SettingIndx], SettingsTree); - - connect(ButtonBox, SIGNAL(accepted()), &Dialog, SLOT(accept())); - connect(ButtonBox, SIGNAL(rejected()), &Dialog, SLOT(reject())); - - if (Dialog.exec() != QDialog::Accepted) - return; - - int size = 0; - QSettings settings; - QString SettingName, SettingValue; - QTreeWidgetItemIterator it(SettingsTree); - - mCod2MapArgs.clear(); - while (*it && size < ARRAYSIZE(gDvars)) - { - QWidget* Widget = SettingsTree->itemWidget(*it, 1); - SettingName = (*it)->data(0, 0).toString(); - COD2MAPArg_s Setting = COD2MAP::findSetting(SettingName, SettingsTree, gCod2MapArgs, ARRAYSIZE(gCod2MapArgs)); - switch(Setting.type) - { - case ARG_VALUE_NEEDS_STRING: - SettingValue = COD2MAP::setCOD2MAPSetting(Setting, (QLineEdit*)Widget); - break; - case ARG_VALUE_SET: - SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QCheckBox*)Widget); - break; - case ARG_VALUE_NEEDS_INT: - SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QSpinBox*)Widget); - break; - case ARG_VALUE_NEEDS_COMBO: - SettingValue = COD2MAP::setCOD2MAPSetting(Setting,(QComboBox*)Widget); - break; - } - - if(!SettingValue.toLatin1().isEmpty()) - { - if(Setting.isSettable) - { - mCod2MapArgs << Setting.name; - mOutputWidget->appendPlainText(Setting.name); - } - else if (!Setting.isSettable) - { - mCod2MapArgs << Setting.name << SettingValue; - mOutputWidget->appendPlainText(QString("%1 %2").arg(SettingName)); - } - } - size++; - ++it; - } -} void mlMainWindow::OnEditDvars() diff --git a/mlMainWindow.h b/mlMainWindow.h index 3ff0cb2..5488530 100644 --- a/mlMainWindow.h +++ b/mlMainWindow.h @@ -107,7 +107,7 @@ protected slots: void OnEditPublish(); void OnEditOptions(); void OnEditDvars(); - void OnEditCOD2MAPArgs(); + void OnOpenDocs(); void OnHelpAbout(); void OnSaveOutput(); @@ -132,6 +132,7 @@ protected slots: void OnCancelZone(); void OnItemSelected(const QItemSelection&,const QItemSelection&); + protected: void closeEvent(QCloseEvent* Event); @@ -150,14 +151,12 @@ protected slots: void InitExport2BinGUI(); void InitZoneEditor(); void InitGDTCreator(); - - void InitCod2MapArgs(); - //void InitLinkerArgs(); Need Docs On This So I can add tool-tips. + + bool mTreyarchTheme; bool mUseBuiltInEditor; bool mOpenAPEAfter; - bool mUseExpertZone; QString mIncludeFormat; QString mQuoteFormat; @@ -188,7 +187,7 @@ protected slots: QPushButton* mBuildButton; QPushButton* mDvarsButton; QPushButton* mConvertButton; - QPushButton* mCOD2MAPOptionsButton; + QCheckBox* mCompileEnabledWidget; QCheckBox* mLightEnabledWidget; @@ -213,6 +212,7 @@ protected slots: QDockWidget* mExport2BinGUIWidget; QDockWidget* mZoneEditorGUIWidget; QDockWidget* mGDTCreatorGUIWidget; + QDockWidget* mColorChangeWidget; QString mBuildLanguage; QString mTitle; @@ -227,7 +227,7 @@ protected slots: QStringList mTags; QStringList mRunDvars; - QStringList mCod2MapArgs; + QTimer mTimer; QTimer SyntaxTimer; diff --git a/stdafx.h b/stdafx.h index 076e492..4e470f7 100644 --- a/stdafx.h +++ b/stdafx.h @@ -22,7 +22,7 @@ #include "steam_api.h" #include "dvar.h" -#include "cod2map.h" +//#include "cod2map.h" Not Ready For Ship Yet. #include "GDTCreator.h" class mlMainWindow;