Connect TreeWidget when scene is updated.
This commit is contained in:
parent
0659df94bd
commit
e6bcd131b7
|
@ -76,5 +76,5 @@ Qtk::QtkWidget * MainWindow::getQtkWidget(const QString & name) {
|
||||||
|
|
||||||
void MainWindow::refreshScene(QString sceneName) {
|
void MainWindow::refreshScene(QString sceneName) {
|
||||||
// TODO: Select TreeView using sceneName>
|
// TODO: Select TreeView using sceneName>
|
||||||
ui_->qtk__TreeView->updateView(getQtkWidget(sceneName)->getScene());
|
ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,13 @@ void QtkWidget::paintGL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtkWidget::setScene(Qtk::Scene * scene) {
|
void QtkWidget::setScene(Qtk::Scene * scene) {
|
||||||
delete mScene;
|
if (mScene != Q_NULLPTR) {
|
||||||
|
delete mScene;
|
||||||
|
connect(
|
||||||
|
scene, &Qtk::Scene::sceneUpdated, MainWindow::getMainWindow(),
|
||||||
|
&MainWindow::refreshScene);
|
||||||
|
}
|
||||||
|
|
||||||
mScene = scene;
|
mScene = scene;
|
||||||
if(mScene != Q_NULLPTR) {
|
if(mScene != Q_NULLPTR) {
|
||||||
mConsole->setTitle(mScene->getSceneName());
|
mConsole->setTitle(mScene->getSceneName());
|
||||||
|
|
|
@ -45,7 +45,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) {
|
||||||
QString name = item->text(column);
|
QString name = item->text(column);
|
||||||
auto scene =
|
auto scene =
|
||||||
MainWindow::getMainWindow()->getQtkWidget(mSceneName)->getScene();
|
MainWindow::getMainWindow()->getQtkWidget()->getScene();
|
||||||
auto & transform = scene->getCamera().getTransform();
|
auto & transform = scene->getCamera().getTransform();
|
||||||
auto object = scene->getObject(name);
|
auto object = scene->getObject(name);
|
||||||
if (object == Q_NULLPTR) {
|
if (object == Q_NULLPTR) {
|
||||||
|
|
Loading…
Reference in New Issue