Clear the properties when clearing the scene, and also deactivate the buttons and comboboxes of the material widget.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent b776409cc8
commit e99c1e2785

@ -256,7 +256,7 @@ namespace MaterialEditor
void MaterialEditorWindow::onClearSceneClicked() void MaterialEditorWindow::onClearSceneClicked()
{ {
nl3dIface->clearScene(); nl3dIface->clearScene();
materialSplitter->onShapeChanged(); materialSplitter->onSceneCleared();
viewPort->stopTimedUpdates(); viewPort->stopTimedUpdates();
} }

@ -75,6 +75,12 @@ namespace MaterialEditor
materialWidget->onMaterialLoaded(); materialWidget->onMaterialLoaded();
} }
void MaterialSplitter::onSceneCleared()
{
materialWidget->onSceneCleared();
browserCtrl->onSceneCleared();
}
void MaterialSplitter::onShapeChanged() void MaterialSplitter::onShapeChanged()
{ {
materialWidget->onShapeChanged(); materialWidget->onShapeChanged();

@ -44,6 +44,7 @@ namespace MaterialEditor
void onNewMaterial(); void onNewMaterial();
void onMaterialLoaded(); void onMaterialLoaded();
void onSceneCleared();
void onShapeChanged(); void onShapeChanged();
void onPassAdded( const char *name ); void onPassAdded( const char *name );
void onPassRemoved( const char *name ); void onPassRemoved( const char *name );

@ -40,6 +40,17 @@ namespace MaterialEditor
matPropWidget = NULL; 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() void MaterialWidget::onNewMaterial()
{ {
passCB->clear(); passCB->clear();
@ -76,6 +87,11 @@ namespace MaterialEditor
for( unsigned long i = 1; i < c; i++ ) for( unsigned long i = 1; i < c; i++ )
subMatCB->addItem( QString::number( i ) ); subMatCB->addItem( QString::number( i ) );
passCB->setEnabled( true );
shaderCB->setEnabled( true );
passButton->setEnabled( true );
shaderButton->setEnabled( true );
subMatCB->setCurrentIndex( 0 ); subMatCB->setCurrentIndex( 0 );

@ -33,6 +33,7 @@ namespace MaterialEditor
MaterialWidget( QWidget *parent = NULL ); MaterialWidget( QWidget *parent = NULL );
~MaterialWidget(); ~MaterialWidget();
void onSceneCleared();
void onNewMaterial(); void onNewMaterial();
void onMaterialLoaded(); void onMaterialLoaded();
void onShapeChanged(); void onShapeChanged();

@ -43,7 +43,11 @@
<item row="3" column="0"> <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QComboBox" name="passCB"/> <widget class="QComboBox" name="passCB">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="passButton"> <widget class="QPushButton" name="passButton">
@ -74,6 +78,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QComboBox" name="shaderCB"> <widget class="QComboBox" name="shaderCB">
<property name="enabled">
<bool>false</bool>
</property>
<item> <item>
<property name="text"> <property name="text">
<string/> <string/>

@ -255,6 +255,11 @@ namespace MaterialEditor
this, SLOT( onValueChanged( QtProperty*, const QVariant& ) ) ); this, SLOT( onValueChanged( QtProperty*, const QVariant& ) ) );
} }
void CPropBrowserCtrl::onSceneCleared()
{
clearProps();
}
void CPropBrowserCtrl::onPropsChanged() void CPropBrowserCtrl::onPropsChanged()
{ {
clearProps(); clearProps();

@ -40,6 +40,7 @@ namespace MaterialEditor
void setBrowser( QtTreePropertyBrowser *b ); void setBrowser( QtTreePropertyBrowser *b );
void setNel3DIface( CNel3DInterface *iface ); void setNel3DIface( CNel3DInterface *iface );
void setupConnections(); void setupConnections();
void onSceneCleared();
void onPropsChanged(); void onPropsChanged();
void clearProps(); void clearProps();
void loadPropsForPass( const QString &pass ); void loadPropsForPass( const QString &pass );

Loading…
Cancel
Save