Material properties widget is now linked to the right button.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 85e885f274
commit 8c35946010

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "material_widget.h" #include "material_widget.h"
#include "render_passes.h"
#include "shader_editor.h" #include "shader_editor.h"
#include "material_properties.h"
namespace MaterialEditor namespace MaterialEditor
{ {
@ -25,17 +25,17 @@ namespace MaterialEditor
QWidget( parent ) QWidget( parent )
{ {
setupUi( this ); setupUi( this );
renderPassesWidget = new RenderPassesWidget();
shaderEditorWidget = new ShaderEditorWidget(); shaderEditorWidget = new ShaderEditorWidget();
matPropWidget = new MatPropWidget();
setupConnections(); setupConnections();
} }
MaterialWidget::~MaterialWidget() MaterialWidget::~MaterialWidget()
{ {
delete renderPassesWidget;
renderPassesWidget = NULL;
delete shaderEditorWidget; delete shaderEditorWidget;
shaderEditorWidget = NULL; shaderEditorWidget = NULL;
delete matPropWidget;
matPropWidget = NULL;
} }
void MaterialWidget::setupConnections() void MaterialWidget::setupConnections()
@ -43,27 +43,12 @@ namespace MaterialEditor
connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) ); connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) );
connect( shaderButton, SIGNAL( clicked( bool ) ), this, SLOT( onShaderEditClicked() ) ); connect( shaderButton, SIGNAL( clicked( bool ) ), this, SLOT( onShaderEditClicked() ) );
connect( renderPassesWidget, SIGNAL( passAdded( const QString& ) ),
this, SLOT( onPassAdded( const QString& ) ) );
connect( renderPassesWidget, SIGNAL( passRemoved( const QString& ) ),
this, SLOT( onPassRemoved( const QString& ) ) );
connect( renderPassesWidget, SIGNAL( passRenamed( const QString&, const QString& ) ),
this, SLOT( onPassRenamed( const QString&, const QString& ) ) );
connect( renderPassesWidget, SIGNAL( passPushedUp( const QString& ) ),
this, SLOT( onPassPushedUp( const QString& ) ) );
connect( renderPassesWidget, SIGNAL( passPushedDown( const QString& ) ),
this, SLOT( onPassPushedDown( const QString& ) ) );
connect( shaderEditorWidget, SIGNAL( okClicked() ), this, SLOT( onShaderEditOKClicked() ) ); connect( shaderEditorWidget, SIGNAL( okClicked() ), this, SLOT( onShaderEditOKClicked() ) );
} }
void MaterialWidget::onPassEditClicked() void MaterialWidget::onPassEditClicked()
{ {
renderPassesWidget->show(); matPropWidget->show();
} }
void MaterialWidget::onShaderEditClicked() void MaterialWidget::onShaderEditClicked()
@ -71,62 +56,6 @@ namespace MaterialEditor
shaderEditorWidget->show(); shaderEditorWidget->show();
} }
void MaterialWidget::onPassAdded( const QString &pass )
{
passCB->addItem( pass );
}
void MaterialWidget::onPassRemoved( const QString &pass )
{
int i = passCB->findText( pass );
if( i == -1 )
return;
passCB->removeItem( i );
}
void MaterialWidget::onPassRenamed( const QString &from, const QString &to )
{
int i = passCB->findText( from );
if( i == -1 )
return;
passCB->setItemText( i, to );
}
void MaterialWidget::onPassPushedUp( const QString &pass )
{
int i = passCB->findText( pass );
if( i == -1 )
return;
if( i == 0 )
return;
QString temp = passCB->itemText( i - 1 );
passCB->setItemText( i - 1, pass );
passCB->setItemText( i, temp );
if( passCB->currentIndex() == i )
passCB->setCurrentIndex( i - 1 );
}
void MaterialWidget::onPassPushedDown( const QString &pass )
{
int i = passCB->findText( pass );
if( i == -1 )
return;
if( i == ( passCB->count() - 1 ) )
return;
QString temp = passCB->itemText( i + 1 );
passCB->setItemText( i + 1, pass );
passCB->setItemText( i, temp );
if( passCB->currentIndex() == i )
passCB->setCurrentIndex( i + 1 );
}
void MaterialWidget::onShaderEditOKClicked() void MaterialWidget::onShaderEditOKClicked()
{ {
} }

@ -21,9 +21,8 @@
namespace MaterialEditor namespace MaterialEditor
{ {
class RenderPassesWidget;
class ShaderEditorWidget; class ShaderEditorWidget;
class MatPropWidget;
class MaterialWidget : public QWidget, Ui::MaterialWidget class MaterialWidget : public QWidget, Ui::MaterialWidget
{ {
@ -34,19 +33,12 @@ namespace MaterialEditor
private: private:
void setupConnections(); void setupConnections();
RenderPassesWidget *renderPassesWidget;
ShaderEditorWidget *shaderEditorWidget; ShaderEditorWidget *shaderEditorWidget;
MatPropWidget *matPropWidget;
private Q_SLOTS: private Q_SLOTS:
void onPassEditClicked(); void onPassEditClicked();
void onShaderEditClicked(); void onShaderEditClicked();
void onPassAdded( const QString &pass );
void onPassRemoved( const QString &pass );
void onPassRenamed( const QString &from, const QString &to );
void onPassPushedUp( const QString &pass );
void onPassPushedDown( const QString &pass );
void onShaderEditOKClicked(); void onShaderEditOKClicked();
}; };

Loading…
Cancel
Save