Rename inspector
This commit is contained in:
parent
b5bbd15bd8
commit
4a01dab006
5 changed files with 32 additions and 32 deletions
|
@ -1,7 +1,7 @@
|
||||||
set(INCLUDE_FILES
|
set(INCLUDE_FILES
|
||||||
include/mainwindow.h
|
include/mainwindow.h
|
||||||
include/hierarchy.h
|
include/hierarchy.h
|
||||||
include/inspector.h)
|
include/properties.h)
|
||||||
|
|
||||||
qt5_wrap_cpp(EDITOR_SRC ${INCLUDE_FILES})
|
qt5_wrap_cpp(EDITOR_SRC ${INCLUDE_FILES})
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ add_executable(LevelEditor
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/mainwindow.cpp
|
src/mainwindow.cpp
|
||||||
src/hierarchy.cpp
|
src/hierarchy.cpp
|
||||||
src/inspector.cpp
|
src/properties.cpp
|
||||||
${EDITOR_SRC})
|
${EDITOR_SRC})
|
||||||
target_include_directories(LevelEditor PRIVATE include)
|
target_include_directories(LevelEditor PRIVATE include)
|
||||||
target_link_libraries(LevelEditor Qt5::Widgets Engine ToolWindowManager EditorCommon)
|
target_link_libraries(LevelEditor Qt5::Widgets Engine ToolWindowManager EditorCommon)
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void addSceneView();
|
void addSceneView();
|
||||||
void addHierarchy();
|
void addHierarchy();
|
||||||
void addInspector();
|
void addProperties();
|
||||||
|
|
||||||
Context& context;
|
Context& context;
|
||||||
ToolWindowManager* manager = nullptr;
|
ToolWindowManager* manager = nullptr;
|
||||||
|
|
|
@ -9,18 +9,18 @@ struct TransformComponent;
|
||||||
struct MeshComponent;
|
struct MeshComponent;
|
||||||
struct LightComponent;
|
struct LightComponent;
|
||||||
|
|
||||||
class Inspector : public QWidget {
|
class Properties : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Inspector(Context& context, QWidget* parent = nullptr);
|
Properties(Context& context, QWidget* parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void rebuild();
|
void rebuild();
|
||||||
|
|
||||||
void addInfoInspector(InfoComponent* info);
|
void addInfoSection(InfoComponent* info);
|
||||||
void addTransformInspector(TransformComponent* transform);
|
void addTransformSection(TransformComponent* transform);
|
||||||
void addMeshInspector(MeshComponent* mesh);
|
void addMeshSection(MeshComponent* mesh);
|
||||||
void addLightInspector(LightComponent* light);
|
void addLightSection(LightComponent* light);
|
||||||
|
|
||||||
QVBoxLayout* layout = nullptr;
|
QVBoxLayout* layout = nullptr;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "renderwindow.h"
|
#include "renderwindow.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "hierarchy.h"
|
#include "hierarchy.h"
|
||||||
#include "inspector.h"
|
#include "properties.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(Context& context) : context(context) {
|
MainWindow::MainWindow(Context& context) : context(context) {
|
||||||
setWindowTitle("Level Editor");
|
setWindowTitle("Level Editor");
|
||||||
|
@ -124,10 +124,10 @@ MainWindow::MainWindow(Context& context) : context(context) {
|
||||||
addHierarchy->setIcon(QIcon::fromTheme("view-sort-ascending"));
|
addHierarchy->setIcon(QIcon::fromTheme("view-sort-ascending"));
|
||||||
newViewMenu->addAction(addHierarchy);
|
newViewMenu->addAction(addHierarchy);
|
||||||
|
|
||||||
QAction* addInspector = new QAction("Inspector");
|
QAction* addProperties = new QAction("Properties");
|
||||||
connect(addInspector, &QAction::triggered, this, &MainWindow::addInspector);
|
connect(addProperties, &QAction::triggered, this, &MainWindow::addProperties);
|
||||||
addInspector->setIcon(QIcon::fromTheme("edit-cut"));
|
addProperties->setIcon(QIcon::fromTheme("document-properties"));
|
||||||
newViewMenu->addAction(addInspector);
|
newViewMenu->addAction(addProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainMenuBar->addSeparator();
|
mainMenuBar->addSeparator();
|
||||||
|
@ -144,7 +144,7 @@ MainWindow::MainWindow(Context& context) : context(context) {
|
||||||
|
|
||||||
addSceneView();
|
addSceneView();
|
||||||
addHierarchy();
|
addHierarchy();
|
||||||
addInspector();
|
addProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addSceneView() {
|
void MainWindow::addSceneView() {
|
||||||
|
@ -164,9 +164,9 @@ void MainWindow::addHierarchy() {
|
||||||
manager->addToolWindow(hierarchy, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
|
manager->addToolWindow(hierarchy, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addInspector() {
|
void MainWindow::addProperties() {
|
||||||
Inspector* inspector = new Inspector(context);
|
Properties* properties = new Properties(context);
|
||||||
|
|
||||||
manager->addToolWindow(inspector, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
|
manager->addToolWindow(properties, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "inspector.h"
|
#include "properties.h"
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -12,9 +12,9 @@
|
||||||
#include "collapsesection.h"
|
#include "collapsesection.h"
|
||||||
#include "coloredit.h"
|
#include "coloredit.h"
|
||||||
|
|
||||||
Inspector::Inspector(Context& context, QWidget* parent) : QWidget(parent), context(context) {
|
Properties::Properties(Context& context, QWidget* parent) : QWidget(parent), context(context) {
|
||||||
setWindowTitle("Inspector");
|
setWindowTitle("Properties");
|
||||||
setWindowIcon(QIcon::fromTheme("edit-cut"));
|
setWindowIcon(QIcon::fromTheme("document-properties"));
|
||||||
|
|
||||||
layout = new QVBoxLayout();
|
layout = new QVBoxLayout();
|
||||||
layout->setAlignment(Qt::AlignTop);
|
layout->setAlignment(Qt::AlignTop);
|
||||||
|
@ -24,10 +24,10 @@ Inspector::Inspector(Context& context, QWidget* parent) : QWidget(parent), conte
|
||||||
|
|
||||||
rebuild();
|
rebuild();
|
||||||
|
|
||||||
connect(&context, &Context::selectionChanged, this, &Inspector::rebuild);
|
connect(&context, &Context::selectionChanged, this, &Properties::rebuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::rebuild() {
|
void Properties::rebuild() {
|
||||||
for(auto section : sections) {
|
for(auto section : sections) {
|
||||||
layout->removeWidget(section);
|
layout->removeWidget(section);
|
||||||
delete section;
|
delete section;
|
||||||
|
@ -42,22 +42,22 @@ void Inspector::rebuild() {
|
||||||
|
|
||||||
InfoComponent* info = ECS::getComponent<InfoComponent>(entity);
|
InfoComponent* info = ECS::getComponent<InfoComponent>(entity);
|
||||||
if(info)
|
if(info)
|
||||||
addInfoInspector(info);
|
addInfoSection(info);
|
||||||
|
|
||||||
TransformComponent* transform = ECS::getComponent<TransformComponent>(entity);
|
TransformComponent* transform = ECS::getComponent<TransformComponent>(entity);
|
||||||
if(transform)
|
if(transform)
|
||||||
addTransformInspector(transform);
|
addTransformSection(transform);
|
||||||
|
|
||||||
MeshComponent* mesh = ECS::getComponent<MeshComponent>(entity);
|
MeshComponent* mesh = ECS::getComponent<MeshComponent>(entity);
|
||||||
if(mesh)
|
if(mesh)
|
||||||
addMeshInspector(mesh);
|
addMeshSection(mesh);
|
||||||
|
|
||||||
LightComponent* light = ECS::getComponent<LightComponent>(entity);
|
LightComponent* light = ECS::getComponent<LightComponent>(entity);
|
||||||
if(light)
|
if(light)
|
||||||
addLightInspector(light);
|
addLightSection(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::addInfoInspector(InfoComponent* info) {
|
void Properties::addInfoSection(InfoComponent* info) {
|
||||||
CollapseSection* section = new CollapseSection("Info");
|
CollapseSection* section = new CollapseSection("Info");
|
||||||
layout->addWidget(section);
|
layout->addWidget(section);
|
||||||
sections.push_back(section);
|
sections.push_back(section);
|
||||||
|
@ -77,7 +77,7 @@ void Inspector::addInfoInspector(InfoComponent* info) {
|
||||||
layout->addWidget(nameEdit, 0, 1);
|
layout->addWidget(nameEdit, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::addTransformInspector(TransformComponent* transform) {
|
void Properties::addTransformSection(TransformComponent* transform) {
|
||||||
CollapseSection* section = new CollapseSection("Transform");
|
CollapseSection* section = new CollapseSection("Transform");
|
||||||
layout->addWidget(section);
|
layout->addWidget(section);
|
||||||
sections.push_back(section);
|
sections.push_back(section);
|
||||||
|
@ -92,7 +92,7 @@ void Inspector::addTransformInspector(TransformComponent* transform) {
|
||||||
layout->addWidget(positionEdit, 0, 1);
|
layout->addWidget(positionEdit, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::addMeshInspector(MeshComponent* mesh) {
|
void Properties::addMeshSection(MeshComponent* mesh) {
|
||||||
CollapseSection* section = new CollapseSection("Mesh", true);
|
CollapseSection* section = new CollapseSection("Mesh", true);
|
||||||
layout->addWidget(section);
|
layout->addWidget(section);
|
||||||
sections.push_back(section);
|
sections.push_back(section);
|
||||||
|
@ -101,7 +101,7 @@ void Inspector::addMeshInspector(MeshComponent* mesh) {
|
||||||
section->setLayout(layout);
|
section->setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::addLightInspector(LightComponent* light) {
|
void Properties::addLightSection(LightComponent* light) {
|
||||||
CollapseSection* section = new CollapseSection("Light", true);
|
CollapseSection* section = new CollapseSection("Light", true);
|
||||||
layout->addWidget(section);
|
layout->addWidget(section);
|
||||||
sections.push_back(section);
|
sections.push_back(section);
|
Reference in a new issue