mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-06 15:29:02 +00:00
Changed: #1302 Added 2d render in world editor plugin.
This commit is contained in:
parent
a02ddb2369
commit
5edc56cf15
5 changed files with 147 additions and 0 deletions
|
@ -11,6 +11,7 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.
|
|||
|
||||
SET(OVQT_PLUGIN_WORLD_EDITOR_HDR world_editor_plugin.h
|
||||
world_editor_window.h
|
||||
world_editor_scene.h
|
||||
primitives_model.h
|
||||
primitives_view.h
|
||||
)
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 "world_editor_scene.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QGraphicsPixmapItem>
|
||||
#include <QtGui/QGraphicsSimpleTextItem>
|
||||
#include <QApplication>
|
||||
|
||||
namespace WorldEditor
|
||||
{
|
||||
|
||||
WorldEditorScene::WorldEditorScene(int sizeCell, QObject *parent)
|
||||
: LandscapeEditor::LandscapeSceneBase(sizeCell, parent)
|
||||
{
|
||||
}
|
||||
|
||||
WorldEditorScene::~WorldEditorScene()
|
||||
{
|
||||
}
|
||||
/*
|
||||
void LandscapeSceneBase::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
QGraphicsScene::mousePressEvent(mouseEvent);
|
||||
|
||||
qreal x = mouseEvent->scenePos().x();
|
||||
qreal y = mouseEvent->scenePos().y();
|
||||
m_posX = sint32(floor(x / m_cellSize));
|
||||
m_posY = sint32(-floor(y / m_cellSize));
|
||||
|
||||
m_mouseButton = mouseEvent->button();
|
||||
}
|
||||
|
||||
void LandscapeSceneBase::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
m_mouseX = mouseEvent->scenePos().x();
|
||||
m_mouseY = mouseEvent->scenePos().y() - m_cellSize;
|
||||
|
||||
m_posX = sint32(floor(m_mouseX / m_cellSize));
|
||||
m_posY = sint32(-floor(m_mouseY / m_cellSize));
|
||||
|
||||
QGraphicsScene::mouseMoveEvent(mouseEvent);
|
||||
}
|
||||
|
||||
void LandscapeSceneBase::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
QGraphicsScene::mouseReleaseEvent(mouseEvent);
|
||||
m_mouseButton = Qt::NoButton;
|
||||
}
|
||||
*/
|
||||
|
||||
} /* namespace WorldEditor */
|
|
@ -0,0 +1,57 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 WORLD_EDITOR_SCENE_H
|
||||
#define WORLD_EDITOR_SCENE_H
|
||||
|
||||
// Project includes
|
||||
#include "world_editor_global.h"
|
||||
|
||||
#include "../landscape_editor/landscape_scene_base.h"
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Qt includes
|
||||
|
||||
namespace WorldEditor
|
||||
{
|
||||
|
||||
/*
|
||||
@class WorldEditorScene
|
||||
@brief
|
||||
@details
|
||||
*/
|
||||
class WORLD_EDITOR_EXPORT WorldEditorScene : public LandscapeEditor::LandscapeSceneBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WorldEditorScene(int sizeCell = 160, QObject *parent = 0);
|
||||
virtual ~WorldEditorScene();
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
protected:
|
||||
// virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
// virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
// virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} /* namespace WorldEditor */
|
||||
|
||||
#endif // WORLD_EDITOR_SCENE_H
|
|
@ -19,6 +19,7 @@
|
|||
#include "world_editor_window.h"
|
||||
#include "world_editor_constants.h"
|
||||
#include "primitives_model.h"
|
||||
#include "world_editor_scene.h"
|
||||
|
||||
// Core
|
||||
#include "../core/icore.h"
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include "../core/core_constants.h"
|
||||
|
||||
// Lanscape Editor plugin
|
||||
#include "../landscape_editor/builder_zone_base.h"
|
||||
//#include "../landscape_editor/project_settings_dialog.h"
|
||||
|
||||
// NeL includes
|
||||
|
@ -55,6 +57,12 @@ WorldEditorWindow::WorldEditorWindow(QWidget *parent)
|
|||
m_ui.setupUi(this);
|
||||
m_undoStack = new QUndoStack(this);
|
||||
|
||||
m_worldEditorScene = new WorldEditorScene(160, this);
|
||||
m_zoneBuilderBase = new LandscapeEditor::ZoneBuilderBase(m_worldEditorScene);
|
||||
|
||||
m_worldEditorScene->setZoneBuilder(m_zoneBuilderBase);
|
||||
m_ui.graphicsView->setScene(m_worldEditorScene);
|
||||
|
||||
QActionGroup *sceneModeGroup = new QActionGroup(this);
|
||||
sceneModeGroup->addAction(m_ui.selectAction);
|
||||
sceneModeGroup->addAction(m_ui.moveAction);
|
||||
|
@ -82,6 +90,8 @@ WorldEditorWindow::WorldEditorWindow(QWidget *parent)
|
|||
WorldEditorWindow::~WorldEditorWindow()
|
||||
{
|
||||
writeSettings();
|
||||
|
||||
delete m_zoneBuilderBase;
|
||||
}
|
||||
|
||||
QUndoStack *WorldEditorWindow::undoStack() const
|
||||
|
|
|
@ -24,9 +24,15 @@
|
|||
// Qt includes
|
||||
#include <QtGui/QUndoStack>
|
||||
|
||||
namespace LandscapeEditor
|
||||
{
|
||||
class ZoneBuilderBase;
|
||||
}
|
||||
|
||||
namespace WorldEditor
|
||||
{
|
||||
class PrimitivesTreeModel;
|
||||
class WorldEditorScene;
|
||||
|
||||
class WorldEditorWindow: public QMainWindow
|
||||
{
|
||||
|
@ -57,6 +63,8 @@ private:
|
|||
|
||||
PrimitivesTreeModel *m_primitivesModel;
|
||||
QUndoStack *m_undoStack;
|
||||
WorldEditorScene *m_worldEditorScene;
|
||||
LandscapeEditor::ZoneBuilderBase *m_zoneBuilderBase;
|
||||
Ui::WorldEditorWindow m_ui;
|
||||
}; /* class WorldEditorWindow */
|
||||
|
||||
|
|
Loading…
Reference in a new issue