From e99c1e2785e5cddf66ad1dd6a392c3015844ff73 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 18 Jul 2013 04:25:27 +0200 Subject: [PATCH] Clear the properties when clearing the scene, and also deactivate the buttons and comboboxes of the material widget. --HG-- branch : gsoc2013-dfighter --- .../material_editor/material_editor_window.cpp | 2 +- .../material_editor/material_splitter.cpp | 6 ++++++ .../plugins/material_editor/material_splitter.h | 1 + .../plugins/material_editor/material_widget.cpp | 16 ++++++++++++++++ .../plugins/material_editor/material_widget.h | 1 + .../plugins/material_editor/material_widget.ui | 9 ++++++++- .../material_editor/prop_browser_ctrl.cpp | 5 +++++ .../plugins/material_editor/prop_browser_ctrl.h | 1 + 8 files changed, 39 insertions(+), 2 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp index 77116381a..afc0b3db0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp @@ -256,7 +256,7 @@ namespace MaterialEditor void MaterialEditorWindow::onClearSceneClicked() { nl3dIface->clearScene(); - materialSplitter->onShapeChanged(); + materialSplitter->onSceneCleared(); viewPort->stopTimedUpdates(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp index 76c6ac6ad..8647c7c55 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp @@ -75,6 +75,12 @@ namespace MaterialEditor materialWidget->onMaterialLoaded(); } + void MaterialSplitter::onSceneCleared() + { + materialWidget->onSceneCleared(); + browserCtrl->onSceneCleared(); + } + void MaterialSplitter::onShapeChanged() { materialWidget->onShapeChanged(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h index 7bf7b96b9..784245fc2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h @@ -44,6 +44,7 @@ namespace MaterialEditor void onNewMaterial(); void onMaterialLoaded(); + void onSceneCleared(); void onShapeChanged(); void onPassAdded( const char *name ); void onPassRemoved( const char *name ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp index c5f4f9911..87fcfea96 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp @@ -40,6 +40,17 @@ namespace MaterialEditor matPropWidget = NULL; } + void MaterialWidget::onSceneCleared() + { + passCB->clear(); + subMatCB->clear(); + passCB->setEnabled( false ); + subMatCB->setEnabled( false ); + shaderCB->setEnabled( false ); + passButton->setEnabled( false ); + shaderButton->setEnabled( false ); + } + void MaterialWidget::onNewMaterial() { passCB->clear(); @@ -76,6 +87,11 @@ namespace MaterialEditor for( unsigned long i = 1; i < c; i++ ) subMatCB->addItem( QString::number( i ) ); + + passCB->setEnabled( true ); + shaderCB->setEnabled( true ); + passButton->setEnabled( true ); + shaderButton->setEnabled( true ); subMatCB->setCurrentIndex( 0 ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h index c69fbfead..e8a9ba0d7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h @@ -33,6 +33,7 @@ namespace MaterialEditor MaterialWidget( QWidget *parent = NULL ); ~MaterialWidget(); + void onSceneCleared(); void onNewMaterial(); void onMaterialLoaded(); void onShapeChanged(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui index ccf56a214..a87614b23 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui @@ -43,7 +43,11 @@ - + + + false + + @@ -74,6 +78,9 @@ + + false + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp index 5f08ae604..bcaa88a67 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp @@ -255,6 +255,11 @@ namespace MaterialEditor this, SLOT( onValueChanged( QtProperty*, const QVariant& ) ) ); } + void CPropBrowserCtrl::onSceneCleared() + { + clearProps(); + } + void CPropBrowserCtrl::onPropsChanged() { clearProps(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h index 6d2540123..b298a6079 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h @@ -40,6 +40,7 @@ namespace MaterialEditor void setBrowser( QtTreePropertyBrowser *b ); void setNel3DIface( CNel3DInterface *iface ); void setupConnections(); + void onSceneCleared(); void onPropsChanged(); void clearProps(); void loadPropsForPass( const QString &pass );