mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
Rotation can now be set.
This commit is contained in:
parent
ca1f00e35a
commit
df4446701e
5 changed files with 49 additions and 1 deletions
|
@ -58,6 +58,23 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
|||
rotateActions.push_back(m_ui->actionRotateTile270);
|
||||
m_rotationMenu->addActions(rotateActions);
|
||||
m_ui->toolBar->addAction(m_rotationMenu->menuAction());
|
||||
m_rotateSM = new QSignalMapper();
|
||||
m_rotateAG = new QActionGroup(this);
|
||||
m_rotateAG->addAction(m_ui->actionRotateTile0);
|
||||
m_rotateAG->addAction(m_ui->actionRotateTile90);
|
||||
m_rotateAG->addAction(m_ui->actionRotateTile180);
|
||||
m_rotateAG->addAction(m_ui->actionRotateTile270);
|
||||
m_ui->actionRotateTile0->setChecked( true );
|
||||
|
||||
connect( m_ui->actionRotateTile0, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) );
|
||||
connect( m_ui->actionRotateTile90, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) );
|
||||
connect( m_ui->actionRotateTile180, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) );
|
||||
connect( m_ui->actionRotateTile270, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) );
|
||||
m_rotateSM->setMapping( m_ui->actionRotateTile0, 0 );
|
||||
m_rotateSM->setMapping( m_ui->actionRotateTile90, 1 );
|
||||
m_rotateSM->setMapping( m_ui->actionRotateTile180, 2 );
|
||||
m_rotateSM->setMapping( m_ui->actionRotateTile270, 3 );
|
||||
connect( m_rotateSM, SIGNAL( mapped( int ) ), this, SLOT( onRotate( int ) ) );
|
||||
|
||||
// Create the tile zoom menu.
|
||||
m_zoomMenu = new QMenu(tr("Zoom"), m_ui->toolBar);
|
||||
|
@ -186,6 +203,8 @@ TileEditorMainWindow::~TileEditorMainWindow()
|
|||
delete m_ui;
|
||||
delete m_undoStack;
|
||||
delete m_rotationMenu;
|
||||
delete m_rotateSM;
|
||||
delete m_rotateAG;
|
||||
|
||||
delete m_tileDisplayMenu;
|
||||
delete m_tileEditorMenu;
|
||||
|
@ -315,6 +334,11 @@ void TileEditorMainWindow::onZoomFactor(int level)
|
|||
m_ui->listViewTransition->repaint();
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onRotate( int id )
|
||||
{
|
||||
TileItemNode::setAlphaRot( id * 90 );
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onActionAddTile(bool triggered)
|
||||
{
|
||||
onActionAddTile(m_ui->tileViewTabWidget->currentIndex());
|
||||
|
|
|
@ -81,6 +81,7 @@ private Q_SLOTS:
|
|||
|
||||
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
||||
void onZoomFactor(int level);
|
||||
void onRotate(int id);
|
||||
|
||||
private:
|
||||
void onActionAddTile(int tabId);
|
||||
|
@ -107,6 +108,8 @@ private:
|
|||
QMenu *m_zoomMenu;
|
||||
QActionGroup *m_zoomActionGroup;
|
||||
QSignalMapper *m_zoomSignalMapper;
|
||||
QActionGroup *m_rotateAG;
|
||||
QSignalMapper *m_rotateSM;
|
||||
|
||||
TileItemDelegate *m_tileItemDelegate;
|
||||
|
||||
|
|
|
@ -581,6 +581,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionRotateTile0">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="tile_editor.qrc">
|
||||
<normaloff>:/tileRotation/images/rotation0.png</normaloff>:/tileRotation/images/rotation0.png</iconset>
|
||||
|
@ -617,6 +620,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionRotateTile90">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="tile_editor.qrc">
|
||||
<normaloff>:/tileRotation/images/rotation90.png</normaloff>:/tileRotation/images/rotation90.png</iconset>
|
||||
|
@ -629,6 +635,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionRotateTile180">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="tile_editor.qrc">
|
||||
<normaloff>:/tileRotation/images/rotation180.png</normaloff>:/tileRotation/images/rotation180.png</iconset>
|
||||
|
@ -641,6 +650,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionRotateTile270">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="tile_editor.qrc">
|
||||
<normaloff>:/tileRotation/images/rotation270.png</normaloff>:/tileRotation/images/rotation270.png</iconset>
|
||||
|
|
|
@ -290,6 +290,7 @@ public:
|
|||
m_borderFirst[ i ] = false;
|
||||
|
||||
m_id = -1;
|
||||
m_alphaRot = 0;
|
||||
}
|
||||
|
||||
bool pixmapToCBGRA( QPixmap &pixmap, std::vector< NLMISC::CBGRA >& pixels )
|
||||
|
@ -511,6 +512,9 @@ public:
|
|||
|
||||
const NL3D::CTileBorder &border( TileModel::TTileChannel channel ){ return m_border[ channel ]; }
|
||||
|
||||
int alphaRot() const{ return m_alphaRot; }
|
||||
void setAlphaRot( int rot ){ m_alphaRot = rot; }
|
||||
|
||||
private:
|
||||
QPixmap pixmaps[ TileModel::TileChannelCount ];
|
||||
TileModel::TNodeTileType m_type;
|
||||
|
@ -518,9 +522,11 @@ private:
|
|||
int m_id;
|
||||
QString m_lastError;
|
||||
bool m_borderFirst[ TileModel::TileChannelCount ];
|
||||
int m_alphaRot;
|
||||
};
|
||||
|
||||
TileModel::TTileChannel TileItemNode::s_displayChannel = TileModel::TileDiffuse;
|
||||
int TileItemNode::s_alphaRot = 0;
|
||||
|
||||
TileItemNode::TileItemNode( TileModel::TNodeTileType type, int tileId, TileModel::TTileChannel channel, QString filename, Node *parent)
|
||||
{
|
||||
|
@ -555,6 +561,7 @@ bool TileItemNode::setTileFilename(TileModel::TTileChannel channel, QString file
|
|||
empty = true;
|
||||
}
|
||||
|
||||
pvt->setAlphaRot( s_alphaRot );
|
||||
bool b = pvt->loadImage( channel, fn, empty );
|
||||
m_hasError = !b;
|
||||
if( !b )
|
||||
|
@ -601,7 +608,7 @@ const NL3D::CTileBorder& TileItemNode::border( TileModel::TTileChannel channel )
|
|||
|
||||
int TileItemNode::alphaRot() const
|
||||
{
|
||||
return 0;
|
||||
return pvt->alphaRot();
|
||||
}
|
||||
|
||||
QVariant TileItemNode::data(int column, int role) const
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
|
||||
static void setDisplayChannel( TileModel::TTileChannel channel ){ s_displayChannel = channel; }
|
||||
static TileModel::TTileChannel displayChannel(){ return s_displayChannel; }
|
||||
static void setAlphaRot( int rot ){ s_alphaRot = rot; }
|
||||
|
||||
bool hasError() const{ return m_hasError; }
|
||||
|
||||
|
@ -137,6 +138,7 @@ private:
|
|||
QMap<TileModel::TTileChannel, TileWidget*> m_tileWidget;
|
||||
|
||||
static TileModel::TTileChannel s_displayChannel;
|
||||
static int s_alphaRot;
|
||||
|
||||
TileItemNodePvt *pvt;
|
||||
|
||||
|
|
Loading…
Reference in a new issue