Compare commits
7 Commits
d230662924
...
8d60355ccf
Author | SHA1 | Date | |
---|---|---|---|
8d60355ccf | |||
0551b4f91f | |||
ecae09f82d | |||
e68d384340 | |||
e2c7f5ba75 | |||
f1d9a07940 | |||
f5a38892b1 |
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@ -360,3 +360,31 @@ jobs:
|
|||||||
- name: Build Qtk
|
- name: Build Qtk
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build build/ --config Release
|
run: cmake --build build/ --config Release
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: startsWith(github.event.workflow_run.head_branch, 'v')
|
||||||
|
needs: [Qtk, Qtk-Library, Qtk-Plugins]
|
||||||
|
steps:
|
||||||
|
- name: Download Installer Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: Qtk Packages
|
||||||
|
path: |
|
||||||
|
build/packages/*
|
||||||
|
install/*
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
id: create_release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.event.workflow_run.head_branch }}
|
||||||
|
name: Qtk ${{ github.event.workflow_run.head_branch }}
|
||||||
|
draft: true
|
||||||
|
prerelease: false
|
||||||
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
|
build/packages/*
|
||||||
|
install/*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
35
.github/workflows/release.yml
vendored
35
.github/workflows/release.yml
vendored
@ -1,35 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Build"]
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: startsWith(github.event.workflow_run.head_branch, 'v')
|
|
||||||
steps:
|
|
||||||
- name: Download Installer Artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: Qtk Packages
|
|
||||||
path: |
|
|
||||||
build/packages/*
|
|
||||||
install/*
|
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
id: create_release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.event.workflow_run.head_branch }}
|
|
||||||
name: Qtk ${{ github.event.workflow_run.head_branch }}
|
|
||||||
draft: true
|
|
||||||
prerelease: false
|
|
||||||
generate_release_notes: true
|
|
||||||
files: |
|
|
||||||
build/packages/*
|
|
||||||
install/*
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -9,7 +9,11 @@
|
|||||||
# Qtk Application
|
# Qtk Application
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set(QTK_GUI_SOURCES qtkscene.cpp qtkscene.h main.cpp)
|
set(QTK_GUI_SOURCES
|
||||||
|
qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
|
||||||
|
qtkscene.cpp qtkscene.h
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
|
qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
|
||||||
target_link_libraries(qtk_gui PRIVATE qtk_plugin_library)
|
target_link_libraries(qtk_gui PRIVATE qtk_plugin_library)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "designer-plugins/qtkmainwindow.h"
|
#include "qtkmainwindow.h"
|
||||||
#include "qtkscene.h"
|
#include "qtkscene.h"
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
@ -24,7 +24,7 @@ int main(int argc, char * argv[])
|
|||||||
// NOTE: We set the scene here and not in QtkMainWindow to detach the scene
|
// NOTE: We set the scene here and not in QtkMainWindow to detach the scene
|
||||||
// from the QtkWidget plugin (qtk_plugin_library build target).
|
// from the QtkWidget plugin (qtk_plugin_library build target).
|
||||||
// Once we can save / load scenes, this call, and QtkScene, can be removed.
|
// Once we can save / load scenes, this call, and QtkScene, can be removed.
|
||||||
window->getQtkWidget()->setScene(new QtkScene);
|
window->setScene(new QtkScene);
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent)
|
|||||||
// Initialize static container for all active QtkWidgets
|
// Initialize static container for all active QtkWidgets
|
||||||
auto qtkWidgets = findChildren<Qtk::QtkWidget *>();
|
auto qtkWidgets = findChildren<Qtk::QtkWidget *>();
|
||||||
for (auto & qtkWidget : qtkWidgets) {
|
for (auto & qtkWidget : qtkWidgets) {
|
||||||
|
qtkWidget->setMainWindow(this);
|
||||||
// NOTE: Set a temporary scene for the widget to use for initialization.
|
// NOTE: Set a temporary scene for the widget to use for initialization.
|
||||||
// This should be replaced by loading a scene, or creating a new (unsaved)
|
// This should be replaced by loading a scene, or creating a new (unsaved)
|
||||||
// scene when Qtk is opened.
|
// scene when Qtk is opened.
|
||||||
@ -39,6 +40,8 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent)
|
|||||||
&Qtk::Scene::sceneUpdated,
|
&Qtk::Scene::sceneUpdated,
|
||||||
this,
|
this,
|
||||||
&MainWindow::refreshScene);
|
&MainWindow::refreshScene);
|
||||||
|
|
||||||
|
// Update the ToolBox details panel when an item is double-clicked.
|
||||||
connect(qtkWidget,
|
connect(qtkWidget,
|
||||||
&Qtk::QtkWidget::objectFocusChanged,
|
&Qtk::QtkWidget::objectFocusChanged,
|
||||||
ui_->qtk__ToolBox,
|
ui_->qtk__ToolBox,
|
||||||
@ -100,3 +103,12 @@ void MainWindow::refreshScene(const QString & sceneName)
|
|||||||
// TODO: Select TreeView using sceneName
|
// TODO: Select TreeView using sceneName
|
||||||
ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
|
ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setScene(Qtk::Scene * scene)
|
||||||
|
{
|
||||||
|
connect(scene,
|
||||||
|
&Qtk::Scene::sceneUpdated,
|
||||||
|
MainWindow::getMainWindow(),
|
||||||
|
&MainWindow::refreshScene);
|
||||||
|
ui_->qtk__QtkWidget->setScene(scene);
|
||||||
|
}
|
@ -14,8 +14,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
#include "debugconsole.h"
|
#include "designer-plugins/debugconsole.h"
|
||||||
#include "designer-plugins/qtkwidget.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -97,6 +96,11 @@ class MainWindow : public QMainWindow
|
|||||||
*/
|
*/
|
||||||
Qtk::QtkWidget * getQtkWidget(const QString & name);
|
Qtk::QtkWidget * getQtkWidget(const QString & name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scene The new scene to view.
|
||||||
|
*/
|
||||||
|
void setScene(Qtk::Scene * scene);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* Trigger a refresh for widgets related to a scene that has been updated.
|
* Trigger a refresh for widgets related to a scene that has been updated.
|
@ -310,19 +310,19 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Qtk::QtkWidget</class>
|
<class>Qtk::QtkWidget</class>
|
||||||
<extends>QOpenGLWidget</extends>
|
<extends>QOpenGLWidget</extends>
|
||||||
<header>qtkwidget.h</header>
|
<header>designer-plugins/qtkwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Qtk::TreeView</class>
|
<class>Qtk::TreeView</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QDockWidget</extends>
|
||||||
<header>treeview.h</header>
|
<header>designer-plugins/treeview.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Qtk::ToolBox</class>
|
<class>Qtk::ToolBox</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QDockWidget</extends>
|
||||||
<header>toolbox.h</header>
|
<header>designer-plugins/toolbox.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
@ -15,7 +15,6 @@ set(
|
|||||||
debugconsole.cpp debugconsole.ui
|
debugconsole.cpp debugconsole.ui
|
||||||
toolbox.cpp toolbox.ui
|
toolbox.cpp toolbox.ui
|
||||||
treeview.cpp treeview.ui
|
treeview.cpp treeview.ui
|
||||||
qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
|
|
||||||
)
|
)
|
||||||
set(
|
set(
|
||||||
QTK_PLUGIN_LIBRARY_HEADERS
|
QTK_PLUGIN_LIBRARY_HEADERS
|
||||||
|
@ -7,19 +7,21 @@
|
|||||||
##############################################################################*/
|
##############################################################################*/
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QMainWindow>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
#include "qtk/input.h"
|
#include "qtk/input.h"
|
||||||
#include "qtk/scene.h"
|
#include "qtk/scene.h"
|
||||||
#include "qtk/shape.h"
|
#include "qtk/shape.h"
|
||||||
|
|
||||||
#include "debugconsole.h"
|
#include "debugconsole.h"
|
||||||
#include "qtkmainwindow.h"
|
|
||||||
#include "qtkwidget.h"
|
#include "qtkwidget.h"
|
||||||
|
|
||||||
using namespace Qtk;
|
using namespace Qtk;
|
||||||
|
|
||||||
|
/// Static manager for all QtkWidget instances.
|
||||||
|
QtkWidgetManager QtkWidget::mWidgetManager;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Constructors, Destructors
|
* Constructors, Destructors
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -35,9 +37,11 @@ QtkWidget::QtkWidget(QWidget * parent, const QString & name, Scene * scene) :
|
|||||||
QOpenGLWidget(parent), mDebugLogger(Q_NULLPTR),
|
QOpenGLWidget(parent), mDebugLogger(Q_NULLPTR),
|
||||||
mConsole(new DebugConsole(this, name)), mScene(Q_NULLPTR)
|
mConsole(new DebugConsole(this, name)), mScene(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
|
setObjectName(name);
|
||||||
|
mWidgetManager.add_widget(this);
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setScene(scene);
|
setScene(scene);
|
||||||
setObjectName(name);
|
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
format.setRenderableType(QSurfaceFormat::OpenGL);
|
||||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
@ -79,8 +83,10 @@ void QtkWidget::initializeGL()
|
|||||||
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
|
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
|
||||||
|
|
||||||
// Add the debug console widget to the window and set its hidden state.
|
// Add the debug console widget to the window and set its hidden state.
|
||||||
MainWindow::getMainWindow()->addDockWidget(
|
if (mMainWindow != nullptr) {
|
||||||
Qt::DockWidgetArea::BottomDockWidgetArea, mConsole);
|
mMainWindow->addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea,
|
||||||
|
mConsole);
|
||||||
|
}
|
||||||
mConsole->setHidden(!mConsoleActive);
|
mConsole->setHidden(!mConsoleActive);
|
||||||
|
|
||||||
// Initialize OpenGL debug context
|
// Initialize OpenGL debug context
|
||||||
@ -127,10 +133,6 @@ void QtkWidget::setScene(Scene * scene)
|
|||||||
{
|
{
|
||||||
if (mScene != Q_NULLPTR) {
|
if (mScene != Q_NULLPTR) {
|
||||||
delete mScene;
|
delete mScene;
|
||||||
connect(scene,
|
|
||||||
&Scene::sceneUpdated,
|
|
||||||
MainWindow::getMainWindow(),
|
|
||||||
&MainWindow::refreshScene);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mScene = scene;
|
mScene = scene;
|
||||||
|
@ -119,6 +119,18 @@ namespace Qtk
|
|||||||
*/
|
*/
|
||||||
void setScene(Qtk::Scene * scene);
|
void setScene(Qtk::Scene * scene);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param window The QMainWindow that owns this QtkWidget.
|
||||||
|
*/
|
||||||
|
void setMainWindow(QMainWindow * window) { mMainWindow = window; }
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Public Members
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/// Static manager for all QtkWidget instances.
|
||||||
|
static class QtkWidgetManager mWidgetManager;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,6 +223,55 @@ namespace Qtk
|
|||||||
Qtk::Scene * mScene;
|
Qtk::Scene * mScene;
|
||||||
Qtk::DebugConsole * mConsole;
|
Qtk::DebugConsole * mConsole;
|
||||||
bool mConsoleActive = true;
|
bool mConsoleActive = true;
|
||||||
|
QMainWindow * mMainWindow = Q_NULLPTR;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct to help manage QtkWidget instances.
|
||||||
|
* When a QtkWidget is constructed we register it by calling add_widget().
|
||||||
|
* Widgets can be retrieved by their unique name.
|
||||||
|
*/
|
||||||
|
struct QtkWidgetManager {
|
||||||
|
/**
|
||||||
|
* Get a QtkWidget by name.
|
||||||
|
*
|
||||||
|
* @param name The name of the QtkWidget to retrieve.
|
||||||
|
*/
|
||||||
|
QtkWidget * get_widget(const QString & name = "QtkWidget")
|
||||||
|
{
|
||||||
|
if (mQtkWidgets.count(name) == 0) {
|
||||||
|
qDebug() << this
|
||||||
|
<< " Attempt to get QtkWidget that doesn't exist: " << name;
|
||||||
|
return Q_NULLPTR;
|
||||||
|
}
|
||||||
|
return mQtkWidgets[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a QtkWidget with this manager.
|
||||||
|
*
|
||||||
|
* If the QObject::objectName is unset the widget and QObject is renamed
|
||||||
|
* 'Unamed-QtkWidget'.
|
||||||
|
*
|
||||||
|
* @param widget Pointer to the QtkWidget to register to this manager.
|
||||||
|
*/
|
||||||
|
void add_widget(QtkWidget * widget)
|
||||||
|
{
|
||||||
|
auto name = widget->objectName();
|
||||||
|
name = name == "" ? "Unamed-QtkWidget" : name;
|
||||||
|
if (mQtkWidgets.count(name)) {
|
||||||
|
qDebug()
|
||||||
|
<< "[QtkWidgetManager " << this
|
||||||
|
<< " ] Failed to add a QtkWidget with the previously used name '"
|
||||||
|
<< name << "'";
|
||||||
|
}
|
||||||
|
qDebug() << this << " Adding new QtkWidget named '" << name << "'";
|
||||||
|
mQtkWidgets[name] = widget;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unordered_map<QString, QtkWidget *> mQtkWidgets;
|
||||||
};
|
};
|
||||||
} // namespace Qtk
|
} // namespace Qtk
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "toolbox.h"
|
#include "toolbox.h"
|
||||||
#include "qtkmainwindow.h"
|
#include "qtkwidget.h"
|
||||||
#include "ui_toolbox.h"
|
#include "ui_toolbox.h"
|
||||||
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
@ -25,7 +25,7 @@ ToolBox::ToolBox(QWidget * parent) : QDockWidget(parent), ui(new Ui::ToolBox)
|
|||||||
void ToolBox::updateFocus(const QString & name)
|
void ToolBox::updateFocus(const QString & name)
|
||||||
{
|
{
|
||||||
auto object =
|
auto object =
|
||||||
MainWindow::getMainWindow()->getQtkWidget()->getScene()->getObject(name);
|
Qtk::QtkWidget::mWidgetManager.get_widget()->getScene()->getObject(name);
|
||||||
if (object != Q_NULLPTR) {
|
if (object != Q_NULLPTR) {
|
||||||
removePages();
|
removePages();
|
||||||
createPageProperties(object);
|
createPageProperties(object);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "treeview.h"
|
#include "treeview.h"
|
||||||
#include "qtkmainwindow.h"
|
#include "qtkwidget.h"
|
||||||
#include "ui_treeview.h"
|
#include "ui_treeview.h"
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -49,7 +49,7 @@ void Qtk::TreeView::updateView(const Qtk::Scene * scene)
|
|||||||
void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column)
|
void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column)
|
||||||
{
|
{
|
||||||
const QString & name = item->text(column);
|
const QString & name = item->text(column);
|
||||||
auto scene = MainWindow::getMainWindow()->getQtkWidget()->getScene();
|
auto scene = QtkWidget::mWidgetManager.get_widget()->getScene();
|
||||||
auto object = scene->getObject(name);
|
auto object = scene->getObject(name);
|
||||||
// If the object is a mesh or model, focus the camera on it.
|
// If the object is a mesh or model, focus the camera on it.
|
||||||
if (object == Q_NULLPTR) {
|
if (object == Q_NULLPTR) {
|
||||||
@ -70,5 +70,5 @@ void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column)
|
|||||||
camera_transform.translate(0.0f, 0.0f, 3.0f);
|
camera_transform.translate(0.0f, 0.0f, 3.0f);
|
||||||
|
|
||||||
// Emit signal from qtk widget for new object focus. Triggers GUI updates.
|
// Emit signal from qtk widget for new object focus. Triggers GUI updates.
|
||||||
emit MainWindow::getMainWindow() -> getQtkWidget()->objectFocusChanged(name);
|
emit QtkWidget::mWidgetManager.get_widget()->objectFocusChanged(name);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ template <> MeshRenderer * Scene::addObject(MeshRenderer * object)
|
|||||||
{
|
{
|
||||||
initSceneObjectName(object);
|
initSceneObjectName(object);
|
||||||
mMeshes.push_back(object);
|
mMeshes.push_back(object);
|
||||||
sceneUpdated(mSceneName);
|
emit sceneUpdated(mSceneName);
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ template <> Model * Scene::addObject(Model * object)
|
|||||||
{
|
{
|
||||||
initSceneObjectName(object);
|
initSceneObjectName(object);
|
||||||
mModels.push_back(object);
|
mModels.push_back(object);
|
||||||
sceneUpdated(mSceneName);
|
emit sceneUpdated(mSceneName);
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,10 +118,8 @@ void Scene::setSkybox(Skybox * skybox)
|
|||||||
|
|
||||||
void Scene::initSceneObjectName(Object * object)
|
void Scene::initSceneObjectName(Object * object)
|
||||||
{
|
{
|
||||||
mObjectCount[object->getName()] = mObjectCount.count(object->getName()) + 1;
|
// If the object name exists make it unique.
|
||||||
|
auto count = ++mObjectCount[object->getName()];
|
||||||
// If the object exists make it's name unique.
|
|
||||||
auto count = mObjectCount[object->getName()];
|
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
object->setName(object->getName() + " (" + std::to_string(count) + ")");
|
object->setName(object->getName() + " (" + std::to_string(count) + ")");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user