MegaGlest Forum

MegaGlest => MegaGlest => Topic started by: tomreyn on 15 March 2014, 18:33:07

Title: WIP: dabascht's QT4/5 based map editor
Post by: tomreyn on 15 March 2014, 18:33:07
dabascht AKA basxto is currently working on a QT4/5 based clone of the (cureently wxgtk based) map editor:
https://github.com/dabascht/megaglest-source/tree/qt4 (https://github.com/dabascht/megaglest-source/tree/qt4)

It's work in progress, most functionality isn't there, yet, but it's possible to build it already.

So here's how to build it on Ubuntu:

Ubuntu 12.04 LTS (QT4):

Code: [Select]
cd
mkdir SCM
cd SCM
git clone https://github.com/dabascht/megaglest-source.git megaglest-source_dabascht
cd megaglest-source_dabascht
# If you also want the default MegaGlest assets:
#git submodule update --init --recursive
git checkout qt4
cd mk/linux
sudo ./setupBuildDeps.sh
sudo apt-get install libqt4-dev
sed -i 's/^EXTRA_CMAKE_OPTIONS=$/EXTRA_CMAKE_OPTIONS="-DBUILD_MEGAGLEST=Off -DBUILD_MEGAGLEST_MAP_EDITOR=On -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=Off -DBUILD_MEGAGLEST_MODEL_VIEWER=Off -DUSE_QT5=Off"/' build-mg.sh
./build-mg.sh

Ubuntu 13.10 (QT5):

Code: [Select]
cd
mkdir SCM
cd SCM
git clone https://github.com/dabascht/megaglest-source.git megaglest-source_dabascht
cd megaglest-source_dabascht
# If you also want the default MegaGlest assets:
#git submodule update --init --recursive
git checkout qt4
cd mk/linux
sudo ./setupBuildDeps.sh
sudo apt-get install qt5-default
sed -i 's/^EXTRA_CMAKE_OPTIONS=$/EXTRA_CMAKE_OPTIONS="-DBUILD_MEGAGLEST=Off -DBUILD_MEGAGLEST_MAP_EDITOR=On -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=Off -DBUILD_MEGAGLEST_MODEL_VIEWER=Off -DUSE_QT5=On"/' build-mg.sh
./build-mg.sh

Ubuntu 14.04 LTS will likely work the same as 13.10.

SCM stands for source code management, it's just where I like to keep any source code repositories - you can name this differently and place it elsewhere, of course. The same goes for the megaglest-source_dabascht directory.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 15 March 2014, 18:50:41
Also builds on Arch GNU/Linux with

pacman -S qt4

or

pacman -S qt5 and -DUSE_QT5=On

You can find the default dependencies with pacman -Si megaglest

