Added some application-wide macros, set up various parts of the editor to reference the application name via macro instead of hardcoded to a specific string
This commit is contained in:
parent
2db740e572
commit
ab38205611
|
@ -0,0 +1,13 @@
|
|||
# CONFIG += PUBLIC_RELEASE
|
||||
|
||||
DEFINES += 'APP_NAME=\"\\\"Prime World Editor\\\"\"' \
|
||||
'APP_VERSION=\"\\\"1.1.0\\\"\"'
|
||||
|
||||
PUBLIC_RELEASE {
|
||||
DEFINES += 'PUBLIC_RELEASE=1' \
|
||||
'APP_FULL_NAME=\"APP_NAME \\\" v\\\" APP_VERSION\"'
|
||||
}
|
||||
else {
|
||||
DEFINES += 'PUBLIC_RELEASE=0' \
|
||||
'APP_FULL_NAME=\"APP_NAME \\\" v\\\" APP_VERSION \\\" (DEV)\\\"\"'
|
||||
}
|
|
@ -8,32 +8,50 @@
|
|||
|
||||
#define __FILE_SHORT__ strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__
|
||||
|
||||
#define ASSERT_CHECK_BEGIN(Expression) \
|
||||
#if _DEBUG
|
||||
#define DEBUG_BREAK __debugbreak();
|
||||
#else
|
||||
#define DEBUG_BREAK {}
|
||||
#endif
|
||||
|
||||
#if !PUBLIC_RELEASE
|
||||
|
||||
// Development Build
|
||||
#define ASSERT_CHECK_BEGIN(Expression) \
|
||||
{ \
|
||||
if (!(Expression)) \
|
||||
{
|
||||
|
||||
#define ASSERT_CHECK_END \
|
||||
#define ASSERT_CHECK_END \
|
||||
} \
|
||||
}
|
||||
|
||||
#define WRITE_FAILURE_TO_LOG(Expression) \
|
||||
#define WRITE_FAILURE_TO_LOG(Expression) \
|
||||
Log::Write(TString(__FILE_SHORT__) + "(" + TString::FromInt32(__LINE__, 0, 10) + "): ASSERT FAILED: " + #Expression);
|
||||
|
||||
#define BREAK_ONLY_ASSERT(Expression) \
|
||||
#define BREAK_ONLY_ASSERT(Expression) \
|
||||
ASSERT_CHECK_BEGIN(Expression) \
|
||||
__debugbreak(); \
|
||||
DEBUG_BREAK \
|
||||
ASSERT_CHECK_END
|
||||
|
||||
#define LOG_ONLY_ASSERT(Expression) \
|
||||
#define LOG_ONLY_ASSERT(Expression) \
|
||||
ASSERT_CHECK_BEGIN(Expression) \
|
||||
WRITE_FAILURE_TO_LOG(Expression) \
|
||||
ASSERT_CHECK_END
|
||||
|
||||
#define ASSERT(Expression) \
|
||||
#define ASSERT(Expression) \
|
||||
ASSERT_CHECK_BEGIN(Expression) \
|
||||
WRITE_FAILURE_TO_LOG(Expression) \
|
||||
__debugbreak(); \
|
||||
DEBUG_BREAK \
|
||||
ASSERT_CHECK_END
|
||||
|
||||
#else
|
||||
|
||||
// Public Release Build
|
||||
#define BREAK_ONLY_ASSERT(Expression) {}
|
||||
#define LOG_ONLY_ASSERT(Expression) {}
|
||||
#define ASSERT(Expression) {}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ASSERT_H
|
||||
|
|
|
@ -53,6 +53,9 @@ bool InitLog(const TString& rkFilename)
|
|||
fprintf(gpLogFile, "Opened log file at %s\n", Buffer);
|
||||
fflush(gpLogFile);
|
||||
|
||||
// Print app name and version
|
||||
fprintf(gpLogFile, APP_FULL_NAME"\n");
|
||||
|
||||
// Print any messages that were attempted before we initialized
|
||||
if (!gPreInitLogs.empty())
|
||||
{
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#include "CAboutDialog.h"
|
||||
#include "ui_CAboutDialog.h"
|
||||
#include "UICommon.h"
|
||||
|
||||
CAboutDialog::CAboutDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CAboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QString LabelText = ui->AboutLabel->text();
|
||||
REPLACE_APPVARS(LabelText);
|
||||
ui->AboutLabel->setText(LabelText);
|
||||
}
|
||||
|
||||
CAboutDialog::~CAboutDialog()
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="AboutLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:12pt; font-weight:600;">Prime World Editor v1.0.0</span></p><p>Prime World Editor is developed by <span style=" font-weight:600;">Parax</span>.<br/>All the games it edits are developed by <span style=" font-weight:600;">Retro Studios</span> and published by <span style=" font-weight:600;">Nintendo</span>.</p><p>Special thanks to:</p><p><ul><li> The community at <span style=" font-weight:600;">Metroid2002</span> that contributed to reverse engineering the game and documenting its internals and file formats; in particular, <span style=" font-weight:600;">Antidote</span> and <span style=" font-weight:600;">jackoalan</span>, among others!</li><li> <span style=" font-weight:600;">Miles: </span>In addition to helping reverse engineer a few formats (in particular MLVL and MREA), also contributed greatly to putting together the script object templates and documenting object properties.</li><li> <span style=" font-weight:600;">Bearborg:</span> Lots of testing and feedback, plus the UI icons and some script object assets.</li><li> <span style=" font-weight:600;">Omega: </span>Script object assets.</li></ul>Check the <a href="http://www.metroid2002.com/retromodding/wiki/Retro_Modding_Wiki">Retro Modding Wiki</a> for file format documentation.</p><p>Prime World Editor uses <span style=" font-weight:600;">Assimp</span> (Open Asset Import Library).<br/>Copyright © 2006-2015 assimp team<br/>All rights reserved.</p></body></html></string>
|
||||
<string><html><head/><body><p><span style=" font-size:12pt; font-weight:600;">%APP_FULL_NAME%</span></p><p>%APP_NAME% is developed by <span style=" font-weight:600;">Parax</span>.<br/>All the games it edits are developed by <span style=" font-weight:600;">Retro Studios</span> and published by <span style=" font-weight:600;">Nintendo</span>.</p><p>Special thanks to:</p><p><ul><li> The community at <span style=" font-weight:600;">Metroid2002</span> that contributed to reverse engineering the game and documenting its internals and file formats; in particular, <span style=" font-weight:600;">Antidote</span> and <span style=" font-weight:600;">jackoalan</span>, among others!</li><li> <span style=" font-weight:600;">Miles: </span>In addition to helping reverse engineer a few formats (in particular MLVL and MREA), also contributed greatly to putting together the script object templates and documenting object properties.</li><li> <span style=" font-weight:600;">Bearborg:</span> Lots of testing and feedback, plus the UI icons and some script object assets.</li><li> <span style=" font-weight:600;">Omega: </span>Script object assets.</li></ul>Check the <a href="http://www.metroid2002.com/retromodding/wiki/Retro_Modding_Wiki">Retro Modding Wiki</a> for file format documentation.</p><p>%APP_NAME% uses <span style=" font-weight:600;">Assimp</span> (Open Asset Import Library).<br/>Copyright © 2006-2015 assimp team<br/>All rights reserved.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -18,6 +18,8 @@ CStartWindow::CStartWindow(QWidget *parent)
|
|||
, ui(new Ui::CStartWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
REPLACE_WINDOWTITLE_APPVARS;
|
||||
|
||||
mpWorld = nullptr;
|
||||
mpWorldEditor = new CWorldEditor(0);
|
||||
mpModelEditor = new CModelEditorWindow(this);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Prime World Editor</string>
|
||||
<string>%APP_FULL_NAME%</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
|
|
@ -23,6 +23,7 @@ CCharacterEditor::CCharacterEditor(QWidget *parent)
|
|||
, mPlaybackSpeed(1.f)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
REPLACE_WINDOWTITLE_APPVARS;
|
||||
|
||||
ui->Viewport->SetNode(mpCharNode);
|
||||
|
||||
|
@ -195,7 +196,7 @@ void CCharacterEditor::Open()
|
|||
{
|
||||
mpSet = pSet;
|
||||
mpCharNode->SetCharSet(mpSet);
|
||||
setWindowTitle("Prime World Editor - Character Editor: " + TO_QSTRING(mpSet->Source()));
|
||||
SET_WINDOWTITLE_APPVARS("%APP_FULL_NAME% - Character Editor: " + TO_QSTRING(mpSet->Source()));
|
||||
|
||||
// Clear selected bone
|
||||
ui->SkeletonHierarchyTreeView->selectionModel()->clear();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Prime World Editor - Character Editor</string>
|
||||
<string>%APP_FULL_NAME% - Character Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="CentralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -49,7 +49,7 @@
|
|||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0">
|
||||
<item>
|
||||
<widget class="CCharacterEditorViewport" name="Viewport" native="true">
|
||||
|
|
|
@ -11,12 +11,15 @@ RESOURCES += Icons.qrc
|
|||
|
||||
win32: RC_ICONS += icons/AppIcon.ico
|
||||
|
||||
CONFIG += console
|
||||
TEMPLATE = app
|
||||
DESTDIR = $$PWD/../../bin
|
||||
UI_DIR = $$PWD/../../build/Editor
|
||||
DEFINES += GLEW_STATIC
|
||||
|
||||
!PUBLIC_RELEASE {
|
||||
CONFIG += console
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
# Debug Config
|
||||
OBJECTS_DIR = $$PWD/../../build/Editor/debug
|
||||
|
|
|
@ -33,6 +33,7 @@ CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
|
|||
, mIgnoreSignals(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
REPLACE_WINDOWTITLE_APPVARS;
|
||||
|
||||
ui->Viewport->SetNode(mpCurrentModelNode);
|
||||
ui->Viewport->SetClearColor(CColor(0.3f, 0.3f, 0.3f, 1.f));
|
||||
|
@ -725,7 +726,7 @@ void CModelEditorWindow::Open()
|
|||
if (pModel)
|
||||
{
|
||||
SetActiveModel(pModel);
|
||||
setWindowTitle("Prime World Editor - Model Editor: " + TO_QSTRING(pModel->Source()));
|
||||
SET_WINDOWTITLE_APPVARS("%APP_FULL_NAME% - Model Editor: " + TO_QSTRING(pModel->Source()));
|
||||
mOutputFilename = TO_QSTRING(pModel->FullSource());
|
||||
}
|
||||
|
||||
|
@ -770,7 +771,7 @@ void CModelEditorWindow::Import()
|
|||
pModel = CModelLoader::ImportAssimpNode(pScene->mRootNode, pScene, *pSet);
|
||||
|
||||
SetActiveModel(pModel);
|
||||
setWindowTitle("Prime World Editor - Model Editor: Untitled");
|
||||
SET_WINDOWTITLE_APPVARS("%APP_FULL_NAME% - Model Editor: Untitled");
|
||||
mOutputFilename = "";
|
||||
gResCache.Clean();
|
||||
}
|
||||
|
@ -799,7 +800,7 @@ void CModelEditorWindow::SaveAs()
|
|||
Save();
|
||||
|
||||
TString Name = TString(FileName.toStdString());
|
||||
setWindowTitle("Prime World Editor - Model Editor: " + TO_QSTRING(Name));
|
||||
SET_WINDOWTITLE_APPVARS("%APP_FULL_NAME% - Model Editor: " + TO_QSTRING(Name));
|
||||
}
|
||||
|
||||
void CModelEditorWindow::ConvertToDDS()
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Prime World Editor - Model Editor</string>
|
||||
<string>%APP_FULL_NAME% - Model Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
|
|
|
@ -5,6 +5,27 @@
|
|||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
// App string variable handling - automatically fill in application name/version
|
||||
#define UI_APPVAR_NAME "%APP_NAME%"
|
||||
#define UI_APPVAR_FULLNAME "%APP_FULL_NAME%"
|
||||
#define UI_APPVAR_VERSION "%APP_VERSION%"
|
||||
|
||||
#define REPLACE_APPVARS(InQString) \
|
||||
InQString.replace(UI_APPVAR_NAME, APP_NAME); \
|
||||
InQString.replace(UI_APPVAR_FULLNAME, APP_FULL_NAME); \
|
||||
InQString.replace(UI_APPVAR_VERSION, APP_VERSION);
|
||||
|
||||
#define SET_WINDOWTITLE_APPVARS(InString) \
|
||||
{ \
|
||||
QString APPVAR_MACRO_NEWTITLE = InString; \
|
||||
REPLACE_APPVARS(APPVAR_MACRO_NEWTITLE) \
|
||||
setWindowTitle(APPVAR_MACRO_NEWTITLE); \
|
||||
}
|
||||
|
||||
#define REPLACE_WINDOWTITLE_APPVARS \
|
||||
SET_WINDOWTITLE_APPVARS(windowTitle());
|
||||
|
||||
// Common conversion functions
|
||||
#define TO_QSTRING(Str) UICommon::ToQString(Str)
|
||||
#define TO_TSTRING(Str) UICommon::ToTString(Str)
|
||||
#define TO_TWIDESTRING(Str) UICommon::ToTWideString(Str)
|
||||
|
|
|
@ -42,6 +42,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||
{
|
||||
Log::Write("Creating World Editor");
|
||||
ui->setupUi(this);
|
||||
REPLACE_WINDOWTITLE_APPVARS;
|
||||
|
||||
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
||||
|
||||
|
@ -238,7 +239,7 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
|
|||
if (AreaName.IsEmpty())
|
||||
AreaName = "[Untitled Area]";
|
||||
|
||||
setWindowTitle(QString("Prime World Editor - %1 - %2[*]").arg(TO_QSTRING(WorldName)).arg(TO_QSTRING(AreaName)));
|
||||
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2[*]").arg(TO_QSTRING(WorldName)).arg(TO_QSTRING(AreaName)) );
|
||||
Log::Write("Loaded area: " + mpArea->Source() + " (" + TO_TSTRING(TO_QSTRING(AreaName)) + ")");
|
||||
}
|
||||
|
||||
|
@ -248,7 +249,7 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
|
|||
if (pWorldNameTable) LevelName = TO_QSTRING(WorldName);
|
||||
else LevelName = "!" + TO_QSTRING(mpWorld->AreaInternalName(mpArea->WorldIndex()));
|
||||
|
||||
setWindowTitle(QString("Prime World Editor - %1[*]").arg(LevelName));
|
||||
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1[*]").arg(LevelName) );
|
||||
Log::Write("Loaded level: World " + mpWorld->Source() + " / Area " + mpArea->Source() + " (" + TO_TSTRING(LevelName) + ")");
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Prime World Editor</string>
|
||||
<string>%APP_FULL_NAME%</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
|
|
Loading…
Reference in New Issue