Added GUI code for multi/sub-material.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent c2296a2a93
commit 9306bd71e6

@ -106,6 +106,7 @@ namespace MaterialEditor
);
}
materialSplitter->onShapeChanged();
viewPort->startTimedUpdates( 20 );
}
@ -203,6 +204,7 @@ namespace MaterialEditor
);
return;
}
materialSplitter->onShapeChanged();
viewPort->startTimedUpdates( 20 );
}
@ -217,6 +219,7 @@ namespace MaterialEditor
);
return;
}
materialSplitter->onShapeChanged();
viewPort->startTimedUpdates( 20 );
}
@ -231,6 +234,7 @@ namespace MaterialEditor
);
return;
}
materialSplitter->onShapeChanged();
viewPort->startTimedUpdates( 20 );
}
@ -245,12 +249,14 @@ namespace MaterialEditor
);
return;
}
materialSplitter->onShapeChanged();
viewPort->startTimedUpdates( 20 );
}
void MaterialEditorWindow::onClearSceneClicked()
{
nl3dIface->clearScene();
materialSplitter->onShapeChanged();
viewPort->stopTimedUpdates();
}

@ -74,6 +74,11 @@ namespace MaterialEditor
materialWidget->onMaterialLoaded();
}
void MaterialSplitter::onShapeChanged()
{
materialWidget->onShapeChanged();
}
void MaterialSplitter::onPassAdded( const char *name )
{
materialWidget->onPassAdded( name );

@ -43,7 +43,8 @@ namespace MaterialEditor
void setNel3DIface( CNel3DInterface *iface );
void onNewMaterial();
void onMaterialLoaded();
void onMaterialLoaded();
void onShapeChanged();
void onPassAdded( const char *name );
void onPassRemoved( const char *name );
void onPassMovedUp( const char *name );

@ -66,6 +66,23 @@ namespace MaterialEditor
passButton->setEnabled( true );
}
void MaterialWidget::onShapeChanged()
{
unsigned long c = nl3dIface->getShapeMatCount();
subMatCB->clear();
subMatCB->addItem( "0" );
for( unsigned long i = 1; i < c; i++ )
subMatCB->addItem( QString::number( i ) );
subMatCB->setCurrentIndex( 0 );
if( subMatCB->count() > 1 )
subMatCB->setEnabled( true );
else
subMatCB->setEnabled( false );
}
void MaterialWidget::onPassAdded( const char *name )
{
passCB->addItem( name );
@ -148,6 +165,7 @@ namespace MaterialEditor
{
connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) );
connect( shaderButton, SIGNAL( clicked( bool ) ), this, SLOT( onShaderEditClicked() ) );
connect( subMatCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSubMatCBChanged( int ) ) );
connect( passCB, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( onPassCBChanged( const QString& ) ) );
connect( shaderCB, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( onShaderCBChanged( const QString& ) ) );
@ -175,6 +193,11 @@ namespace MaterialEditor
int result = shaderEditorWidget->exec();
}
void MaterialWidget::onSubMatCBChanged( int i )
{
// Update the material to the current submaterial
}
void MaterialWidget::onPassCBChanged( const QString &text )
{
if( text.isEmpty() )

@ -35,6 +35,7 @@ namespace MaterialEditor
void onNewMaterial();
void onMaterialLoaded();
void onShapeChanged();
void onPassAdded( const char *name );
void onPassRemoved( const char *name );
@ -62,6 +63,7 @@ namespace MaterialEditor
private Q_SLOTS:
void onPassEditClicked();
void onShaderEditClicked();
void onSubMatCBChanged( int i );
void onPassCBChanged( const QString &text );
void onShaderCBChanged( const QString &text );

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>338</width>
<height>139</height>
<width>255</width>
<height>179</height>
</rect>
</property>
<property name="windowTitle">
@ -15,13 +15,32 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Sub-material</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="subMatCB">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pass</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="passCB"/>
@ -44,14 +63,14 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Shader</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="shaderCB">
@ -80,7 +99,7 @@
</item>
</layout>
</item>
<item row="4" column="1">
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

@ -442,6 +442,14 @@ namespace MaterialEditor
}
}
unsigned long CNel3DInterface::getShapeMatCount() const
{
if( currentShape.empty() )
return 0;
return currentShape.getNumMaterials();
}
void CNel3DInterface::setupCamera()
{
NLMISC::CAABBox bbox;

@ -159,6 +159,8 @@ namespace MaterialEditor
void updateInput();
void renderScene();
unsigned long getShapeMatCount() const;
private:
void setupCamera();

Loading…
Cancel
Save