Added world/area info sections to the world info sidebar
This commit is contained in:
parent
009c42f281
commit
00a48e69f8
|
@ -96,6 +96,7 @@ public:
|
|||
// Accessors
|
||||
inline void SetProjectName(const TString& rkName) { mProjectName = rkName; }
|
||||
|
||||
inline TString Name() const { return mProjectName; }
|
||||
inline u32 NumPackages() const { return mPackages.size(); }
|
||||
inline CPackage* PackageByIndex(u32 Index) const { return mPackages[Index]; }
|
||||
inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
|
||||
|
|
|
@ -60,6 +60,24 @@ void CWorld::SetAreaLayerInfo(CGameArea *pArea)
|
|||
}
|
||||
}
|
||||
|
||||
TString CWorld::InGameName() const
|
||||
{
|
||||
if (mpWorldName)
|
||||
return mpWorldName->String("ENGL", 0).ToUTF8();
|
||||
else
|
||||
return Entry()->Name().ToUTF8();
|
||||
}
|
||||
|
||||
TString CWorld::AreaInGameName(u32 AreaIndex) const
|
||||
{
|
||||
const SArea& rkArea = mAreas[AreaIndex];
|
||||
|
||||
if (rkArea.pAreaName)
|
||||
return rkArea.pAreaName->String("ENGL", 0).ToUTF8();
|
||||
else
|
||||
return "!!" + rkArea.InternalName;
|
||||
}
|
||||
|
||||
// ************ SERIALIZATION ************
|
||||
void CWorld::Serialize(IArchive& rArc)
|
||||
{
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
void SetAreaLayerInfo(CGameArea *pArea);
|
||||
TString InGameName() const;
|
||||
TString AreaInGameName(u32 AreaIndex) const;
|
||||
|
||||
// Serialization
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
|
|
|
@ -109,7 +109,6 @@ HEADERS += \
|
|||
Widgets/WColorPicker.h \
|
||||
Widgets/WDraggableSpinBox.h \
|
||||
Widgets/WIntegralSpinBox.h \
|
||||
Widgets/WResourceSelector.h \
|
||||
Widgets/WScanPreviewPanel.h \
|
||||
Widgets/WStringPreviewPanel.h \
|
||||
Widgets/WTextureGLWidget.h \
|
||||
|
@ -198,7 +197,6 @@ SOURCES += \
|
|||
Widgets/WColorPicker.cpp \
|
||||
Widgets/WDraggableSpinBox.cpp \
|
||||
Widgets/WIntegralSpinBox.cpp \
|
||||
Widgets/WResourceSelector.cpp \
|
||||
Widgets/WScanPreviewPanel.cpp \
|
||||
Widgets/WStringPreviewPanel.cpp \
|
||||
Widgets/WTextureGLWidget.cpp \
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "ui_CModelEditorWindow.h"
|
||||
#include "Editor/UICommon.h"
|
||||
#include "Editor/Widgets/WColorPicker.h"
|
||||
#include "Editor/Widgets/WResourceSelector.h"
|
||||
|
||||
#include <Common/TString.h>
|
||||
#include <Core/Render/CDrawUtil.h>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Editor/Widgets/WColorPicker.h"
|
||||
#include "Editor/Widgets/WDraggableSpinBox.h"
|
||||
#include "Editor/Widgets/WIntegralSpinBox.h"
|
||||
#include "Editor/Widgets/WResourceSelector.h"
|
||||
|
||||
#include <Core/Resource/Script/IProperty.h>
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
|
@ -140,6 +139,8 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie
|
|||
case eAssetProperty:
|
||||
{
|
||||
CResourceSelector *pSelector = new CResourceSelector(pParent);
|
||||
pSelector->SetFrameVisible(false);
|
||||
|
||||
CAssetTemplate *pTemp = static_cast<CAssetTemplate*>(pProp->Template());
|
||||
pSelector->SetAllowedExtensions(pTemp->AllowedExtensions());
|
||||
|
||||
|
@ -598,6 +599,7 @@ QWidget* CPropertyDelegate::CreateCharacterEditor(QWidget *pParent, const QModel
|
|||
if (Type == eAssetProperty)
|
||||
{
|
||||
CResourceSelector *pSelector = new CResourceSelector(pParent);
|
||||
pSelector->SetFrameVisible(false);
|
||||
|
||||
if (Params.Version() <= eEchoes)
|
||||
pSelector->SetAllowedExtensions("ANCS");
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>189</width>
|
||||
<height>128</height>
|
||||
<height>126</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
CResourceSelector::CResourceSelector(QWidget *pParent /*= 0*/)
|
||||
: QWidget(pParent)
|
||||
, mpResEntry(nullptr)
|
||||
, mIsEditable(true)
|
||||
{
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
|
@ -35,13 +36,21 @@ CResourceSelector::CResourceSelector(QWidget *pParent /*= 0*/)
|
|||
mpClearButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
mpClearButton->setFixedSize(16, 16);
|
||||
|
||||
mpLayout = new QHBoxLayout(this);
|
||||
mpLayout->setSpacing(2);
|
||||
mpFrameLayout = new QHBoxLayout(this);
|
||||
mpFrameLayout->setSpacing(2);
|
||||
mpFrameLayout->setContentsMargins(3, 0, 0, 0);
|
||||
mpFrameLayout->addWidget(mpResNameLabel);
|
||||
mpFrameLayout->addWidget(mpSetButton);
|
||||
mpFrameLayout->addWidget(mpFindButton);
|
||||
mpFrameLayout->addWidget(mpClearButton);
|
||||
mpFrame = new QFrame(this);
|
||||
mpFrame->setBackgroundRole(QPalette::AlternateBase);
|
||||
mpFrame->setLayout(mpFrameLayout);
|
||||
SetFrameVisible(true);
|
||||
|
||||
mpLayout = new QVBoxLayout(this);
|
||||
mpLayout->addWidget(mpFrame);
|
||||
mpLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mpLayout->addWidget(mpResNameLabel);
|
||||
mpLayout->addWidget(mpSetButton);
|
||||
mpLayout->addWidget(mpFindButton);
|
||||
mpLayout->addWidget(mpClearButton);
|
||||
setLayout(mpLayout);
|
||||
|
||||
// UI Connections
|
||||
|
@ -63,6 +72,19 @@ CResourceSelector::CResourceSelector(QWidget *pParent /*= 0*/)
|
|||
UpdateUI();
|
||||
}
|
||||
|
||||
void CResourceSelector::SetFrameVisible(bool Visible)
|
||||
{
|
||||
mpFrame->setFrameStyle(Visible ? QFrame::StyledPanel : QFrame::NoFrame);
|
||||
mpFrame->setAutoFillBackground(Visible);
|
||||
}
|
||||
|
||||
void CResourceSelector::SetEditable(bool Editable)
|
||||
{
|
||||
mpSetButton->setVisible(Editable);
|
||||
mpClearButton->setVisible(Editable);
|
||||
mIsEditable = Editable;
|
||||
}
|
||||
|
||||
void CResourceSelector::UpdateUI()
|
||||
{
|
||||
bool HasResource = mpResEntry != nullptr;
|
||||
|
|
|
@ -12,9 +12,12 @@ class CResourceSelector : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
CResourceEntry *mpResEntry;
|
||||
bool mIsEditable;
|
||||
|
||||
// UI
|
||||
QHBoxLayout *mpLayout;
|
||||
QVBoxLayout *mpLayout;
|
||||
QHBoxLayout *mpFrameLayout;
|
||||
QFrame *mpFrame;
|
||||
QLabel *mpResNameLabel;
|
||||
QPushButton *mpSetButton;
|
||||
QPushButton *mpFindButton;
|
||||
|
@ -27,6 +30,8 @@ class CResourceSelector : public QWidget
|
|||
|
||||
public:
|
||||
explicit CResourceSelector(QWidget *pParent = 0);
|
||||
void SetFrameVisible(bool Visible);
|
||||
void SetEditable(bool Editable);
|
||||
void SetAllowedExtensions(const QString& rkExtension);
|
||||
void SetAllowedExtensions(const TStringList& rkExtensions);
|
||||
void SetResource(const CAssetID& rkID);
|
||||
|
@ -35,6 +40,7 @@ public:
|
|||
|
||||
// Accessors
|
||||
inline CResourceEntry* Entry() const { return mpResEntry; }
|
||||
inline bool IsEditable() const { return mIsEditable; }
|
||||
|
||||
public slots:
|
||||
void CreateContextMenu(const QPoint& rkPoint);
|
||||
|
|
|
@ -1,286 +0,0 @@
|
|||
#include "WResourceSelector.h"
|
||||
#include "WTexturePreviewPanel.h"
|
||||
#include "Editor/UICommon.h"
|
||||
#include <Core/GameProject/CResourceStore.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCompleter>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDirModel>
|
||||
#include <QEvent>
|
||||
#include <QFileDialog>
|
||||
|
||||
WResourceSelector::WResourceSelector(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
// Preview Panel Members
|
||||
, mpPreviewPanel(nullptr)
|
||||
, mEnablePreviewPanel(true)
|
||||
, mPreviewPanelValid(false)
|
||||
, mShowingPreviewPanel(false)
|
||||
, mAdjustPreviewToParent(false)
|
||||
// Resource Members
|
||||
, mpResource(nullptr)
|
||||
, mResourceValid(false)
|
||||
{
|
||||
// Create Widgets
|
||||
mUI.LineEdit = new QLineEdit(this);
|
||||
mUI.BrowseButton = new QPushButton(this);
|
||||
|
||||
// Create Layout
|
||||
mUI.Layout = new QHBoxLayout(this);
|
||||
setLayout(mUI.Layout);
|
||||
mUI.Layout->addWidget(mUI.LineEdit);
|
||||
mUI.Layout->addWidget(mUI.BrowseButton);
|
||||
mUI.Layout->setContentsMargins(0,0,0,0);
|
||||
mUI.Layout->setSpacing(1);
|
||||
|
||||
// Set Up Widgets
|
||||
mUI.LineEdit->installEventFilter(this);
|
||||
mUI.LineEdit->setMouseTracking(true);
|
||||
mUI.LineEdit->setMaximumHeight(23);
|
||||
mUI.LineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
mUI.BrowseButton->installEventFilter(this);
|
||||
mUI.BrowseButton->setMouseTracking(true);
|
||||
mUI.BrowseButton->setText("...");
|
||||
mUI.BrowseButton->setMaximumSize(25, 23);
|
||||
mUI.BrowseButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
connect(mUI.LineEdit, SIGNAL(editingFinished()), this, SLOT(OnLineEditTextEdited()));
|
||||
connect(mUI.BrowseButton, SIGNAL(clicked()), this, SLOT(OnBrowseButtonClicked()));
|
||||
}
|
||||
|
||||
WResourceSelector::~WResourceSelector()
|
||||
{
|
||||
delete mpPreviewPanel;
|
||||
}
|
||||
|
||||
bool WResourceSelector::event(QEvent *pEvent)
|
||||
{
|
||||
if ((pEvent->type() == QEvent::Leave) || (pEvent->type() == QEvent::WindowDeactivate))
|
||||
HidePreviewPanel();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WResourceSelector::eventFilter(QObject* /*pObj*/, QEvent *pEvent)
|
||||
{
|
||||
if (pEvent->type() == QEvent::MouseMove)
|
||||
if (mEnablePreviewPanel)
|
||||
ShowPreviewPanel();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WResourceSelector::IsSupportedExtension(const QString& rkExtension)
|
||||
{
|
||||
foreach(const QString& rkStr, mSupportedExtensions)
|
||||
if (rkStr == rkExtension) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WResourceSelector::HasSupportedExtension(CResourceEntry *pEntry)
|
||||
{
|
||||
return IsSupportedExtension(TO_QSTRING(pEntry->CookedExtension().ToString()));
|
||||
}
|
||||
|
||||
void WResourceSelector::UpdateFrameColor()
|
||||
{
|
||||
// Red frame should only display if the current path is either invalid or points to an entry of an invalid type.
|
||||
bool RedFrame = (!GetText().isEmpty() && !mpResource) || (mpResource && !mResourceValid);
|
||||
mUI.LineEdit->setStyleSheet(RedFrame ? "border: 1px solid red" : "");
|
||||
mUI.LineEdit->setFont(font());
|
||||
}
|
||||
|
||||
// ************ GETTERS ************
|
||||
CResourceEntry* WResourceSelector::GetResourceEntry()
|
||||
{
|
||||
return mpResource;
|
||||
}
|
||||
|
||||
CResource* WResourceSelector::GetResource()
|
||||
{
|
||||
return mpResource->Load();
|
||||
}
|
||||
|
||||
QString WResourceSelector::GetText()
|
||||
{
|
||||
return mUI.LineEdit->text();
|
||||
}
|
||||
|
||||
bool WResourceSelector::IsPreviewPanelEnabled()
|
||||
{
|
||||
return mEnablePreviewPanel;
|
||||
}
|
||||
|
||||
// ************ SETTERS ************
|
||||
void WResourceSelector::SetResource(CResource *pRes)
|
||||
{
|
||||
SetResource(pRes ? pRes->Entry() : nullptr);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetResource(CResourceEntry *pRes)
|
||||
{
|
||||
if (mpResource != pRes)
|
||||
{
|
||||
mpResource = pRes;
|
||||
|
||||
// We might prefer to have the line edit be cleared if pRes is null. However atm this function triggers
|
||||
// when the user types in a resource path so I'd prefer for the text not to be cleared out in that case
|
||||
if (mpResource)
|
||||
{
|
||||
TWideString Path = mpResource->CookedAssetPath(true);
|
||||
mUI.LineEdit->setText(TO_QSTRING(Path));
|
||||
mResourceValid = HasSupportedExtension(mpResource);
|
||||
}
|
||||
else
|
||||
mResourceValid = false;
|
||||
|
||||
UpdateFrameColor();
|
||||
CreatePreviewPanel();
|
||||
emit ResourceChanged(mpResource);
|
||||
}
|
||||
}
|
||||
|
||||
void WResourceSelector::SetResource(const CAssetID& rkID)
|
||||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(rkID);
|
||||
SetResource(pEntry);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetResource(const QString& rkRes)
|
||||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(TO_TWIDESTRING(rkRes));
|
||||
SetResource(pEntry);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetAllowedExtensions(const QString& rkExtension)
|
||||
{
|
||||
TStringList list = TString(rkExtension.toStdString()).Split(",");
|
||||
SetAllowedExtensions(list);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetAllowedExtensions(const TStringList& rkExtensions)
|
||||
{
|
||||
mSupportedExtensions.clear();
|
||||
for (auto it = rkExtensions.begin(); it != rkExtensions.end(); it++)
|
||||
mSupportedExtensions << TO_QSTRING(*it);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetText(const QString& rkResPath)
|
||||
{
|
||||
mUI.LineEdit->setText(rkResPath);
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(TO_TWIDESTRING(rkResPath));
|
||||
SetResource(pEntry);
|
||||
}
|
||||
|
||||
void WResourceSelector::SetPreviewPanelEnabled(bool Enabled)
|
||||
{
|
||||
mEnablePreviewPanel = Enabled;
|
||||
if (!mPreviewPanelValid) CreatePreviewPanel();
|
||||
}
|
||||
|
||||
void WResourceSelector::AdjustPreviewToParent(bool Adjust)
|
||||
{
|
||||
mAdjustPreviewToParent = Adjust;
|
||||
}
|
||||
|
||||
// ************ SLOTS ************
|
||||
void WResourceSelector::OnLineEditTextEdited()
|
||||
{
|
||||
SetResource(mUI.LineEdit->text());
|
||||
}
|
||||
|
||||
void WResourceSelector::OnBrowseButtonClicked()
|
||||
{
|
||||
// Construct filter string
|
||||
QString Filter;
|
||||
|
||||
if (mSupportedExtensions.size() > 1)
|
||||
{
|
||||
QString All = "All allowed extensions (";
|
||||
|
||||
for (int iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
|
||||
{
|
||||
if (iExt > 0) All += " ";
|
||||
All += "*." + mSupportedExtensions[iExt];
|
||||
}
|
||||
All += ")";
|
||||
Filter += All + ";;";
|
||||
}
|
||||
|
||||
for (int iExt = 0; iExt < mSupportedExtensions.size(); iExt++)
|
||||
{
|
||||
if (iExt > 0) Filter += ";;";
|
||||
Filter += UICommon::ExtensionFilterString(mSupportedExtensions[iExt]);
|
||||
}
|
||||
|
||||
QString NewRes = UICommon::OpenFileDialog(this, "Select resource", Filter);
|
||||
|
||||
if (!NewRes.isEmpty())
|
||||
{
|
||||
mUI.LineEdit->setText(NewRes);
|
||||
SetResource(NewRes);
|
||||
}
|
||||
}
|
||||
|
||||
// ************ PRIVATE ************
|
||||
void WResourceSelector::CreatePreviewPanel()
|
||||
{
|
||||
delete mpPreviewPanel;
|
||||
mpPreviewPanel = nullptr;
|
||||
|
||||
if (mResourceValid)
|
||||
mpPreviewPanel = IPreviewPanel::CreatePanel(mpResource->ResourceType(), this);
|
||||
|
||||
if (!mpPreviewPanel) mPreviewPanelValid = false;
|
||||
|
||||
else
|
||||
{
|
||||
mPreviewPanelValid = true;
|
||||
mpPreviewPanel->setWindowFlags(Qt::ToolTip);
|
||||
if (mResourceValid) mpPreviewPanel->SetResource(mpResource->Load());
|
||||
}
|
||||
}
|
||||
|
||||
void WResourceSelector::ShowPreviewPanel()
|
||||
{
|
||||
if (mPreviewPanelValid)
|
||||
{
|
||||
// Preferred panel point is lower-right, but can move if there's not enough room
|
||||
QPoint Position = parentWidget()->mapToGlobal(pos());
|
||||
QRect ScreenResolution = QApplication::desktop()->screenGeometry();
|
||||
QSize PanelSize = mpPreviewPanel->size();
|
||||
QPoint PanelPoint = Position;
|
||||
|
||||
// Calculate parent adjustment with 9 pixels of buffer
|
||||
int ParentAdjustLeft = (mAdjustPreviewToParent ? pos().x() + 9 : 0);
|
||||
int ParentAdjustRight = (mAdjustPreviewToParent ? parentWidget()->width() - pos().x() + 9 : 0);
|
||||
|
||||
// Is there enough space on the right?
|
||||
if (Position.x() + width() + PanelSize.width() + ParentAdjustRight >= ScreenResolution.width())
|
||||
PanelPoint.rx() -= PanelSize.width() + ParentAdjustLeft;
|
||||
else
|
||||
PanelPoint.rx() += width() + ParentAdjustRight;
|
||||
|
||||
// Is there enough space on the bottom?
|
||||
if (Position.y() + PanelSize.height() >= ScreenResolution.height() - 30)
|
||||
{
|
||||
int Difference = Position.y() + PanelSize.height() - ScreenResolution.height() + 30;
|
||||
PanelPoint.ry() -= Difference;
|
||||
}
|
||||
|
||||
mpPreviewPanel->move(PanelPoint);
|
||||
mpPreviewPanel->show();
|
||||
mShowingPreviewPanel = true;
|
||||
}
|
||||
}
|
||||
|
||||
void WResourceSelector::HidePreviewPanel()
|
||||
{
|
||||
if (mPreviewPanelValid && mShowingPreviewPanel)
|
||||
{
|
||||
mpPreviewPanel->hide();
|
||||
mShowingPreviewPanel = false;
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
#ifndef WRESOURCESELECTOR_H
|
||||
#define WRESOURCESELECTOR_H
|
||||
|
||||
#include "IPreviewPanel.h"
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Core/Resource/EResType.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
class WResourceSelector : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// Selector
|
||||
QStringList mSupportedExtensions;
|
||||
|
||||
// Preview Panel
|
||||
IPreviewPanel *mpPreviewPanel;
|
||||
bool mEnablePreviewPanel;
|
||||
bool mPreviewPanelValid;
|
||||
bool mShowingPreviewPanel;
|
||||
bool mAdjustPreviewToParent;
|
||||
|
||||
// Resource
|
||||
CResourceEntry *mpResource;
|
||||
bool mResourceValid;
|
||||
|
||||
// UI
|
||||
struct {
|
||||
QLineEdit *LineEdit;
|
||||
QPushButton *BrowseButton;
|
||||
QHBoxLayout *Layout;
|
||||
} mUI;
|
||||
|
||||
// Functions
|
||||
signals:
|
||||
void ResourceChanged(CResourceEntry *pNewRes);
|
||||
|
||||
public:
|
||||
explicit WResourceSelector(QWidget *pParent = 0);
|
||||
~WResourceSelector();
|
||||
bool event(QEvent *);
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
bool IsSupportedExtension(const QString& rkExtension);
|
||||
bool HasSupportedExtension(CResourceEntry *pEntry);
|
||||
void UpdateFrameColor();
|
||||
|
||||
// Getters
|
||||
CResourceEntry* GetResourceEntry();
|
||||
CResource* GetResource();
|
||||
QString GetText();
|
||||
bool IsPreviewPanelEnabled();
|
||||
|
||||
// Setters
|
||||
void SetResource(CResource *pRes);
|
||||
void SetResource(CResourceEntry *pEntry);
|
||||
void SetResource(const CAssetID& rkID);
|
||||
void SetResource(const QString& rkResPath);
|
||||
void SetAllowedExtensions(const QString& rkExtension);
|
||||
void SetAllowedExtensions(const QStringList& rkExtensions);
|
||||
void SetAllowedExtensions(const TStringList& rkExtensions);
|
||||
void SetText(const QString& rkResPath);
|
||||
void SetPreviewPanelEnabled(bool Enabled);
|
||||
void AdjustPreviewToParent(bool Adjust);
|
||||
|
||||
// Slots
|
||||
public slots:
|
||||
void OnLineEditTextEdited();
|
||||
void OnBrowseButtonClicked();
|
||||
|
||||
private:
|
||||
void CreatePreviewPanel();
|
||||
void ShowPreviewPanel();
|
||||
void HidePreviewPanel();
|
||||
};
|
||||
|
||||
#endif // WRESOURCESELECTOR_H
|
|
@ -118,6 +118,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||
{
|
||||
QAction *pAction = new QAction(this);
|
||||
pAction->setVisible(false);
|
||||
pAction->setData((int) iAct);
|
||||
connect(pAction, SIGNAL(triggered(bool)), this, SLOT(OpenRecentProject()));
|
||||
|
||||
mpOpenRecentMenu->addAction(pAction);
|
||||
|
|
|
@ -16,8 +16,34 @@ CWorldInfoSidebar::CWorldInfoSidebar(CWorldEditor *pEditor)
|
|||
QHeaderView *pHeader = mpUI->WorldTreeView->header();
|
||||
pHeader->resizeSection(0, pHeader->width() * 2); // I really have no idea how this works, I just got this from trial & error
|
||||
|
||||
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(OnActiveProjectChanged(CGameProject*)));
|
||||
connect(mpUI->AreaSearchLineEdit, SIGNAL(StoppedTyping(QString)), this, SLOT(OnAreaFilterStringChanged(QString)));
|
||||
connect(mpUI->WorldTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(OnWorldTreeClicked(QModelIndex)));
|
||||
connect(mpUI->WorldTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnWorldTreeDoubleClicked(QModelIndex)));
|
||||
|
||||
// Set up UI for world/area info; disable editing for now
|
||||
mpUI->ProjectInfoWidget->setHidden(true);
|
||||
mpUI->WorldInfoWidget->setHidden(true);
|
||||
mpUI->AreaInfoWidget->setHidden(true);
|
||||
|
||||
QSizePolicy SizePolicy = mpUI->WorldInfoWidget->sizePolicy();
|
||||
SizePolicy.setRetainSizeWhenHidden(true);
|
||||
mpUI->WorldInfoWidget->setSizePolicy(SizePolicy);
|
||||
|
||||
SizePolicy = mpUI->AreaInfoWidget->sizePolicy();
|
||||
SizePolicy.setRetainSizeWhenHidden(true);
|
||||
mpUI->AreaInfoWidget->setSizePolicy(SizePolicy);
|
||||
|
||||
mpUI->WorldSelector->SetEditable(false);
|
||||
mpUI->WorldNameSelector->SetEditable(false);
|
||||
mpUI->DarkWorldNameStringLabel->setHidden(true);
|
||||
mpUI->DarkWorldNameSelector->SetEditable(false);
|
||||
mpUI->DarkWorldNameSelector->setHidden(true);
|
||||
mpUI->SkySelector->SetEditable(false);
|
||||
|
||||
mpUI->AreaNameLineEdit->setEnabled(false);
|
||||
mpUI->AreaSelector->SetEditable(false);
|
||||
mpUI->AreaNameSelector->SetEditable(false);
|
||||
}
|
||||
|
||||
CWorldInfoSidebar::~CWorldInfoSidebar()
|
||||
|
@ -26,6 +52,19 @@ CWorldInfoSidebar::~CWorldInfoSidebar()
|
|||
}
|
||||
|
||||
// ************ SLOTS ************
|
||||
void CWorldInfoSidebar::OnActiveProjectChanged(CGameProject *pProj)
|
||||
{
|
||||
mpUI->ProjectInfoWidget->setHidden( pProj == nullptr );
|
||||
mpUI->WorldInfoWidget->setHidden(true);
|
||||
mpUI->AreaInfoWidget->setHidden(true);
|
||||
|
||||
bool IsEchoes = pProj && (pProj->Game() == eEchoesDemo || pProj->Game() == eEchoes);
|
||||
mpUI->GameNameLabel->setText( pProj ? TO_QSTRING(pProj->Name()) : "" );
|
||||
mpUI->DarkWorldNameStringLabel->setHidden(!IsEchoes);
|
||||
mpUI->DarkWorldNameSelector->setHidden(!IsEchoes);
|
||||
ClearWorldInfo();
|
||||
}
|
||||
|
||||
void CWorldInfoSidebar::OnAreaFilterStringChanged(const QString& rkFilter)
|
||||
{
|
||||
mProxyModel.SetFilterString(rkFilter);
|
||||
|
@ -42,6 +81,43 @@ void CWorldInfoSidebar::OnAreaFilterStringChanged(const QString& rkFilter)
|
|||
}
|
||||
}
|
||||
|
||||
void CWorldInfoSidebar::OnWorldTreeClicked(QModelIndex Index)
|
||||
{
|
||||
QModelIndex RealIndex = mProxyModel.mapToSource(Index);
|
||||
|
||||
// Fill in world info
|
||||
mpUI->WorldInfoWidget->setHidden(false);
|
||||
|
||||
CWorld *pWorld = mModel.WorldForIndex(RealIndex);
|
||||
mpUI->WorldNameLabel->setText( TO_QSTRING(pWorld->InGameName()) );
|
||||
mpUI->WorldSelector->SetResource(pWorld);
|
||||
mpUI->WorldNameSelector->SetResource(pWorld->WorldName());
|
||||
mpUI->DarkWorldNameSelector->SetResource(pWorld->DarkWorldName());
|
||||
mpUI->SkySelector->SetResource(pWorld->DefaultSkybox());
|
||||
|
||||
// Fill in area info
|
||||
bool IsArea = !mModel.IndexIsWorld(RealIndex);
|
||||
mpUI->AreaInfoWidget->setHidden(!IsArea);
|
||||
|
||||
if (IsArea)
|
||||
{
|
||||
int AreaIndex = mModel.AreaIndexForIndex(RealIndex);
|
||||
mpUI->AreaNameLabel->setText( TO_QSTRING(pWorld->AreaInGameName(AreaIndex)) );
|
||||
mpUI->AreaSelector->SetResource( pWorld->AreaResourceID(AreaIndex) );
|
||||
mpUI->AreaNameLineEdit->setText( TO_QSTRING(pWorld->AreaInternalName(AreaIndex)) );
|
||||
mpUI->AreaNameSelector->SetResource( pWorld->AreaName(AreaIndex) );
|
||||
|
||||
mpUI->AttachedAreasList->clear();
|
||||
|
||||
for (u32 iAtt = 0; iAtt < pWorld->AreaAttachedCount(AreaIndex); iAtt++)
|
||||
{
|
||||
u32 AttachedIdx = pWorld->AreaAttachedID(AreaIndex, iAtt);
|
||||
QString Name = TO_QSTRING( pWorld->AreaInGameName(AttachedIdx) );
|
||||
mpUI->AttachedAreasList->addItem(Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldInfoSidebar::OnWorldTreeDoubleClicked(QModelIndex Index)
|
||||
{
|
||||
QModelIndex RealIndex = mProxyModel.mapToSource(Index);
|
||||
|
@ -53,3 +129,22 @@ void CWorldInfoSidebar::OnWorldTreeDoubleClicked(QModelIndex Index)
|
|||
gpEdApp->WorldEditor()->SetArea(pWorld, AreaIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldInfoSidebar::ClearWorldInfo()
|
||||
{
|
||||
mpUI->WorldNameLabel->clear();
|
||||
mpUI->WorldSelector->Clear();
|
||||
mpUI->WorldNameSelector->Clear();
|
||||
mpUI->DarkWorldNameSelector->Clear();
|
||||
mpUI->SkySelector->Clear();
|
||||
ClearAreaInfo();
|
||||
}
|
||||
|
||||
void CWorldInfoSidebar::ClearAreaInfo()
|
||||
{
|
||||
mpUI->AreaNameLabel->clear();
|
||||
mpUI->AreaSelector->Clear();
|
||||
mpUI->AreaNameLineEdit->clear();
|
||||
mpUI->AreaNameSelector->Clear();
|
||||
mpUI->AttachedAreasList->clear();
|
||||
}
|
||||
|
|
|
@ -24,8 +24,12 @@ public:
|
|||
~CWorldInfoSidebar();
|
||||
|
||||
public slots:
|
||||
void OnActiveProjectChanged(CGameProject *pProj);
|
||||
void OnAreaFilterStringChanged(const QString& rkFilter);
|
||||
void OnWorldTreeClicked(QModelIndex Index);
|
||||
void OnWorldTreeDoubleClicked(QModelIndex Index);
|
||||
void ClearWorldInfo();
|
||||
void ClearAreaInfo();
|
||||
};
|
||||
|
||||
#endif // CWORLDINFOSIDEBAR_H
|
||||
|
|
|
@ -7,13 +7,40 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>314</width>
|
||||
<height>585</height>
|
||||
<height>670</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="ProjectInfoWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="GameNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GAME NAME</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CTimedLineEdit" name="AreaSearchLineEdit">
|
||||
<property name="font">
|
||||
|
@ -34,6 +61,12 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="WorldTreeView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
|
@ -55,18 +88,250 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="WorldInfoWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="WorldNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>WORLD NAME</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="WorldLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>World:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="CResourceSelector" name="WorldSelector" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="WorldNameStringLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name String:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="CResourceSelector" name="WorldNameSelector" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="DarkWorldNameStringLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dark World Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="CResourceSelector" name="DarkWorldNameSelector" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="WorldSkyLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default Sky:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="CResourceSelector" name="SkySelector" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="AreaInfoWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="AreaNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AREA NAME</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="AreaInternalNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="AreaNameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="AreaLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Area:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="CResourceSelector" name="AreaSelector" native="true">
|
||||
<zorder>AreaNameLineEdit</zorder>
|
||||
<zorder>AreaInternalNameLabel</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="AreaNameStringLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name String:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="CResourceSelector" name="AreaNameSelector" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="AttachedAreasLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Attached Areas</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="AttachedAreasList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTimedLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Editor/Widgets/CTimedLineEdit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CResourceSelector</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Editor/Widgets/CResourceSelector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue