Changed: Added the basic UI structure of the new Tile Editor plugin.

This commit is contained in:
sfb 2011-12-02 07:55:24 -06:00
parent 361402e152
commit 93dae1ecd1
34 changed files with 1549 additions and 0 deletions

View file

@ -7,6 +7,7 @@ ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(georges_editor) ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(translation_manager) ADD_SUBDIRECTORY(translation_manager)
ADD_SUBDIRECTORY(tile_editor)
# Note: Temporarily disabled until development continues. # Note: Temporarily disabled until development continues.
#ADD_SUBDIRECTORY(zone_painter) #ADD_SUBDIRECTORY(zone_painter)
# Ryzom Specific Plugins # Ryzom Specific Plugins

View file

@ -0,0 +1,47 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
FILE(GLOB SRC *.cpp *.h)
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
SET(OVQT_TILE_EDITOR_PLUGIN_HDR
tile_model.h
tile_editor_main_window.h
tile_editor_plugin.h)
SET(OVQT_TILE_EDITOR_PLUGIN_UIS
tile_editor_main_window.ui)
SET(OVQT_PLUG_TILE_EDITOR_RCS tile_editor.qrc)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
QT4_WRAP_CPP(OVQT_TILE_EDITOR_PLUGIN_MOC_SRC ${OVQT_TILE_EDITOR_PLUGIN_HDR})
QT4_ADD_RESOURCES( OVQT_PLUG_TILE_EDITOR_RC_SRCS ${OVQT_PLUG_TILE_EDITOR_RCS})
QT4_WRAP_UI(OVQT_TILE_EDITOR_PLUGIN_UI_HDRS ${OVQT_TILE_EDITOR_PLUGIN_UIS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS})
SOURCE_GROUP("Tile Editor Plugin" FILES ${SRC})
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_tile_editor MODULE ${SRC} ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS})
TARGET_LINK_LIBRARIES(ovqt_plugin_tile_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES})
IF(WITH_STLPORT)
TARGET_LINK_LIBRARIES(ovqt_plugin_tile_editor ${CMAKE_THREAD_LIBS_INIT})
ENDIF(WITH_STLPORT)
NL_DEFAULT_PROPS(ovqt_plugin_tile_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Tile Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_tile_editor)
NL_ADD_LIB_SUFFIX(ovqt_plugin_tile_editor)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_tile_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_tile_editor</library-name>
<name>TileEditor</name>
<version>1.0</version>
<vendor>Ryzom Core</vendor>
<description>Tile bank editing plugin.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -0,0 +1,29 @@
<RCC>
<qresource prefix="tileTools">
<file>images/add_tile.png</file>
<file>images/delete_image.png</file>
<file>images/delete_tile.png</file>
<file>images/replace_image.png</file>
</qresource>
<qresource prefix="movementIcons">
<file>images/ic_nel_add_item.png</file>
<file>images/ic_nel_new.png</file>
<file>images/ic_nel_open.png</file>
<file>images/ic_nel_save.png</file>
<file>images/ic_nel_save_as.png</file>
<file>images/down.png</file>
<file>images/left.png</file>
<file>images/reset.png</file>
<file>images/right.png</file>
<file>images/up.png</file>
</qresource>
<qresource prefix="tileRotation">
<file>images/rotation0.png</file>
<file>images/rotation90.png</file>
<file>images/rotation180.png</file>
<file>images/rotation270.png</file>
</qresource>
<qresource prefix="placeHolder">
<file>images/empty_image.png</file>
</qresource>
</RCC>

View file

@ -0,0 +1,171 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tile_editor_main_window.h"
#include "nel/misc/path.h"
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#include <QtGui/QMenu>
#include <QFileDialog>
#include <QInputDialog>
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/menu_manager.h"
#include "tile_model.h"
#include "tile_item.h"
TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
: QMainWindow(parent),
m_ui(new Ui::TileEditorMainWindow)
{
m_ui->setupUi(this);
m_undoStack = new QUndoStack(this);
// Retrieve the menu manager
Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager();
QMenu *m_tileEditorMenu;
// Create tile rotation drop down toolbar menu.
m_rotationMenu = new QMenu(tr("Rotate Tile"), m_ui->toolBar);
m_rotationMenu->setIcon(QIcon(":/tileRotation/images/rotation0.png"));
QList<QAction*> rotateActions;
rotateActions.push_back(m_ui->actionRotateTile0);
rotateActions.push_back(m_ui->actionRotateTile90);
rotateActions.push_back(m_ui->actionRotateTile180);
rotateActions.push_back(m_ui->actionRotateTile270);
m_rotationMenu->addActions(rotateActions);
m_ui->toolBar->addAction(m_rotationMenu->menuAction());
// Create the tile zoom menu.
m_zoomMenu = new QMenu(tr("Zoom"), m_ui->toolBar);
QList<QAction*> zoomActions;
m_tileEditorMenu = new QMenu(tr("Tile Editor"), core->menuManager()->menuBar());
m_tileDisplayMenu = new QMenu(tr("Tile Display"), m_ui->toolBar);
QList<QAction*> displayActions;
displayActions.push_back(m_ui->actionTileDisplayFilename);
displayActions.push_back(m_ui->actionTileDisplayIndex);
m_ui->actionTileDisplayIndex->setChecked(true);
m_tileDisplayMenu->addActions(displayActions);
m_tileEditorMenu->addMenu(m_tileDisplayMenu);
core->menuManager()->menuBar()->addMenu(m_tileEditorMenu);
// Set up the list views.
QStringList headers;
headers << "Tile Set";
m_model = new TileModel(headers, this);
// Set up the tile set list view.
m_ui->tileSetLV->setModel(m_model);
m_ui->tileSetLV->setRootIndex(m_model->index(0,0));
connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd()));
// 128x128 List View
m_ui->listView128->setModel(m_model);
m_ui->listView128->addAction(m_ui->actionAddTile);
m_ui->listView128->addAction(m_ui->actionDeleteTile);
m_ui->listView128->addAction(m_ui->actionReplaceImage);
m_ui->listView128->addAction(m_ui->actionDeleteImage);
// Connect context menu actions up.
connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool)));
connect(m_ui->actionDeleteTile, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteTile(bool)));
connect(m_ui->actionReplaceImage, SIGNAL(triggered(bool)), this, SLOT(onActionReplaceImage(bool)));
connect(m_ui->actionDeleteImage, SIGNAL(triggered(bool)), this, SLOT(onActioneleteImage(bool)));
}
TileEditorMainWindow::~TileEditorMainWindow()
{
delete m_ui;
delete m_undoStack;
delete m_rotationMenu;
delete m_zoomMenu;
}
void TileEditorMainWindow::onActionAddTile(bool triggered)
{
onActionAddTile(m_ui->tileViewTabWidget->currentIndex());
}
void TileEditorMainWindow::onActionDeleteTile(bool triggered)
{
}
void TileEditorMainWindow::onActionReplaceImage(bool triggered)
{
}
void TileEditorMainWindow::onActionDeleteImage(bool triggered)
{
}
void TileEditorMainWindow::onTileSetAdd()
{
bool ok;
QString text = QInputDialog::getText(this, tr("Add Tile Set"), tr("Enter Tile Set name:"), QLineEdit::Normal, "", &ok);
if (ok && !text.isEmpty())
{
//if (ui.tileSetListWidget->findItems(text, Qt::MatchExactly).count() > 0)
//{
// QMessageBox::information( this, tr("Error Adding Tile Set"), tr("This name already exists") );
//}
//else
//{
QModelIndex index = m_ui->tileSetLV->selectionModel()->currentIndex();
TileModel *model = static_cast<TileModel*>(m_ui->tileSetLV->model());
if(index.isValid())
{
if(!model->insertRow(index.row()+1, index.parent()))
return;
//updateActions()
for(int column=0; column<model->columnCount(index.parent()); column++)
{
QModelIndex child = model->index(index.row()+1, column, index.parent());
model->setData(child, QVariant(text), Qt::EditRole);
}
}
else
{
QVector<QVariant> items;
items.push_back(QVariant(text));
TileItem *item = new TileItem(items, 0);
model->appendRow(item);
//updateActions()
}
// tileBank.addTileSet( text.toStdString() );
// ui.tileSetListWidget->addItem(text);
// ui.tileSetListWidget->setCurrentRow(ui.tileSetListWidget->count() - 1);
//}
}
}
void TileEditorMainWindow::onActionAddTile(int tabId)
{
QFileDialog::Options options;
QString selectedFilter;
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Tile Texture", "." , "PNG Bitmap(*.png);;All Files (*.*);;", &selectedFilter, options);
}

View file

@ -0,0 +1,63 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef TILE_EDITOR_MAIN_WINDOW_H
#define TILE_EDITOR_MAIN_WINDOW_H
#include "ui_tile_editor_main_window.h"
#include "nel/misc/types_nl.h"
#include "nel/misc/sheet_id.h"
#include <QtGui/QUndoStack>
namespace Ui {
class TileEditorMainWindow;
}
class TileModel;
class TileEditorMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit TileEditorMainWindow(QWidget *parent = 0);
~TileEditorMainWindow();
QUndoStack *getUndoStack() { return m_undoStack; }
public Q_SLOTS:
void onActionAddTile(bool triggered);
void onActionDeleteTile(bool triggered);
void onActionReplaceImage(bool triggered);
void onActionDeleteImage(bool triggered);
void onTileSetAdd();
private:
void onActionAddTile(int tabId);
Ui::TileEditorMainWindow *m_ui;
QUndoStack *m_undoStack;
QMenu *m_rotationMenu;
QMenu *m_zoomMenu;
QMenu *m_tileDisplayMenu;
QMenu *m_tileEditorMenu;
TileModel *m_model;
};
#endif // TILE_EDITOR_MAIN_WINDOW_H

View file

@ -0,0 +1,663 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TileEditorMainWindow</class>
<widget class="QMainWindow" name="TileEditorMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tileViewTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab128">
<attribute name="title">
<string>128x128</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QListView" name="listView128">
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="editChannel128GB">
<property name="title">
<string>Edit Channel</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="radioButton_5">
<property name="text">
<string>Diffuse</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_6">
<property name="text">
<string>Additive</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab256">
<attribute name="title">
<string>256x256</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QListView" name="listView256"/>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="editChannel256GB">
<property name="title">
<string>Edit Channel</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="radioButton_10">
<property name="text">
<string>Diffuse</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_9">
<property name="text">
<string>Additive</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTransition">
<attribute name="title">
<string>Transition</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_12">
<item row="0" column="0">
<widget class="QListView" name="listViewTransition"/>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="editChannelTransitionGB">
<property name="title">
<string>Edit Channel</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QRadioButton" name="radioButton_13">
<property name="text">
<string>Diffuse</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_12">
<property name="text">
<string>Additive</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_11">
<property name="text">
<string>Alpha</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabDisplacement">
<attribute name="title">
<string>Displacement</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="0">
<widget class="QListView" name="listViewDisplacement"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTileSetDetails">
<attribute name="title">
<string>Tile Set Details</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="6" column="0">
<widget class="QCheckBox" name="orientedCheckBox">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Oriented</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLineEdit" name="surfaceDataLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Surface Data:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Vegetation Set:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="chooseVegetPushButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="resetVegetPushButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../../tile_edit_qt/tile_edit_qt.qrc">
<normaloff>:/newPrefix/reset.png</normaloff>:/newPrefix/reset.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>Tile Editor Tool Bar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionOpenTileBank"/>
<addaction name="actionSaveTileBank"/>
<addaction name="actionSaveTileBankAs"/>
<addaction name="separator"/>
</widget>
<widget class="QDockWidget" name="tileBankDockWidget">
<property name="windowTitle">
<string>Tile Bank</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Lands</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QListWidget" name="listWidget"/>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton_3">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_add_item.png</normaloff>:/movementIcons/images/ic_nel_add_item.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/reset.png</normaloff>:/movementIcons/images/reset.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_open.png</normaloff>:/movementIcons/images/ic_nel_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Tile Sets</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton_5">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/up.png</normaloff>:/movementIcons/images/up.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_4">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/down.png</normaloff>:/movementIcons/images/down.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="tileSetAddTB">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_add_item.png</normaloff>:/movementIcons/images/ic_nel_add_item.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_7">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/reset.png</normaloff>:/movementIcons/images/reset.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_6">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_open.png</normaloff>:/movementIcons/images/ic_nel_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="tileBankTexturePathPB">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tileBankTexturePathTB">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tile Bank Texture Path</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QListView" name="tileSetLV"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="actionOpenTileBank">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_open.png</normaloff>:/movementIcons/images/ic_nel_open.png</iconset>
</property>
<property name="text">
<string>Open Tile Bank</string>
</property>
<property name="toolTip">
<string>Open Tile Bank</string>
</property>
</action>
<action name="actionRotateTile0">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileRotation/images/rotation0.png</normaloff>:/tileRotation/images/rotation0.png</iconset>
</property>
<property name="text">
<string>0</string>
</property>
<property name="toolTip">
<string>Rotate Tile 0 Degrees</string>
</property>
</action>
<action name="actionSaveTileBank">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_save.png</normaloff>:/movementIcons/images/ic_nel_save.png</iconset>
</property>
<property name="text">
<string>Save Tile Bank</string>
</property>
<property name="toolTip">
<string>Save Tile Bank</string>
</property>
</action>
<action name="actionSaveTileBankAs">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/movementIcons/images/ic_nel_save_as.png</normaloff>:/movementIcons/images/ic_nel_save_as.png</iconset>
</property>
<property name="text">
<string>Save Tile Bank As...</string>
</property>
<property name="toolTip">
<string>Save Tile Bank As...</string>
</property>
</action>
<action name="actionRotateTile90">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileRotation/images/rotation90.png</normaloff>:/tileRotation/images/rotation90.png</iconset>
</property>
<property name="text">
<string>90</string>
</property>
<property name="toolTip">
<string>Rotate Tile 90 Degrees</string>
</property>
</action>
<action name="actionRotateTile180">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileRotation/images/rotation180.png</normaloff>:/tileRotation/images/rotation180.png</iconset>
</property>
<property name="text">
<string>180</string>
</property>
<property name="toolTip">
<string>Rotate Tile180 Degrees</string>
</property>
</action>
<action name="actionRotateTile270">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileRotation/images/rotation270.png</normaloff>:/tileRotation/images/rotation270.png</iconset>
</property>
<property name="text">
<string>270</string>
</property>
<property name="toolTip">
<string>Rotate Tile 270 Degrees</string>
</property>
</action>
<action name="actionBatchLoad">
<property name="text">
<string>Batch Load</string>
</property>
<property name="toolTip">
<string>Batch Load</string>
</property>
</action>
<action name="actionImportBorder">
<property name="text">
<string>Import Border</string>
</property>
<property name="toolTip">
<string>Import Border</string>
</property>
</action>
<action name="actionExportBorder">
<property name="text">
<string>Export Border</string>
</property>
<property name="toolTip">
<string>Export Border</string>
</property>
</action>
<action name="actionTileDisplayIndex">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Index</string>
</property>
<property name="toolTip">
<string>Display Tile Index</string>
</property>
</action>
<action name="actionTileDisplayFilename">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Filename</string>
</property>
<property name="toolTip">
<string>Display Tile Filename</string>
</property>
</action>
<action name="actionAddTile">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileTools/images/add_tile.png</normaloff>:/tileTools/images/add_tile.png</iconset>
</property>
<property name="text">
<string>Add Tile</string>
</property>
<property name="toolTip">
<string>Add Tile</string>
</property>
</action>
<action name="actionDeleteTile">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileTools/images/delete_tile.png</normaloff>:/tileTools/images/delete_tile.png</iconset>
</property>
<property name="text">
<string>Delete Tile</string>
</property>
<property name="toolTip">
<string>Delete Tile</string>
</property>
</action>
<action name="actionReplaceImage">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileTools/images/replace_image.png</normaloff>:/tileTools/images/replace_image.png</iconset>
</property>
<property name="text">
<string>Replace Image</string>
</property>
<property name="toolTip">
<string>Replace Image</string>
</property>
</action>
<action name="actionDeleteImage">
<property name="icon">
<iconset resource="tile_editor.qrc">
<normaloff>:/tileTools/images/delete_image.png</normaloff>:/tileTools/images/delete_image.png</iconset>
</property>
<property name="text">
<string>Delete Image</string>
</property>
<property name="toolTip">
<string>Delete Image</string>
</property>
</action>
</widget>
<resources>
<include location="tile_editor.qrc"/>
<include location="../../../../tile_edit_qt/tile_edit_qt.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,75 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Project includes
#include "tile_editor_plugin.h"
#include "tile_editor_main_window.h"
#include "../core/icore.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
// NeL includes
#include "nel/misc/debug.h"
using namespace TileEditorPluginQt;
TileEditorPlugin::~TileEditorPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool TileEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
addAutoReleasedObject(new TileEditorContext());
return true;
}
void TileEditorPlugin::extensionsInitialized()
{
}
void TileEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
{
#ifdef NL_OS_WINDOWS
// Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
void TileEditorPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
Q_EXPORT_PLUGIN(TileEditorPlugin)

View file

@ -0,0 +1,109 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef TILE_EDITOR_PLUGIN_H
#define TILE_EDITOR_PLUGIN_H
#include "../../extension_system/iplugin.h"
#include "../core/icontext.h"
#include "nel/misc/app_context.h"
#include "tile_editor_main_window.h"
#include <QtCore/QObject>
namespace NLMISC
{
class CLibraryContext;
}
namespace TileEditorPluginQt
{
class TileEditorPlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
~TileEditorPlugin();
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext);
void addAutoReleasedObject(QObject *obj);
protected:
NLMISC::CLibraryContext *m_LibContext;
private:
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
};
class TileEditorContext: public Core::IContext
{
Q_OBJECT
public:
TileEditorContext(QObject *parent = 0) : IContext(parent)
{
m_tileEditorMainWindow = new TileEditorMainWindow();
}
virtual ~TileEditorContext()
{
delete m_tileEditorMainWindow;
}
virtual QString id() const
{
return QLatin1String("TileEditor");
}
virtual QString trName() const
{
return tr("Tile Editor");
}
virtual QIcon icon() const
{
return QIcon(":/tileRotation/images/rotation0.png");
}
virtual QUndoStack *undoStack()
{
return m_tileEditorMainWindow->getUndoStack();
}
virtual void open()
{
}
virtual QWidget *widget()
{
return m_tileEditorMainWindow;
}
private:
TileEditorMainWindow *m_tileEditorMainWindow;
};
} // namespace TileEditorPluginQt
#endif // TILE_EDITOR_PLUGIN_H

View file

@ -0,0 +1,138 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tile_item.h"
TileItem::TileItem(const QVector<QVariant> &data, TileItem *parent)
{
parentItem = parent;
itemData = data;
}
TileItem::~TileItem()
{
qDeleteAll(childItems);
}
void TileItem::appendChild(TileItem *item)
{
childItems.append(item);
}
TileItem *TileItem::child(int row)
{
return childItems.value(row);
}
int TileItem::childCount() const
{
return childItems.count();
}
int TileItem::childNumber() const
{
if(parentItem)
return parentItem->childItems.indexOf(const_cast<TileItem*>(this));
return 0;
}
bool TileItem::insertChildren(int position, int count, int columns)
{
if(position<0 || position>childItems.size())
return false;
for(int row = 0; row < count; row++)
{
QVector<QVariant> data(columns);
TileItem *item = new TileItem(data, this);
childItems.insert(position, item);
}
return true;
}
bool TileItem::removeChildren(int position, int count)
{
if(position<0 || position+count>childItems.size())
return false;
for(int row=0; row<count; row++)
delete childItems.takeAt(position);
return true;
}
bool TileItem::insertColumns(int position, int columns)
{
if(position<0 || position > itemData.size())
return false;
for(int column=0; column<columns; column++)
itemData.insert(position, columns);
Q_FOREACH(TileItem *child, childItems)
child->insertColumns(position, columns);
return true;
}
int TileItem::row() const
{
if(parentItem)
return parentItem->childItems.indexOf(const_cast<TileItem*>(this));
return 0;
}
int TileItem::columnCount() const
{
return itemData.count();
}
QVariant TileItem::data(int column) const
{
return itemData.value(column);
}
bool TileItem::setData(int column, const QVariant &value)
{
if(column < 0 || column >= itemData.size())
return false;
itemData[column] = value;
return true;
}
TileItem *TileItem::parent()
{
return parentItem;
}
void TileItem::appendRow(const QList<TileItem*> &items)
{
Q_FOREACH(TileItem *item, items)
appendRow(item);
}
void TileItem::appendRow(TileItem *item)
{
childItems.append(item);
}
//QImage *TileItem::getTileImageFromChannel(int channel)
//{
// return m_tileChannels[channel];
//}

