From c4257403618442a037e99ba4e9f67e91b84e837b Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Tue, 11 Oct 2011 13:44:53 +0300 Subject: [PATCH] Changed: #1302 Fixed undo/redo in world editor qt. --HG-- branch : gsoc2011-worldeditorqt --- .../src/plugins/world_editor/world_editor_constants.h | 4 ++++ .../src/plugins/world_editor/world_editor_misc.cpp | 2 +- .../src/plugins/world_editor/world_editor_scene.cpp | 4 +++- .../src/plugins/world_editor/world_editor_scene_item.h | 2 -- .../src/plugins/world_editor/world_editor_window.cpp | 4 ++-- .../src/plugins/world_editor/world_editor_window.ui | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h index a75e2148b..d0617373e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h @@ -32,6 +32,10 @@ const int PRIMITIVE_IS_MODIFIED = USER_TYPE + 5; const int PRIMITIVE_FILE_IS_CREATED = USER_TYPE + 6; const int PRIMITIVE_IS_VISIBLE = USER_TYPE + 7; +//properties editor +const char *const DIFFERENT_VALUE_STRING = ""; +const char *const DIFFERENT_VALUE_MULTI_STRING = ""; + //settings const char *const WORLD_EDITOR_SECTION = "WorldEditor"; const char *const WORLD_WINDOW_STATE = "WorldWindowState"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp index 6db59f9e5..dc1ae435f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp @@ -171,7 +171,7 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList NLLIGO::CPrimitives ligoPrimitives; // Read it - ligoPrimitives.read(primitives, fileName.c_str(), *NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig); + ligoPrimitives.read(primitives, fileName.c_str(), *ligoConfig()); //_DataHierarchy.back ().Primitives.read (primitives, filename, theApp.Config); // Set the filename diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp index ba67ab9a8..9922daaf7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp @@ -181,7 +181,7 @@ void WorldEditorScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) { m_firstPick = mouseEvent->scenePos(); - if (m_pointsMode) + if (isEnabledEditPoints()) { m_polygons = polygonsFromItems(m_selectedItems); @@ -288,6 +288,8 @@ void WorldEditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) if (mouseEvent->button() == Qt::LeftButton) { + checkUndo(); + // Update selection if ((m_selectionArea.left() != 0) && (m_selectionArea.right() != 0)) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h index b5584c427..9752d783d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h @@ -223,10 +223,8 @@ public: WorldItemZone(const QPolygonF &polygon, QGraphicsItem *parent = 0); virtual ~WorldItemZone(); - virtual void setColor(const QColor &color); virtual bool removeSubPoint(WorldItemSubPoint *subPoint); - virtual QPainterPath shape() const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp index 40e69d1f2..1e6d44ff6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp @@ -384,8 +384,8 @@ void WorldEditorWindow::readSettings() // Use OpenGL graphics system instead raster graphics system if (settings->value(Constants::WORLD_EDITOR_USE_OPENGL, true).toBool()) { - //m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer)); - m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers)); + m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer)); + //m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers)); m_ui.graphicsView->setViewport(m_oglWidget); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui index d6d4edb28..d9b6f8ac3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui @@ -28,7 +28,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing + QPainter::SmoothPixmapTransform QGraphicsView::NoDrag