Added scan editor

This commit is contained in:
Aruki 2019-01-27 16:49:51 -07:00
parent e2d554ae8b
commit 246784926f
6 changed files with 170 additions and 6 deletions

View File

@ -5,6 +5,7 @@
#include "CProjectSettingsDialog.h"
#include "Editor/CharacterEditor/CCharacterEditor.h"
#include "Editor/ModelEditor/CModelEditorWindow.h"
#include "Editor/ScanEditor/CScanEditor.h"
#include "Editor/StringEditor/CStringEditor.h"
#include "Editor/ResourceBrowser/CResourceBrowser.h"
#include "Editor/WorldEditor/CWorldEditor.h"
@ -154,6 +155,10 @@ void CEditorApplication::EditResource(CResourceEntry *pEntry)
pEd = new CCharacterEditor((CAnimSet*) pRes, mpWorldEditor);
break;
case EResourceType::Scan:
pEd = new CScanEditor((CScan*) pRes, mpWorldEditor);
break;
case EResourceType::StringTable:
pEd = new CStringEditor((CStringTable*) pRes, mpWorldEditor);
break;

View File

@ -202,7 +202,8 @@ HEADERS += \
CTweakEditor.h \
Undo/CEditIntrinsicPropertyCommand.h \
Undo/TSerializeUndoCommand.h \
StringEditor/CStringMimeData.h
StringEditor/CStringMimeData.h \
ScanEditor/CScanEditor.h
# Source Files
SOURCES += \
@ -277,7 +278,8 @@ SOURCES += \
StringEditor/CStringListModel.cpp \
IEditor.cpp \
StringEditor/CStringDelegate.cpp \
CTweakEditor.cpp
CTweakEditor.cpp \
ScanEditor/CScanEditor.cpp
# UI Files
FORMS += \
@ -304,7 +306,8 @@ FORMS += \
Widgets/CSelectResourcePanel.ui \
CGeneratePropertyNamesDialog.ui \
StringEditor/CStringEditor.ui \
CTweakEditor.ui
CTweakEditor.ui \
ScanEditor/CScanEditor.ui
# Codegen
CODEGEN_DIR = $$EXTERNALS_DIR/CodeGen

View File

@ -0,0 +1,22 @@
#include "CScanEditor.h"
#include "ui_CScanEditor.h"
CScanEditor::CScanEditor(CScan* pScan, QWidget* pParent /*= 0*/)
: IEditor(pParent)
, mpUI(new Ui::CScanEditor)
, mpScan(pScan)
{
mpUI->setupUi(this);
mpUI->PropertyView->SetIntrinsicProperties(pScan->ScanData());
mpUI->ToolBar->addSeparator();
AddUndoActions(mpUI->ToolBar);
QString WindowTitle = "%APP_FULL_NAME% - Scan Editor - %1[*]";
WindowTitle = WindowTitle.arg( TO_QSTRING(mpScan->Entry()->CookedAssetPath(true).GetFileName()) );
SET_WINDOWTITLE_APPVARS(WindowTitle);
}
CScanEditor::~CScanEditor()
{
delete mpUI;
}

View File

@ -0,0 +1,26 @@
#ifndef CSCANEDITOR_H
#define CSCANEDITOR_H
#include "Editor/IEditor.h"
#include <Core/Resource/Scan/CScan.h>
namespace Ui {
class CScanEditor;
}
class CScanEditor : public IEditor
{
Q_OBJECT
/** Qt UI */
Ui::CScanEditor* mpUI;
/** Scan asset being edited */
TResPtr<CScan> mpScan;
public:
explicit CScanEditor(CScan* pScan, QWidget* pParent = 0);
~CScanEditor();
};
#endif // CSCANEDITOR_H

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CScanEditor</class>
<widget class="QMainWindow" name="CScanEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>644</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<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="CPropertyView" name="PropertyView">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DropOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QToolBar" name="ToolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="ActionSave"/>
<addaction name="ActionSaveAndCook"/>
</widget>
<action name="ActionSave">
<property name="icon">
<iconset resource="../Icons.qrc">
<normaloff>:/icons/Save.png</normaloff>:/icons/Save.png</iconset>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="toolTip">
<string>Save</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="ActionSaveAndCook">
<property name="icon">
<iconset resource="../Icons.qrc">
<normaloff>:/icons/SaveAndRepack_32px.png</normaloff>:/icons/SaveAndRepack_32px.png</iconset>
</property>
<property name="text">
<string>Save and Cook</string>
</property>
<property name="toolTip">
<string>Save and Cook</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>CPropertyView</class>
<extends>QTreeView</extends>
<header>Editor/PropertyEdit/CPropertyView.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../Icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -132,9 +132,6 @@ void CStringEditor::InitUI()
connect( mpUI->AddStringButton, SIGNAL(pressed()), this, SLOT(OnAddString()) );
connect( mpUI->RemoveStringButton, SIGNAL(pressed()), this, SLOT(OnRemoveString()) );
connect( mpListModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
this, SLOT(OnRowsMoved(QModelIndex,int,int,QModelIndex,int)) );
connect( mpUI->ActionSave, SIGNAL(triggered(bool)), this, SLOT(Save()) );
connect( mpUI->ActionSaveAndCook, SIGNAL(triggered(bool)), this, SLOT(SaveAndRepack()) );