mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-05-31 03:31:32 +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
|
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 "CCollisionNode.h"
|
||||||
|
#include "CScene.h"
|
||||||
#include "Core/Render/CDrawUtil.h"
|
#include "Core/Render/CDrawUtil.h"
|
||||||
#include "Core/Render/CGraphics.h"
|
#include "Core/Render/CGraphics.h"
|
||||||
#include "Core/Render/CRenderer.h"
|
#include "Core/Render/CRenderer.h"
|
||||||
@ -38,8 +39,8 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
|||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
// Turn off backface culling
|
// Turn off backface culling
|
||||||
EGame CollisionGame = mpCollision->Game();
|
EGame Game = mpScene->ActiveArea()->Game();
|
||||||
bool ForceDisableBackfaceCull = (rkViewInfo.CollisionSettings.DrawBackfaces || CollisionGame == eReturns) && glIsEnabled(GL_CULL_FACE);
|
bool ForceDisableBackfaceCull = (rkViewInfo.CollisionSettings.DrawBackfaces || Game == eReturns) && glIsEnabled(GL_CULL_FACE);
|
||||||
|
|
||||||
if (ForceDisableBackfaceCull)
|
if (ForceDisableBackfaceCull)
|
||||||
glDisable(GL_CULL_FACE);
|
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)
|
if (rkViewInfo.CollisionSettings.HighlightMask != 0 && (rMat.RawFlags() & rkViewInfo.CollisionSettings.HighlightMask) == rkViewInfo.CollisionSettings.HighlightMask)
|
||||||
Tint *= CColor::skRed;
|
Tint *= CColor::skRed;
|
||||||
|
|
||||||
else if (CollisionGame != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
|
else if (Game != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
|
||||||
Tint *= rMat.SurfaceColor(CollisionGame);
|
Tint *= rMat.SurfaceColor(Game);
|
||||||
|
|
||||||
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || CollisionGame == eReturns;
|
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || Game == eReturns;
|
||||||
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(CollisionGame) : false) && CollisionGame != eReturns;
|
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(Game) : false) && Game != eReturns;
|
||||||
CDrawUtil::UseCollisionShader(IsFloor, IsUnstandable, Tint);
|
CDrawUtil::UseCollisionShader(IsFloor, IsUnstandable, Tint);
|
||||||
pMesh->DrawMaterial(iMat, false);
|
pMesh->DrawMaterial(iMat, false);
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
|||||||
// Draw collision bounds for area collision
|
// 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
|
// 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
|
// 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 );
|
CDrawUtil::DrawWireCube( mpCollision->MeshByIndex(0)->BoundingBox(), CColor::skRed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
inline CWorldEditor* WorldEditor() const { return mpWorldEditor; }
|
inline CWorldEditor* WorldEditor() const { return mpWorldEditor; }
|
||||||
inline CResourceBrowser* ResourceBrowser() const { return mpResourceBrowser; }
|
inline CResourceBrowser* ResourceBrowser() const { return mpResourceBrowser; }
|
||||||
inline CProjectSettingsDialog* ProjectDialog() const { return mpProjectDialog; }
|
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 void SetEditorTicksEnabled(bool Enabled) { Enabled ? mRefreshTimer.start(gkTickFrequencyMS) : mRefreshTimer.stop(); }
|
||||||
inline bool AreEditorTicksEnabled() const { return mRefreshTimer.isActive(); }
|
inline bool AreEditorTicksEnabled() const { return mRefreshTimer.isActive(); }
|
||||||
|
@ -131,7 +131,6 @@ HEADERS += \
|
|||||||
CErrorLogDialog.h \
|
CErrorLogDialog.h \
|
||||||
Undo/CSelectAllCommand.h \
|
Undo/CSelectAllCommand.h \
|
||||||
Undo/CInvertSelectionCommand.h \
|
Undo/CInvertSelectionCommand.h \
|
||||||
WorldEditor/CPoiMapEditDialog.h \
|
|
||||||
WorldEditor/CPoiMapModel.h \
|
WorldEditor/CPoiMapModel.h \
|
||||||
WorldEditor/CPoiListDialog.h \
|
WorldEditor/CPoiListDialog.h \
|
||||||
PropertyEdit/CPropertyModel.h \
|
PropertyEdit/CPropertyModel.h \
|
||||||
@ -183,7 +182,9 @@ HEADERS += \
|
|||||||
WorldEditor/CWorldInfoSidebar.h \
|
WorldEditor/CWorldInfoSidebar.h \
|
||||||
WorldEditor/CWorldTreeModel.h \
|
WorldEditor/CWorldTreeModel.h \
|
||||||
Widgets/CTimedLineEdit.h \
|
Widgets/CTimedLineEdit.h \
|
||||||
CProjectSettingsDialog.h
|
CProjectSettingsDialog.h \
|
||||||
|
WorldEditor/CPoiMapSidebar.h \
|
||||||
|
WorldEditor/CWorldEditorSidebar.h
|
||||||
|
|
||||||
# Source Files
|
# Source Files
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@ -216,7 +217,6 @@ SOURCES += \
|
|||||||
TestDialog.cpp \
|
TestDialog.cpp \
|
||||||
UICommon.cpp \
|
UICommon.cpp \
|
||||||
CErrorLogDialog.cpp \
|
CErrorLogDialog.cpp \
|
||||||
WorldEditor/CPoiMapEditDialog.cpp \
|
|
||||||
WorldEditor/CPoiMapModel.cpp \
|
WorldEditor/CPoiMapModel.cpp \
|
||||||
PropertyEdit/CPropertyModel.cpp \
|
PropertyEdit/CPropertyModel.cpp \
|
||||||
PropertyEdit/CPropertyDelegate.cpp \
|
PropertyEdit/CPropertyDelegate.cpp \
|
||||||
@ -249,7 +249,9 @@ SOURCES += \
|
|||||||
WorldEditor/CScriptEditSidebar.cpp \
|
WorldEditor/CScriptEditSidebar.cpp \
|
||||||
WorldEditor/CWorldInfoSidebar.cpp \
|
WorldEditor/CWorldInfoSidebar.cpp \
|
||||||
WorldEditor/CWorldTreeModel.cpp \
|
WorldEditor/CWorldTreeModel.cpp \
|
||||||
CProjectSettingsDialog.cpp
|
CProjectSettingsDialog.cpp \
|
||||||
|
WorldEditor/CPoiMapSidebar.cpp \
|
||||||
|
WorldEditor/CWorldEditorSidebar.cpp
|
||||||
|
|
||||||
# UI Files
|
# UI Files
|
||||||
FORMS += \
|
FORMS += \
|
||||||
@ -263,7 +265,6 @@ FORMS += \
|
|||||||
WorldEditor/WInstancesTab.ui \
|
WorldEditor/WInstancesTab.ui \
|
||||||
WorldEditor/WModifyTab.ui \
|
WorldEditor/WModifyTab.ui \
|
||||||
CErrorLogDialog.ui \
|
CErrorLogDialog.ui \
|
||||||
WorldEditor/CPoiMapEditDialog.ui \
|
|
||||||
WorldEditor/CTemplateEditDialog.ui \
|
WorldEditor/CTemplateEditDialog.ui \
|
||||||
WorldEditor/CLinkDialog.ui \
|
WorldEditor/CLinkDialog.ui \
|
||||||
WorldEditor/CSelectInstanceDialog.ui \
|
WorldEditor/CSelectInstanceDialog.ui \
|
||||||
@ -274,4 +275,5 @@ FORMS += \
|
|||||||
ResourceBrowser/CResourceBrowser.ui \
|
ResourceBrowser/CResourceBrowser.ui \
|
||||||
CExportGameDialog.ui \
|
CExportGameDialog.ui \
|
||||||
WorldEditor/CWorldInfoSidebar.ui \
|
WorldEditor/CWorldInfoSidebar.ui \
|
||||||
CProjectSettingsDialog.ui
|
CProjectSettingsDialog.ui \
|
||||||
|
WorldEditor/CPoiMapSidebar.ui
|
||||||
|
@ -11,6 +11,7 @@ CCollisionRenderSettingsDialog::CCollisionRenderSettingsDialog(CWorldEditor *pEd
|
|||||||
mpUi->setupUi(this);
|
mpUi->setupUi(this);
|
||||||
|
|
||||||
SetupWidgets();
|
SetupWidgets();
|
||||||
|
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(SetupWidgets()));
|
||||||
connect(mpUi->HideMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHideMaskChanged(QString)));
|
connect(mpUi->HideMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHideMaskChanged(QString)));
|
||||||
connect(mpUi->HighlightMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHighlightMaskChanged(QString)));
|
connect(mpUi->HighlightMaskLineEdit, SIGNAL(textChanged(QString)), this, SLOT(OnHighlightMaskChanged(QString)));
|
||||||
connect(mpUi->WireframeCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnWireframeToggled(bool)));
|
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*/)
|
CPoiMapModel::CPoiMapModel(CWorldEditor *pEditor, QObject *pParent /*= 0*/)
|
||||||
: QAbstractListModel(pParent)
|
: QAbstractListModel(pParent)
|
||||||
, mpEditor(pEditor)
|
, mpEditor(pEditor)
|
||||||
, mpArea(pEditor->ActiveArea())
|
, mpArea(nullptr)
|
||||||
, mpPoiToWorld(mpArea->PoiToWorldMap())
|
, mpPoiToWorld(nullptr)
|
||||||
{
|
{
|
||||||
if (mpPoiToWorld)
|
connect(pEditor, SIGNAL(MapChanged(CWorld*,CGameArea*)), this, SLOT(OnMapChange(CWorld*,CGameArea*)));
|
||||||
{
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CPoiMapModel::headerData(int Section, Qt::Orientation Orientation, int Role) const
|
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
|
int CPoiMapModel::rowCount(const QModelIndex& /*rkParent*/) const
|
||||||
{
|
{
|
||||||
return mpPoiToWorld->NumMappedPOIs();
|
return mpPoiToWorld ? mpPoiToWorld->NumMappedPOIs() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CPoiMapModel::data(const QModelIndex& rkIndex, int Role) const
|
QVariant CPoiMapModel::data(const QModelIndex& rkIndex, int Role) const
|
||||||
@ -199,3 +161,54 @@ const QList<CModelNode*>& CPoiMapModel::GetPoiMeshList(CScriptNode *pPOI) const
|
|||||||
{
|
{
|
||||||
return *mModelMap[pPOI];
|
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
|
#define CPOIMAPMODEL_H
|
||||||
|
|
||||||
#include <Core/Resource/CPoiToWorld.h>
|
#include <Core/Resource/CPoiToWorld.h>
|
||||||
|
#include <Core/Resource/CWorld.h>
|
||||||
#include <Core/Resource/TResPtr.h>
|
#include <Core/Resource/TResPtr.h>
|
||||||
#include <Core/Scene/CModelNode.h>
|
#include <Core/Scene/CModelNode.h>
|
||||||
#include <Core/Scene/CScriptNode.h>
|
#include <Core/Scene/CScriptNode.h>
|
||||||
@ -22,7 +23,6 @@ class CPoiMapModel : public QAbstractListModel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CPoiMapModel(CWorldEditor *pEditor, QObject *pParent = 0);
|
explicit CPoiMapModel(CWorldEditor *pEditor, QObject *pParent = 0);
|
||||||
~CPoiMapModel();
|
|
||||||
QVariant headerData(int Section, Qt::Orientation Orientation, int Role) const;
|
QVariant headerData(int Section, Qt::Orientation Orientation, int Role) const;
|
||||||
int rowCount(const QModelIndex& rkParent) const;
|
int rowCount(const QModelIndex& rkParent) const;
|
||||||
QVariant data(const QModelIndex& rkIndex, int Role) const;
|
QVariant data(const QModelIndex& rkIndex, int Role) const;
|
||||||
@ -37,6 +37,9 @@ public:
|
|||||||
CScriptNode* PoiNodePointer(const QModelIndex& rkIndex) const;
|
CScriptNode* PoiNodePointer(const QModelIndex& rkIndex) const;
|
||||||
const QList<CModelNode*>& GetPoiMeshList(const QModelIndex& rkIndex) const;
|
const QList<CModelNode*>& GetPoiMeshList(const QModelIndex& rkIndex) const;
|
||||||
const QList<CModelNode*>& GetPoiMeshList(CScriptNode *pPOI) const;
|
const QList<CModelNode*>& GetPoiMeshList(CScriptNode *pPOI) const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void OnMapChange(CWorld*, CGameArea *pArea);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPOIMAPMODEL_H
|
#endif // CPOIMAPMODEL_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "CPoiMapEditDialog.h"
|
#include "CPoiMapSidebar.h"
|
||||||
#include "ui_CPoiMapEditDialog.h"
|
#include "ui_CPoiMapSidebar.h"
|
||||||
#include "CWorldEditor.h"
|
#include "CWorldEditor.h"
|
||||||
#include "Editor/UICommon.h"
|
#include "Editor/UICommon.h"
|
||||||
|
|
||||||
@ -11,14 +11,13 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
const CColor CPoiMapEditDialog::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f);
|
const CColor CPoiMapSidebar::skNormalColor(0.137255f, 0.184314f, 0.776471f, 0.5f);
|
||||||
const CColor CPoiMapEditDialog::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f);
|
const CColor CPoiMapSidebar::skImportantColor(0.721569f, 0.066667f, 0.066667f, 0.5f);
|
||||||
const CColor CPoiMapEditDialog::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f);
|
const CColor CPoiMapSidebar::skHoverColor(0.047059f, 0.2f, 0.003922f, 0.5f);
|
||||||
|
|
||||||
CPoiMapEditDialog::CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent)
|
CPoiMapSidebar::CPoiMapSidebar(CWorldEditor *pEditor)
|
||||||
: QMainWindow(pParent)
|
: CWorldEditorSidebar(pEditor)
|
||||||
, ui(new Ui::CPoiMapEditDialog)
|
, ui(new Ui::CPoiMapSidebar)
|
||||||
, mpEditor(pEditor)
|
|
||||||
, mSourceModel(pEditor, this)
|
, mSourceModel(pEditor, this)
|
||||||
, mHighlightMode(eHighlightSelected)
|
, mHighlightMode(eHighlightSelected)
|
||||||
, mPickType(eNotPicking)
|
, mPickType(eNotPicking)
|
||||||
@ -30,16 +29,11 @@ CPoiMapEditDialog::CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->ListView->setModel(&mModel);
|
ui->ListView->setModel(&mModel);
|
||||||
ui->ListView->selectionModel()->select(mModel.index(0,0), QItemSelectionModel::Select | QItemSelectionModel::Current);
|
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();
|
SetHighlightSelected();
|
||||||
|
|
||||||
connect(ui->ActionHighlightSelected, SIGNAL(triggered()), this, SLOT(SetHighlightSelected()));
|
connect(ui->HighlightSelectedButton, SIGNAL(pressed()), this, SLOT(SetHighlightSelected()));
|
||||||
connect(ui->ActionHighlightAll, SIGNAL(triggered()), this, SLOT(SetHighlightAll()));
|
connect(ui->HighlightAllButton, SIGNAL(pressed()), this, SLOT(SetHighlightAll()));
|
||||||
connect(ui->ActionHighlightNone, SIGNAL(triggered()), this, SLOT(SetHighlightNone()));
|
connect(ui->HighlightNoneButton, SIGNAL(pressed()), this, SLOT(SetHighlightNone()));
|
||||||
connect(ui->ListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
connect(ui->ListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this, SLOT(OnSelectionChanged(QItemSelection,QItemSelection)));
|
this, SLOT(OnSelectionChanged(QItemSelection,QItemSelection)));
|
||||||
connect(ui->ListView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnItemDoubleClick(QModelIndex)));
|
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->AddPoiFromViewportButton, SIGNAL(clicked()), this, SLOT(OnPickButtonClicked()));
|
||||||
connect(ui->AddPoiFromInstanceListButton, SIGNAL(clicked()), this, SLOT(OnInstanceListButtonClicked()));
|
connect(ui->AddPoiFromInstanceListButton, SIGNAL(clicked()), this, SLOT(OnInstanceListButtonClicked()));
|
||||||
connect(ui->RemovePoiButton, SIGNAL(clicked()), this, SLOT(OnRemovePoiButtonClicked()));
|
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)
|
if (mHighlightMode != eHighlightNone)
|
||||||
|
{
|
||||||
|
EHighlightMode OldHighlightMode = mHighlightMode;
|
||||||
SetHighlightNone();
|
SetHighlightNone();
|
||||||
|
mHighlightMode = OldHighlightMode;
|
||||||
|
}
|
||||||
|
|
||||||
// Stop picking
|
// Stop picking
|
||||||
if (mPickType != eNotPicking)
|
if (mPickType != eNotPicking)
|
||||||
StopPicking();
|
StopPicking();
|
||||||
|
|
||||||
delete ui;
|
// Disable unmerged world rendering
|
||||||
|
Editor()->SetRenderingMergedWorld(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::closeEvent(QCloseEvent* /*pEvent*/)
|
void CPoiMapSidebar::HighlightPoiModels(const QModelIndex& rkIndex)
|
||||||
{
|
|
||||||
if (mPickType != eNotPicking)
|
|
||||||
mpEditor->ExitPickMode();
|
|
||||||
|
|
||||||
emit Closed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPoiMapEditDialog::HighlightPoiModels(const QModelIndex& rkIndex)
|
|
||||||
{
|
{
|
||||||
// Get POI and models
|
// Get POI and models
|
||||||
QModelIndex SourceIndex = mModel.mapToSource(rkIndex);
|
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);
|
QModelIndex SourceIndex = mModel.mapToSource(rkIndex);
|
||||||
const QList<CModelNode*>& rkModels = mSourceModel.GetPoiMeshList(SourceIndex);
|
const QList<CModelNode*>& rkModels = mSourceModel.GetPoiMeshList(SourceIndex);
|
||||||
@ -98,19 +98,19 @@ void CPoiMapEditDialog::UnhighlightPoiModels(const QModelIndex& rkIndex)
|
|||||||
RevertModelOverlay(rkModels[iMdl]);
|
RevertModelOverlay(rkModels[iMdl]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode)
|
void CPoiMapSidebar::HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode)
|
||||||
{
|
{
|
||||||
bool Important = IsImportant(rkIndex);
|
bool Important = IsImportant(rkIndex);
|
||||||
pNode->SetScanOverlayEnabled(true);
|
pNode->SetScanOverlayEnabled(true);
|
||||||
pNode->SetScanOverlayColor(Important ? skImportantColor : skNormalColor);
|
pNode->SetScanOverlayColor(Important ? skImportantColor : skNormalColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::UnhighlightModel(CModelNode *pNode)
|
void CPoiMapSidebar::UnhighlightModel(CModelNode *pNode)
|
||||||
{
|
{
|
||||||
pNode->SetScanOverlayEnabled(false);
|
pNode->SetScanOverlayEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::RevertModelOverlay(CModelNode *pModel)
|
void CPoiMapSidebar::RevertModelOverlay(CModelNode *pModel)
|
||||||
{
|
{
|
||||||
if (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 (!AltPressed) return mPickType;
|
||||||
if (mPickType == eAddMeshes) return eRemoveMeshes;
|
if (mPickType == eAddMeshes) return eRemoveMeshes;
|
||||||
return eAddMeshes;
|
return eAddMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPoiMapEditDialog::IsImportant(const QModelIndex& rkIndex)
|
bool CPoiMapSidebar::IsImportant(const QModelIndex& rkIndex)
|
||||||
{
|
{
|
||||||
CScriptNode *pPOI = mSourceModel.PoiNodePointer(rkIndex);
|
CScriptNode *pPOI = mSourceModel.PoiNodePointer(rkIndex);
|
||||||
|
|
||||||
@ -175,32 +175,14 @@ bool CPoiMapEditDialog::IsImportant(const QModelIndex& rkIndex)
|
|||||||
return Important;
|
return Important;
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex CPoiMapEditDialog::GetSelectedRow() const
|
QModelIndex CPoiMapSidebar::GetSelectedRow() const
|
||||||
{
|
{
|
||||||
QModelIndexList Indices = ui->ListView->selectionModel()->selectedRows();
|
QModelIndexList Indices = ui->ListView->selectionModel()->selectedRows();
|
||||||
return ( Indices.isEmpty() ? QModelIndex() : mModel.mapToSource(Indices.front()) );
|
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();
|
const QItemSelection kSelection = ui->ListView->selectionModel()->selection();
|
||||||
QList<QModelIndex> SelectedIndices;
|
QList<QModelIndex> SelectedIndices;
|
||||||
QList<QModelIndex> UnselectedIndices;
|
QList<QModelIndex> UnselectedIndices;
|
||||||
@ -209,45 +191,55 @@ void CPoiMapEditDialog::SetHighlightSelected()
|
|||||||
{
|
{
|
||||||
QModelIndex Index = mModel.index(iRow, 0);
|
QModelIndex Index = mModel.index(iRow, 0);
|
||||||
|
|
||||||
|
switch (mHighlightMode)
|
||||||
|
{
|
||||||
|
case eHighlightSelected:
|
||||||
if (kSelection.contains(Index))
|
if (kSelection.contains(Index))
|
||||||
SelectedIndices << Index;
|
SelectedIndices << Index;
|
||||||
else
|
else
|
||||||
UnselectedIndices << Index;
|
UnselectedIndices << Index;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case eHighlightAll:
|
||||||
|
SelectedIndices << Index;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case eHighlightNone:
|
||||||
|
UnselectedIndices << Index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int iIdx = 0; iIdx < UnselectedIndices.size(); iIdx++)
|
foreach (const QModelIndex& rkIndex, UnselectedIndices)
|
||||||
UnhighlightPoiModels(UnselectedIndices[iIdx]);
|
UnhighlightPoiModels(rkIndex);
|
||||||
for (int iIdx = 0; iIdx < SelectedIndices.size(); iIdx++)
|
|
||||||
HighlightPoiModels(SelectedIndices[iIdx]);
|
foreach (const QModelIndex& rkIndex, SelectedIndices)
|
||||||
|
HighlightPoiModels(rkIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::SetHighlightAll()
|
void CPoiMapSidebar::SetHighlightSelected()
|
||||||
|
{
|
||||||
|
mHighlightMode = eHighlightSelected;
|
||||||
|
UpdateModelHighlights();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPoiMapSidebar::SetHighlightAll()
|
||||||
{
|
{
|
||||||
mHighlightMode = eHighlightAll;
|
mHighlightMode = eHighlightAll;
|
||||||
|
UpdateModelHighlights();
|
||||||
for (int iRow = 0; iRow < mModel.rowCount(QModelIndex()); iRow++)
|
|
||||||
HighlightPoiModels(mModel.index(iRow, 0));
|
|
||||||
|
|
||||||
// Call HighlightPoiModels again on the selected index to prioritize it over the non-selected POIs.
|
// Call HighlightPoiModels again on the selected index to prioritize it over the non-selected POIs.
|
||||||
if (ui->ListView->selectionModel()->hasSelection())
|
if (ui->ListView->selectionModel()->hasSelection())
|
||||||
HighlightPoiModels(ui->ListView->selectionModel()->selectedRows().front());
|
HighlightPoiModels(ui->ListView->selectionModel()->selectedRows().front());
|
||||||
|
|
||||||
if (mpHoverModel)
|
|
||||||
HighlightModel(GetSelectedRow(), mpHoverModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::SetHighlightNone()
|
void CPoiMapSidebar::SetHighlightNone()
|
||||||
{
|
{
|
||||||
mHighlightMode = eHighlightNone;
|
mHighlightMode = eHighlightNone;
|
||||||
|
UpdateModelHighlights();
|
||||||
for (int iRow = 0; iRow < mModel.rowCount(QModelIndex()); iRow++)
|
|
||||||
UnhighlightPoiModels(mModel.index(iRow, 0));
|
|
||||||
|
|
||||||
if (mpHoverModel)
|
|
||||||
UnhighlightModel(mpHoverModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::OnSelectionChanged(const QItemSelection& rkSelected, const QItemSelection& rkDeselected)
|
void CPoiMapSidebar::OnSelectionChanged(const QItemSelection& rkSelected, const QItemSelection& rkDeselected)
|
||||||
{
|
{
|
||||||
if (mHighlightMode == eHighlightSelected)
|
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);
|
QModelIndex SourceIndex = mModel.mapToSource(Index);
|
||||||
CScriptNode *pPOI = mSourceModel.PoiNodePointer(SourceIndex);
|
CScriptNode *pPOI = mSourceModel.PoiNodePointer(SourceIndex);
|
||||||
mpEditor->ClearAndSelectNode(pPOI);
|
Editor()->ClearAndSelectNode(pPOI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::OnUnmapAllPressed()
|
void CPoiMapSidebar::OnUnmapAllPressed()
|
||||||
{
|
{
|
||||||
QModelIndex Index = GetSelectedRow();
|
QModelIndex Index = GetSelectedRow();
|
||||||
QList<CModelNode*> ModelList = mSourceModel.GetPoiMeshList(Index);
|
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());
|
QPushButton *pButton = qobject_cast<QPushButton*>(sender());
|
||||||
|
|
||||||
if (pButton == ui->AddPoiFromViewportButton)
|
if (pButton == ui->AddPoiFromViewportButton)
|
||||||
{
|
{
|
||||||
mpEditor->EnterPickMode(eScriptNode, true, false, false);
|
Editor()->EnterPickMode(eScriptNode, true, false, false);
|
||||||
connect(mpEditor, SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
connect(Editor(), SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||||
connect(mpEditor, SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, SLOT(OnPoiPicked(SRayIntersection,QMouseEvent*)));
|
connect(Editor(), SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, SLOT(OnPoiPicked(SRayIntersection,QMouseEvent*)));
|
||||||
|
|
||||||
pButton->setChecked(true);
|
pButton->setChecked(true);
|
||||||
ui->MapMeshesButton->setChecked(false);
|
ui->MapMeshesButton->setChecked(false);
|
||||||
@ -304,13 +296,13 @@ void CPoiMapEditDialog::OnPickButtonClicked()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!pButton->isChecked())
|
if (!pButton->isChecked())
|
||||||
mpEditor->ExitPickMode();
|
Editor()->ExitPickMode();
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mpEditor->EnterPickMode(eModelNode, false, false, true);
|
Editor()->EnterPickMode(eModelNode, false, false, true);
|
||||||
connect(mpEditor, SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
connect(Editor(), SIGNAL(PickModeExited()), this, SLOT(StopPicking()));
|
||||||
connect(mpEditor, SIGNAL(PickModeHoverChanged(SRayIntersection,QMouseEvent*)), this, SLOT(OnModelHover(SRayIntersection,QMouseEvent*)));
|
connect(Editor(), SIGNAL(PickModeHoverChanged(SRayIntersection,QMouseEvent*)), this, SLOT(OnModelHover(SRayIntersection,QMouseEvent*)));
|
||||||
pButton->setChecked(true);
|
pButton->setChecked(true);
|
||||||
|
|
||||||
if (pButton == ui->MapMeshesButton)
|
if (pButton == ui->MapMeshesButton)
|
||||||
@ -328,7 +320,7 @@ void CPoiMapEditDialog::OnPickButtonClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::StopPicking()
|
void CPoiMapSidebar::StopPicking()
|
||||||
{
|
{
|
||||||
ui->MapMeshesButton->setChecked(false);
|
ui->MapMeshesButton->setChecked(false);
|
||||||
ui->UnmapMeshesButton->setChecked(false);
|
ui->UnmapMeshesButton->setChecked(false);
|
||||||
@ -338,15 +330,18 @@ void CPoiMapEditDialog::StopPicking()
|
|||||||
RevertModelOverlay(mpHoverModel);
|
RevertModelOverlay(mpHoverModel);
|
||||||
mpHoverModel = nullptr;
|
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");
|
CScriptTemplate *pPoiTemplate = CMasterTemplate::MasterForGame(Game)->TemplateByID("POIN");
|
||||||
|
|
||||||
CPoiListDialog Dialog(pPoiTemplate, &mSourceModel, mpEditor->Scene(), this);
|
CPoiListDialog Dialog(pPoiTemplate, &mSourceModel, Editor()->Scene(), this);
|
||||||
Dialog.exec();
|
Dialog.exec();
|
||||||
|
|
||||||
const QList<CScriptNode*>& rkSelection = Dialog.Selection();
|
const QList<CScriptNode*>& rkSelection = Dialog.Selection();
|
||||||
@ -360,7 +355,7 @@ void CPoiMapEditDialog::OnInstanceListButtonClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPoiMapEditDialog::OnRemovePoiButtonClicked()
|
void CPoiMapSidebar::OnRemovePoiButtonClicked()
|
||||||
{
|
{
|
||||||
if (ui->ListView->selectionModel()->hasSelection())
|
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);
|
CScriptNode *pPOI = static_cast<CScriptNode*>(rkIntersect.pNode);
|
||||||
if (pPOI->Instance()->ObjectTypeID() != CFourCC("POIN").ToLong()) return;
|
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
|
// Exit pick mode unless the user is holding the Ctrl key
|
||||||
if (!(pEvent->modifiers() & Qt::ControlModifier))
|
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;
|
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
|
// Restore old hover model to correct overlay color, and set new hover model
|
||||||
if (mpHoverModel)
|
if (mpHoverModel)
|
@ -1,21 +1,22 @@
|
|||||||
#ifndef CPOIMAPEDITDIALOG_H
|
#ifndef CPOIMAPSIDEBAR_H
|
||||||
#define CPOIMAPEDITDIALOG_H
|
#define CPOIMAPSIDEBAR_H
|
||||||
|
|
||||||
#include "CPoiMapModel.h"
|
#include "CPoiMapModel.h"
|
||||||
#include "CPoiListDialog.h"
|
#include "CPoiListDialog.h"
|
||||||
|
#include "CWorldEditorSidebar.h"
|
||||||
|
|
||||||
#include <QItemSelection>
|
#include <QItemSelection>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CPoiMapEditDialog;
|
class CPoiMapSidebar;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CPoiMapEditDialog : public QMainWindow
|
class CPoiMapSidebar : public CWorldEditorSidebar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Ui::CPoiMapEditDialog *ui;
|
Ui::CPoiMapSidebar *ui;
|
||||||
|
|
||||||
enum EHighlightMode
|
enum EHighlightMode
|
||||||
{
|
{
|
||||||
@ -24,7 +25,6 @@ class CPoiMapEditDialog : public QMainWindow
|
|||||||
eHighlightSelected
|
eHighlightSelected
|
||||||
};
|
};
|
||||||
|
|
||||||
CWorldEditor *mpEditor;
|
|
||||||
CPoiMapModel mSourceModel;
|
CPoiMapModel mSourceModel;
|
||||||
QSortFilterProxyModel mModel;
|
QSortFilterProxyModel mModel;
|
||||||
EHighlightMode mHighlightMode;
|
EHighlightMode mHighlightMode;
|
||||||
@ -45,9 +45,10 @@ class CPoiMapEditDialog : public QMainWindow
|
|||||||
static const CColor skHoverColor;
|
static const CColor skHoverColor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CPoiMapEditDialog(CWorldEditor *pEditor, QWidget *pParent = 0);
|
explicit CPoiMapSidebar(CWorldEditor *pEditor);
|
||||||
~CPoiMapEditDialog();
|
~CPoiMapSidebar();
|
||||||
void closeEvent(QCloseEvent *pEvent);
|
void SidebarOpen();
|
||||||
|
void SidebarClose();
|
||||||
void HighlightPoiModels(const QModelIndex& rkIndex);
|
void HighlightPoiModels(const QModelIndex& rkIndex);
|
||||||
void UnhighlightPoiModels(const QModelIndex& rkIndex);
|
void UnhighlightPoiModels(const QModelIndex& rkIndex);
|
||||||
void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode);
|
void HighlightModel(const QModelIndex& rkIndex, CModelNode *pNode);
|
||||||
@ -58,7 +59,7 @@ public:
|
|||||||
QModelIndex GetSelectedRow() const;
|
QModelIndex GetSelectedRow() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Save();
|
void UpdateModelHighlights();
|
||||||
void SetHighlightSelected();
|
void SetHighlightSelected();
|
||||||
void SetHighlightAll();
|
void SetHighlightAll();
|
||||||
void SetHighlightNone();
|
void SetHighlightNone();
|
||||||
@ -73,9 +74,6 @@ public slots:
|
|||||||
void OnPoiPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
void OnPoiPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||||
void OnModelPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
void OnModelPicked(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||||
void OnModelHover(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
void OnModelHover(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
|
||||||
|
|
||||||
signals:
|
|
||||||
void Closed();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPOIMAPEDITDIALOG_H
|
#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"
|
#include "CWorldEditor.h"
|
||||||
|
|
||||||
CScriptEditSidebar::CScriptEditSidebar(CWorldEditor *pEditor)
|
CScriptEditSidebar::CScriptEditSidebar(CWorldEditor *pEditor)
|
||||||
: QWidget(pEditor)
|
: CWorldEditorSidebar(pEditor)
|
||||||
{
|
{
|
||||||
QVBoxLayout *pLayout = new QVBoxLayout(this);
|
QVBoxLayout *pLayout = new QVBoxLayout(this);
|
||||||
pLayout->setContentsMargins(1, 1, 1, 1);
|
pLayout->setContentsMargins(1, 1, 1, 1);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef CSCRIPTEDITSIDEBAR_H
|
#ifndef CSCRIPTEDITSIDEBAR_H
|
||||||
#define CSCRIPTEDITSIDEBAR_H
|
#define CSCRIPTEDITSIDEBAR_H
|
||||||
|
|
||||||
|
#include "CWorldEditorSidebar.h"
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
|
||||||
class CWorldEditor;
|
class CWorldEditor;
|
||||||
@ -9,7 +10,7 @@ class WCreateTab;
|
|||||||
class WModifyTab;
|
class WModifyTab;
|
||||||
class WInstancesTab;
|
class WInstancesTab;
|
||||||
|
|
||||||
class CScriptEditSidebar : public QWidget
|
class CScriptEditSidebar : public CWorldEditorSidebar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -38,14 +38,13 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
, mpArea(nullptr)
|
, mpArea(nullptr)
|
||||||
, mpWorld(nullptr)
|
, mpWorld(nullptr)
|
||||||
, mpLinkDialog(new CLinkDialog(this, this))
|
, mpLinkDialog(new CLinkDialog(this, this))
|
||||||
, mpPoiDialog(nullptr)
|
|
||||||
, mIsMakingLink(false)
|
, mIsMakingLink(false)
|
||||||
, mpNewLinkSender(nullptr)
|
, mpNewLinkSender(nullptr)
|
||||||
, mpNewLinkReceiver(nullptr)
|
, mpNewLinkReceiver(nullptr)
|
||||||
{
|
{
|
||||||
Log::Write("Creating World Editor");
|
Log::Write("Creating World Editor");
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
REPLACE_WINDOWTITLE_APPVARS;
|
UpdateWindowTitle();
|
||||||
|
|
||||||
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
||||||
|
|
||||||
@ -69,15 +68,14 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
ui->menuEdit->insertSeparator(ui->ActionCut);
|
ui->menuEdit->insertSeparator(ui->ActionCut);
|
||||||
|
|
||||||
// Initialize sidebar
|
// Initialize sidebar
|
||||||
mpCurSidebarWidget = nullptr;
|
mpCurSidebar = nullptr;
|
||||||
mpRightSidebarLayout = new QVBoxLayout();
|
mpRightSidebarLayout = new QVBoxLayout();
|
||||||
mpRightSidebarLayout->setContentsMargins(0, 0, 0, 0);
|
mpRightSidebarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
ui->RightSidebarFrame->setLayout(mpRightSidebarLayout);
|
ui->RightSidebarFrame->setLayout(mpRightSidebarLayout);
|
||||||
|
|
||||||
mpWorldInfoSidebar = new CWorldInfoSidebar(this);
|
mpWorldInfoSidebar = new CWorldInfoSidebar(this);
|
||||||
mpWorldInfoSidebar->setHidden(true);
|
|
||||||
mpScriptSidebar = new CScriptEditSidebar(this);
|
mpScriptSidebar = new CScriptEditSidebar(this);
|
||||||
mpScriptSidebar->setHidden(true);
|
mpPoiMapSidebar = new CPoiMapSidebar(this);
|
||||||
|
|
||||||
// Initialize edit mode toolbar
|
// Initialize edit mode toolbar
|
||||||
mpEditModeButtonGroup = new QButtonGroup(this);
|
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/World.png"), "Edit World Info",eWEM_EditWorldInfo );
|
||||||
AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript );
|
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);
|
ChangeEditMode(eWEM_EditWorldInfo);
|
||||||
|
|
||||||
@ -187,7 +187,6 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
|
|
||||||
connect(ui->ActionResourceBrowser, SIGNAL(triggered()), this, SLOT(OpenResourceBrowser()));
|
connect(ui->ActionResourceBrowser, SIGNAL(triggered()), this, SLOT(OpenResourceBrowser()));
|
||||||
connect(ui->ActionEditLayers, SIGNAL(triggered()), this, SLOT(EditLayers()));
|
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->ActionDrawWorld, SIGNAL(triggered()), this, SLOT(ToggleDrawWorld()));
|
||||||
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
|
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
|
||||||
@ -224,10 +223,6 @@ void CWorldEditor::closeEvent(QCloseEvent *pEvent)
|
|||||||
mUndoStack.clear();
|
mUndoStack.clear();
|
||||||
mpCollisionDialog->close();
|
mpCollisionDialog->close();
|
||||||
mpLinkDialog->close();
|
mpLinkDialog->close();
|
||||||
|
|
||||||
if (mpPoiDialog)
|
|
||||||
mpPoiDialog->close();
|
|
||||||
|
|
||||||
IEditor::closeEvent(pEvent);
|
IEditor::closeEvent(pEvent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -249,12 +244,10 @@ bool CWorldEditor::CloseWorld()
|
|||||||
mpCollisionDialog->close();
|
mpCollisionDialog->close();
|
||||||
mpLinkDialog->close();
|
mpLinkDialog->close();
|
||||||
|
|
||||||
if (mpPoiDialog)
|
|
||||||
mpPoiDialog->close();
|
|
||||||
|
|
||||||
mpArea = nullptr;
|
mpArea = nullptr;
|
||||||
mpWorld = nullptr;
|
mpWorld = nullptr;
|
||||||
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
|
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
|
||||||
|
UpdateWindowTitle();
|
||||||
|
|
||||||
emit MapChanged(mpWorld, mpArea);
|
emit MapChanged(mpWorld, mpArea);
|
||||||
return true;
|
return true;
|
||||||
@ -272,12 +265,6 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
|
|||||||
ClearSelection();
|
ClearSelection();
|
||||||
mUndoStack.clear();
|
mUndoStack.clear();
|
||||||
|
|
||||||
if (mpPoiDialog)
|
|
||||||
{
|
|
||||||
delete mpPoiDialog;
|
|
||||||
mpPoiDialog = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load new area
|
// Load new area
|
||||||
mpWorld = pWorld;
|
mpWorld = pWorld;
|
||||||
CAssetID AreaID = mpWorld->AreaResourceID(AreaIndex);
|
CAssetID AreaID = mpWorld->AreaResourceID(AreaIndex);
|
||||||
@ -301,36 +288,20 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
|
|||||||
|
|
||||||
UpdateCameraOrbit();
|
UpdateCameraOrbit();
|
||||||
|
|
||||||
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
// Update UI stuff
|
||||||
bool AllowBloom = (mpWorld->Game() == eCorruptionProto || mpWorld->Game() == eCorruption);
|
UpdateWindowTitle();
|
||||||
AllowBloom ? SetFakeBloom() : SetNoBloom();
|
|
||||||
ui->menuBloom->setEnabled(AllowBloom);
|
|
||||||
|
|
||||||
// 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());
|
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);
|
mpLinkDialog->SetMaster(pMaster);
|
||||||
|
|
||||||
// Set window title
|
|
||||||
QString ProjectName = TO_QSTRING(gpEdApp->ActiveProject()->Name());
|
QString ProjectName = TO_QSTRING(gpEdApp->ActiveProject()->Name());
|
||||||
QString WorldName = TO_QSTRING(mpWorld->InGameName());
|
QString WorldName = TO_QSTRING(mpWorld->InGameName());
|
||||||
QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex));
|
QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex));
|
||||||
|
|
||||||
if (CurrentGame() < eReturns)
|
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) + ")");
|
Log::Write("Loaded area: " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
|
||||||
}
|
|
||||||
|
|
||||||
else
|
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) + ")");
|
Log::Write("Loaded level: World " + mpWorld->Entry()->Name().ToUTF8() + " / Area " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
|
||||||
}
|
|
||||||
|
|
||||||
// Update paste action
|
// Update paste action
|
||||||
OnClipboardDataModified();
|
OnClipboardDataModified();
|
||||||
@ -517,6 +488,7 @@ void CWorldEditor::ExportGame()
|
|||||||
void CWorldEditor:: CloseProject()
|
void CWorldEditor:: CloseProject()
|
||||||
{
|
{
|
||||||
gpEdApp->CloseProject();
|
gpEdApp->CloseProject();
|
||||||
|
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME%") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldEditor::ChangeEditMode(int Mode)
|
void CWorldEditor::ChangeEditMode(int Mode)
|
||||||
@ -534,11 +506,15 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
|
|||||||
switch (Mode)
|
switch (Mode)
|
||||||
{
|
{
|
||||||
case eWEM_EditWorldInfo:
|
case eWEM_EditWorldInfo:
|
||||||
SetSidebarWidget(mpWorldInfoSidebar);
|
SetSidebar(mpWorldInfoSidebar);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eWEM_EditScript:
|
case eWEM_EditScript:
|
||||||
SetSidebarWidget(mpScriptSidebar);
|
SetSidebar(mpScriptSidebar);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case eWEM_EditPOIMappings:
|
||||||
|
SetSidebar(mpPoiMapSidebar);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -547,6 +523,11 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorldEditor::SetRenderingMergedWorld(bool RenderMerged)
|
||||||
|
{
|
||||||
|
Viewport()->SetRenderMergedWorld(RenderMerged);
|
||||||
|
}
|
||||||
|
|
||||||
void CWorldEditor::OpenProjectSettings()
|
void CWorldEditor::OpenProjectSettings()
|
||||||
{
|
{
|
||||||
CProjectSettingsDialog *pDialog = gpEdApp->ProjectDialog();
|
CProjectSettingsDialog *pDialog = gpEdApp->ProjectDialog();
|
||||||
@ -565,14 +546,24 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
|
|||||||
{
|
{
|
||||||
ui->ActionProjectSettings->setEnabled( pProj != nullptr );
|
ui->ActionProjectSettings->setEnabled( pProj != nullptr );
|
||||||
ui->ActionCloseProject->setEnabled( pProj != nullptr );
|
ui->ActionCloseProject->setEnabled( pProj != nullptr );
|
||||||
|
mpPoiMapButton->setEnabled( pProj != nullptr && pProj->Game() >= eEchoesDemo && pProj->Game() <= eCorruption );
|
||||||
ResetCamera();
|
ResetCamera();
|
||||||
if (!pProj) return;
|
UpdateWindowTitle();
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
if (!pProj)
|
||||||
|
{
|
||||||
// Update recent projects list
|
// Update recent projects list
|
||||||
UpdateOpenRecentActions();
|
UpdateOpenRecentActions();
|
||||||
|
|
||||||
|
// Reset editor mode
|
||||||
ChangeEditMode(eWEM_EditWorldInfo);
|
ChangeEditMode(eWEM_EditWorldInfo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CWorldEditor::OnLinksModified(const QList<CScriptObject*>& rkInstances)
|
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()
|
void CWorldEditor::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
// Would be cool to do more frequent status bar updates with more info. Unfortunately, this causes lag.
|
// 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 ************
|
// ************ PROTECTED ************
|
||||||
void CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
|
QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
|
||||||
{
|
{
|
||||||
ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr);
|
ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr);
|
||||||
|
|
||||||
@ -923,22 +936,28 @@ void CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMo
|
|||||||
|
|
||||||
ui->EditModeToolBar->addWidget(pButton);
|
ui->EditModeToolBar->addWidget(pButton);
|
||||||
mpEditModeButtonGroup->addButton(pButton, Mode);
|
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);
|
mpCurSidebar->SidebarClose();
|
||||||
mpCurSidebarWidget->setHidden(true);
|
mpRightSidebarLayout->removeWidget(mpCurSidebar);
|
||||||
|
mpCurSidebar->setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpCurSidebarWidget = pWidget;
|
mpCurSidebar = pSidebar;
|
||||||
|
|
||||||
if (mpCurSidebarWidget)
|
if (mpCurSidebar)
|
||||||
{
|
{
|
||||||
mpRightSidebarLayout->addWidget(pWidget);
|
mpCurSidebar->SidebarOpen();
|
||||||
mpCurSidebarWidget->setHidden(false);
|
mpRightSidebarLayout->addWidget(mpCurSidebar);
|
||||||
|
mpCurSidebar->setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1208,13 +1227,6 @@ void CWorldEditor::OnTransformSpinBoxEdited(CVector3f)
|
|||||||
UpdateGizmoUI();
|
UpdateGizmoUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldEditor::OnClosePoiEditDialog()
|
|
||||||
{
|
|
||||||
delete mpPoiDialog;
|
|
||||||
mpPoiDialog = nullptr;
|
|
||||||
ui->MainViewport->SetRenderMergedWorld(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWorldEditor::SelectAllTriggered()
|
void CWorldEditor::SelectAllTriggered()
|
||||||
{
|
{
|
||||||
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
|
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
|
||||||
@ -1351,18 +1363,3 @@ void CWorldEditor::EditLayers()
|
|||||||
Editor.SetArea(mpArea);
|
Editor.SetArea(mpArea);
|
||||||
Editor.exec();
|
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
|
#define CWORLDEDITOR_H
|
||||||
|
|
||||||
#include "CCollisionRenderSettingsDialog.h"
|
#include "CCollisionRenderSettingsDialog.h"
|
||||||
|
#include "CEditorApplication.h"
|
||||||
#include "CLinkDialog.h"
|
#include "CLinkDialog.h"
|
||||||
#include "CPoiMapEditDialog.h"
|
#include "CPoiMapSidebar.h"
|
||||||
#include "CScriptEditSidebar.h"
|
#include "CScriptEditSidebar.h"
|
||||||
#include "CWorldInfoSidebar.h"
|
#include "CWorldInfoSidebar.h"
|
||||||
#include "Editor/INodeEditor.h"
|
#include "Editor/INodeEditor.h"
|
||||||
@ -36,7 +37,8 @@ class CWorldEditor;
|
|||||||
enum EWorldEditorMode
|
enum EWorldEditorMode
|
||||||
{
|
{
|
||||||
eWEM_EditWorldInfo,
|
eWEM_EditWorldInfo,
|
||||||
eWEM_EditScript
|
eWEM_EditScript,
|
||||||
|
eWEM_EditPOIMappings
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWorldEditor : public INodeEditor
|
class CWorldEditor : public INodeEditor
|
||||||
@ -53,7 +55,6 @@ class CWorldEditor : public INodeEditor
|
|||||||
|
|
||||||
CCollisionRenderSettingsDialog *mpCollisionDialog;
|
CCollisionRenderSettingsDialog *mpCollisionDialog;
|
||||||
CLinkDialog *mpLinkDialog;
|
CLinkDialog *mpLinkDialog;
|
||||||
CPoiMapEditDialog *mpPoiDialog;
|
|
||||||
|
|
||||||
bool mIsMakingLink;
|
bool mIsMakingLink;
|
||||||
CScriptObject *mpNewLinkSender;
|
CScriptObject *mpNewLinkSender;
|
||||||
@ -65,11 +66,14 @@ class CWorldEditor : public INodeEditor
|
|||||||
|
|
||||||
// Sidebars
|
// Sidebars
|
||||||
QVBoxLayout *mpRightSidebarLayout;
|
QVBoxLayout *mpRightSidebarLayout;
|
||||||
QWidget *mpCurSidebarWidget;
|
CWorldEditorSidebar *mpCurSidebar;
|
||||||
|
|
||||||
QButtonGroup *mpEditModeButtonGroup;
|
QButtonGroup *mpEditModeButtonGroup;
|
||||||
CWorldInfoSidebar *mpWorldInfoSidebar;
|
CWorldInfoSidebar *mpWorldInfoSidebar;
|
||||||
CScriptEditSidebar *mpScriptSidebar;
|
CScriptEditSidebar *mpScriptSidebar;
|
||||||
|
CPoiMapSidebar *mpPoiMapSidebar;
|
||||||
|
|
||||||
|
QPushButton *mpPoiMapButton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CWorldEditor(QWidget *parent = 0);
|
explicit CWorldEditor(QWidget *parent = 0);
|
||||||
@ -83,7 +87,7 @@ public:
|
|||||||
|
|
||||||
inline CWorld* ActiveWorld() const { return mpWorld; }
|
inline CWorld* ActiveWorld() const { return mpWorld; }
|
||||||
inline CGameArea* ActiveArea() const { return mpArea; }
|
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; }
|
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
||||||
CSceneViewport* Viewport() const;
|
CSceneViewport* Viewport() const;
|
||||||
|
|
||||||
@ -109,6 +113,7 @@ public slots:
|
|||||||
|
|
||||||
void ChangeEditMode(int Mode);
|
void ChangeEditMode(int Mode);
|
||||||
void ChangeEditMode(EWorldEditorMode Mode);
|
void ChangeEditMode(EWorldEditorMode Mode);
|
||||||
|
void SetRenderingMergedWorld(bool RenderMerged);
|
||||||
void OpenProjectSettings();
|
void OpenProjectSettings();
|
||||||
void OpenResourceBrowser();
|
void OpenResourceBrowser();
|
||||||
|
|
||||||
@ -121,6 +126,7 @@ public slots:
|
|||||||
void DeleteSelection();
|
void DeleteSelection();
|
||||||
|
|
||||||
void UpdateOpenRecentActions();
|
void UpdateOpenRecentActions();
|
||||||
|
void UpdateWindowTitle();
|
||||||
void UpdateStatusBar();
|
void UpdateStatusBar();
|
||||||
void UpdateGizmoUI();
|
void UpdateGizmoUI();
|
||||||
void UpdateSelectionUI();
|
void UpdateSelectionUI();
|
||||||
@ -128,8 +134,8 @@ public slots:
|
|||||||
void UpdateNewLinkLine();
|
void UpdateNewLinkLine();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
|
QPushButton* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
|
||||||
void SetSidebarWidget(QWidget *pWidget);
|
void SetSidebar(CWorldEditorSidebar *pSidebar);
|
||||||
void GizmoModeChanged(CGizmo::EGizmoMode Mode);
|
void GizmoModeChanged(CGizmo::EGizmoMode Mode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -149,7 +155,6 @@ private slots:
|
|||||||
void OnCameraSpeedChange(double Speed);
|
void OnCameraSpeedChange(double Speed);
|
||||||
void OnTransformSpinBoxModified(CVector3f Value);
|
void OnTransformSpinBoxModified(CVector3f Value);
|
||||||
void OnTransformSpinBoxEdited(CVector3f Value);
|
void OnTransformSpinBoxEdited(CVector3f Value);
|
||||||
void OnClosePoiEditDialog();
|
|
||||||
|
|
||||||
void SelectAllTriggered();
|
void SelectAllTriggered();
|
||||||
void InvertSelectionTriggered();
|
void InvertSelectionTriggered();
|
||||||
@ -172,7 +177,6 @@ private slots:
|
|||||||
void DecrementGizmo();
|
void DecrementGizmo();
|
||||||
void EditCollisionRenderSettings();
|
void EditCollisionRenderSettings();
|
||||||
void EditLayers();
|
void EditLayers();
|
||||||
void EditPoiToWorldMap();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MapChanged(CWorld *pNewWorld, CGameArea *pNewArea);
|
void MapChanged(CWorld *pNewWorld, CGameArea *pNewArea);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>%APP_FULL_NAME%</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
@ -342,7 +342,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="ActionResourceBrowser"/>
|
<addaction name="ActionResourceBrowser"/>
|
||||||
<addaction name="ActionEditLayers"/>
|
<addaction name="ActionEditLayers"/>
|
||||||
<addaction name="ActionEditPoiToWorldMap"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
@ -638,11 +637,6 @@
|
|||||||
<string>Ctrl+I</string>
|
<string>Ctrl+I</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="ActionEditPoiToWorldMap">
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit POI to World Map</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="ActionDelete">
|
<action name="ActionDelete">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<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"
|
#include "Editor/CEditorApplication.h"
|
||||||
|
|
||||||
CWorldInfoSidebar::CWorldInfoSidebar(CWorldEditor *pEditor)
|
CWorldInfoSidebar::CWorldInfoSidebar(CWorldEditor *pEditor)
|
||||||
: QWidget(pEditor)
|
: CWorldEditorSidebar(pEditor)
|
||||||
, mpUI(new Ui::CWorldInfoSidebar)
|
, mpUI(new Ui::CWorldInfoSidebar)
|
||||||
, mModel(pEditor)
|
, mModel(pEditor)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#include "CWorldEditorSidebar.h"
|
||||||
#include "CWorldTreeModel.h"
|
#include "CWorldTreeModel.h"
|
||||||
|
|
||||||
class CWorldEditor;
|
class CWorldEditor;
|
||||||
@ -11,7 +12,7 @@ namespace Ui {
|
|||||||
class CWorldInfoSidebar;
|
class CWorldInfoSidebar;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CWorldInfoSidebar : public QWidget
|
class CWorldInfoSidebar : public CWorldEditorSidebar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user