Update resource selectors when their asset is renamed, fixed default world editor split sizes, disabled model editor save button outside of MP1

This commit is contained in:
Aruki 2017-07-18 03:07:42 -06:00
parent db277d7a15
commit 16e310fb2f
9 changed files with 30 additions and 22 deletions

View File

@ -7,7 +7,7 @@ CCamera::CCamera()
: mMode(eFreeCamera)
, mPosition(0)
, mAspectRatio(1.7777777f)
, mYaw(Math::skHalfPi)
, mYaw(-Math::skHalfPi)
, mPitch(0.f)
, mMoveSpeed(1.f)
, mLookSpeed(1.f)
@ -26,7 +26,7 @@ CCamera::CCamera(CVector3f Position, CVector3f /*Target*/)
, mMoveSpeed(1.f)
, mLookSpeed(1.f)
, mPosition(Position)
, mYaw(Math::skHalfPi)
, mYaw(-Math::skHalfPi)
, mPitch(0.f)
{
}
@ -75,7 +75,7 @@ void CCamera::Zoom(float Amount)
void CCamera::Snap(CVector3f Position)
{
mPosition = Position;
mYaw = Math::skHalfPi;
mYaw = -Math::skHalfPi;
mPitch = 0.0f;
mTransformDirty = true;
mViewDirty = true;

View File

@ -34,6 +34,7 @@ CEditorApplication::~CEditorApplication()
void CEditorApplication::InitEditor()
{
mpResourceBrowser = new CResourceBrowser();
mpWorldEditor = new CWorldEditor();
mpProjectDialog = new CProjectSettingsDialog(mpWorldEditor);
mpWorldEditor->showMaximized();
@ -292,8 +293,3 @@ void CEditorApplication::OnEditorClose()
}
}
}
CResourceBrowser* CEditorApplication::ResourceBrowser() const
{
return mpWorldEditor->ResourceBrowser();
}

View File

@ -21,6 +21,7 @@ class CEditorApplication : public QApplication
CGameProject *mpActiveProject;
CWorldEditor *mpWorldEditor;
CResourceBrowser *mpResourceBrowser;
CProjectSettingsDialog *mpProjectDialog;
QVector<IEditor*> mEditorWindows;
QMap<CResourceEntry*,IEditor*> mEditingMap;
@ -44,7 +45,7 @@ public:
bool RebuildResourceDatabase();
CResourceBrowser* ResourceBrowser() const;
inline CResourceBrowser* ResourceBrowser() const { return mpResourceBrowser; }
// Accessors
inline CGameProject* ActiveProject() const { return mpActiveProject; }

View File

@ -31,6 +31,7 @@ CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
, mIgnoreSignals(false)
{
ui->setupUi(this);
ui->ActionSave->setEnabled( pModel->Game() == ePrime ); // we don't support saving games later than MP1
REPLACE_WINDOWTITLE_APPVARS;
ui->Viewport->SetNode(mpCurrentModelNode);

View File

@ -129,6 +129,9 @@ CResourceBrowser::CResourceBrowser(QWidget *pParent)
pGroup->addAction(pEdStoreAction);
#endif
// Resize splitter
mpUI->splitter->setSizes( QList<int>() << width() * 0.4 << width() * 0.6 );
// Create context menu for the resource table
new CResourceTableContextMenu(this, mpUI->ResourceTableView, mpModel, mpProxyModel);

View File

@ -66,6 +66,7 @@ CResourceSelector::CResourceSelector(QWidget *pParent /*= 0*/)
connect(mpResNameButton, SIGNAL(clicked()), this, SLOT(Find()));
connect(mpSelectButton, SIGNAL(clicked()), this, SLOT(Select()));
connect(mpClearButton, SIGNAL(clicked()), this, SLOT(Clear()));
connect(gpEdApp->ResourceBrowser(), SIGNAL(ResourceMoved(CResourceEntry*,CVirtualDirectory*,TString)), this, SLOT(OnResourceMoved(CResourceEntry*)));
// Set up context menu
mpEditAssetAction = new QAction("Edit", this);
@ -292,3 +293,9 @@ void CResourceSelector::OnResourceChanged()
UpdateUI();
emit ResourceChanged(mpResEntry);
}
void CResourceSelector::OnResourceMoved(CResourceEntry *pEntry)
{
if (pEntry == mpResEntry)
UpdateUI();
}

View File

@ -69,6 +69,7 @@ public slots:
void CopyName();
void CopyPath();
void OnResourceChanged();
void OnResourceMoved(CResourceEntry *pEntry);
void UpdateUI();
signals:

View File

@ -46,9 +46,19 @@ CWorldEditor::CWorldEditor(QWidget *parent)
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
// Add resource browser to the layout
QVBoxLayout *pLayout = new QVBoxLayout();
pLayout->setContentsMargins(0,0,0,0);
CResourceBrowser *pResourceBrowser = gpEdApp->ResourceBrowser();
//pResourceBrowser->setParent(this);
pLayout->addWidget( pResourceBrowser );
ui->ResourceBrowserContainer->setLayout(pLayout);
// Initialize splitter
QList<int> SplitterSizes;
SplitterSizes << width() * 0.775 << width() * 0.225;
SplitterSizes << width() * 0.25 << width() * 0.53 << width() * 0.22;
ui->splitter->setSizes(SplitterSizes);
// Initialize UI stuff
@ -332,11 +342,6 @@ bool CWorldEditor::HasAnyScriptNodesSelected() const
return false;
}
CResourceBrowser* CWorldEditor::ResourceBrowser() const
{
return ui->ResourceBrowser;
}
CSceneViewport* CWorldEditor::Viewport() const
{
return ui->MainViewport;

View File

@ -32,7 +32,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="CResourceBrowser" name="ResourceBrowser" native="true"/>
<widget class="QWidget" name="ResourceBrowserContainer" native="true"/>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
@ -786,12 +786,6 @@
<header>Editor/CSceneViewport.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>CResourceBrowser</class>
<extends>QWidget</extends>
<header>Editor/ResourceBrowser/CResourceBrowser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../Icons.qrc"/>