Moved edit mode buttons onto a toolbar, fixed a couple bugs
This commit is contained in:
parent
4d87ef0312
commit
009c42f281
|
@ -67,7 +67,7 @@ void CAnimEventLoader::LoadEvents(IInputStream& rEVNT, bool IsEchoes)
|
|||
|
||||
if (SoundID != 0xFFFF)
|
||||
{
|
||||
SSoundInfo SoundInfo = mpEventData->Entry()->Project()->AudioManager()->GetSoundInfo(SoundID);
|
||||
SSoundInfo SoundInfo = gpResourceStore->Project()->AudioManager()->GetSoundInfo(SoundID);
|
||||
|
||||
if (SoundInfo.pAudioGroup)
|
||||
mpEventData->AddEvent(CharIndex, SoundInfo.pAudioGroup->ID());
|
||||
|
|
|
@ -24,6 +24,7 @@ CProjectOverviewDialog::CProjectOverviewDialog(QWidget *pParent)
|
|||
connect(mpUI->CookPackageButton, SIGNAL(clicked()), this, SLOT(CookPackage()));
|
||||
connect(mpUI->CookAllDirtyPackagesButton, SIGNAL(clicked(bool)), this, SLOT(CookAllDirtyPackages()));
|
||||
|
||||
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(ActiveProjectChanged(CGameProject*)));
|
||||
connect(gpEdApp, SIGNAL(AssetsModified()), this, SLOT(SetupPackagesList()));
|
||||
}
|
||||
|
||||
|
@ -32,6 +33,13 @@ CProjectOverviewDialog::~CProjectOverviewDialog()
|
|||
delete mpUI;
|
||||
}
|
||||
|
||||
void CProjectOverviewDialog::ActiveProjectChanged(CGameProject *pProj)
|
||||
{
|
||||
mpProject = pProj;
|
||||
SetupWorldsList();
|
||||
SetupPackagesList();
|
||||
}
|
||||
|
||||
void CProjectOverviewDialog::ExportGame()
|
||||
{
|
||||
QString IsoPath = UICommon::OpenFileDialog(this, "Select ISO", "*.iso *.gcm *.tgc *.wbfs");
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
~CProjectOverviewDialog();
|
||||
|
||||
public slots:
|
||||
void ActiveProjectChanged(CGameProject *pProj);
|
||||
void ExportGame();
|
||||
void LoadWorld();
|
||||
void LaunchEditor();
|
||||
|
@ -34,9 +35,6 @@ public slots:
|
|||
|
||||
void SetupWorldsList();
|
||||
void SetupPackagesList();
|
||||
|
||||
signals:
|
||||
void ActiveProjectChanged(CGameProject *pNewProj);
|
||||
};
|
||||
|
||||
#endif // CPROJECTOVERVIEWDIALOG_H
|
||||
|
|
|
@ -62,12 +62,15 @@ public:
|
|||
mpMaster = pMaster;
|
||||
mTemplates.clear();
|
||||
|
||||
for (u32 iTemp = 0; iTemp < mpMaster->NumScriptTemplates(); iTemp++)
|
||||
mTemplates << mpMaster->TemplateByIndex(iTemp);
|
||||
if (mpMaster)
|
||||
{
|
||||
for (u32 iTemp = 0; iTemp < mpMaster->NumScriptTemplates(); iTemp++)
|
||||
mTemplates << mpMaster->TemplateByIndex(iTemp);
|
||||
|
||||
qSort(mTemplates.begin(), mTemplates.end(), [](CScriptTemplate *pLeft, CScriptTemplate *pRight) -> bool {
|
||||
return pLeft->Name() < pRight->Name();
|
||||
});
|
||||
qSort(mTemplates.begin(), mTemplates.end(), [](CScriptTemplate *pLeft, CScriptTemplate *pRight) -> bool {
|
||||
return pLeft->Name() < pRight->Name();
|
||||
});
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
|
|
@ -76,13 +76,16 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||
mpWorldInfoSidebar->setHidden(true);
|
||||
mpScriptSidebar = new CScriptEditSidebar(this);
|
||||
mpScriptSidebar->setHidden(true);
|
||||
SetSidebarWidget(mpWorldInfoSidebar);
|
||||
|
||||
// Initialize edit mode toolbar
|
||||
mpEditModeButtonGroup = new QButtonGroup(this);
|
||||
mpEditModeButtonGroup->addButton( ui->EditWorldInfoButton, eWEM_WorldInfo );
|
||||
mpEditModeButtonGroup->addButton( ui->EditScriptButton, eWEM_EditScript );
|
||||
connect(mpEditModeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(ChangeEditMode(int)));
|
||||
|
||||
AddEditModeButton( QIcon(":/icons/World.png"), "Edit World Info",eWEM_EditWorldInfo );
|
||||
AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript );
|
||||
|
||||
ChangeEditMode(eWEM_EditWorldInfo);
|
||||
|
||||
// Initialize actions
|
||||
addAction(ui->ActionIncrementGizmo);
|
||||
addAction(ui->ActionDecrementGizmo);
|
||||
|
@ -449,6 +452,9 @@ void CWorldEditor::CloseProject()
|
|||
|
||||
bool CWorldEditor::Save()
|
||||
{
|
||||
if (!mpArea)
|
||||
return true;
|
||||
|
||||
bool SaveAreaSuccess = mpArea->Entry()->Save();
|
||||
bool SaveEGMCSuccess = mpArea->PoiToWorldMap() ? mpArea->PoiToWorldMap()->Entry()->Save() : true;
|
||||
bool SaveWorldSuccess = mpWorld->Entry()->Save();
|
||||
|
@ -478,6 +484,7 @@ bool CWorldEditor::SaveAndRepack()
|
|||
|
||||
void CWorldEditor::ChangeEditMode(int Mode)
|
||||
{
|
||||
// This function is connected to the edit mode QButtonGroup.
|
||||
ChangeEditMode((EWorldEditorMode) Mode);
|
||||
}
|
||||
|
||||
|
@ -489,7 +496,7 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
|
|||
|
||||
switch (Mode)
|
||||
{
|
||||
case eWEM_WorldInfo:
|
||||
case eWEM_EditWorldInfo:
|
||||
SetSidebarWidget(mpWorldInfoSidebar);
|
||||
break;
|
||||
|
||||
|
@ -525,7 +532,7 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
|
|||
Settings.setValue("WorldEditor/RecentProjectsList", RecentProjectsList);
|
||||
UpdateOpenRecentActions();
|
||||
|
||||
ChangeEditMode(eWEM_WorldInfo);
|
||||
ChangeEditMode(eWEM_EditWorldInfo);
|
||||
}
|
||||
|
||||
void CWorldEditor::OnLinksModified(const QList<CScriptObject*>& rkInstances)
|
||||
|
@ -846,6 +853,19 @@ void CWorldEditor::UpdateNewLinkLine()
|
|||
}
|
||||
|
||||
// ************ PROTECTED ************
|
||||
void CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
|
||||
{
|
||||
ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr);
|
||||
|
||||
QPushButton *pButton = new QPushButton(Icon, "", this);
|
||||
pButton->setCheckable(true);
|
||||
pButton->setToolTip(ToolTip);
|
||||
pButton->setIconSize(QSize(24, 24));
|
||||
|
||||
ui->EditModeToolBar->addWidget(pButton);
|
||||
mpEditModeButtonGroup->addButton(pButton, Mode);
|
||||
}
|
||||
|
||||
void CWorldEditor::SetSidebarWidget(QWidget *pWidget)
|
||||
{
|
||||
if (mpCurSidebarWidget)
|
||||
|
|
|
@ -35,7 +35,7 @@ class CWorldEditor;
|
|||
|
||||
enum EWorldEditorMode
|
||||
{
|
||||
eWEM_WorldInfo,
|
||||
eWEM_EditWorldInfo,
|
||||
eWEM_EditScript
|
||||
};
|
||||
|
||||
|
@ -125,6 +125,7 @@ public slots:
|
|||
void UpdateNewLinkLine();
|
||||
|
||||
protected:
|
||||
void AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
|
||||
void SetSidebarWidget(QWidget *pWidget);
|
||||
void GizmoModeChanged(CGizmo::EGizmoMode Mode);
|
||||
|
||||
|
|
|
@ -234,140 +234,6 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="EditModeFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>3</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="QPushButton" name="EditWorldInfoButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>World Edit Mode</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/World.png</normaloff>:/icons/World.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="EditScriptButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Script Edit Mode</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Modify.png</normaloff>:/icons/Modify.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>546</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
|
@ -482,6 +348,23 @@
|
|||
<addaction name="menuTools"/>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="EditModeToolBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>RightToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<action name="ActionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
|
@ -852,6 +735,33 @@
|
|||
<string>Resource Browser</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionEditWorldInfoMode">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/World.png</normaloff>:/icons/World.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit World Info</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionEditScriptMode">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Modify.png</normaloff>:/icons/Modify.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Script</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -15,6 +15,7 @@ WCreateTab::WCreateTab(CWorldEditor *pEditor, QWidget *pParent /*= 0*/)
|
|||
mpEditor->Viewport()->installEventFilter(this);
|
||||
|
||||
connect(mpEditor, SIGNAL(LayersModified()), this, SLOT(OnLayersChanged()));
|
||||
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(OnActiveProjectChanged(CGameProject*)));
|
||||
connect(ui->SpawnLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSpawnLayerChanged(int)));
|
||||
}
|
||||
|
||||
|
@ -57,9 +58,9 @@ bool WCreateTab::eventFilter(QObject *pObj, QEvent *pEvent)
|
|||
}
|
||||
|
||||
// ************ PUBLIC SLOTS ************
|
||||
void WCreateTab::OnMapChanged()
|
||||
void WCreateTab::OnActiveProjectChanged(CGameProject *pProj)
|
||||
{
|
||||
EGame Game = mpEditor->CurrentGame();
|
||||
EGame Game = (pProj ? pProj->Game() : eUnknownGame);
|
||||
CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(Game);
|
||||
ui->TemplateView->SetMaster(pMaster);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
inline CScriptLayer* SpawnLayer() const { return mpSpawnLayer; }
|
||||
|
||||
public slots:
|
||||
void OnMapChanged();
|
||||
void OnActiveProjectChanged(CGameProject *pProj);
|
||||
void OnLayersChanged();
|
||||
void OnSpawnLayerChanged(int LayerIndex);
|
||||
|
||||
|
|
Loading…
Reference in New Issue