Merge pull request #390 from aws-lumberyard-dev/cgalvan/RemoveUnusedDialogs
[LYN-3319] Removed some unused Editor dialogs.
This commit is contained in:
@@ -149,7 +149,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "LevelFileDialog.h"
|
||||
#include "LevelIndependentFileMan.h"
|
||||
#include "WelcomeScreen/WelcomeScreenDialog.h"
|
||||
#include "Dialogs/DuplicatedObjectsHandlerDlg.h"
|
||||
|
||||
#include "Controls/ReflectedPropertyControl/PropertyCtrl.h"
|
||||
#include "Controls/ReflectedPropertyControl/ReflectedVar.h"
|
||||
@@ -400,9 +399,7 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
ON_COMMAND(ID_OBJECTMODIFY_UNFREEZE, OnObjectmodifyUnfreeze)
|
||||
ON_COMMAND(ID_UNDO, OnUndo)
|
||||
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
|
||||
ON_COMMAND(ID_SELECTION_SAVE, OnSelectionSave)
|
||||
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
|
||||
ON_COMMAND(ID_SELECTION_LOAD, OnSelectionLoad)
|
||||
ON_COMMAND(ID_LOCK_SELECTION, OnLockSelection)
|
||||
ON_COMMAND(ID_EDIT_LEVELDATA, OnEditLevelData)
|
||||
ON_COMMAND(ID_FILE_EDITLOGFILE, OnFileEditLogFile)
|
||||
@@ -3019,149 +3016,12 @@ void CCryEditApp::OnFileExportOcclusionMesh()
|
||||
pExportManager->Export(levelName.toUtf8().data(), "ocm", levelPath.toUtf8().data(), false, false, true);
|
||||
}
|
||||
|
||||
void CCryEditApp::OnSelectionSave()
|
||||
{
|
||||
char szFilters[] = "Object Group Files (*.grp)";
|
||||
QtUtil::QtMFCScopedHWNDCapture cap;
|
||||
CAutoDirectoryRestoreFileDialog dlg(QFileDialog::AcceptSave, QFileDialog::AnyFile, "grp", {}, szFilters, {}, {}, cap);
|
||||
|
||||
if (dlg.exec())
|
||||
{
|
||||
QWaitCursor wait;
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
//CXmlArchive xmlAr( "Objects" );
|
||||
|
||||
|
||||
XmlNodeRef root = XmlHelpers::CreateXmlNode("Objects");
|
||||
CObjectArchive ar(GetIEditor()->GetObjectManager(), root, false);
|
||||
// Save all objects to XML.
|
||||
for (int i = 0; i < sel->GetCount(); i++)
|
||||
{
|
||||
ar.SaveObject(sel->GetObject(i));
|
||||
}
|
||||
QString fileName = dlg.selectedFiles().first();
|
||||
XmlHelpers::SaveXmlNode(GetIEditor()->GetFileUtil(), root, fileName.toStdString().c_str());
|
||||
//xmlAr.Save( dlg.GetPathName() );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SDuplicatedObject
|
||||
{
|
||||
SDuplicatedObject(const QString& name, const GUID& id)
|
||||
{
|
||||
m_name = name;
|
||||
m_id = id;
|
||||
}
|
||||
QString m_name;
|
||||
GUID m_id;
|
||||
};
|
||||
|
||||
void GatherAllObjects(XmlNodeRef node, std::vector<SDuplicatedObject>& outDuplicatedObjects)
|
||||
{
|
||||
if (!azstricmp(node->getTag(), "Object"))
|
||||
{
|
||||
GUID guid;
|
||||
if (node->getAttr("Id", guid))
|
||||
{
|
||||
if (GetIEditor()->GetObjectManager()->FindObject(guid))
|
||||
{
|
||||
QString name;
|
||||
node->getAttr("Name", name);
|
||||
outDuplicatedObjects.push_back(SDuplicatedObject(name, guid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0, nChildCount(node->getChildCount()); i < nChildCount; ++i)
|
||||
{
|
||||
XmlNodeRef childNode = node->getChild(i);
|
||||
if (childNode == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
GatherAllObjects(childNode, outDuplicatedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditApp::OnOpenAssetImporter()
|
||||
{
|
||||
QtViewPaneManager::instance()->OpenPane(LyViewPane::SceneSettings);
|
||||
}
|
||||
|
||||
void CCryEditApp::OnSelectionLoad()
|
||||
{
|
||||
// Load objects from .grp file.
|
||||
QtUtil::QtMFCScopedHWNDCapture cap;
|
||||
CAutoDirectoryRestoreFileDialog dlg(QFileDialog::AcceptOpen, QFileDialog::ExistingFile, "grp", {}, "Object Group Files (*.grp)", {}, {}, cap);
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QWaitCursor wait;
|
||||
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(dlg.selectedFiles().first().toStdString().c_str());
|
||||
if (!root)
|
||||
{
|
||||
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Error at loading group file."));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<SDuplicatedObject> duplicatedObjects;
|
||||
GatherAllObjects(root, duplicatedObjects);
|
||||
|
||||
CDuplicatedObjectsHandlerDlg::EResult result(CDuplicatedObjectsHandlerDlg::eResult_None);
|
||||
int nDuplicatedObjectSize(duplicatedObjects.size());
|
||||
|
||||
if (!duplicatedObjects.empty())
|
||||
{
|
||||
QString msg = QObject::tr("The following object(s) already exist(s) in the level.\r\n\r\n");
|
||||
|
||||
for (int i = 0; i < nDuplicatedObjectSize; ++i)
|
||||
{
|
||||
msg += QStringLiteral("\t");
|
||||
msg += duplicatedObjects[i].m_name;
|
||||
if (i < nDuplicatedObjectSize - 1)
|
||||
{
|
||||
msg += QStringLiteral("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
CDuplicatedObjectsHandlerDlg confirmDlg(msg);
|
||||
if (confirmDlg.exec() == QDialog::Rejected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
result = confirmDlg.GetResult();
|
||||
}
|
||||
|
||||
CUndo undo("Load Objects");
|
||||
GetIEditor()->ClearSelection();
|
||||
|
||||
CObjectArchive ar(GetIEditor()->GetObjectManager(), root, true);
|
||||
|
||||
if (result == CDuplicatedObjectsHandlerDlg::eResult_Override)
|
||||
{
|
||||
for (int i = 0; i < nDuplicatedObjectSize; ++i)
|
||||
{
|
||||
CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(duplicatedObjects[i].m_id);
|
||||
if (pObj)
|
||||
{
|
||||
GetIEditor()->GetObjectManager()->DeleteObject(pObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (result == CDuplicatedObjectsHandlerDlg::eResult_CreateCopies)
|
||||
{
|
||||
ar.MakeNewIds(true);
|
||||
}
|
||||
|
||||
GetIEditor()->GetObjectManager()->LoadObjects(ar, true);
|
||||
GetIEditor()->SetModifiedFlag();
|
||||
GetIEditor()->SetModifiedModule(eModifiedBrushes);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateSelected(QAction* action)
|
||||
{
|
||||
|
||||
@@ -232,9 +232,7 @@ public:
|
||||
void OnObjectmodifyFreeze();
|
||||
void OnObjectmodifyUnfreeze();
|
||||
void OnUndo();
|
||||
void OnSelectionSave();
|
||||
void OnOpenAssetImporter();
|
||||
void OnSelectionLoad();
|
||||
void OnUpdateSelected(QAction* action);
|
||||
void OnLockSelection();
|
||||
void OnEditLevelData();
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "DuplicatedObjectsHandlerDlg.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <Dialogs/ui_DuplicatedObjectsHandlerDlg.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
CDuplicatedObjectsHandlerDlg::CDuplicatedObjectsHandlerDlg(const QString& msg, QWidget* pParent)
|
||||
: QDialog(pParent)
|
||||
, m_ui(new Ui::DuplicatedObjectsHandlerDlg)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
m_ui->textBrowser->setPlainText(msg);
|
||||
|
||||
connect(m_ui->buttonOverride, &QPushButton::clicked, this, &CDuplicatedObjectsHandlerDlg::OnBnClickedOverrideBtn);
|
||||
connect(m_ui->buttonCreateCopies, &QPushButton::clicked, this, &CDuplicatedObjectsHandlerDlg::OnBnClickedCreateCopiesBtn);
|
||||
}
|
||||
|
||||
CDuplicatedObjectsHandlerDlg::~CDuplicatedObjectsHandlerDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CDuplicatedObjectsHandlerDlg::OnBnClickedOverrideBtn()
|
||||
{
|
||||
m_result = eResult_Override;
|
||||
accept();
|
||||
}
|
||||
|
||||
void CDuplicatedObjectsHandlerDlg::OnBnClickedCreateCopiesBtn()
|
||||
{
|
||||
m_result = eResult_CreateCopies;
|
||||
accept();
|
||||
}
|
||||
|
||||
#include <Dialogs/moc_DuplicatedObjectsHandlerDlg.cpp>
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_DIALOGS_DUPLICATEDOBJECTSHANDLERDLG_H
|
||||
#define CRYINCLUDE_EDITOR_DIALOGS_DUPLICATEDOBJECTSHANDLERDLG_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DuplicatedObjectsHandlerDlg;
|
||||
}
|
||||
|
||||
class CDuplicatedObjectsHandlerDlg
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDuplicatedObjectsHandlerDlg(const QString& msg, QWidget* pParent = nullptr);
|
||||
virtual ~CDuplicatedObjectsHandlerDlg();
|
||||
|
||||
enum EResult
|
||||
{
|
||||
eResult_None,
|
||||
eResult_Override,
|
||||
eResult_CreateCopies
|
||||
};
|
||||
|
||||
EResult GetResult() const
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
EResult m_result;
|
||||
|
||||
void OnBnClickedOverrideBtn();
|
||||
void OnBnClickedCreateCopiesBtn();
|
||||
|
||||
QScopedPointer<Ui::DuplicatedObjectsHandlerDlg> m_ui;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_DIALOGS_DUPLICATEDOBJECTSHANDLERDLG_H
|
||||
@@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DuplicatedObjectsHandlerDlg</class>
|
||||
<widget class="QDialog" name="DuplicatedObjectsHandlerDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>204</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Duplicated Objects Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonOverride">
|
||||
<property name="text">
|
||||
<string>Override</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonCreateCopies">
|
||||
<property name="text">
|
||||
<string>Create Copies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>DuplicatedObjectsHandlerDlg</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>258</x>
|
||||
<y>183</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>190</x>
|
||||
<y>184</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,218 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "NewEntityDialog.h"
|
||||
|
||||
// Qt
|
||||
#include <QPushButton>
|
||||
#include <QToolTip>
|
||||
#include <QMessageBox>
|
||||
|
||||
// Editor
|
||||
#include "Dialogs/QT/ui_NewEntityDialog.h"
|
||||
|
||||
|
||||
NewEntityDialog::NewEntityDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::NewEntityDialog)
|
||||
{
|
||||
entityNameValidator = new EntityNameValidator(this);
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->entityName->setFocus();
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
connect(ui->entityName, SIGNAL(textChanged(QString)), this, SLOT(ValidateInput()));
|
||||
connect(ui->categoryName, SIGNAL(textChanged(QString)), this, SLOT(ValidateInput()));
|
||||
|
||||
SetCategoryCompleterPath((Path::GetEditingGameDataFolder() + "/Scripts/Entities").c_str());
|
||||
SetNameValidatorPath((Path::GetEditingGameDataFolder() + "/Entities").c_str());
|
||||
}
|
||||
|
||||
NewEntityDialog::~NewEntityDialog()
|
||||
{
|
||||
SAFE_DELETE(entityNameValidator);
|
||||
SAFE_DELETE(folderNameCompleter);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NewEntityDialog::SetCategoryCompleterPath(CryStringT<char> path)
|
||||
{
|
||||
SAFE_DELETE(folderNameCompleter);
|
||||
|
||||
QDirIterator directoryIt(QString::fromLocal8Bit(path.c_str(), path.length()), QDir::NoDotAndDotDot | QDir::AllDirs, QDirIterator::Subdirectories);
|
||||
baseDir = directoryIt.path() + "/";
|
||||
|
||||
QStringList dirs;
|
||||
while (directoryIt.hasNext())
|
||||
{
|
||||
QString dir = directoryIt.next().remove(baseDir);
|
||||
dirs.append(dir);
|
||||
}
|
||||
|
||||
folderNameCompleter = new QCompleter(dirs);
|
||||
folderNameCompleter->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
folderNameCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
ui->categoryName->setCompleter(folderNameCompleter);
|
||||
}
|
||||
|
||||
void NewEntityDialog::SetNameValidatorPath(CryStringT<char> path)
|
||||
{
|
||||
QDir dir(QString::fromLocal8Bit(path.c_str(), path.length()));
|
||||
nameBaseDir = dir.path() + "/";
|
||||
}
|
||||
|
||||
void NewEntityDialog::ValidateInput()
|
||||
{
|
||||
int cursorPos = ui->entityName->cursorPosition();
|
||||
QString text = ui->entityName->text();
|
||||
bool validText = entityNameValidator->validate(text, cursorPos);
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(validText);
|
||||
}
|
||||
|
||||
void NewEntityDialog::accept()
|
||||
{
|
||||
if (ui->categoryName->text().isEmpty()
|
||||
&& QMessageBox::question(this, "Are you sure?", "Create entity without category?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const char* devRoot = gEnv->pFileIO->GetAlias("@engroot@");
|
||||
QString devRootPath(devRoot);
|
||||
QFile entTemplateFile(devRootPath + "/Editor/NewEntityTemplate.ent_template");
|
||||
QFile luaTemplateFile(devRootPath + "/Editor/NewEntityTemplate.lua_template");
|
||||
QFile entDestFile(nameBaseDir + ui->entityName->text() + ".ent");
|
||||
QFile luaDestFile(baseDir + ui->categoryName->text() + "/" + ui->entityName->text() + ".lua");
|
||||
|
||||
if (!entTemplateFile.exists() || !luaTemplateFile.exists())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Missing Template Files"), tr("In order to create default entities the NewEntityTemplate.lua and NewEntityTemplate.ent template files must exist in the Templates folder!"));
|
||||
return;
|
||||
}
|
||||
|
||||
//generate the .ent file
|
||||
QDir pathMaker(nameBaseDir);
|
||||
pathMaker.mkpath(pathMaker.path());
|
||||
QString entFileString;
|
||||
if (!entTemplateFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
AZ_Warning("Editor", false, "Enable to open template file for ent : %s", entTemplateFile.fileName().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
entFileString = entTemplateFile.readAll();
|
||||
entTemplateFile.close();
|
||||
}
|
||||
|
||||
entFileString.replace(QString("[CATEGORY_NAME]"), ui->categoryName->text());
|
||||
entFileString.replace(QString("[ENTITY_NAME]"), ui->entityName->text());
|
||||
if (!entDestFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
AZ_Warning("Editor", false, "Enable to open destination file for ent : %s", entDestFile.fileName().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
entDestFile.write(entFileString.toUtf8());
|
||||
entDestFile.close();
|
||||
}
|
||||
|
||||
//generate the .lua file
|
||||
pathMaker.setPath(baseDir);
|
||||
pathMaker.mkpath(ui->categoryName->text() + "/");
|
||||
|
||||
QString luaFileString;
|
||||
if (!luaTemplateFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
AZ_Warning("Editor", false, "Enable to open template file for lua : %s", luaTemplateFile.fileName().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
luaFileString = luaTemplateFile.readAll();
|
||||
luaTemplateFile.close();
|
||||
}
|
||||
|
||||
luaFileString.replace(QString("[ENTITY_NAME]"), ui->entityName->text());
|
||||
if (!luaDestFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
AZ_Warning("Editor", false, "Enable to open destination file for lua : %s", luaDestFile.fileName().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
luaDestFile.write(luaFileString.toUtf8());
|
||||
luaDestFile.close();
|
||||
}
|
||||
|
||||
|
||||
if (ui->openLuaCB->isChecked())
|
||||
{
|
||||
CFileUtil::EditTextFile(luaDestFile.fileName().toLocal8Bit().data());
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
QValidator::State NewEntityDialog::EntityNameValidator::validate(QString& input, [[maybe_unused]] int& pos) const
|
||||
{
|
||||
if (!m_Parent)
|
||||
{
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
if (input.isEmpty())
|
||||
{
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
if (input.contains("/"))
|
||||
{
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
QString fileBaseName = m_Parent->ui->entityName->text();
|
||||
|
||||
// Characters
|
||||
const char* notAllowedChars = ",^@=+{}[]~!?:&*\"|#%<>$\"'();`' ";
|
||||
for (const char* c = notAllowedChars; *c; c++)
|
||||
{
|
||||
if (fileBaseName.contains(QLatin1Char(*c)))
|
||||
{
|
||||
const QChar qc = QLatin1Char(*c);
|
||||
if (qc.isSpace())
|
||||
{
|
||||
QToolTip::showText(m_Parent->ui->entityName->mapToGlobal(QPoint()), tr("Name may not contain white space."), m_Parent->ui->entityName, m_Parent->ui->entityName->rect(), 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
QToolTip::showText(m_Parent->ui->entityName->mapToGlobal(QPoint()), tr("Invalid character \"%1\".").arg(qc), m_Parent->ui->entityName, m_Parent->ui->entityName->rect(), 2000);
|
||||
}
|
||||
return Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
QString filename(m_Parent->nameBaseDir + m_Parent->ui->entityName->text() + ".ent");
|
||||
QFile newFile(filename);
|
||||
|
||||
if (newFile.exists())
|
||||
{
|
||||
QToolTip::showText(m_Parent->ui->entityName->mapToGlobal(QPoint()), tr("Filename already exists!"), m_Parent->ui->entityName, m_Parent->ui->entityName->rect(), 2000);
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
return Acceptable;
|
||||
}
|
||||
|
||||
#include <Dialogs/QT/moc_NewEntityDialog.cpp>
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#ifndef NEWENTITYDIALOG_H
|
||||
#define NEWENTITYDIALOG_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
#include <QCompleter>
|
||||
#include <QDirIterator>
|
||||
#include <QStringListModel>
|
||||
#include <QValidator>
|
||||
#include <QEvent>
|
||||
#include <QLineEdit>
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class NewEntityDialog;
|
||||
}
|
||||
|
||||
class NewEntityDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewEntityDialog(QWidget* parent = 0);
|
||||
~NewEntityDialog();
|
||||
|
||||
private:
|
||||
Ui::NewEntityDialog* ui;
|
||||
QString baseDir = "";
|
||||
QString nameBaseDir = "";
|
||||
QCompleter* folderNameCompleter = NULL;
|
||||
|
||||
void SetCategoryCompleterPath(CryStringT<char> path);
|
||||
void SetNameValidatorPath(CryStringT<char> path);
|
||||
|
||||
virtual void accept();
|
||||
|
||||
class EntityNameValidator
|
||||
: public QValidator
|
||||
{
|
||||
public:
|
||||
explicit EntityNameValidator(NewEntityDialog* parent = 0)
|
||||
: QValidator(parent)
|
||||
, m_Parent(parent)
|
||||
{
|
||||
}
|
||||
virtual State validate(QString& input, int& pos) const;
|
||||
|
||||
NewEntityDialog* m_Parent;
|
||||
};
|
||||
|
||||
EntityNameValidator* entityNameValidator;
|
||||
|
||||
public slots:
|
||||
void ValidateInput();
|
||||
};
|
||||
|
||||
#endif // NEWENTITYDIALOG_H
|
||||
@@ -1,161 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewEntityDialog</class>
|
||||
<widget class="QDialog" name="NewEntityDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::PreventContextMenu</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>New Entity</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>70</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="entityName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>10</y>
|
||||
<width>281</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Entity Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>entityName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Entity Category:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>categoryName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="categoryName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>40</y>
|
||||
<width>281</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="openLuaCB">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>141</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Lua After Creating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>entityName</tabstop>
|
||||
<tabstop>categoryName</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>NewEntityDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>NewEntityDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -149,8 +149,6 @@
|
||||
#define ID_OBJECTMODIFY_UNFREEZE 33518
|
||||
#define ID_UNDO 33524
|
||||
#define ID_EDIT_CLONE 33525
|
||||
#define ID_SELECTION_SAVE 33527
|
||||
#define ID_SELECTION_LOAD 33529
|
||||
#define ID_GOTO_SELECTED 33535
|
||||
#define ID_EDIT_LEVELDATA 33542
|
||||
#define ID_FILE_EDITEDITORINI 33543
|
||||
|
||||
@@ -511,9 +511,6 @@ set(FILES
|
||||
DimensionsDialog.cpp
|
||||
DimensionsDialog.h
|
||||
DimensionsDialog.ui
|
||||
Dialogs/QT/NewEntityDialog.cpp
|
||||
Dialogs/QT/NewEntityDialog.h
|
||||
Dialogs/QT/NewEntityDialog.ui
|
||||
NewLevelDialog.cpp
|
||||
NewLevelDialog.h
|
||||
NewLevelDialog.ui
|
||||
@@ -551,7 +548,6 @@ set(FILES
|
||||
DatabaseFrameWnd.h
|
||||
DatabaseFrameWnd.ui
|
||||
DatabaseFrameWnd.qrc
|
||||
Dialogs/DuplicatedObjectsHandlerDlg.h
|
||||
DocMultiArchive.h
|
||||
EditMode/DeepSelection.h
|
||||
FBXExporterDialog.h
|
||||
@@ -711,8 +707,6 @@ set(FILES
|
||||
graphicssettingsdialog.ui
|
||||
AboutDialog.cpp
|
||||
DatabaseFrameWnd.cpp
|
||||
Dialogs/DuplicatedObjectsHandlerDlg.cpp
|
||||
Dialogs/DuplicatedObjectsHandlerDlg.ui
|
||||
ErrorReportTableModel.h
|
||||
ErrorReportTableModel.cpp
|
||||
EditMode/DeepSelection.cpp
|
||||
|
||||
Reference in New Issue
Block a user