Code: [Select]
mkdir SCM
cd SCM
git clone https://github.com/dabascht/megaglest-source.git megaglest-source_dabascht
cd megaglest-source_dabascht
git checkout qt4
cd mk/linux
sed -i 's/^EXTRA_CMAKE_OPTIONS=$/EXTRA_CMAKE_OPTIONS="-DBUILD_MEGAGLEST=Off -DBUILD_MEGAGLEST_MAP_EDITOR=On -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=Off -DBUILD_MEGAGLEST_MODEL_VIEWER=Off -DUSE_QT5=Off"/' build-mg.sh
./build-mg.sh

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: softcoder on 15 March 2014, 23:14:48
Great job, hope this editor gets finished an really replaces out use of wxwidgets.

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 17 March 2014, 15:13:16
Basic map editing should be possible now.

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: titi on 17 March 2014, 19:02:15
please provide some screenshots :-) .
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: kagu on 18 March 2014, 00:27:37
(http://i.imgur.com/QQU3WVn.png)
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 18 March 2014, 02:41:56
Newest version, the statusbar is fake :D

You can’t see it, but this version is much faster and uses less RAM.

(http://s61.img-up.net/2014-03-18f9b0.png) (http://img-up.net)
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 18 March 2014, 19:44:19
If you wanna try the preview feature without compiling the whole game, but you have installed megaglest:

Code: [Select]
cd mk/linux/
ln -s $(which megaglest) megaglest

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 19 March 2014, 14:16:58
(http://i68.img-up.net/2014-03-195e55.png) (http://img-up.net)

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: kagu on 19 March 2014, 14:21:38
Dabasto i have a feature request to make the possibility save maps as XML, so we can import and compile the maps.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 19 March 2014, 15:19:08
I’m using the shared libraries of megaglest for loading and saving maps.

It should be possible to extend shared_lib/map/map_preview, this would make it possible loading and saving .xml just like .mgm and .gbm.

This is mostly independant from map editor, just need to modify the suffix filters for loading and saving dialogs.

But I’m focusing on getting rid of WxWidget and porting map editor and g3d viewer to Qt.

-> Will not implement that now.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 21 March 2014, 18:06:10
Improvements compared to WxWidget version:


still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: tomreyn on 22 March 2014, 01:27:40
You're making good progress there!

Some more suggestions for further improvement:

Split toolbars more:
In my opinion, the "heights and diameters" tool bar should be split up in two ("Heights", "Diameters"), so that users will be able to access all diameter icons with a single click even on smaller resolutions (or when windowed). The QT tool bar implementation is rather flexible (try drawing one of them around with the mouse to see), it would be a pity not to make better use of this. So I'd actually split up the "objects and surfaces" toolbar, which is really about editing, surfaces and objects, into tool bars labelled "Edit", "Surfaces", "Objects".

Zoom:
Much better now. But it continues to zoom to the center of the map (not the mouse pointer position) until the map fully fills the window and the canvas is no longer visible. Only then will it actually zoom towards the mouse pointer.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 22 March 2014, 12:02:14
I modified the build scripts.
Most distributions will build with Qt 4 and some (newest Ubuntu and Fedora) with Qt 5.
This code should be sufficient now:
Code: [Select]
cd
mkdir SCM
cd SCM
git clone https://github.com/basxto/megaglest-source.git megaglest-source_basxto
cd megaglest-source_basxto
# If you also want the default MegaGlest assets:
#git submodule update --init --recursive
git checkout qt4
cd mk/linux
sudo ./setupBuildDeps.sh
./build-mg.sh

This also builds the game, but you will need it for the preview feature.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: tomreyn on 22 March 2014, 13:13:37
this will lack the game data, so previews will fail. You could do a --recursive clone, though, or instruct people to point the submodule "remote" to a local directory where the game data already exists as a git repository.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 12 April 2014, 23:04:57
It’s now possible to copy the selected area, it will then be pasted at the most top left point of the actual selection.

Ctrl-Left click: move map in window

Shift-Left click: select tiles

(http://j71.img-up.net/2014-04-132e20.png) (http://img-up.net)

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Coldfusionstorm on 17 April 2014, 02:17:41
Looks Very Very Nice!, GJ
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 1 May 2014, 18:04:31
It should now be possible to compile with Microsoft Visual Studio 2010 Express, if Qt 5.2.1 is installed to C:/Qt/5.2.1/msvc2010_opengl

This is just the 32bit version!

(http://goblin.coding4schoki.org/mgoblin_media/media_entries/7/2014-05-01_1552_1280x1024.medium.png) (http://goblin.coding4schoki.org/u/basxto/m/mg-map-editor-compiles/)

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Tiel on 2 May 2014, 18:57:11
I'm an idiot, what does this mean?
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 3 May 2014, 16:07:18
I'm an idiot, what does this mean?

I don’t feel what exactly you are referencing to.

If you meant this project in whole:

I’m rebuilding the GUI with Qt (https://en.wikipedia.org/wiki/Qt_%28toolkit%29), the current editor uses WxWidget (https://en.wikipedia.org/wiki/WxWidgets)
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Tiel on 4 May 2014, 04:52:44
What does that mean, though? Better cross compatibility?
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: filux on 4 May 2014, 05:10:20
A little bit yes, but also QT has a little greater possibilities.

Mainly regards some linux distributions which don't like (or even hate) gnome and gnome's dependencies.
In my opinion over time this phenomenon will intensify since "canonical" :thumbdown: has an impact on this environment and slowly spoils it  :-X.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 4 May 2014, 06:20:56
The main reason is that I’ve never heard of WxWidget before and were more interested in Qt.

Furthermore the old editor used WxWidget and OpenGL, the latter for rendering (https://github.com/MegaGlest/megaglest-source/blob/develop/source/shared_lib/sources/graphics/gl/base_renderer.cpp) the actual map. I was able to render it with pure Qt and Qt is much more straight forward than OpenGL … at least when drawing a 2D canvas. Qt is handling the redrawing and moving of the canvas. The old editor sometimes failed to draw the map on the screen proberly … at least on my system.

Qt mostly splits code and UI-design. Every non-programmer can open the .ui-files with QtDesigner and redesign the GUI by dragging stuff around.

We used an obsolete version of WxWidget, so we needed to port it to a never version or a different toolkit.

I think, most features I added, should also be possible with WxWidget. The old editor just did not use the whole potential of this toolkit.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: MoLAoS on 4 May 2014, 16:26:38
Comparing WxWidget to QT is pretty common when people want to know what UI library to use. QT has a few cons, but I suspect for most people that its pros outweigh them quite easily. Its definitely focused on being easy to use. And it has a first party drag and drop compared to the low quality third party ones for WxW. Plus, signals and slots built in from the start.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 5 August 2014, 08:44:18
The map-editor should be feature complete by now.
If you still miss a feature or a feature does not work as explected, please let me know.
But I don’t promise to include any further features.

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 6 August 2014, 16:03:04
Today I made some huge changes to the painting of tiles. Thus I can now use a standard-method for zooming, this had also the option to keep a tile under the cursor when scaling. Titi and Tomreyn requested this behavior.

still TODO:

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: titi on 6 August 2014, 23:20:16
This gets better and better and I bet this will replace original map editor soon!

things I would like to see:
- no painting with middle mouse.
- instead move pane with middle mouse down and not with shit + left mouse down
- maybe scroll can be done in smaller steps

Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 8 August 2014, 08:14:42
things I would like to see:
- no painting with middle mouse.
- instead move pane with middle mouse down and not with shit + left mouse down
- maybe scroll can be done in smaller steps (2px steps now)

Using middle click turned out being too difficult, also especially some laptops lack a middle mous button.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: kagu on 21 August 2014, 13:33:02
Im not sure if this is a bug but I'm posting it anyway.

Not rectangular maps not centred , and if you zoom it , the zoom doesn't happen centred in mouse area (like in GIMP).

(http://i.imgur.com/4GLKGVq.png)
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 21 August 2014, 13:59:10
If the map size shrinks, this also happens when you open a map or create a blank one, the surrounding view doesn’t. And this view is centered. Did not figure out how to fix this, but this is probably possible.

As long as the whole map fits in the window it’s centered. As soon as it does not fit anymore, the pixel under the mouse cursor is the anchor for zooming. The Gimp has exactly the same behavior.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: kagu on 5 September 2014, 14:31:12
As soon as I hit Ctrl + Z , it crashes for me. The terminal shows no errors.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 23 December 2014, 16:49:12
Oh forgot to mention, that I can't reproduce that bug.

Also it won't compile with newest Qt versions, will try to fix that next week, this week I try to make the windows version compilable, but with an older version of Qt.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 23 December 2014, 17:38:05
This time it was easier than expected.

Icons can't be displayed, also opening and saving files crashes … but rest looks good.

Revision 3100276fa79512b068d3860a0fe6ade7e493da48 (https://github.com/basxto/megaglest-source/commit/3100276fa79512b068d3860a0fe6ade7e493da48) from windows-test branch should work with VS2010 Express.

You need to install Qt 5.2.1 to C:\Qt\5.2.1\msvc2010_opengl … I plan to change this in the future.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 13 February 2015, 21:29:08
It’s now possible to compile on linux with Qt 5.4 (released Dec 10)

Now I’m trying to reduce the posibilities to cause memory leaks and segmentation faults. (using less pointers in C++)
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Coldfusionstorm on 20 February 2015, 19:25:57
Well, i tried installing QT and Tried compiling This is the result

vs10c++
Windows 10.

Pastebin
http://pastebin.com/JEPy1nxK
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Coldfusionstorm on 28 February 2015, 00:53:41
Got it to compile, But Binary does not :/.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: softcoder on 3 October 2015, 16:52:10
What is the status of this editor? Is it functional enough to replace the wxwidget editor?
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: Baŝto on 3 October 2015, 22:16:57
This project is frozen at the moment.

Basically it's feature complete if I recall correctly.

It's broken with newest Qt version and titi said, it's to slow on his computer.
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: titi on 4 October 2015, 20:30:41
I cannot remember that I said slow. For me this editor works very well!
@softcoder try it here:
https://github.com/basxto/megaglest-source
Title: Re: WIP: dabascht's QT4/5 based map editor
Post by: tomreyn on 31 December 2015, 14:04:54
I think I used to say that some things are slower than on the old editor. But this was a while ago, and I think you optimized things since.
And you definitely improved a lot of things already, and ironed out some old bugs.

Also, QT should work cross platform which is not the case for wxgtk (it does not seem to build on OS X).

So it would be great if we could replace the old editor by yours.