mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-05-28 18:21:20 +00:00
Moved POI mapping dialog to be a sidebar instead, fixed standable collision visualization in MP2/3
This commit is contained in:
parent
a88afe31e3
commit
e89d44f7a7
@ -79,5 +79,5 @@ bool CCollisionMaterial::IsFloor() const
|
||||
|
||||
bool CCollisionMaterial::IsUnstandable(EGame Game) const
|
||||
{
|
||||
return HasFlag(eCF_JumpNotAllowed) || (Game >= eEchoesDemo && !HasFlag(eCF_Floor) && HasAnyFlags(eCF_Wall | eCF_Ceiling));
|
||||
return HasFlag(eCF_JumpNotAllowed) || (Game >= eCorruptionProto && !HasFlag(eCF_Floor) && HasAnyFlags(eCF_Wall | eCF_Ceiling));
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "CCollisionNode.h"
|
||||
#include "CScene.h"
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include "Core/Render/CGraphics.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
@ -38,8 +39,8 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
// Turn off backface culling
|
||||
EGame CollisionGame = mpCollision->Game();
|
||||
bool ForceDisableBackfaceCull = (rkViewInfo.CollisionSettings.DrawBackfaces || CollisionGame == eReturns) && glIsEnabled(GL_CULL_FACE);
|
||||
EGame Game = mpScene->ActiveArea()->Game();
|
||||
bool ForceDisableBackfaceCull = (rkViewInfo.CollisionSettings.DrawBackfaces || Game == eReturns) && glIsEnabled(GL_CULL_FACE);
|
||||
|
||||
if (ForceDisableBackfaceCull)
|
||||
glDisable(GL_CULL_FACE);
|
||||
@ -65,11 +66,11 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
||||
if (rkViewInfo.CollisionSettings.HighlightMask != 0 && (rMat.RawFlags() & rkViewInfo.CollisionSettings.HighlightMask) == rkViewInfo.CollisionSettings.HighlightMask)
|
||||
Tint *= CColor::skRed;
|
||||
|
||||
else if (CollisionGame != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
|
||||
Tint *= rMat.SurfaceColor(CollisionGame);
|
||||
else if (Game != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
|
||||
Tint *= rMat.SurfaceColor(Game);
|
||||
|
||||
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || CollisionGame == eReturns;
|
||||
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(CollisionGame) : false) && CollisionGame != eReturns;
|
||||
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || Game == eReturns;
|
||||
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(Game) : false) && Game != eReturns;
|
||||
CDrawUtil::UseCollisionShader(IsFloor, IsUnstandable, Tint);
|
||||
pMesh->DrawMaterial(iMat, false);
|
||||
|
||||
@ -85,7 +86,7 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
||||
// Draw collision bounds for area collision
|
||||
// note: right now checking parent is the best way to check whether this node is area collision instead of actor collision
|
||||
// actor collision will have a script node parent whereas area collision will have a root node parent
|
||||
if (rkViewInfo.CollisionSettings.DrawAreaCollisionBounds && Parent()->NodeType() == eRootNode && CollisionGame != eReturns)
|
||||
if (rkViewInfo.CollisionSettings.DrawAreaCollisionBounds && Parent()->NodeType() == eRootNode && Game != eReturns)
|
||||
CDrawUtil::DrawWireCube( mpCollision->MeshByIndex(0)->BoundingBox(), CColor::skRed );
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
inline CWorldEditor* WorldEditor() const { return mpWorldEditor; }
|
||||
inline CResourceBrowser* ResourceBrowser() const { return mpResourceBrowser; }
|
||||
inline CProjectSettingsDialog* ProjectDialog() const { return mpProjectDialog; }
|
||||
inline EGame CurrentGame() const { return mpActiveProject ? mpActiveProject->Game() : eUnknownGame; }
|
||||
|
||||
inline void SetEditorTicksEnabled(bool Enabled) { Enabled ? mRefreshTimer.start(gkTickFrequencyMS) : mRefreshTimer.stop(); }
|
||||
inline bool AreEditorTicksEnabled() const { return mRefreshTimer.isActive(); }
|
||||
|
@ -131,7 +131,6 @@ HEADERS += \
|
||||
CErrorLogDialog.h \
|
||||
Undo/CSelectAllCommand.h \
|
||||
Undo/CInvertSelectionCommand.h \
|
||||
WorldEditor/CPoiMapEditDialog.h \
|
||||
WorldEditor/CPoiMapModel.h \
|
||||
WorldEditor/CPoiListDialog.h \
|
||||
PropertyEdit/CPropertyModel.h \
|
||||
@ -183,7 +182,9 @@ HEADERS += \
|
||||
WorldEditor/CWorldInfoSidebar.h \
|
||||
WorldEditor/CWorldTreeModel.h \
|
||||
Widgets/CTimedLineEdit.h \
|
||||
CProjectSettingsDialog.h
|
||||
CProjectSettingsDialog.h \
|
||||
WorldEditor/CPoiMapSidebar.h \
|
||||
WorldEditor/CWorldEditorSidebar.h
|
||||
|
||||
# Source Files
|
||||
SOURCES += \
|
||||
@ -216,7 +217,6 @@ SOURCES += \
|
||||
TestDialog.cpp \
|
||||
UICommon.cpp \
|
||||
CErrorLogDialog.cpp \
|
||||
WorldEditor/CPoiMapEditDialog.cpp \
|
||||
WorldEditor/CPoiMapModel.cpp \
|
||||
PropertyEdit/CPropertyModel.cpp \
|
||||
PropertyEdit/CPropertyDelegate.cpp \
|
||||
@ -249,7 +249,9 @@ SOURCES += \
|
||||
WorldEditor/CScriptEditSidebar.cpp \
|
||||
WorldEditor/CWorldInfoSidebar.cpp \
|
||||
WorldEditor/CWorldTreeModel.cpp \
|
||||
CProjectSettingsDialog.cpp
|
||||
CProjectSettingsDialog.cpp \
|
||||
WorldEditor/CPoiMapSidebar.cpp \
|
||||
WorldEditor/CWorldEditorSidebar.cpp
|
||||
|
||||
# UI Files
|
||||
FORMS += \
|
||||
@ -263,7 +265,6 @@ FORMS += \
|
||||
WorldEditor/WInstancesTab.ui \
|
||||
WorldEditor/WModifyTab.ui \
|
||||
CErrorLogDialog.ui \
|
||||
WorldEditor/CPoiMapEditDialog.ui \
|
||||
WorldEditor/CTemplateEditDialog.ui \
|
||||
WorldEditor/CLinkDialog.ui \
|
||||
WorldEditor/CSelectInstanceDialog.ui \
|
||||
@ -274,4 +275,5 @@ FORMS += \
|
||||
ResourceBrowser/CResourceBrowser.ui \
|
||||
CExportGameDialog.ui \
|
||||
WorldEditor/CWorldInfoSidebar.ui \
|
||||
CProjectSettingsDialog.ui
|
||||
CProjectSettingsDialog.ui \
|
||||
WorldEditor/CPoiMapSidebar.ui
|
||||
|
@ -11,6 +11,7 @@ CCollisionRenderSettingsDialog::CCollisionRenderSettingsDialog(CWorldEditor *pEd
|
||||
mpUi->setupUi(this);
|
||||
|
||||
SetupWidgets();
|
||||
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(SetupWidgets()));
|
||||
connect(mpUi->HideMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHideMaskChanged(QString)));
|
||||
connect(mpUi->HighlightMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHighlightMaskChanged(QString)));
|
||||
connect(mpUi->WireframeCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnWireframeToggled(bool)));
|
||||
|
@ -1,196 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CPoiMapEditDialog</class>
|
||||
<widget class="QMainWindow" name="CPoiMapEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>263</width>
|
||||
<height>306</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit POI to World Mappings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="MapMeshesButton">
|
||||
<property name="text">
|
||||
<string>Map</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Plus.png</normaloff>:/icons/Plus.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="UnmapMeshesButton">
|
||||
<property name="text">
|
||||
<string>Unmap</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Minus v2.png</normaloff>:/icons/Minus v2.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="UnmapAllButton">
|
||||
<property name="text">
|
||||
<string>Unmap All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="AddPoiFromViewportButton">
|
||||
<property name="toolTip">
|
||||
<string>Add from Viewport</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/SelectMode_16px.png</normaloff>:/icons/SelectMode_16px.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddPoiFromInstanceListButton">
|
||||
<property name="toolTip">
|
||||
<string>Add from Instance List</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Instances_16px.png</normaloff>:/icons/Instances_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RemovePoiButton">
|
||||
<property name="toolTip">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Minus v2.png</normaloff>:/icons/Minus v2.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="ListView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="ButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="ToolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="ActionHighlightSelected"/>
|
||||
<addaction name="ActionHighlightAll"/>
|
||||
<addaction name="ActionHighlightNone"/>
|
||||
</widget>
|
||||
<action name="ActionHighlightAll">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Highlight All</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionHighlightNone">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Highlight None</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Highlight None</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionHighlightSelected">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Highlight Selected</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Highlight Selected</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../Icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -7,48 +7,10 @@
|
||||
CPoiMapModel::CPoiMapModel(CWorldEditor *pEditor, QObject *pParent /*= 0*/)
|
||||
: QAbstractListModel(pParent)
|
||||
, mpEditor(pEditor)
|
||||
, mpArea(pEditor->ActiveArea())
|
||||
, mpPoiToWorld(mpArea->PoiToWorldMap())
|
||||
, mpArea(nullptr)
|
||||
, mpPoiToWorld(nullptr)
|
||||
{
|
||||
if (mpPoiToWorld)
|
||||
{
|
||||
// Create an ID -> Model Node lookup map
|
||||
QMap<u32,CModelNode*> NodeMap;
|
||||
|
||||
for (CSceneIterator It(mpEditor->Scene(), eModelNode, true); !It.DoneIterating(); ++It)
|
||||
{
|
||||
CModelNode *pNode = static_cast<CModelNode*>(*It);
|
||||
NodeMap[pNode->FindMeshID()] = pNode;
|
||||
}
|
||||
|
||||
// Create internal model map
|
||||
for (u32 iPoi = 0; iPoi < mpPoiToWorld->NumMappedPOIs(); iPoi++)
|
||||
{
|
||||
const CPoiToWorld::SPoiMap *pkMap = mpPoiToWorld->MapByIndex(iPoi);
|
||||
CScriptNode *pPoiNode = mpEditor->Scene()->NodeForInstanceID(pkMap->PoiID);
|
||||
|
||||
if (pPoiNode)
|
||||
{
|
||||
QList<CModelNode*> *pModelList = new QList<CModelNode*>;
|
||||
|
||||
for (auto it = pkMap->ModelIDs.begin(); it != pkMap->ModelIDs.end(); it++)
|
||||
{
|
||||
if (NodeMap.contains(*it))
|
||||
*pModelList << NodeMap[*it];
|
||||
}
|
||||
|
||||
mModelMap[pPoiNode] = pModelList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPoiMapModel::~CPoiMapModel()
|
||||
{
|
||||
QList<QList<CModelNode*>*> Lists = mModelMap.values();
|
||||
|
||||
for (auto it = Lists.begin(); it != Lists.end(); it++)
|
||||
delete *it;
|
||||
connect(pEditor, SIGNAL(MapChanged(CWorld*,CGameArea*)), this, SLOT(OnMapChange(CWorld*,CGameArea*)));
|
||||
}
|
||||
|
||||
QVariant CPoiMapModel::headerData(int Section, Qt::Orientation Orientation, int Role) const
|
||||
@ -61,7 +23,7 @@ QVariant CPoiMapModel::headerData(int Section, Qt::Orientation Orientation, int
|
||||
|
||||
int CPoiMapModel::rowCount(const QModelIndex& /*rkParent*/) const
|
||||
{
|
||||
return mpPoiToWorld->NumMappedPOIs();
|
||||
return mpPoiToWorld ? mpPoiToWorld->NumMappedPOIs() : 0;
|
||||
}
|
||||
|
||||
QVariant CPoiMapModel::data(const QModelIndex& rkIndex, int Role) const
|
||||
@ -199,3 +161,54 @@ const QList<CModelNode*>& CPoiMapModel::GetPoiMeshList(CScriptNode *pPOI) const
|
||||
{
|
||||
return *mModelMap[pPOI];
|
||||
}
|
||||
|
||||
void CPoiMapModel::OnMapChange(CWorld*, CGameArea *pArea)
|
||||
{
|
||||
beginResetModel();
|
||||
mpArea = pArea;
|
||||
mpPoiToWorld = (pArea ? pArea->PoiToWorldMap() : nullptr);
|
||||
|
||||
if (mpPoiToWorld)
|
||||
{
|
||||
// Create an ID -> Model Node lookup map
|
||||
QMap<u32,CModelNode*> NodeMap;
|
||||
|
||||
for (CSceneIterator It(mpEditor->Scene(), eModelNode, true); !It.DoneIterating(); ++It)
|
||||
{
|
||||
CModelNode *pNode = static_cast<CModelNode*>(*It);
|
||||
NodeMap[pNode->FindMeshID()] = pNode;
|
||||
}
|
||||
|
||||
// Create internal model map
|
||||
for (u32 iPoi = 0; iPoi < mpPoiToWorld->NumMappedPOIs(); iPoi++)
|
||||
{
|
||||
const CPoiToWorld::SPoiMap *pkMap = mpPoiToWorld->MapByIndex(iPoi);
|
||||
CScriptNode *pPoiNode = mpEditor->Scene()->NodeForInstanceID(pkMap->PoiID);
|
||||
|
||||
if (pPoiNode)
|
||||
{
|
||||
QList<CModelNode*> *pModelList = new QList<CModelNode*>;
|
||||
|
||||
for (auto it = pkMap->ModelIDs.begin(); it != pkMap->ModelIDs.end(); it++)
|
||||
{
|
||||
if (NodeMap.contains(*it))
|
||||
*pModelList << NodeMap[*it];
|
||||
}
|
||||
|
||||
mModelMap[pPoiNode] = pModelList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
QList<QList<CModelNode*>*> Lists = mModelMap.values();
|
||||
|
||||
for (auto it = Lists.begin(); it != Lists.end(); it++)
|
||||
delete *it;
|
||||
|
||||
mModelMap.clear();
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define CPOIMAPMODEL_H
|
||||
|
||||
#include <Core/Resource/CPoiToWorld.h>
|
||||
#include <Core/Resource/CWorld.h>
|
||||
#include <Core/Resource/TResPtr.h>
|
||||
#include <Core/Scene/CModelNode.h>
|
||||
#include <Core/Scene/CScriptNode.h>
|
||||
@ -22,7 +23,6 @@ class CPoiMapModel : public QAbstractListModel
|
||||
|
||||
public:
|
||||
explicit CPoiMapModel(CWorldEditor *pEditor, QObject *pParent = 0);
|
||||
~CPoiMapModel();
|
||||
QVariant headerData(int Section, Qt::Orientation Orientation, int Role) const;
|
||||
int rowCount(const QModelIndex& rkParent) const;
|
||||
QVariant data(const QModelIndex& rkIndex, int Role) const;
|
||||
@ -37,6 +37,9 @@ public:
|
||||
CScriptNode* PoiNodePointer(const QModelIndex& rkIndex) const;
|
||||
const QList<CModelNode*>& GetPoiMeshList(const QModelIndex& rkIndex) const;
|
||||
const QList<CModelNode*>& GetPoiMeshList(CScriptNode *pPOI) const;
|
||||
|
||||
public slots:
|
||||
void OnMapChange(CWorld*, CGameArea *pArea);
|
||||
};
|
||||
|
||||
#endif // CPOIMAPMODEL_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "CPoiMapEditDialog.h"
|
||||
#include "ui_CPoiMapEditDialog.h"
|
||||
#include "CPoiMapSidebar.h"
|
||||
#include "ui_CPoiMapSidebar.h"
|
||||
#include "CWorldEditor.h"
|
||||
#include "Editor/UICommon.h"
|
||||
|
||||
@ -11,14 +11,13 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QMessageBox>
|
||||
|
||||
const CColor CPoiMapEditDialog::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f);
|
||||
const CColor CPoiMapEditDialog::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f);
|
||||
const CColor CPoiMapEditDialog::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f);
|
||||
const CColor CPoiMapSidebar::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f);
|
||||
const CColor CPoiMapSidebar::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f);
|
||||
const CColor CPoiMapSidebar::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f);
|
||||
|
||||
CPoiMapEditDialog::CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent)
|
||||
: QMainWindow(pParent)
|
||||
, ui(new Ui::CPoiMapEditDialog)
|
||||
, mpEditor(pEditor)
|
||||
CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor)
|
||||
: CWorldEditorSidebar(pEditor)
|
||||
, ui(new Ui::CPoiMapSidebar)
|
||||
, mSourceModel(pEditor, this)
|
||||
, mHighlightMode(eHighlightSelected)
|
||||
, mPickType(eNotPicking)
|
||||
@ -30,16 +29,11 @@ CPoiMapEditDialog::CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent)
|
||||
ui->setupUi(this);
|
||||
ui->ListView->setModel(&mModel);
|
||||
ui->ListView->selectionModel()->select(mModel.index(0,0), QItemSelectionModel::Select | QItemSelectionModel::Current);
|
||||
|
||||
QActionGroup *pGroup = new QActionGroup(this);
|
||||
pGroup->addAction(ui->ActionHighlightSelected);
|
||||
pGroup->addAction(ui->ActionHighlightAll);
|
||||
pGroup->addAction(ui->ActionHighlightNone);
|
||||
SetHighlightSelected();
|
||||
|
||||
connect(ui->ActionHighlightSelected, SIGNAL(triggered()), this, SLOT(SetHighlightSelected()));
|
||||
connect(ui->ActionHighlightAll, SIGNAL(triggered()), this, SLOT(SetHighlightAll()));
|
||||
connect(ui->ActionHighlightNone, SIGNAL(triggered()), this, SLOT(SetHighlightNone()));
|
||||
connect(ui->HighlightSelectedButton, SIGNAL(pressed()), this, SLOT(SetHighlightSelected()));
|
||||
connect(ui->HighlightAllButton, SIGNAL(pressed()), this, SLOT(SetHighlightAll()));
|
||||
connect(ui->HighlightNoneButton, SIGNAL(pressed()), this, SLOT(SetHighlightNone()));
|
||||
connect(ui->ListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(OnSelectionChanged(QItemSelection,QItemSelection)));
|
||||
connect(ui->ListView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnItemDoubleClick(QModelIndex)));
|
||||
@ -49,32 +43,38 @@ CPoiMapEditDialog::CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent)
|
||||
connect(ui->AddPoiFromViewportButton, SIGNAL(clicked()), this, SLOT(OnPickButtonClicked()));
|
||||
connect(ui->AddPoiFromInstanceListButton, SIGNAL(clicked()), this, SLOT(OnInstanceListButtonClicked()));
|
||||
connect(ui->RemovePoiButton, SIGNAL(clicked()), this, SLOT(OnRemovePoiButtonClicked()));
|
||||
connect(ui->ButtonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(ui->ButtonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(Save()));
|
||||
}
|
||||
|
||||
CPoiMapEditDialog::~CPoiMapEditDialog()
|
||||
CPoiMapSidebar::~CPoiMapSidebar()
|
||||
{
|
||||
// Clear model tints
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CPoiMapSidebar::SidebarOpen()
|
||||
{
|
||||
Editor()->SetRenderingMergedWorld(false);
|
||||
UpdateModelHighlights();
|
||||
}
|
||||
|
||||
void CPoiMapSidebar::SidebarClose()
|
||||
{
|
||||
// Clear model highlights
|
||||
if (mHighlightMode != eHighlightNone)
|
||||
{
|
||||
EHighlightMode OldHighlightMode = mHighlightMode;
|
||||
SetHighlightNone();
|
||||
mHighlightMode = OldHighlightMode;
|
||||
}
|
||||
|
||||
// Stop picking
|
||||
if (mPickType != eNotPicking)
|
||||
StopPicking();
|
||||
|
||||
delete ui;
|
||||
// Disable unmerged world rendering
|
||||
Editor()->SetRenderingMergedWorld(true);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::closeEvent(QCloseEvent* /*pEvent*/)
|
||||
{
|
||||
if (mPickType != eNotPicking)
|
||||
mpEditor->ExitPickMode();
|
||||
|
||||
emit Closed();
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::HighlightPoiModels(const QModelIndex& rkIndex)
|
||||
void CPoiMapSidebar::HighlightPoiModels(const QModelIndex& rkIndex)
|
||||
{
|
||||
// Get POI and models
|
||||
QModelIndex SourceIndex = mModel.mapToSource(rkIndex);
|
||||
@ -89,7 +89,7 @@ void CPoiMapEditDialog::HighlightPoiModels(const QModelIndex& rkIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::UnhighlightPoiModels(const QModelIndex& rkIndex)
|
||||
void CPoiMapSidebar::UnhighlightPoiModels(const QModelIndex& rkIndex)
|
||||
{
|
||||
QModelIndex SourceIndex = mModel.mapToSource(rkIndex);
|
||||
const QList<CModelNode*>& rkModels = mSourceModel.GetPoiMeshList(SourceIndex);
|
||||
@ -98,19 +98,19 @@ void CPoiMapEditDialog::UnhighlightPoiModels(const QModelIndex& rkIndex)
|
||||
RevertModelOverlay(rkModels[iMdl]);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode)
|
||||
void CPoiMapSidebar::HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode)
|
||||
{
|
||||
bool Important = IsImportant(rkIndex);
|
||||
pNode->SetScanOverlayEnabled(true);
|
||||
pNode->SetScanOverlayColor(Important ? skImportantColor : skNormalColor);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::UnhighlightModel(CModelNode *pNode)
|
||||
void CPoiMapSidebar::UnhighlightModel(CModelNode *pNode)
|
||||
{
|
||||
pNode->SetScanOverlayEnabled(false);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::RevertModelOverlay(CModelNode *pModel)
|
||||
void CPoiMapSidebar::RevertModelOverlay(CModelNode *pModel)
|
||||
{
|
||||
if (pModel)
|
||||
{
|
||||
@ -155,14 +155,14 @@ void CPoiMapEditDialog::RevertModelOverlay(CModelNode *pModel)
|
||||
}
|
||||
}
|
||||
|
||||
CPoiMapEditDialog::EPickType CPoiMapEditDialog::GetRealPickType(bool AltPressed) const
|
||||
CPoiMapSidebar::EPickType CPoiMapSidebar::GetRealPickType(bool AltPressed) const
|
||||
{
|
||||
if (!AltPressed) return mPickType;
|
||||
if (mPickType == eAddMeshes) return eRemoveMeshes;
|
||||
return eAddMeshes;
|
||||
}
|
||||
|
||||
bool CPoiMapEditDialog::IsImportant(const QModelIndex& rkIndex)
|
||||
bool CPoiMapSidebar::IsImportant(const QModelIndex& rkIndex)
|
||||
{
|
||||
CScriptNode *pPOI = mSourceModel.PoiNodePointer(rkIndex);
|
||||
|
||||
@ -175,32 +175,14 @@ bool CPoiMapEditDialog::IsImportant(const QModelIndex& rkIndex)
|
||||
return Important;
|
||||
}
|
||||
|
||||
QModelIndex CPoiMapEditDialog::GetSelectedRow() const
|
||||
QModelIndex CPoiMapSidebar::GetSelectedRow() const
|
||||
{
|
||||
QModelIndexList Indices = ui->ListView->selectionModel()->selectedRows();
|
||||
return ( Indices.isEmpty() ? QModelIndex() : mModel.mapToSource(Indices.front()) );
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::Save()
|
||||
void CPoiMapSidebar::UpdateModelHighlights()
|
||||
{
|
||||
CPoiToWorld *pPoiToWorld = mpEditor->ActiveArea()->PoiToWorldMap();
|
||||
|
||||
TString FileName = pPoiToWorld->FullSource();
|
||||
CFileOutStream Out(FileName.ToStdString(), IOUtil::eBigEndian);
|
||||
|
||||
if (Out.IsValid())
|
||||
{
|
||||
CPoiToWorldCooker::CookEGMC(pPoiToWorld, Out);
|
||||
QMessageBox::information(this, "Saved", QString("Saved to %1!").arg(TO_QSTRING(pPoiToWorld->Source())));
|
||||
}
|
||||
else
|
||||
QMessageBox::warning(this, "Error", "Couldn't save EGMC; unable to open output file");
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::SetHighlightSelected()
|
||||
{
|
||||
mHighlightMode = eHighlightSelected;
|
||||
|
||||
const QItemSelection kSelection = ui->ListView->selectionModel()->selection();
|
||||
QList<QModelIndex> SelectedIndices;
|
||||
QList<QModelIndex> UnselectedIndices;
|
||||
@ -209,45 +191,55 @@ void CPoiMapEditDialog::SetHighlightSelected()
|
||||
{
|
||||
QModelIndex Index = mModel.index(iRow, 0);
|
||||
|
||||
if (kSelection.contains(Index))
|
||||
switch (mHighlightMode)
|
||||
{
|
||||
case eHighlightSelected:
|
||||
if (kSelection.contains(Index))
|
||||
SelectedIndices << Index;
|
||||
else
|
||||
UnselectedIndices << Index;
|
||||
break;
|
||||
|
||||
case eHighlightAll:
|
||||
SelectedIndices << Index;
|
||||
else
|
||||
break;
|
||||
|
||||
case eHighlightNone:
|
||||
UnselectedIndices << Index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int iIdx = 0; iIdx < UnselectedIndices.size(); iIdx++)
|
||||
UnhighlightPoiModels(UnselectedIndices[iIdx]);
|
||||
for (int iIdx = 0; iIdx < SelectedIndices.size(); iIdx++)
|
||||
HighlightPoiModels(SelectedIndices[iIdx]);
|
||||
foreach (const QModelIndex& rkIndex, UnselectedIndices)
|
||||
UnhighlightPoiModels(rkIndex);
|
||||
|
||||
foreach (const QModelIndex& rkIndex, SelectedIndices)
|
||||
HighlightPoiModels(rkIndex);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::SetHighlightAll()
|
||||
void CPoiMapSidebar::SetHighlightSelected()
|
||||
{
|
||||
mHighlightMode = eHighlightSelected;
|
||||
UpdateModelHighlights();
|
||||
}
|
||||
|
||||
void CPoiMapSidebar::SetHighlightAll()
|
||||
{
|
||||
mHighlightMode = eHighlightAll;
|
||||
|
||||
for (int iRow = 0; iRow < mModel.rowCount(QModelIndex()); iRow++)
|
||||
HighlightPoiModels(mModel.index(iRow, 0));
|
||||
UpdateModelHighlights();
|
||||
|
||||
// Call HighlightPoiModels again on the selected index to prioritize it over the non-selected POIs.
|
||||
if (ui->ListView->selectionModel()->hasSelection())
|
||||
HighlightPoiModels(ui->ListView->selectionModel()->selectedRows().front());
|
||||
|
||||
if (mpHoverModel)
|
||||
HighlightModel(GetSelectedRow(), mpHoverModel);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::SetHighlightNone()
|
||||
void CPoiMapSidebar::SetHighlightNone()
|
||||
{
|
||||
mHighlightMode = eHighlightNone;
|
||||
|
||||
for (int iRow = 0; iRow < mModel.rowCount(QModelIndex()); iRow++)
|
||||
UnhighlightPoiModels(mModel.index(iRow, 0));
|
||||
|
||||
if (mpHoverModel)
|
||||
UnhighlightModel(mpHoverModel);
|
||||
UpdateModelHighlights();
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnSelectionChanged(const QItemSelection& rkSelected, const QItemSelection& rkDeselected)
|
||||
void CPoiMapSidebar::OnSelectionChanged(const QItemSelection& rkSelected, const QItemSelection& rkDeselected)
|
||||
{
|
||||
if (mHighlightMode == eHighlightSelected)
|
||||
{
|
||||
@ -265,14 +257,14 @@ void CPoiMapEditDialog::OnSelectionChanged(const QItemSelection& rkSelected, con
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnItemDoubleClick(QModelIndex Index)
|
||||
void CPoiMapSidebar::OnItemDoubleClick(QModelIndex Index)
|
||||
{
|
||||
QModelIndex SourceIndex = mModel.mapToSource(Index);
|
||||
CScriptNode *pPOI = mSourceModel.PoiNodePointer(SourceIndex);
|
||||
mpEditor->ClearAndSelectNode(pPOI);
|
||||
Editor()->ClearAndSelectNode(pPOI);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnUnmapAllPressed()
|
||||
void CPoiMapSidebar::OnUnmapAllPressed()
|
||||
{
|
||||
QModelIndex Index = GetSelectedRow();
|
||||
QList<CModelNode*> ModelList = mSourceModel.GetPoiMeshList(Index);
|
||||
@ -284,15 +276,15 @@ void CPoiMapEditDialog::OnUnmapAllPressed()
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnPickButtonClicked()
|
||||
void CPoiMapSidebar::OnPickButtonClicked()
|
||||
{
|
||||
QPushButton *pButton = qobject_cast<QPushButton*>(sender());
|
||||
|
||||
if (pButton == ui->AddPoiFromViewportButton)
|
||||
{
|
||||
mpEditor->EnterPickMode(eScriptNode, true, false, false);
|
||||
connect(mpEditor, SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||
connect(mpEditor, SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, SLOT(OnPoiPicked(SRayIntersection,QMouseEvent*)));
|
||||
Editor()->EnterPickMode(eScriptNode, true, false, false);
|
||||
connect(Editor(), SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||
connect(Editor(), SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, SLOT(OnPoiPicked(SRayIntersection,QMouseEvent*)));
|
||||
|
||||
pButton->setChecked(true);
|
||||
ui->MapMeshesButton->setChecked(false);
|
||||
@ -304,13 +296,13 @@ void CPoiMapEditDialog::OnPickButtonClicked()
|
||||
else
|
||||
{
|
||||
if (!pButton->isChecked())
|
||||
mpEditor->ExitPickMode();
|
||||
Editor()->ExitPickMode();
|
||||
|
||||
else
|
||||
{
|
||||
mpEditor->EnterPickMode(eModelNode, false, false, true);
|
||||
connect(mpEditor, SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||
connect(mpEditor, SIGNAL(PickModeHoverChanged(SRayIntersection,QMouseEvent*)), this, SLOT(OnModelHover(SRayIntersection,QMouseEvent*)));
|
||||
Editor()->EnterPickMode(eModelNode, false, false, true);
|
||||
connect(Editor(), SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||
connect(Editor(), SIGNAL(PickModeHoverChanged(SRayIntersection,QMouseEvent*)), this, SLOT(OnModelHover(SRayIntersection,QMouseEvent*)));
|
||||
pButton->setChecked(true);
|
||||
|
||||
if (pButton == ui->MapMeshesButton)
|
||||
@ -328,7 +320,7 @@ void CPoiMapEditDialog::OnPickButtonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::StopPicking()
|
||||
void CPoiMapSidebar::StopPicking()
|
||||
{
|
||||
ui->MapMeshesButton->setChecked(false);
|
||||
ui->UnmapMeshesButton->setChecked(false);
|
||||
@ -338,15 +330,18 @@ void CPoiMapEditDialog::StopPicking()
|
||||
RevertModelOverlay(mpHoverModel);
|
||||
mpHoverModel = nullptr;
|
||||
|
||||
disconnect(mpEditor, 0, this, 0);
|
||||
Editor()->ExitPickMode();
|
||||
disconnect(Editor(), SIGNAL(PickModeExited()), this, 0);
|
||||
disconnect(Editor(), SIGNAL(PickModeHoverChanged(SRayIntersection,QMouseEvent*)), this, 0);
|
||||
disconnect(Editor(), SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, 0);
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnInstanceListButtonClicked()
|
||||
void CPoiMapSidebar::OnInstanceListButtonClicked()
|
||||
{
|
||||
EGame Game = mpEditor->CurrentGame();
|
||||
EGame Game = Editor()->CurrentGame();
|
||||
CScriptTemplate *pPoiTemplate = CMasterTemplate::MasterForGame(Game)->TemplateByID("POIN");
|
||||
|
||||
CPoiListDialog Dialog(pPoiTemplate, &mSourceModel, mpEditor->Scene(), this);
|
||||
CPoiListDialog Dialog(pPoiTemplate, &mSourceModel, Editor()->Scene(), this);
|
||||
Dialog.exec();
|
||||
|
||||
const QList<CScriptNode*>& rkSelection = Dialog.Selection();
|
||||
@ -360,7 +355,7 @@ void CPoiMapEditDialog::OnInstanceListButtonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnRemovePoiButtonClicked()
|
||||
void CPoiMapSidebar::OnRemovePoiButtonClicked()
|
||||
{
|
||||
if (ui->ListView->selectionModel()->hasSelection())
|
||||
{
|
||||
@ -371,7 +366,7 @@ void CPoiMapEditDialog::OnRemovePoiButtonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnPoiPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent)
|
||||
void CPoiMapSidebar::OnPoiPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent)
|
||||
{
|
||||
CScriptNode *pPOI = static_cast<CScriptNode*>(rkIntersect.pNode);
|
||||
if (pPOI->Instance()->ObjectTypeID() != CFourCC("POIN").ToLong()) return;
|
||||
@ -381,10 +376,10 @@ void CPoiMapEditDialog::OnPoiPicked(const SRayIntersection& rkIntersect, QMouseE
|
||||
|
||||
// Exit pick mode unless the user is holding the Ctrl key
|
||||
if (!(pEvent->modifiers() & Qt::ControlModifier))
|
||||
mpEditor->ExitPickMode();
|
||||
Editor()->ExitPickMode();
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnModelPicked(const SRayIntersection& rkRayIntersect, QMouseEvent* pEvent)
|
||||
void CPoiMapSidebar::OnModelPicked(const SRayIntersection& rkRayIntersect, QMouseEvent* pEvent)
|
||||
{
|
||||
if (!rkRayIntersect.pNode) return;
|
||||
|
||||
@ -426,7 +421,7 @@ void CPoiMapEditDialog::OnModelPicked(const SRayIntersection& rkRayIntersect, QM
|
||||
}
|
||||
}
|
||||
|
||||
void CPoiMapEditDialog::OnModelHover(const SRayIntersection& rkIntersect, QMouseEvent *pEvent)
|
||||
void CPoiMapSidebar::OnModelHover(const SRayIntersection& rkIntersect, QMouseEvent *pEvent)
|
||||
{
|
||||
// Restore old hover model to correct overlay color, and set new hover model
|
||||
if (mpHoverModel)
|
@ -1,21 +1,22 @@
|
||||
#ifndef CPOIMAPEDITDIALOG_H
|
||||
#define CPOIMAPEDITDIALOG_H
|
||||
#ifndef CPOIMAPSIDEBAR_H
|
||||
#define CPOIMAPSIDEBAR_H
|
||||
|
||||
#include "CPoiMapModel.h"
|
||||
#include "CPoiListDialog.h"
|
||||
#include "CWorldEditorSidebar.h"
|
||||
|
||||
#include <QItemSelection>
|
||||
#include <QMainWindow>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
namespace Ui {
|
||||
class CPoiMapEditDialog;
|
||||
class CPoiMapSidebar;
|
||||
}
|
||||
|
||||
class CPoiMapEditDialog : public QMainWindow
|
||||
class CPoiMapSidebar : public CWorldEditorSidebar
|
||||
{
|
||||
Q_OBJECT
|
||||
Ui::CPoiMapEditDialog *ui;
|
||||
Ui::CPoiMapSidebar *ui;
|
||||
|
||||
enum EHighlightMode
|
||||
{
|
||||
@ -24,7 +25,6 @@ class CPoiMapEditDialog : public QMainWindow
|
||||
eHighlightSelected
|
||||
};
|
||||
|
||||
CWorldEditor *mpEditor;
|
||||
CPoiMapModel mSourceModel;
|
||||
QSortFilterProxyModel mModel;
|
||||
EHighlightMode mHighlightMode;
|
||||
@ -45,9 +45,10 @@ class CPoiMapEditDialog : public QMainWindow
|
||||
static const CColor skHoverColor;
|
||||
|
||||
public:
|
||||
explicit CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent = 0);
|
||||
~CPoiMapEditDialog();
|
||||
void closeEvent(QCloseEvent *pEvent);
|
||||
explicit CPoiMapSidebar(CWorldEditor *pEditor);
|
||||
~CPoiMapSidebar();
|
||||
void SidebarOpen();
|
||||
void SidebarClose();
|
||||
void HighlightPoiModels(const QModelIndex& rkIndex);
|
||||
void UnhighlightPoiModels(const QModelIndex& rkIndex);
|
||||
void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode);
|
||||
@ -58,7 +59,7 @@ public:
|
||||
QModelIndex GetSelectedRow() const;
|
||||
|
||||
public slots:
|
||||
void Save();
|
||||
void UpdateModelHighlights();
|
||||
void SetHighlightSelected();
|
||||
void SetHighlightAll();
|
||||
void SetHighlightNone();
|
||||
@ -73,9 +74,6 @@ public slots:
|
||||
void OnPoiPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||
void OnModelPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||
void OnModelHover(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||
|
||||
signals:
|
||||
void Closed();
|
||||
};
|
||||
|
||||
#endif // CPOIMAPEDITDIALOG_H
|
171
src/Editor/WorldEditor/CPoiMapSidebar.ui
Normal file
171
src/Editor/WorldEditor/CPoiMapSidebar.ui
Normal file
@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CPoiMapSidebar</class>
|
||||
<widget class="QWidget" name="CPoiMapSidebar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>274</width>
|
||||
<height>438</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit POI to World Mappings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="HighlightLabel">
|
||||
<property name="text">
|
||||
<string>Highlight:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="HighlightSelectedButton">
|
||||
<property name="text">
|
||||
<string>Selected</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="HighlightAllButton">
|
||||
<property name="text">
|
||||
<string>All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="HighlightNoneButton">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="MapMeshesButton">
|
||||
<property name="text">
|
||||
<string>Map</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Plus.png</normaloff>:/icons/Plus.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="UnmapMeshesButton">
|
||||
<property name="text">
|
||||
<string>Unmap</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Minus v2.png</normaloff>:/icons/Minus v2.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="UnmapAllButton">
|
||||
<property name="text">
|
||||
<string>Unmap All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="ListView">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddPoiFromViewportButton">
|
||||
<property name="toolTip">
|
||||
<string>Add from Viewport</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/SelectMode_16px.png</normaloff>:/icons/SelectMode_16px.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddPoiFromInstanceListButton">
|
||||
<property name="toolTip">
|
||||
<string>Add from Instance List</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Instances_16px.png</normaloff>:/icons/Instances_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RemovePoiButton">
|
||||
<property name="toolTip">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Icons.qrc">
|
||||
<normaloff>:/icons/Minus v2.png</normaloff>:/icons/Minus v2.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../Icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -6,7 +6,7 @@
|
||||
#include "CWorldEditor.h"
|
||||
|
||||
CScriptEditSidebar::CScriptEditSidebar(CWorldEditor *pEditor)
|
||||
: QWidget(pEditor)
|
||||
: CWorldEditorSidebar(pEditor)
|
||||
{
|
||||
QVBoxLayout *pLayout = new QVBoxLayout(this);
|
||||
pLayout->setContentsMargins(1, 1, 1, 1);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef CSCRIPTEDITSIDEBAR_H
|
||||
#define CSCRIPTEDITSIDEBAR_H
|
||||
|
||||
#include "CWorldEditorSidebar.h"
|
||||
#include <QTabWidget>
|
||||
|
||||
class CWorldEditor;
|
||||
@ -9,7 +10,7 @@ class WCreateTab;
|
||||
class WModifyTab;
|
||||
class WInstancesTab;
|
||||
|
||||
class CScriptEditSidebar : public QWidget
|
||||
class CScriptEditSidebar : public CWorldEditorSidebar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -38,14 +38,13 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
||||
, mpArea(nullptr)
|
||||
, mpWorld(nullptr)
|
||||
, mpLinkDialog(new CLinkDialog(this, this))
|
||||
, mpPoiDialog(nullptr)
|
||||
, mIsMakingLink(false)
|
||||
, mpNewLinkSender(nullptr)
|
||||
, mpNewLinkReceiver(nullptr)
|
||||
{
|
||||
Log::Write("Creating World Editor");
|
||||
ui->setupUi(this);
|
||||
REPLACE_WINDOWTITLE_APPVARS;
|
||||
UpdateWindowTitle();
|
||||
|
||||
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
||||
|
||||
@ -69,15 +68,14 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
||||
ui->menuEdit->insertSeparator(ui->ActionCut);
|
||||
|
||||
// Initialize sidebar
|
||||
mpCurSidebarWidget = nullptr;
|
||||
mpCurSidebar = nullptr;
|
||||
mpRightSidebarLayout = new QVBoxLayout();
|
||||
mpRightSidebarLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->RightSidebarFrame->setLayout(mpRightSidebarLayout);
|
||||
|
||||
mpWorldInfoSidebar = new CWorldInfoSidebar(this);
|
||||
mpWorldInfoSidebar->setHidden(true);
|
||||
mpScriptSidebar = new CScriptEditSidebar(this);
|
||||
mpScriptSidebar->setHidden(true);
|
||||
mpPoiMapSidebar = new CPoiMapSidebar(this);
|
||||
|
||||
// Initialize edit mode toolbar
|
||||
mpEditModeButtonGroup = new QButtonGroup(this);
|
||||
@ -85,6 +83,8 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
||||
|
||||
AddEditModeButton( QIcon(":/icons/World.png"), "Edit World Info",eWEM_EditWorldInfo );
|
||||
AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript );
|
||||
mpPoiMapButton = AddEditModeButton( QIcon(":/icons/POI Normal.png"), "Edit POI Mappings", eWEM_EditPOIMappings );
|
||||
mpPoiMapButton->setEnabled(false);
|
||||
|
||||
ChangeEditMode(eWEM_EditWorldInfo);
|
||||
|
||||
@ -187,7 +187,6 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
||||
|
||||
connect(ui->ActionResourceBrowser, SIGNAL(triggered()), this, SLOT(OpenResourceBrowser()));
|
||||
connect(ui->ActionEditLayers, SIGNAL(triggered()), this, SLOT(EditLayers()));
|
||||
connect(ui->ActionEditPoiToWorldMap, SIGNAL(triggered()), this, SLOT(EditPoiToWorldMap()));
|
||||
|
||||
connect(ui->ActionDrawWorld, SIGNAL(triggered()), this, SLOT(ToggleDrawWorld()));
|
||||
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
|
||||
@ -224,10 +223,6 @@ void CWorldEditor::closeEvent(QCloseEvent *pEvent)
|
||||
mUndoStack.clear();
|
||||
mpCollisionDialog->close();
|
||||
mpLinkDialog->close();
|
||||
|
||||
if (mpPoiDialog)
|
||||
mpPoiDialog->close();
|
||||
|
||||
IEditor::closeEvent(pEvent);
|
||||
}
|
||||
else
|
||||
@ -249,12 +244,10 @@ bool CWorldEditor::CloseWorld()
|
||||
mpCollisionDialog->close();
|
||||
mpLinkDialog->close();
|
||||
|
||||
if (mpPoiDialog)
|
||||
mpPoiDialog->close();
|
||||
|
||||
mpArea = nullptr;
|
||||
mpWorld = nullptr;
|
||||
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
|
||||
UpdateWindowTitle();
|
||||
|
||||
emit MapChanged(mpWorld, mpArea);
|
||||
return true;
|
||||
@ -272,12 +265,6 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
|
||||
ClearSelection();
|
||||
mUndoStack.clear();
|
||||
|
||||
if (mpPoiDialog)
|
||||
{
|
||||
delete mpPoiDialog;
|
||||
mpPoiDialog = nullptr;
|
||||
}
|
||||
|
||||
// Load new area
|
||||
mpWorld = pWorld;
|
||||
CAssetID AreaID = mpWorld->AreaResourceID(AreaIndex);
|
||||
@ -301,36 +288,20 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
|
||||
|
||||
UpdateCameraOrbit();
|
||||
|
||||
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
||||
bool AllowBloom = (mpWorld->Game() == eCorruptionProto || mpWorld->Game() == eCorruption);
|
||||
AllowBloom ? SetFakeBloom() : SetNoBloom();
|
||||
ui->menuBloom->setEnabled(AllowBloom);
|
||||
// Update UI stuff
|
||||
UpdateWindowTitle();
|
||||
|
||||
// Disable EGMC editing for Prime 1 and DKCR
|
||||
bool AllowEGMC = ( (mpWorld->Game() >= eEchoesDemo) && (mpWorld->Game() <= eCorruption) );
|
||||
ui->ActionEditPoiToWorldMap->setEnabled(AllowEGMC);
|
||||
|
||||
// Set up dialogs
|
||||
CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(mpArea->Game());
|
||||
mpCollisionDialog->SetupWidgets(); // Won't modify any settings but will update widget visibility status if we've changed games
|
||||
mpLinkDialog->SetMaster(pMaster);
|
||||
|
||||
// Set window title
|
||||
QString ProjectName = TO_QSTRING(gpEdApp->ActiveProject()->Name());
|
||||
QString WorldName = TO_QSTRING(mpWorld->InGameName());
|
||||
QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex));
|
||||
|
||||
if (CurrentGame() < eReturns)
|
||||
{
|
||||
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2 - %3[*]").arg(ProjectName, WorldName, AreaName) );
|
||||
Log::Write("Loaded area: " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2[*]").arg(AreaName) );
|
||||
Log::Write("Loaded level: World " + mpWorld->Entry()->Name().ToUTF8() + " / Area " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
|
||||
}
|
||||
|
||||
// Update paste action
|
||||
OnClipboardDataModified();
|
||||
@ -517,6 +488,7 @@ void CWorldEditor::ExportGame()
|
||||
void CWorldEditor:: CloseProject()
|
||||
{
|
||||
gpEdApp->CloseProject();
|
||||
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME%") );
|
||||
}
|
||||
|
||||
void CWorldEditor::ChangeEditMode(int Mode)
|
||||
@ -534,11 +506,15 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
|
||||
switch (Mode)
|
||||
{
|
||||
case eWEM_EditWorldInfo:
|
||||
SetSidebarWidget(mpWorldInfoSidebar);
|
||||
SetSidebar(mpWorldInfoSidebar);
|
||||
break;
|
||||
|
||||
case eWEM_EditScript:
|
||||
SetSidebarWidget(mpScriptSidebar);
|
||||
SetSidebar(mpScriptSidebar);
|
||||
break;
|
||||
|
||||
case eWEM_EditPOIMappings:
|
||||
SetSidebar(mpPoiMapSidebar);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -547,6 +523,11 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldEditor::SetRenderingMergedWorld(bool RenderMerged)
|
||||
{
|
||||
Viewport()->SetRenderMergedWorld(RenderMerged);
|
||||
}
|
||||
|
||||
void CWorldEditor::OpenProjectSettings()
|
||||
{
|
||||
CProjectSettingsDialog *pDialog = gpEdApp->ProjectDialog();
|
||||
@ -565,13 +546,23 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
|
||||
{
|
||||
ui->ActionProjectSettings->setEnabled( pProj != nullptr );
|
||||
ui->ActionCloseProject->setEnabled( pProj != nullptr );
|
||||
mpPoiMapButton->setEnabled( pProj != nullptr && pProj->Game() >= eEchoesDemo && pProj->Game() <= eCorruption );
|
||||
ResetCamera();
|
||||
if (!pProj) return;
|
||||
UpdateWindowTitle();
|
||||
|
||||
// Update recent projects list
|
||||
UpdateOpenRecentActions();
|
||||
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
||||
bool AllowBloom = (CurrentGame() == eCorruptionProto || CurrentGame() == eCorruption);
|
||||
AllowBloom ? SetFakeBloom() : SetNoBloom();
|
||||
ui->menuBloom->setEnabled(AllowBloom);
|
||||
|
||||
ChangeEditMode(eWEM_EditWorldInfo);
|
||||
if (!pProj)
|
||||
{
|
||||
// Update recent projects list
|
||||
UpdateOpenRecentActions();
|
||||
|
||||
// Reset editor mode
|
||||
ChangeEditMode(eWEM_EditWorldInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldEditor::OnLinksModified(const QList<CScriptObject*>& rkInstances)
|
||||
@ -740,6 +731,28 @@ void CWorldEditor::UpdateOpenRecentActions()
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldEditor::UpdateWindowTitle()
|
||||
{
|
||||
QString WindowTitle = "%APP_FULL_NAME%";
|
||||
CGameProject *pProj = gpEdApp->ActiveProject();
|
||||
|
||||
if (pProj)
|
||||
{
|
||||
WindowTitle += " - " + TO_QSTRING( pProj->Name() );
|
||||
|
||||
if (mpWorld)
|
||||
{
|
||||
WindowTitle += " - " + TO_QSTRING(mpWorld->InGameName());
|
||||
|
||||
if (mpArea && CurrentGame() < eReturns)
|
||||
WindowTitle += " - " + TO_QSTRING( mpWorld->AreaInGameName(mpArea->WorldIndex()) );
|
||||
}
|
||||
}
|
||||
|
||||
WindowTitle += "[*]";
|
||||
SET_WINDOWTITLE_APPVARS(WindowTitle);
|
||||
}
|
||||
|
||||
void CWorldEditor::UpdateStatusBar()
|
||||
{
|
||||
// Would be cool to do more frequent status bar updates with more info. Unfortunately, this causes lag.
|
||||
@ -912,7 +925,7 @@ void CWorldEditor::UpdateNewLinkLine()
|
||||
}
|
||||
|
||||
// ************ PROTECTED ************
|
||||
void CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
|
||||
QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
|
||||
{
|
||||
ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr);
|
||||
|
||||
@ -923,22 +936,28 @@ void CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMo
|
||||
|
||||
ui->EditModeToolBar->addWidget(pButton);
|
||||
mpEditModeButtonGroup->addButton(pButton, Mode);
|
||||
return pButton;
|
||||
}
|
||||
|
||||
void CWorldEditor::SetSidebarWidget(QWidget *pWidget)
|
||||
void CWorldEditor::SetSidebar(CWorldEditorSidebar *pSidebar)
|
||||
{
|
||||
if (mpCurSidebarWidget)
|
||||
if (mpCurSidebar == pSidebar)
|
||||
return;
|
||||
|
||||
if (mpCurSidebar)
|
||||
{
|
||||
mpRightSidebarLayout->removeWidget(mpCurSidebarWidget);
|
||||
mpCurSidebarWidget->setHidden(true);
|
||||
mpCurSidebar->SidebarClose();
|
||||
mpRightSidebarLayout->removeWidget(mpCurSidebar);
|
||||
mpCurSidebar->setHidden(true);
|
||||
}
|
||||
|
||||
mpCurSidebarWidget = pWidget;
|
||||
mpCurSidebar = pSidebar;
|
||||
|
||||
if (mpCurSidebarWidget)
|
||||
if (mpCurSidebar)
|
||||
{
|
||||
mpRightSidebarLayout->addWidget(pWidget);
|
||||
mpCurSidebarWidget->setHidden(false);
|
||||
mpCurSidebar->SidebarOpen();
|
||||
mpRightSidebarLayout->addWidget(mpCurSidebar);
|
||||
mpCurSidebar->setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,13 +1227,6 @@ void CWorldEditor::OnTransformSpinBoxEdited(CVector3f)
|
||||
UpdateGizmoUI();
|
||||
}
|
||||
|
||||
void CWorldEditor::OnClosePoiEditDialog()
|
||||
{
|
||||
delete mpPoiDialog;
|
||||
mpPoiDialog = nullptr;
|
||||
ui->MainViewport->SetRenderMergedWorld(true);
|
||||
}
|
||||
|
||||
void CWorldEditor::SelectAllTriggered()
|
||||
{
|
||||
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
|
||||
@ -1351,18 +1363,3 @@ void CWorldEditor::EditLayers()
|
||||
Editor.SetArea(mpArea);
|
||||
Editor.exec();
|
||||
}
|
||||
|
||||
void CWorldEditor::EditPoiToWorldMap()
|
||||
{
|
||||
if (!mpPoiDialog)
|
||||
{
|
||||
mpPoiDialog = new CPoiMapEditDialog(this, this);
|
||||
mpPoiDialog->show();
|
||||
ui->MainViewport->SetRenderMergedWorld(false);
|
||||
connect(mpPoiDialog, SIGNAL(Closed()), this, SLOT(OnClosePoiEditDialog()));
|
||||
}
|
||||
else
|
||||
{
|
||||
mpPoiDialog->show();
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define CWORLDEDITOR_H
|
||||
|
||||
#include "CCollisionRenderSettingsDialog.h"
|
||||
#include "CEditorApplication.h"
|
||||
#include "CLinkDialog.h"
|
||||
#include "CPoiMapEditDialog.h"
|
||||
#include "CPoiMapSidebar.h"
|
||||
#include "CScriptEditSidebar.h"
|
||||
#include "CWorldInfoSidebar.h"
|
||||
#include "Editor/INodeEditor.h"
|
||||
@ -36,7 +37,8 @@ class CWorldEditor;
|
||||
enum EWorldEditorMode
|
||||
{
|
||||
eWEM_EditWorldInfo,
|
||||
eWEM_EditScript
|
||||
eWEM_EditScript,
|
||||
eWEM_EditPOIMappings
|
||||
};
|
||||
|
||||
class CWorldEditor : public INodeEditor
|
||||
@ -53,7 +55,6 @@ class CWorldEditor : public INodeEditor
|
||||
|
||||
CCollisionRenderSettingsDialog *mpCollisionDialog;
|
||||
CLinkDialog *mpLinkDialog;
|
||||
CPoiMapEditDialog *mpPoiDialog;
|
||||
|
||||
bool mIsMakingLink;
|
||||
CScriptObject *mpNewLinkSender;
|
||||
@ -65,11 +66,14 @@ class CWorldEditor : public INodeEditor
|
||||
|
||||
// Sidebars
|
||||
QVBoxLayout *mpRightSidebarLayout;
|
||||
QWidget *mpCurSidebarWidget;
|
||||
CWorldEditorSidebar *mpCurSidebar;
|
||||
|
||||
QButtonGroup *mpEditModeButtonGroup;
|
||||
CWorldInfoSidebar *mpWorldInfoSidebar;
|
||||
CScriptEditSidebar *mpScriptSidebar;
|
||||
CPoiMapSidebar *mpPoiMapSidebar;
|
||||
|
||||
QPushButton *mpPoiMapButton;
|
||||
|
||||
public:
|
||||
explicit CWorldEditor(QWidget *parent = 0);
|
||||
@ -83,7 +87,7 @@ public:
|
||||
|
||||
inline CWorld* ActiveWorld() const { return mpWorld; }
|
||||
inline CGameArea* ActiveArea() const { return mpArea; }
|
||||
inline EGame CurrentGame() const { return mpArea ? mpArea->Game() : eUnknownGame; }
|
||||
inline EGame CurrentGame() const { return gpEdApp->CurrentGame(); }
|
||||
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
||||
CSceneViewport* Viewport() const;
|
||||
|
||||
@ -109,6 +113,7 @@ public slots:
|
||||
|
||||
void ChangeEditMode(int Mode);
|
||||
void ChangeEditMode(EWorldEditorMode Mode);
|
||||
void SetRenderingMergedWorld(bool RenderMerged);
|
||||
void OpenProjectSettings();
|
||||
void OpenResourceBrowser();
|
||||
|
||||
@ -121,6 +126,7 @@ public slots:
|
||||
void DeleteSelection();
|
||||
|
||||
void UpdateOpenRecentActions();
|
||||
void UpdateWindowTitle();
|
||||
void UpdateStatusBar();
|
||||
void UpdateGizmoUI();
|
||||
void UpdateSelectionUI();
|
||||
@ -128,8 +134,8 @@ public slots:
|
||||
void UpdateNewLinkLine();
|
||||
|
||||
protected:
|
||||
void AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
|
||||
void SetSidebarWidget(QWidget *pWidget);
|
||||
QPushButton* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
|
||||
void SetSidebar(CWorldEditorSidebar *pSidebar);
|
||||
void GizmoModeChanged(CGizmo::EGizmoMode Mode);
|
||||
|
||||
private slots:
|
||||
@ -149,7 +155,6 @@ private slots:
|
||||
void OnCameraSpeedChange(double Speed);
|
||||
void OnTransformSpinBoxModified(CVector3f Value);
|
||||
void OnTransformSpinBoxEdited(CVector3f Value);
|
||||
void OnClosePoiEditDialog();
|
||||
|
||||
void SelectAllTriggered();
|
||||
void InvertSelectionTriggered();
|
||||
@ -172,7 +177,6 @@ private slots:
|
||||
void DecrementGizmo();
|
||||
void EditCollisionRenderSettings();
|
||||
void EditLayers();
|
||||
void EditPoiToWorldMap();
|
||||
|
||||
signals:
|
||||
void MapChanged(CWorld *pNewWorld, CGameArea *pNewArea);
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>%APP_FULL_NAME%</string>
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@ -342,7 +342,6 @@
|
||||
</property>
|
||||
<addaction name="ActionResourceBrowser"/>
|
||||
<addaction name="ActionEditLayers"/>
|
||||
<addaction name="ActionEditPoiToWorldMap"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
@ -638,11 +637,6 @@
|
||||
<string>Ctrl+I</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionEditPoiToWorldMap">
|
||||
<property name="text">
|
||||
<string>Edit POI to World Map</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionDelete">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
14
src/Editor/WorldEditor/CWorldEditorSidebar.cpp
Normal file
14
src/Editor/WorldEditor/CWorldEditorSidebar.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "CWorldEditorSidebar.h"
|
||||
#include "CWorldEditor.h"
|
||||
|
||||
CWorldEditorSidebar::CWorldEditorSidebar(CWorldEditor *pEditor)
|
||||
: QWidget(pEditor)
|
||||
, mpWorldEditor(pEditor)
|
||||
{
|
||||
setHidden(true);
|
||||
}
|
||||
|
||||
CWorldEditor* CWorldEditorSidebar::Editor() const
|
||||
{
|
||||
return mpWorldEditor;
|
||||
}
|
19
src/Editor/WorldEditor/CWorldEditorSidebar.h
Normal file
19
src/Editor/WorldEditor/CWorldEditorSidebar.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef CWORLDEDITORSIDEBAR_H
|
||||
#define CWORLDEDITORSIDEBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
class CWorldEditor;
|
||||
|
||||
class CWorldEditorSidebar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
CWorldEditor *mpWorldEditor;
|
||||
|
||||
public:
|
||||
explicit CWorldEditorSidebar(CWorldEditor *pEditor);
|
||||
CWorldEditor* Editor() const;
|
||||
virtual void SidebarOpen() {}
|
||||
virtual void SidebarClose() {}
|
||||
};
|
||||
|
||||
#endif // CWORLDEDITORSIDEBAR_H
|
@ -4,7 +4,7 @@
|
||||
#include "Editor/CEditorApplication.h"
|
||||
|
||||
CWorldInfoSidebar::CWorldInfoSidebar(CWorldEditor *pEditor)
|
||||
: QWidget(pEditor)
|
||||
: CWorldEditorSidebar(pEditor)
|
||||
, mpUI(new Ui::CWorldInfoSidebar)
|
||||
, mModel(pEditor)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "CWorldEditorSidebar.h"
|
||||
#include "CWorldTreeModel.h"
|
||||
|
||||
class CWorldEditor;
|
||||
@ -11,7 +12,7 @@ namespace Ui {
|
||||
class CWorldInfoSidebar;
|
||||
}
|
||||
|
||||
class CWorldInfoSidebar : public QWidget
|
||||
class CWorldInfoSidebar : public CWorldEditorSidebar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user