Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
59399f9
Convert
May 6, 2017
a2d5af6
Convert
May 6, 2017
432815f
Stuff
May 6, 2017
f8cd67b
Basic Syntax Highlighting
May 6, 2017
16f206e
Added Cancel button to Zone editor at requet by SE2Dev
May 6, 2017
d0ca540
Cleaned up some code, added devmap dvar
May 6, 2017
8c7de02
zone file wasn't saving, damn QT with the file handling
May 6, 2017
ed14baa
added some dvar stuff, added map dvar, witch populates normal maps, t…
May 6, 2017
5f15bdc
Fix maps not compiling and a few other bug fixes (reverted back code)
May 12, 2017
097e744
adding fast gdt creator, so you don't need to fluff around in APE, bu…
May 12, 2017
682afea
don't want people using my settings, so I am removing my vcxprof file
May 12, 2017
9381940
csv editor
May 13, 2017
a6227ea
csv editor
May 13, 2017
3fe4604
Merge remote-tracking branch 'origin/master'
May 13, 2017
a22fec7
Split Syntax
May 13, 2017
b7f5eec
Split GDTCreator
May 13, 2017
604dd0b
Re-Added GDT Creator to mlMainWindow
May 13, 2017
bfd0bed
Reverted Lost Commits
May 13, 2017
e5173b0
Wip
May 13, 2017
45b9d12
Ready
May 13, 2017
fd515d1
Zone Editor
May 13, 2017
2ea4faf
My eyes hurt
May 14, 2017
cb79b5d
Big
May 14, 2017
656d394
Zone Editor
May 19, 2017
4b16a2b
GDT Code coming along
May 19, 2017
0d996b7
I mean it makes the GDt
May 19, 2017
70197f1
GDT Fixes
May 19, 2017
39bf296
Stop / Start / Stop / Start
May 19, 2017
9069b8e
cod2map args
May 20, 2017
682e191
More Args
May 23, 2017
5096157
More Args Again
May 23, 2017
1499134
Eh, done for the night
May 23, 2017
69b51b8
Moving Code Around
May 25, 2017
b84b4f4
GDT "creator" nove fully moved
May 25, 2017
b1447d2
GDT Tune up
May 25, 2017
9d5efa4
Pull Request
Jun 1, 2017
5428f83
Merge branch 'master' into Ship
Arefu Jun 1, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions GDTCreator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
#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<QUrl> 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);
return;
}

if(CurrentFile.isDir())
{
QMessageBox::information(this,"Hold Up!","Sorry, I Don't Support Folders! Please Drag The Files Onto Me.",QMessageBox::Ok);
/*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 SavePath = QString("%1/%2").arg(model_export_folder->absolutePath(),WorkingDir);

if(parentWindow->mAutoCopyAssetsAfterGDTCreation->isChecked())
{
if(!QDir().exists(SavePath))
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);

if(!GDTType.isEmpty())
{
FileName = GetGDTFileName(WorkingDir);
MakeGDT(GDTType, FileName, CurrentFile.suffix(),Path);
}
}
}

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;
}
}
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);
FileWriter << Template;
FileWriter.flush();
GDTFile->close();
}
else
{
QMessageBox::critical(this,"Uh-Oh!","I Couldn't Open The File For Saving",QMessageBox::Ok);
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;
}
24 changes: 24 additions & 0 deletions GDTCreator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#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
QString GetGDTType(QFileInfo); //Current File
QString GetGDTFileName(QString); //Working Dir

public:
GDTCreator(QWidget *parent, mlMainWindow* parent_window);
};
2 changes: 1 addition & 1 deletion ModLauncher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Qt5Version = external
Qt5Version = qt
EndGlobalSection
EndGlobal
Loading