mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-06 14:43:47 +00:00
Added tweak editor
This commit is contained in:
parent
2c80e60b78
commit
e8d3224088
@ -157,12 +157,23 @@ void CEditorApplication::EditResource(CResourceEntry *pEntry)
|
|||||||
case EResourceType::StringTable:
|
case EResourceType::StringTable:
|
||||||
pEd = new CStringEditor((CStringTable*) pRes, mpWorldEditor);
|
pEd = new CStringEditor((CStringTable*) pRes, mpWorldEditor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EResourceType::Tweaks:
|
||||||
|
{
|
||||||
|
CTweakEditor* pTweakEditor = mpWorldEditor->TweakEditor();
|
||||||
|
pTweakEditor->SetActiveTweakData( (CTweakData*) pRes );
|
||||||
|
pEd = pTweakEditor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pEd)
|
if (pEd)
|
||||||
{
|
{
|
||||||
pEd->show();
|
pEd->show();
|
||||||
mEditingMap[pEntry] = pEd;
|
|
||||||
|
if (pEntry->ResourceType() != EResourceType::Tweaks)
|
||||||
|
mEditingMap[pEntry] = pEd;
|
||||||
}
|
}
|
||||||
else if (pEntry->ResourceType() != EResourceType::Area)
|
else if (pEntry->ResourceType() != EResourceType::Area)
|
||||||
UICommon::InfoMsg(mpWorldEditor, "Unsupported Resource", "This resource type is currently unsupported for editing.");
|
UICommon::InfoMsg(mpWorldEditor, "Unsupported Resource", "This resource type is currently unsupported for editing.");
|
||||||
@ -308,7 +319,11 @@ void CEditorApplication::OnEditorClose()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mEditorWindows.removeOne(pEditor);
|
mEditorWindows.removeOne(pEditor);
|
||||||
delete pEditor;
|
|
||||||
|
if (pEditor != mpWorldEditor->TweakEditor())
|
||||||
|
{
|
||||||
|
delete pEditor;
|
||||||
|
}
|
||||||
|
|
||||||
if (mpActiveProject)
|
if (mpActiveProject)
|
||||||
{
|
{
|
||||||
|
108
src/Editor/CTweakEditor.cpp
Normal file
108
src/Editor/CTweakEditor.cpp
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#include "CTweakEditor.h"
|
||||||
|
#include "ui_CTweakEditor.h"
|
||||||
|
|
||||||
|
CTweakEditor::CTweakEditor(QWidget* pParent)
|
||||||
|
: IEditor(pParent)
|
||||||
|
, mpUI(new Ui::CTweakEditor)
|
||||||
|
, mCurrentTweakIndex(-1)
|
||||||
|
, mHasBeenShown(false)
|
||||||
|
{
|
||||||
|
mpUI->setupUi(this);
|
||||||
|
mpUI->TweakTabs->setExpanding(false);
|
||||||
|
SET_WINDOWTITLE_APPVARS("%APP_FULL_NAME% - Tweak Editor");
|
||||||
|
|
||||||
|
connect(mpUI->TweakTabs, SIGNAL(currentChanged(int)), this, SLOT(SetActiveTweakIndex(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CTweakEditor::~CTweakEditor()
|
||||||
|
{
|
||||||
|
delete mpUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CTweakEditor::HasTweaks()
|
||||||
|
{
|
||||||
|
return !mTweakAssets.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTweakEditor::showEvent(QShowEvent* pEvent)
|
||||||
|
{
|
||||||
|
// Perform first-time UI initialization
|
||||||
|
// Property view cannot initialize correctly until first show due to window width not being configured
|
||||||
|
if (!mHasBeenShown)
|
||||||
|
{
|
||||||
|
mpUI->PropertyView->InitColumnWidths(0.6f, 0.3f);
|
||||||
|
mHasBeenShown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEditor::showEvent(pEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTweakEditor::SetActiveTweakData(CTweakData* pTweakData)
|
||||||
|
{
|
||||||
|
for( int TweakIdx = 0; TweakIdx < mTweakAssets.size(); TweakIdx++ )
|
||||||
|
{
|
||||||
|
if (mTweakAssets[TweakIdx] == pTweakData)
|
||||||
|
{
|
||||||
|
SetActiveTweakIndex(TweakIdx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTweakEditor::SetActiveTweakIndex(int Index)
|
||||||
|
{
|
||||||
|
if( mCurrentTweakIndex != Index )
|
||||||
|
{
|
||||||
|
mCurrentTweakIndex = Index;
|
||||||
|
|
||||||
|
CTweakData* pTweakData = mTweakAssets[Index];
|
||||||
|
mpUI->PropertyView->SetIntrinsicProperties(pTweakData->TweakData());
|
||||||
|
|
||||||
|
mpUI->TweakTabs->blockSignals(true);
|
||||||
|
mpUI->TweakTabs->setCurrentIndex(Index);
|
||||||
|
mpUI->TweakTabs->blockSignals(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTweakEditor::OnProjectChanged(CGameProject* pNewProject)
|
||||||
|
{
|
||||||
|
// Close and clear tabs
|
||||||
|
mCurrentTweakIndex = -1;
|
||||||
|
mpUI->PropertyView->ClearProperties();
|
||||||
|
close();
|
||||||
|
|
||||||
|
mpUI->TweakTabs->blockSignals(true);
|
||||||
|
|
||||||
|
while (mpUI->TweakTabs->count() > 0)
|
||||||
|
{
|
||||||
|
mpUI->TweakTabs->removeTab(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
mpUI->TweakTabs->blockSignals(false);
|
||||||
|
mTweakAssets.clear();
|
||||||
|
|
||||||
|
// Create tweak list
|
||||||
|
if (pNewProject != nullptr)
|
||||||
|
{
|
||||||
|
for (TResPtr<CTweakData> pTweakData : pNewProject->TweakManager()->TweakObjects())
|
||||||
|
{
|
||||||
|
mTweakAssets << pTweakData.RawPointer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort in alphabetical order and create tabs
|
||||||
|
if (!mTweakAssets.isEmpty())
|
||||||
|
{
|
||||||
|
qSort(mTweakAssets.begin(), mTweakAssets.end(), [](CTweakData* pLeft, CTweakData* pRight) -> bool {
|
||||||
|
return pLeft->Entry()->Name().ToUpper() < pRight->Entry()->Name().ToUpper();
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (CTweakData* pTweakData, mTweakAssets)
|
||||||
|
{
|
||||||
|
QString TweakName = TO_QSTRING( pTweakData->Entry()->Name() );
|
||||||
|
mpUI->TweakTabs->addTab(TweakName);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetActiveTweakIndex(0);
|
||||||
|
}
|
||||||
|
}
|
39
src/Editor/CTweakEditor.h
Normal file
39
src/Editor/CTweakEditor.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef CTWEAKEDITOR_H
|
||||||
|
#define CTWEAKEDITOR_H
|
||||||
|
|
||||||
|
#include "Editor/IEditor.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CTweakEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CTweakEditor : public IEditor
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
/** Qt UI */
|
||||||
|
Ui::CTweakEditor* mpUI;
|
||||||
|
|
||||||
|
/** List of editable tweak assets */
|
||||||
|
QVector<CTweakData*> mTweakAssets;
|
||||||
|
|
||||||
|
/** Whether the editor window has been shown before */
|
||||||
|
bool mHasBeenShown;
|
||||||
|
|
||||||
|
/** Index of tweak data currently being edited */
|
||||||
|
int mCurrentTweakIndex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CTweakEditor(QWidget* pParent = 0);
|
||||||
|
~CTweakEditor();
|
||||||
|
bool HasTweaks();
|
||||||
|
|
||||||
|
virtual void showEvent(QShowEvent* pEvent) override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void SetActiveTweakData(CTweakData* pTweakData);
|
||||||
|
void SetActiveTweakIndex(int Index);
|
||||||
|
void OnProjectChanged(CGameProject* pNewProject);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CTWEAKEDITOR_H
|
120
src/Editor/CTweakEditor.ui
Normal file
120
src/Editor/CTweakEditor.ui
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CTweakEditor</class>
|
||||||
|
<widget class="QMainWindow" name="CTweakEditor">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>452</width>
|
||||||
|
<height>644</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QTabBar" name="TweakTabs" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="CPropertyView" name="PropertyView">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="verticalScrollMode">
|
||||||
|
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="ToolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="ActionSave"/>
|
||||||
|
<addaction name="ActionSaveAndRepack"/>
|
||||||
|
</widget>
|
||||||
|
<action name="ActionSave">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Icons.qrc">
|
||||||
|
<normaloff>:/icons/Save.png</normaloff>:/icons/Save.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="ActionSaveAndRepack">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Icons.qrc">
|
||||||
|
<normaloff>:/icons/SaveAndRepack_32px.png</normaloff>:/icons/SaveAndRepack_32px.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save and Repack</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save and Repack</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QTabBar</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">QTabBar</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CPropertyView</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header>Editor/PropertyEdit/CPropertyView.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources>
|
||||||
|
<include location="Icons.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -203,7 +203,8 @@ HEADERS += \
|
|||||||
StringEditor/CStringEditor.h \
|
StringEditor/CStringEditor.h \
|
||||||
StringEditor/CStringListModel.h \
|
StringEditor/CStringListModel.h \
|
||||||
StringEditor/CStringDelegate.h \
|
StringEditor/CStringDelegate.h \
|
||||||
CCustomDelegate.h
|
CCustomDelegate.h \
|
||||||
|
CTweakEditor.h
|
||||||
|
|
||||||
# Source Files
|
# Source Files
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@ -282,7 +283,8 @@ SOURCES += \
|
|||||||
StringEditor/CStringEditor.cpp \
|
StringEditor/CStringEditor.cpp \
|
||||||
StringEditor/CStringListModel.cpp \
|
StringEditor/CStringListModel.cpp \
|
||||||
IEditor.cpp \
|
IEditor.cpp \
|
||||||
StringEditor/CStringDelegate.cpp
|
StringEditor/CStringDelegate.cpp \
|
||||||
|
CTweakEditor.cpp
|
||||||
|
|
||||||
# UI Files
|
# UI Files
|
||||||
FORMS += \
|
FORMS += \
|
||||||
@ -310,7 +312,8 @@ FORMS += \
|
|||||||
CProgressDialog.ui \
|
CProgressDialog.ui \
|
||||||
Widgets/CSelectResourcePanel.ui \
|
Widgets/CSelectResourcePanel.ui \
|
||||||
CGeneratePropertyNamesDialog.ui \
|
CGeneratePropertyNamesDialog.ui \
|
||||||
StringEditor/CStringEditor.ui
|
StringEditor/CStringEditor.ui \
|
||||||
|
CTweakEditor.ui
|
||||||
|
|
||||||
# Codegen
|
# Codegen
|
||||||
CODEGEN_DIR = $$EXTERNALS_DIR/CodeGen
|
CODEGEN_DIR = $$EXTERNALS_DIR/CodeGen
|
||||||
|
@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
CPropertyDelegate::CPropertyDelegate(QObject *pParent /*= 0*/)
|
CPropertyDelegate::CPropertyDelegate(QObject *pParent /*= 0*/)
|
||||||
: QStyledItemDelegate(pParent)
|
: QStyledItemDelegate(pParent)
|
||||||
, mpEditor(nullptr)
|
|
||||||
, mpModel(nullptr)
|
, mpModel(nullptr)
|
||||||
, mInRelayWidgetEdit(false)
|
, mInRelayWidgetEdit(false)
|
||||||
, mEditInProgress(false)
|
, mEditInProgress(false)
|
||||||
, mRelaysBlocked(false)
|
, mRelaysBlocked(false)
|
||||||
{
|
{
|
||||||
|
mpEditor = gpEdApp->WorldEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyDelegate::SetPropertyModel(CPropertyModel *pModel)
|
void CPropertyDelegate::SetPropertyModel(CPropertyModel *pModel)
|
||||||
@ -40,11 +40,6 @@ void CPropertyDelegate::SetPropertyModel(CPropertyModel *pModel)
|
|||||||
mpModel = pModel;
|
mpModel = pModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyDelegate::SetEditor(CWorldEditor *pEditor)
|
|
||||||
{
|
|
||||||
mpEditor = pEditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionViewItem& /*rkOption*/, const QModelIndex& rkIndex) const
|
QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionViewItem& /*rkOption*/, const QModelIndex& rkIndex) const
|
||||||
{
|
{
|
||||||
if (!mpModel) return nullptr;
|
if (!mpModel) return nullptr;
|
||||||
|
@ -18,7 +18,6 @@ class CPropertyDelegate : public QStyledItemDelegate
|
|||||||
public:
|
public:
|
||||||
CPropertyDelegate(QObject *pParent = 0);
|
CPropertyDelegate(QObject *pParent = 0);
|
||||||
void SetPropertyModel(CPropertyModel *pModel);
|
void SetPropertyModel(CPropertyModel *pModel);
|
||||||
void SetEditor(CWorldEditor *pEditor);
|
|
||||||
|
|
||||||
virtual QWidget* createEditor(QWidget *pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const;
|
virtual QWidget* createEditor(QWidget *pParent, const QStyleOptionViewItem& rkOption, const QModelIndex& rkIndex) const;
|
||||||
virtual void setEditorData(QWidget *pEditor, const QModelIndex &rkIndex) const;
|
virtual void setEditorData(QWidget *pEditor, const QModelIndex &rkIndex) const;
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
CPropertyView::CPropertyView(QWidget *pParent)
|
CPropertyView::CPropertyView(QWidget *pParent)
|
||||||
: QTreeView(pParent)
|
: QTreeView(pParent)
|
||||||
, mpEditor(nullptr)
|
|
||||||
, mpMenuProperty(nullptr)
|
, mpMenuProperty(nullptr)
|
||||||
{
|
{
|
||||||
mpModel = new CPropertyModel(this);
|
mpModel = new CPropertyModel(this);
|
||||||
@ -40,6 +39,9 @@ CPropertyView::CPropertyView(QWidget *pParent)
|
|||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CreateContextMenu(QPoint)));
|
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CreateContextMenu(QPoint)));
|
||||||
connect(mpModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(SetPersistentEditors(QModelIndex)));
|
connect(mpModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(SetPersistentEditors(QModelIndex)));
|
||||||
connect(mpModel, SIGNAL(PropertyModified(const QModelIndex&)), this, SLOT(OnPropertyModified(const QModelIndex&)));
|
connect(mpModel, SIGNAL(PropertyModified(const QModelIndex&)), this, SLOT(OnPropertyModified(const QModelIndex&)));
|
||||||
|
|
||||||
|
mpEditor = gpEdApp->WorldEditor();
|
||||||
|
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IProperty*)), mpModel, SLOT(NotifyPropertyModified(CScriptObject*,IProperty*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyView::setModel(QAbstractItemModel *pModel)
|
void CPropertyView::setModel(QAbstractItemModel *pModel)
|
||||||
@ -84,11 +86,17 @@ bool CPropertyView::event(QEvent *pEvent)
|
|||||||
else return QTreeView::event(pEvent);
|
else return QTreeView::event(pEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyView::SetEditor(CWorldEditor *pEditor)
|
void CPropertyView::InitColumnWidths(float NameColumnPercentage, float ValueColumnPercentage)
|
||||||
{
|
{
|
||||||
mpEditor = pEditor;
|
header()->resizeSection(0, width() * NameColumnPercentage);
|
||||||
mpDelegate->SetEditor(pEditor);
|
header()->resizeSection(1, width() * ValueColumnPercentage);
|
||||||
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IProperty*)), mpModel, SLOT(NotifyPropertyModified(CScriptObject*,IProperty*)));
|
header()->setSectionResizeMode(1, QHeaderView::Fixed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPropertyView::ClearProperties()
|
||||||
|
{
|
||||||
|
mpObject = nullptr;
|
||||||
|
mpModel->ConfigureScript(nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyView::SetIntrinsicProperties(CStructRef InProperties)
|
void CPropertyView::SetIntrinsicProperties(CStructRef InProperties)
|
||||||
|
@ -26,7 +26,8 @@ public:
|
|||||||
CPropertyView(QWidget *pParent = 0);
|
CPropertyView(QWidget *pParent = 0);
|
||||||
void setModel(QAbstractItemModel *pModel);
|
void setModel(QAbstractItemModel *pModel);
|
||||||
bool event(QEvent *pEvent);
|
bool event(QEvent *pEvent);
|
||||||
void SetEditor(CWorldEditor *pEditor);
|
void InitColumnWidths(float NameColumnPercentage, float ValueColumnPercentage);
|
||||||
|
void ClearProperties();
|
||||||
void SetIntrinsicProperties(CStructRef InProperties);
|
void SetIntrinsicProperties(CStructRef InProperties);
|
||||||
void SetInstance(CScriptObject *pObj);
|
void SetInstance(CScriptObject *pObj);
|
||||||
void UpdateEditorProperties(const QModelIndex& rkParent);
|
void UpdateEditorProperties(const QModelIndex& rkParent);
|
||||||
|
@ -39,6 +39,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
, mpWorld(nullptr)
|
, mpWorld(nullptr)
|
||||||
, mpLinkDialog(new CLinkDialog(this, this))
|
, mpLinkDialog(new CLinkDialog(this, this))
|
||||||
, mpGeneratePropertyNamesDialog(new CGeneratePropertyNamesDialog(this))
|
, mpGeneratePropertyNamesDialog(new CGeneratePropertyNamesDialog(this))
|
||||||
|
, mpTweakEditor(new CTweakEditor(this))
|
||||||
, mIsMakingLink(false)
|
, mIsMakingLink(false)
|
||||||
, mpNewLinkSender(nullptr)
|
, mpNewLinkSender(nullptr)
|
||||||
, mpNewLinkReceiver(nullptr)
|
, mpNewLinkReceiver(nullptr)
|
||||||
@ -170,8 +171,9 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
connect(ui->ActionLink, SIGNAL(toggled(bool)), this, SLOT(OnLinkButtonToggled(bool)));
|
connect(ui->ActionLink, SIGNAL(toggled(bool)), this, SLOT(OnLinkButtonToggled(bool)));
|
||||||
connect(ui->ActionUnlink, SIGNAL(triggered()), this, SLOT(OnUnlinkClicked()));
|
connect(ui->ActionUnlink, SIGNAL(triggered()), this, SLOT(OnUnlinkClicked()));
|
||||||
|
|
||||||
|
connect(ui->ActionEditTweaks, SIGNAL(triggered()), mpTweakEditor, SLOT(show()));
|
||||||
connect(ui->ActionEditLayers, SIGNAL(triggered()), this, SLOT(EditLayers()));
|
connect(ui->ActionEditLayers, SIGNAL(triggered()), this, SLOT(EditLayers()));
|
||||||
connect(ui->ActionGeneratePropertyNames, SIGNAL(triggered()), this, SLOT(GeneratePropertyNames()));
|
connect(ui->ActionGeneratePropertyNames, SIGNAL(triggered()), mpGeneratePropertyNamesDialog, SLOT(show()));
|
||||||
|
|
||||||
connect(ui->ActionDrawWorld, SIGNAL(triggered()), this, SLOT(ToggleDrawWorld()));
|
connect(ui->ActionDrawWorld, SIGNAL(triggered()), this, SLOT(ToggleDrawWorld()));
|
||||||
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
|
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
|
||||||
@ -190,7 +192,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
connect(ui->ActionBloom, SIGNAL(triggered()), this, SLOT(SetBloom()));
|
connect(ui->ActionBloom, SIGNAL(triggered()), this, SLOT(SetBloom()));
|
||||||
connect(ui->ActionIncrementGizmo, SIGNAL(triggered()), this, SLOT(IncrementGizmo()));
|
connect(ui->ActionIncrementGizmo, SIGNAL(triggered()), this, SLOT(IncrementGizmo()));
|
||||||
connect(ui->ActionDecrementGizmo, SIGNAL(triggered()), this, SLOT(DecrementGizmo()));
|
connect(ui->ActionDecrementGizmo, SIGNAL(triggered()), this, SLOT(DecrementGizmo()));
|
||||||
connect(ui->ActionCollisionRenderSettings, SIGNAL(triggered()), this, SLOT(EditCollisionRenderSettings()));
|
connect(ui->ActionCollisionRenderSettings, SIGNAL(triggered()), mpCollisionDialog, SLOT(show()));
|
||||||
|
|
||||||
connect(ui->ActionAbout, SIGNAL(triggered(bool)), this, SLOT(About()));
|
connect(ui->ActionAbout, SIGNAL(triggered(bool)), this, SLOT(About()));
|
||||||
}
|
}
|
||||||
@ -509,6 +511,12 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
|
|||||||
ResetCamera();
|
ResetCamera();
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
|
|
||||||
|
// Update tweak editor
|
||||||
|
// We update this here to ensure we can update the menu item correctly without risking
|
||||||
|
// that this function runs before the tweak editor has a chance to update its tweak list.
|
||||||
|
mpTweakEditor->OnProjectChanged(pProj);
|
||||||
|
ui->ActionEditTweaks->setEnabled( mpTweakEditor->HasTweaks() );
|
||||||
|
|
||||||
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
||||||
bool AllowBloom = (CurrentGame() == EGame::CorruptionProto || CurrentGame() == EGame::Corruption);
|
bool AllowBloom = (CurrentGame() == EGame::CorruptionProto || CurrentGame() == EGame::Corruption);
|
||||||
AllowBloom ? SetFakeBloom() : SetNoBloom();
|
AllowBloom ? SetFakeBloom() : SetNoBloom();
|
||||||
@ -1319,11 +1327,6 @@ void CWorldEditor::DecrementGizmo()
|
|||||||
mGizmo.DecrementSize();
|
mGizmo.DecrementSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldEditor::EditCollisionRenderSettings()
|
|
||||||
{
|
|
||||||
mpCollisionDialog->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWorldEditor::EditLayers()
|
void CWorldEditor::EditLayers()
|
||||||
{
|
{
|
||||||
// Launch layer editor
|
// Launch layer editor
|
||||||
@ -1331,9 +1334,3 @@ void CWorldEditor::EditLayers()
|
|||||||
Editor.SetArea(mpArea);
|
Editor.SetArea(mpArea);
|
||||||
Editor.exec();
|
Editor.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldEditor::GeneratePropertyNames()
|
|
||||||
{
|
|
||||||
// Launch property name generation dialog
|
|
||||||
mpGeneratePropertyNamesDialog->show();
|
|
||||||
}
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "CLinkDialog.h"
|
#include "CLinkDialog.h"
|
||||||
#include "CPoiMapSidebar.h"
|
#include "CPoiMapSidebar.h"
|
||||||
#include "CScriptEditSidebar.h"
|
#include "CScriptEditSidebar.h"
|
||||||
|
#include "CTweakEditor.h"
|
||||||
#include "CWorldInfoSidebar.h"
|
#include "CWorldInfoSidebar.h"
|
||||||
#include "Editor/INodeEditor.h"
|
#include "Editor/INodeEditor.h"
|
||||||
#include "Editor/CGeneratePropertyNamesDialog.h"
|
#include "Editor/CGeneratePropertyNamesDialog.h"
|
||||||
@ -47,31 +48,32 @@ class CWorldEditor : public INodeEditor
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
static const int mskMaxRecentProjects = 10;
|
static const int mskMaxRecentProjects = 10;
|
||||||
|
|
||||||
Ui::CWorldEditor *ui;
|
Ui::CWorldEditor* ui;
|
||||||
QMenu *mpOpenRecentMenu;
|
QMenu* mpOpenRecentMenu;
|
||||||
QAction *mRecentProjectsActions[ mskMaxRecentProjects ];
|
QAction* mRecentProjectsActions[ mskMaxRecentProjects ];
|
||||||
|
|
||||||
TResPtr<CWorld> mpWorld;
|
TResPtr<CWorld> mpWorld;
|
||||||
TResPtr<CGameArea> mpArea;
|
TResPtr<CGameArea> mpArea;
|
||||||
|
|
||||||
CCollisionRenderSettingsDialog *mpCollisionDialog;
|
CCollisionRenderSettingsDialog* mpCollisionDialog;
|
||||||
CLinkDialog *mpLinkDialog;
|
CLinkDialog* mpLinkDialog;
|
||||||
CGeneratePropertyNamesDialog* mpGeneratePropertyNamesDialog;
|
CGeneratePropertyNamesDialog* mpGeneratePropertyNamesDialog;
|
||||||
|
CTweakEditor* mpTweakEditor;
|
||||||
|
|
||||||
bool mIsMakingLink;
|
bool mIsMakingLink;
|
||||||
CScriptObject *mpNewLinkSender;
|
CScriptObject* mpNewLinkSender;
|
||||||
CScriptObject *mpNewLinkReceiver;
|
CScriptObject* mpNewLinkReceiver;
|
||||||
|
|
||||||
// Sidebars
|
// Sidebars
|
||||||
QVBoxLayout *mpRightSidebarLayout;
|
QVBoxLayout* mpRightSidebarLayout;
|
||||||
CWorldEditorSidebar *mpCurSidebar;
|
CWorldEditorSidebar* mpCurSidebar;
|
||||||
|
|
||||||
QButtonGroup *mpEditModeButtonGroup;
|
QButtonGroup* mpEditModeButtonGroup;
|
||||||
CWorldInfoSidebar *mpWorldInfoSidebar;
|
CWorldInfoSidebar* mpWorldInfoSidebar;
|
||||||
CScriptEditSidebar *mpScriptSidebar;
|
CScriptEditSidebar* mpScriptSidebar;
|
||||||
CPoiMapSidebar *mpPoiMapSidebar;
|
CPoiMapSidebar* mpPoiMapSidebar;
|
||||||
|
|
||||||
QAction *mpPoiMapAction;
|
QAction* mpPoiMapAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CWorldEditor(QWidget *parent = 0);
|
explicit CWorldEditor(QWidget *parent = 0);
|
||||||
@ -86,6 +88,7 @@ public:
|
|||||||
inline EGame CurrentGame() const { return gpEdApp->CurrentGame(); }
|
inline EGame CurrentGame() const { return gpEdApp->CurrentGame(); }
|
||||||
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
||||||
inline CGeneratePropertyNamesDialog* NameGeneratorDialog() const { return mpGeneratePropertyNamesDialog; }
|
inline CGeneratePropertyNamesDialog* NameGeneratorDialog() const { return mpGeneratePropertyNamesDialog; }
|
||||||
|
inline CTweakEditor* TweakEditor() { return mpTweakEditor; }
|
||||||
CResourceBrowser* ResourceBrowser() const;
|
CResourceBrowser* ResourceBrowser() const;
|
||||||
CSceneViewport* Viewport() const;
|
CSceneViewport* Viewport() const;
|
||||||
|
|
||||||
@ -167,9 +170,7 @@ private slots:
|
|||||||
void SetBloom();
|
void SetBloom();
|
||||||
void IncrementGizmo();
|
void IncrementGizmo();
|
||||||
void DecrementGizmo();
|
void DecrementGizmo();
|
||||||
void EditCollisionRenderSettings();
|
|
||||||
void EditLayers();
|
void EditLayers();
|
||||||
void GeneratePropertyNames();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MapChanged(CWorld *pNewWorld, CGameArea *pNewArea);
|
void MapChanged(CWorld *pNewWorld, CGameArea *pNewArea);
|
||||||
|
@ -338,6 +338,7 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Tools</string>
|
<string>Tools</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="ActionEditTweaks"/>
|
||||||
<addaction name="ActionEditLayers"/>
|
<addaction name="ActionEditLayers"/>
|
||||||
<addaction name="ActionGeneratePropertyNames"/>
|
<addaction name="ActionGeneratePropertyNames"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -785,6 +786,14 @@
|
|||||||
<string>About</string>
|
<string>About</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="ActionEditTweaks">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit Tweaks</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -16,14 +16,9 @@ WModifyTab::WModifyTab(CWorldEditor *pEditor, QWidget *pParent)
|
|||||||
, mIsPicking(false)
|
, mIsPicking(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->PropertyView->InitColumnWidths(0.3f, 0.3f);
|
||||||
|
|
||||||
mpWorldEditor = pEditor;
|
mpWorldEditor = pEditor;
|
||||||
ui->PropertyView->SetEditor(mpWorldEditor);
|
|
||||||
|
|
||||||
int PropViewWidth = ui->PropertyView->width();
|
|
||||||
ui->PropertyView->header()->resizeSection(0, PropViewWidth * 0.3);
|
|
||||||
ui->PropertyView->header()->resizeSection(1, PropViewWidth * 0.3);
|
|
||||||
ui->PropertyView->header()->setSectionResizeMode(1, QHeaderView::Fixed);
|
|
||||||
|
|
||||||
mpInLinkModel = new CLinkModel(this);
|
mpInLinkModel = new CLinkModel(this);
|
||||||
mpInLinkModel->SetConnectionType(ELinkType::Incoming);
|
mpInLinkModel->SetConnectionType(ELinkType::Incoming);
|
||||||
|
@ -461,7 +461,7 @@
|
|||||||
</Element>
|
</Element>
|
||||||
<Element Type="Array" ID="0x99">
|
<Element Type="Array" ID="0x99">
|
||||||
<Name>ScanSpeeds</Name>
|
<Name>ScanSpeeds</Name>
|
||||||
<ItemArchetype Type="Int" ID="0x0">
|
<ItemArchetype Type="Float" ID="0x0">
|
||||||
<Name>ScanSpeed</Name>
|
<Name>ScanSpeed</Name>
|
||||||
</ItemArchetype>
|
</ItemArchetype>
|
||||||
</Element>
|
</Element>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Atomic>true</Atomic>
|
<Atomic>true</Atomic>
|
||||||
<SubProperties>
|
<SubProperties>
|
||||||
<Element Type="Float" ID="0x0">
|
<Element Type="Float" ID="0x0">
|
||||||
<Name>CoolDown</Name>
|
<Name>Cooldown</Name>
|
||||||
</Element>
|
</Element>
|
||||||
<Element Type="Struct" ID="0x1" Archetype="ShotParam">
|
<Element Type="Struct" ID="0x1" Archetype="ShotParam">
|
||||||
<Name>NormalDamage</Name>
|
<Name>NormalDamage</Name>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user