Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: m!m on March 12, 2018, 04:48:52 am

Title: qtFRED: What is it and can I eat it?
Post by: m!m on March 12, 2018, 04:48:52 am
Those of you who frequent the #scp channel on Discord probably already know this but for the past few months there has been an ongoing effort to port the Windows only FRED code to the cross-platform UI framework Qt (https://www.qt.io/). This has actually been quite successful which allowed us to merge the current state of the project into the master branch instead of keeping it in a separate branch of the repository. Don't worry, the standard FRED won't go anywhere for some time since qtFRED is still lacking a lot of features.

The project began when the forum user groscask began porting the existing FRED rendering code to the Qt platform. He was very successful in this undertaking and managed to get a version working which allowed to view missions natively on platforms other than Windows. Unfortunately, he was unable to continue developing the project so development pretty much fell dormant at some point. Then (according to the git logs) at the end of May 2017 I restarted development on the project based on the excellent ground work done by groscask. I fixed the code so that it works with the now updated version of the FSO code and soon after I was joined by DahBlount and z64555.
We continued porting code from the FRED codebase and started to make a lot of progress towards making qtFRED an actual editor. Currently the following features are supported:

Test builds (http://swc.fs2downloads.com/builds/test/qtFRED/)
These builds are updated occasionally when there is something to test.

That is all for the moment. We will post updates here when there are news.
Finally, here are some screenshots of qtFRED in action. These pictures were taken on Linux which already shows that cross-platform compatibility is a thing with qtFRED:

(https://i.imgur.com/a8nzOC6.png)

Fully functional mission Specs editor dialog:
(https://i.imgur.com/vB1TGx7.png)

Event editor with SEXP tree:
(https://i.imgur.com/vV5yaiw.png)
Title: Re: qtFRED: What is it and can I eat it?
Post by: X3N0-Life-Form on March 12, 2018, 05:31:05 am
Impressive work, looks like it's moving along nicely :).

Uses psychic powers to summon cookies to m!m, DahBlount and z64555.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Nightmare on March 12, 2018, 05:59:35 am
Actually, does cuteFRED any further improvements aside the nice new UI?
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on March 12, 2018, 06:02:18 am
Aside from a few bug fixes when we find them it will be a straight port of FRED code to qtFRED. Additional features would only slow down development. There are some changes to the architecture of the code which should make it easier to add features in the future but that will not be used to introduce new features at this time.
Title: Re: qtFRED: What is it and can I eat it?
Post by: karajorma on March 12, 2018, 07:35:00 am
The unbundling of the SEXP tree code is a good example of that. One of the main reasons I never got around to making the cutscene editor dialogue was that I didn't fancy having to figure out how to make the SEXP code work. Now it can be added as soon as qtFRED is working.
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on March 12, 2018, 07:50:45 am
The SEXP tree code I extracted is pretty much a copy & paste job. I didn't change the existing FRED code much except that I changed the MFC controls to Qt so the issues you encountered with the existing SEXP code will probably be the same although I introduced a better way of specifying context specific behavior though an abstract class.
Title: Re: qtFRED: What is it and can I eat it?
Post by: mjn.mixael on March 12, 2018, 08:43:13 am
This is excellent.

So, when can I eat it? :p
Title: Re: qtFRED: What is it and can I eat it?
Post by: Spoon on March 12, 2018, 11:32:03 am
Clickbait title, poses a question, doesn't provide an answer.
Disliked, unsubscribed, reported

Can I actually eat it???


Aside from a few bug fixes when we find them it will be a straight port of FRED code to qtFRED. Additional features would only slow down development. There are some changes to the architecture of the code which should make it easier to add features in the future but that will not be used to introduce new features at this time.
There is a whole host of UI things I would like to see in cuteFRED, I've told Dahblount about them in a distance past, I'll write a bunch down here for the heck of it. (I dont know how many of these are already a thing in kawaiiFRED.)


I'm sure I can come up with some more.
Title: Re: qtFRED: What is it and can I eat it?
Post by: mjn.mixael on March 12, 2018, 11:43:21 am
Clickbait title, poses a question, doesn't provide an answer.
Disliked, unsubscribed, reported

Can I actually eat it???


Aside from a few bug fixes when we find them it will be a straight port of FRED code to qtFRED. Additional features would only slow down development. There are some changes to the architecture of the code which should make it easier to add features in the future but that will not be used to introduce new features at this time.
There is a whole host of UI things I would like to see in cuteFRED, I've told Dahblount about them in a distance past, I'll write a bunch down here for the heck of it. (I dont know how many of these are already a thing in kawaiiFRED.)

  • Resizeable windows, primarily the event window. It can get pretty frustrating working with a large event in such a small window. I've got plenty of unused screen estate here!
  • Reorder messages. For organizing those messages you add later but actually belong up higher in the list.
  • Increase the size of the ANI dropdown menu, I've got file names that get cut off in its current dimensions.
  • Have the window that opens when you browse for an ani file, default to all valid image types, or at least to apng by default. (If been pestering Dahblount about this change for the past few days now, and I think its already been changed to default to apng for regular FRED)
  • Working keyboard shortcuts. CTRL-C CTRL-V CTRL-Z
  • Update new events. So when you make a new event, and then another new event that does a is-event-true-delay, you can actually instantly add the events you just created. Without having to close and reopen the event window.
  • A briefing window that isn't terrible and awful.

I'm sure I can come up with some more.

OMG So much yes.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Axem on March 12, 2018, 12:13:15 pm
https://docs.google.com/document/d/1BRJZ8wI-1JeEzaZ0GuZki7K93BYqPea-iSEDnjqZ49Q/edit?usp=sharing

:)

EDIT: I should add this is very cool and major props to the people who are diving into this job!
Title: Re: qtFRED: What is it and can I eat it?
Post by: Spoon on March 12, 2018, 12:56:36 pm
Right, I forgot that document existed.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Nightmare on March 12, 2018, 01:18:22 pm
If we're already talking about that, what about some kind of dialog editor that ties message, sender (including ani), interval and stuff like that together, so that instead of send-message-list you have pre-made message lists that can be stopped if necessary? If you had a button like "add message to list", with interval (from message length) and priority being assigned automaticly, all the user would have to add being sender and priority (if needed), and writing the message of course.

Because for now the easiest way to insert a msg into send-message-list is to open the mission in notepad, AFAIK.

Also, if the list is too long it can happen that you (probably even with correct FREDing) receive opposite messages at the same time.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Spoon on March 12, 2018, 01:30:55 pm
If we're already talking about that, what about some kind of dialog editor that ties message, sender (including ani), interval and stuff like that together, so that instead of send-message-list you have pre-made message lists that can be stopped if necessary? If you had a button like "add message to list", with interval (from message length) and priority being assigned automaticly, all the user would have to add being sender and priority (if needed), and writing the message of course.

Because for now the easiest way to insert a msg into send-message-list is to open the mission in notepad, AFAIK.

Also, if the list is too long it can happen that you (probably even with correct FREDing) receive opposite messages at the same time.
+1 for that

The way we still do messages nowadays is archaic as all heck
Title: Re: qtFRED: What is it and can I eat it?
Post by: chief1983 on March 12, 2018, 01:52:54 pm
I mean, you might be able to get Ctrl+Z working on an individual text element if that is already supported by Qt, but having an undo stack for FRED in general has been a long-awaited but very difficult thing to try to implement.  Assuming the state of that won't change much as the underlying architecture of how FRED works is being maintained.  That probably means that it's still using backup mission files for each change you make, etc.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Nightmare on March 12, 2018, 02:19:31 pm
Well you might be able to log all things in a seperate file everytime something in the mission is updated.

That would require having a window where you could read things like

"Alpha 1" moved to coordinates "x,y,z"
"Alpha 1" changed orientation to "p,b,h"
Event "WTF" modified

So far FRED spits out a Backup.00x file everytime something is updated, if only the changes were saved it might be easier to handle.

Also, it might be useful to have such a log file if you're working on a project with others. If something is suddenly broken that worked before, it is probably easier to find out why.

but I have no idea about coding, sooo...
Title: Re: qtFRED: What is it and can I eat it?
Post by: DahBlount on March 12, 2018, 02:37:55 pm
I highly encourage any suggestions be put in the google doc Axem linked. It'll make things easier once qtFRED is at parity with FRED2.
Title: Re: qtFRED: What is it and can I eat it?
Post by: mjn.mixael on March 12, 2018, 05:34:35 pm
Oh my... I imagined FREDing in the future FRED as described by that document and I about died with excitement. Yes. All of that.
Title: Re: qtFRED: What is it and can I eat it?
Post by: kaptain on March 12, 2018, 10:15:31 pm
Amazing work :yes: ! i know this is not a priority but... just a question out of curiosity, how difficult under a coding point of view will be a feature to test a mission without loading it every time from zero? i mean, keeping the invariable assets in memory (models, sounds, etc.) and only loading the changes?
Title: Re: qtFRED: What is it and can I eat it?
Post by: DahBlount on March 12, 2018, 11:22:38 pm
That might be a bit difficult as FRED and FreeSpace are separate executables.
Title: Re: qtFRED: What is it and can I eat it?
Post by: karajorma on March 13, 2018, 12:14:11 am
Oh my... I imagined FREDing in the future FRED as described by that document and I about died with excitement. Yes. All of that.

The problem is that at the moment qtFRED is a straight port of FRED. All that's changed is the interface. So if anything was impossible before because of MFC, then it might be possible to change it (CTRL + whatever is an example of that sort of thing. I did look into it a while back and could never get it to work despite the fact I seemed to be doing everything the MFC documentation told me to do). If the problem is that you'd have to rewrite large sections of FRED, then that's not going to be fixed simply by moving to qt.
Title: Re: qtFRED: What is it and can I eat it?
Post by: HLD_Prophecy on March 13, 2018, 11:20:17 am
This is great! Looking forward to using qtFRED some years down the road. :)
Title: Re: qtFRED: What is it and can I eat it?
Post by: Axem on March 13, 2018, 12:14:52 pm
Oh my... I imagined FREDing in the future FRED as described by that document and I about died with excitement. Yes. All of that.

The problem is that at the moment qtFRED is a straight port of FRED. All that's changed is the interface. So if anything was impossible before because of MFC, then it might be possible to change it (CTRL + whatever is an example of that sort of thing. I did look into it a while back and could never get it to work despite the fact I seemed to be doing everything the MFC documentation told me to do). If the problem is that you'd have to rewrite large sections of FRED, then that's not going to be fixed simply by moving to qt.

Well I mean the document is really just a pie-in-the-sky wishlist without any thought or concern as how easy/possible it is. Definitely qtFRED should be brought up to par before any major changes are done, but it's still fun to dream and think about what features would be nice.

For ages whenever I asked for some alteration in FRED (even if it was resizing a few windows), I always got "let's wait until we have cross-platform FRED running before we change anything", so I hope you'll excuse me that 10 years of belated requests get suddenly posted. :cool:
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on March 13, 2018, 12:17:48 pm
One thing qtFRED actually does differently from FRED is that all the dialogs and windows use proper dynamic layouts which means that resizing them is actually possible now. So, at least that can be added to the "more or less done"-list of the FRED wishlist document :p
Title: Re: qtFRED: What is it and can I eat it?
Post by: karajorma on March 13, 2018, 09:03:01 pm
Well I mean the document is really just a pie-in-the-sky wishlist without any thought or concern as how easy/possible it is. Definitely qtFRED should be brought up to par before any major changes are done, but it's still fun to dream and think about what features would be nice.

And that's fine. I just wanted to make sure that people understood that qtFRED is just the first step towards some of the things on that list rather than actually being about making things on that list happen.

I like the list, but let's remember that cross-platform FRED is a huge benefit to the SCP in and of itself. Obviously we can now attract more FREDders who use Linux and Mac. Less obviously, we can now attract coders from those two platforms. In the past Taylor has commented that better coders than him were turned off the SCP because they felt it was too Windows specific. And I think anyone who remembers the sheer volume of changes Taylor made should realise that is a massive loss.

Title: Re: qtFRED: What is it and can I eat it?
Post by: mjn.mixael on March 13, 2018, 09:04:49 pm
Oh I completely understand that.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Nightmare on March 13, 2018, 09:12:47 pm
Well that are veryy good news than :)
Title: Re: qtFRED: What is it and can I eat it?
Post by: PIe on March 13, 2018, 09:29:27 pm
I'd like qtFRED 3000AD er... procedurally generated, high fidelity, high realism, $5000 JPEGs of qtFRED er...
One basic feature (which I will add to the doc) is for the event editor to not ask if I want to save changes if I close it without actually having done anything.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Darkmage on March 14, 2018, 02:02:07 am
Heh I've been half tempted to crowdfund Ryan Gordon to work on the FS2 Fred port.... I can't program in QT worth a damn, I only know gtk/gtkmm and I'm a bad programmer. Hit me up if you need testing on Linux though...
Title: Re: qtFRED: What is it and can I eat it?
Post by: DahBlount on March 14, 2018, 10:01:02 am
If anyone wants to offer help, someone on Mac OS would be great actually, considering neither myself nor m!m have a Mac.
Title: Re: qtFRED: What is it and can I eat it?
Post by: chief1983 on March 14, 2018, 10:02:38 am
I have Macs!  I even have one I could offer up remote access to, that I pretty much only use for FSO anyway.  And I don't mind attempting to test things regularly if that would be useful.  Just wasn't sure that was needed or was in a state it'd be expected to work yet.
Title: Re: qtFRED: What is it and can I eat it?
Post by: chief1983 on March 14, 2018, 02:12:22 pm
(https://i.imgur.com/kBaudnt.png)

Code: [Select]
brew install qt
cmake -GXcode -DCMAKE_BUILD_TYPE=Debug -DFSO_BUILD_QTFRED=ON -DCMAKE_PREFIX_PATH=$(brew --prefix qt) ../
xcodebuild -configuration Debug

Have not tested with the official Qt installer version yet, didn't feel like creating an account.  There may be a simpler way to have it find the qt install, or a way to make it not require any special settings with a change to the cmake code, not sure.
Title: Re: qtFRED: What is it and can I eat it?
Post by: ngld on March 15, 2018, 02:48:08 am
You can skip the account step in Qt's installer IIRC.
"brew link qt" might help CMake detect Qt correctly but you should only use that if you don't already have an official Qt installation.
Title: Re: qtFRED: What is it and can I eat it?
Post by: chief1983 on March 15, 2018, 11:34:27 am
How did I miss that skip button?  Oh well.  I may try that one out.  Tried forcing the qt linking, ended up with an error other than 'qt not found' though.

Code: [Select]

CMake Error at /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
  The imported target "Qt5::Core" references the file

     "/usr/local/.//mkspecs/macx-clang"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake:50 (_qt5_Core_check_file_exists)
  /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:167 (include)
  /usr/local/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:83 (find_package)
  /usr/local/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:83 (find_package)
  /usr/local/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  qtfred/CMakeLists.txt:11 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/cliff.gordon/fs2_open/build/CMakeFiles/CMakeOutput.log".
See also "/Users/cliff.gordon/fs2_open/build/CMakeFiles/CMakeError.log".

I will try the Qt installer version and see what happens, although I still suspect we'll need custom built libraries for a distributed build.
Title: Re: qtFRED: What is it and can I eat it?
Post by: macinlew on March 15, 2018, 03:40:20 pm
Ok, sorry for the off topic post but I have to know what those icons between System Preferences and Chrome are in your dock chief1983?
Title: Re: qtFRED: What is it and can I eat it?
Post by: chief1983 on March 15, 2018, 03:41:58 pm
Discord (you aren't on our Discord server?), HipChat (work), Sequel Pro (MySQL client for work), and PyCharm (Python IDE for work).
Title: Re: qtFRED: What is it and can I eat it?
Post by: macinlew on March 16, 2018, 11:37:53 am
Ah, you professional and employed programmers…

Actually any programmer…

Are all CRAZY!!!!...

But, thank you.

I do enjoy and benefit from your labor and just because programming for me is like getting my fingernails pulled off my fingers…

Doesn’t mean I don’t appreciate and respect what you do, and sometimes wish I could help. In my limited free time these days I sometimes think I could help and get a little farther each time, usually until it hurts.
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on March 19, 2018, 12:10:20 pm
Small development update here. I finished porting the 1200 lines of code required to get the SEXP tree context menu to work. It should now support all the features of the standard FRED except adding and modifying variables since those operations require new dialogs.
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on March 21, 2018, 04:53:37 am
Since there is actually something to test now I compiled some test builds: http://swc.fs2downloads.com/builds/test/qtFRED/
Only the Windows builds contain qtFRED since our CI is not configured for building Linux or Mac bundles of qtFRED yet.

The notable thing about these builds is (as mentioned above) that the SEXP tree and its context menu should be mostly done now. Please test if they work correctly and are actually doing what you expect them to do.
qtFRED will respect the mod options just like FSO and FRED does so you don't need to configure anything special.
Title: Re: qtFRED: What is it and can I eat it?
Post by: Darkmage on April 07, 2018, 07:03:15 pm
I just compiled the Linux qtFred and ran it. This is brilliant, been waiting for a Linux native FRED since the Linux port of Freespace 2 got made. Thanks to PCS2 already running on Linux it should now be possible to create entire mod campaigns and art from start to finish on Linux. Been waiting 10 years for this. Thanks to everyone involved.
Title: Re: qtFRED: What is it and can I eat it?
Post by: m!m on April 09, 2018, 11:59:58 am
There has been some activity surrouding qtFRED in the past few days. jg18 is working on adding a working fiction viewer dialog and has added the GUI forms for the background editor, the shield system and the voice acting editor. niffiwan has been working on the Asteroid Field editor dialog and I finished porting the code for the event editor dialog to qtFRED. It should now be fully functional so please take a look at that.

Test builds are available here: http://swc.fs2downloads.com/builds/test/qtFRED/