mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 18:40:54 +00:00
Show the image that belongs to the channel that is selected.
This commit is contained in:
parent
47a5f95b71
commit
0750ca7a4d
5 changed files with 76 additions and 8 deletions
|
@ -168,6 +168,17 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
||||||
connect( m_ui->actionOpenTileBank, SIGNAL( triggered() ), this, SLOT( open() ) );
|
connect( m_ui->actionOpenTileBank, SIGNAL( triggered() ), this, SLOT( open() ) );
|
||||||
|
|
||||||
connect( m_ui->orientedCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onOrientedStateChanged( int ) ) );
|
connect( m_ui->orientedCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onOrientedStateChanged( int ) ) );
|
||||||
|
|
||||||
|
connect( m_ui->diffuse128BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) );
|
||||||
|
connect( m_ui->diffuse256BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) );
|
||||||
|
connect( m_ui->diffuseTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) );
|
||||||
|
connect( m_ui->additive128BT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) );
|
||||||
|
connect( m_ui->additive256BT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) );
|
||||||
|
connect( m_ui->additiveTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) );
|
||||||
|
connect( m_ui->alphaTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onAlphaToggled( bool ) ) );
|
||||||
|
|
||||||
|
connect( m_ui->tileViewTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( onTabChanged( int ) ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEditorMainWindow::~TileEditorMainWindow()
|
TileEditorMainWindow::~TileEditorMainWindow()
|
||||||
|
@ -601,6 +612,43 @@ void TileEditorMainWindow::onOrientedStateChanged( int state )
|
||||||
node->setOriented( false );
|
node->setOriented( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onDiffuseToggled( bool b )
|
||||||
|
{
|
||||||
|
if( !b )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TileItemNode::setDisplayChannel( TileModel::TileDiffuse );
|
||||||
|
updateTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onAdditiveToggled( bool b )
|
||||||
|
{
|
||||||
|
if( !b )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TileItemNode::setDisplayChannel( TileModel::TileAdditive );
|
||||||
|
updateTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onAlphaToggled( bool b )
|
||||||
|
{
|
||||||
|
if( !b )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TileItemNode::setDisplayChannel( TileModel::TileAlpha );
|
||||||
|
updateTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onTabChanged( int tab )
|
||||||
|
{
|
||||||
|
if( tab == -1 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ui->diffuse128BT->setChecked( true );
|
||||||
|
m_ui->diffuse256BT->setChecked( true );
|
||||||
|
m_ui->diffuseTrBT->setChecked( true );
|
||||||
|
}
|
||||||
|
|
||||||
void TileEditorMainWindow::onActionAddTile(int tabId)
|
void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
{
|
{
|
||||||
QModelIndex idx = m_ui->tileSetLV->currentIndex();
|
QModelIndex idx = m_ui->tileSetLV->currentIndex();
|
||||||
|
@ -758,6 +806,11 @@ void TileEditorMainWindow::onTileBankLoaded()
|
||||||
m_ui->landLW->setCurrentRow( 0 );
|
m_ui->landLW->setCurrentRow( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::updateTab()
|
||||||
|
{
|
||||||
|
m_ui->tileViewTabWidget->currentWidget()->repaint();
|
||||||
|
}
|
||||||
|
|
||||||
TileModel* TileEditorMainWindow::createTileModel()
|
TileModel* TileEditorMainWindow::createTileModel()
|
||||||
{
|
{
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
|
|
|
@ -72,6 +72,12 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void onOrientedStateChanged( int state );
|
void onOrientedStateChanged( int state );
|
||||||
|
|
||||||
|
void onDiffuseToggled( bool b );
|
||||||
|
void onAdditiveToggled( bool b );
|
||||||
|
void onAlphaToggled( bool b );
|
||||||
|
|
||||||
|
void onTabChanged( int tab );
|
||||||
|
|
||||||
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
||||||
void onZoomFactor(int level);
|
void onZoomFactor(int level);
|
||||||
|
|
||||||
|
@ -85,6 +91,8 @@ private:
|
||||||
void onTileSetRenamed( const QString &oldname, const QString &newname );
|
void onTileSetRenamed( const QString &oldname, const QString &newname );
|
||||||
void onTileBankLoaded();
|
void onTileBankLoaded();
|
||||||
|
|
||||||
|
void updateTab();
|
||||||
|
|
||||||
TileModel* createTileModel();
|
TileModel* createTileModel();
|
||||||
QListView* getListViewByTab( int tab ) const;
|
QListView* getListViewByTab( int tab ) const;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_5">
|
<widget class="QRadioButton" name="diffuse128BT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Diffuse</string>
|
<string>Diffuse</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_6">
|
<widget class="QRadioButton" name="additive128BT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Additive</string>
|
<string>Additive</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_10">
|
<widget class="QRadioButton" name="diffuse256BT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Diffuse</string>
|
<string>Diffuse</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_9">
|
<widget class="QRadioButton" name="additive256BT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Additive</string>
|
<string>Additive</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_13">
|
<widget class="QRadioButton" name="diffuseTrBT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Diffuse</string>
|
<string>Diffuse</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -195,14 +195,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_12">
|
<widget class="QRadioButton" name="additiveTrBT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Additive</string>
|
<string>Additive</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_11">
|
<widget class="QRadioButton" name="alphaTrBT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Alpha</string>
|
<string>Alpha</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -264,6 +264,8 @@ void TileTypeNode::reindex()
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TileModel::TTileChannel TileItemNode::s_displayChannel = TileModel::TileDiffuse;
|
||||||
|
|
||||||
TileItemNode::TileItemNode(int tileId, TileModel::TTileChannel channel, QString filename, Node *parent) : m_tileId(tileId)
|
TileItemNode::TileItemNode(int tileId, TileModel::TTileChannel channel, QString filename, Node *parent) : m_tileId(tileId)
|
||||||
{
|
{
|
||||||
m_tileFilename[channel] = filename;
|
m_tileFilename[channel] = filename;
|
||||||
|
@ -294,7 +296,7 @@ QString TileItemNode::getTileFilename(TileModel::TTileChannel channel)
|
||||||
QVariant TileItemNode::data(int column, int role) const
|
QVariant TileItemNode::data(int column, int role) const
|
||||||
{
|
{
|
||||||
// find some way to know which file/bitmap to display
|
// find some way to know which file/bitmap to display
|
||||||
QString tileFilename = m_tileFilename[TileModel::TileDiffuse];
|
QString tileFilename = m_tileFilename[s_displayChannel];
|
||||||
|
|
||||||
if(role == TileModel::TilePixmapRole || role == Qt::DecorationRole)
|
if(role == TileModel::TilePixmapRole || role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,10 +115,15 @@ public:
|
||||||
QString getTileFilename(TileModel::TTileChannel channel);
|
QString getTileFilename(TileModel::TTileChannel channel);
|
||||||
void setId( int id ){ m_tileId = id; }
|
void setId( int id ){ m_tileId = id; }
|
||||||
int id() const{ return m_tileId; }
|
int id() const{ return m_tileId; }
|
||||||
|
|
||||||
|
static void setDisplayChannel( TileModel::TTileChannel channel ){ s_displayChannel = channel; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_tileId;
|
int m_tileId;
|
||||||
QMap<TileModel::TTileChannel, QString> m_tileFilename;
|
QMap<TileModel::TTileChannel, QString> m_tileFilename;
|
||||||
QMap<TileModel::TTileChannel, TileWidget*> m_tileWidget;
|
QMap<TileModel::TTileChannel, TileWidget*> m_tileWidget;
|
||||||
|
|
||||||
|
static TileModel::TTileChannel s_displayChannel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TILE_ITEM_H
|
#endif // TILE_ITEM_H
|
||||||
|
|
Loading…
Reference in a new issue