View file

@ -0,0 +1,66 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef TILE_ITEM_H
#define TILE_ITEM_H
#include "nel/misc/types_nl.h"
#include <QAbstractListModel>
#include <QVector>
class TileItem
{
public:
TileItem(const QVector<QVariant> &data, TileItem *parent=0);
~TileItem();
void appendChild(TileItem *child);
TileItem *child(int row);
int childCount() const;
int childNumber() const;
int columnCount() const;
bool setData(int column, const QVariant &value);
QVariant data(int column) const;
bool insertChildren(int position, int count, int columns);
bool removeChildren(int position, int count);
bool insertColumns(int position, int columns);
int row() const;
TileItem *parent();
void appendRow(const QList<TileItem*> &items);
void appendRow(TileItem *item);
//QImage *getTileImageFromChannel(int channel);
//int getTileIndex() { return m_tileIndex; }
//QString getTileFilename() { return m_tileFilename; }
private:
QList<TileItem*> childItems;
QVector<QVariant> itemData;
TileItem *parentItem;
//QMap<int, QImage*> m_tileChannels;
//int m_tileIndex;
//QString m_tileFilename;
};
#endif // TILE_ITEM_H

View file

@ -0,0 +1,123 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tile_model.h"
#include "tile_item.h"
#include <QStringList>
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
{
QVector<QVariant> rootData;
Q_FOREACH(QString header, headers)
rootData << header;
rootItem = new TileItem(rootData);
}
TileModel::~TileModel()
{
delete rootItem;
}
TileItem *TileModel::getItem(const QModelIndex &index) const
{
if(index.isValid())
{
TileItem *item = static_cast<TileItem*>(index.internalPointer());
if(item) return item;
}
return rootItem;
}
QModelIndex TileModel::index(int row, int column, const QModelIndex &parent) const
{
if(parent.isValid() && parent.column() != 0)
return QModelIndex();
TileItem *parentItem = getItem(parent);
TileItem *childItem = parentItem->child(row);
if(childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
QModelIndex TileModel::parent(const QModelIndex &index) const
{
if(!index.isValid())
return QModelIndex();
TileItem *childItem = getItem(index);
TileItem *parentItem = childItem->parent();
if(parentItem == rootItem)
return QModelIndex();
return createIndex(parentItem->childNumber(), 0, parentItem);
}
int TileModel::rowCount(const QModelIndex &parent) const
{
TileItem *parentItem = getItem(parent);
return parentItem->childCount();
}
int TileModel::columnCount(const QModelIndex &parent) const
{
TileItem *parentItem = getItem(parent);
return parentItem->columnCount();
}
QVariant TileModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid())
return QVariant();
if(role != Qt::DisplayRole)
return QVariant();
TileItem *item = static_cast<TileItem*>(index.internalPointer());
return item->data(index.column());
}
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
{
if(!index.isValid())
return Qt::ItemIsEnabled;
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
}
QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
return rootItem->data(section);
return QVariant();
}
void TileModel::appendRow(const QList<TileItem*> &items)
{
rootItem->appendRow(items);
}
void TileModel::appendRow(TileItem *item)
{
rootItem->appendRow(item);
}

View file

@ -0,0 +1,54 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef TILE_MODEL_H
#define TILE_MODEL_H
#include "nel/misc/types_nl.h"
#include <QAbstractListModel>
class TileItem;
class TileModel : public QAbstractItemModel
{
Q_OBJECT
public:
TileModel::TileModel(const QStringList &headers, QObject *parent);
~TileModel();
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent= QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
// Tile Model specific functions
void appendRow(const QList<TileItem*> &items);
void appendRow(TileItem *item);
private:
TileItem *getItem(const QModelIndex &index) const;
//QList<TileItem*> m_tiles;
//int m_activeEditChannel;
TileItem *rootItem;
};
#endif // TILE_128_MODEL_H