Announcement

Collapse
No announcement yet.

[TOOL] [Tut] [Win] Unreal Qt Creator Project Generator v0.3

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [TOOL] [Tut] [Win] Unreal Qt Creator Project Generator v0.3

    In this post I want to share a small command line tool with you, which is able to automatically generate Qt Creator projects from Unreal Projects.
    I also wrote a small tutorial (partially based on Antares' tutorial) which covers initial setup of Qt Creator for Unreal development, usage of my tool and (optionally) doxygen help generation for the Unreal Engine classes.

    EDIT: Tool now open-source, available on GitHub

    Overview

    As some of you may have noticed, Visual Studio 2013/2015 (in particular the default IntelliSense auto completion) performs pretty badly when it comes to C++ development with huge codebases (like the Unreal Engine), unless you use something like VisualAssistX (which is not free).

    To address this issue, Antares created a nice tutorial (Link | Wiki) on how to manually create a Qt Creator project for Unreal game logic development a few months ago.
    Qt Creator is a C++ IDE, which is written in native C++.

    Some advantages over vanilla Visual Studio:
    1. Fast auto completion
    2. Fast go to declaration
    3. Refactoring support
    4. Doxygen documentation sidebar

    This tool allows you to take advantage of Qt Creator without having to bother with manual creation of projects files.

    In theory it should work with any version of Unreal Engine 4. You just have to rerun it whenever you upgrade your project to a new version.

    Requirements
    • Visual Studio 2013/2015 (Express / Community / Professional)
    • Unreal Engine 4
    • .Net Framework 4.0 Client Profile
    • Windows, 64-Bit

    Features:

    The tool can generate .pro files with:
    • Configuration for Unreal Engine development (C++11 support, no Qt)
    • All your current source and header files (+ build.cs) included
    • All Unreal Engine defines and includes added
    • 5 different build and launch targets, which are included in the Visual Studio project file (Debug game, Development Editor, Shipping, etc...)

    Download

    Here is the link to the GitHub page for download (for usage tutorial with instructions see below)

    I cannot guarantee that there are no bugs.
    I have tested the tool on two different computers with one small project, some templates and under the following configurations
    • Windows 8.1 64 bit
    • Unreal Engine 4.6/4.7/4.8/4.9/4.13
    • Visual Studio 2013 Community Update 4 / Visual Studio 2015 Community Update 3
    • Qt 5.4/5.5/5.7 and Qt Creator 3.3.0/3.5.0/4.1.0.

    By downloading this tool you accept that I am not liable for any damage caused by the use of this tool.

    +++ DOWNLOAD LINK +++


    Instructions (Partially based on Antares' tutorial)

    These steps you only have to do once
    1. Download Qt 5.x (Link), Debugging Tools for Windows (part of Windows SDK, Link) and my Qt Project Generator Tool (download link above)
    2. Run Windows SDK installer (you only have to install Debugging Tools)
    3. Install Qt, during installation depending on your Visual Studio version select either “msvc2013 64-bit" or "msvc2015 64-bit" under “Qt\Qt 5.x” (where x = latest version, tested with 5.7)
    4. Now you have to configure the debugger. Open Qt Creator, go to "tools/options/Build & Run/Debugger", click "add" and fill out the details according to this screenshot:

      Click image for larger version  Name:	debuggerSetupSmall.png Views:	1 Size:	70.3 KB ID:	1144484
    5. Next go to "tools/options/Debugger". In the "CDB" tab tick "ignore first chance access violations". In the "CDB Paths" tab insert the following paths (replace <YOUR USERNAME> by your actual windows username):
      Code:
      symsrv*symsrv.dll*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache
      	cache*cache*C:\Users\<YOUR USERNAME>\AppData\Local\Temp\symbolcache
    6. IMPORTANT, when you debug a project for the first time, Qt Creator asks whether it should use Microsoft Symbol Server. Untick the corresponding checkbox (Otherwise it will get symbol data from the internet which can be very slow).

      Click image for larger version  Name:	symbolServer.png Views:	1 Size:	16.5 KB ID:	1144488

      For the original debugger setup tutorial from Antares see Link.
    7. Next you have to configure a new build kit. Go to "tools/options/Build & Run/Kits". Click "add" and adjust the new configuration to match this screenshot
      UPDATE: If you use Visual Studio 2015 you should select Visual C++ 14.0 (amd64) under Compiler and Qt 5.x.x MSVC2015_64bit under Qt version

      Click image for larger version  Name:	customKitSmall.png Views:	1 Size:	82.9 KB ID:	1144485
    8. UPDATE: If you are using QtCreator >= 4.7 or have manually enabled "Clang code model" you might experience very slow or unreliable autocompletion. Clang code model offers many advantages over the legacy built-in code model (see link), but on most systems it doesn't perform well enough to handle UE's complex codebase. So if you have issues with completion I recommend turning off "Clang code model".

      This can be done globally by disabling the "ClangCodeModel" plugin in QtCreator under Help -> About Plugins -> C++.

    The following steps have to be performed every time you create a new project or if you upgrade your project to a new Unreal Engine version.
    1. Run my tool and follow the instructions, the generated project file is stored in the directory <YOUR PROJECT>\Intermediate\ProjectFiles
    2. Done, happy coding If you want to build or run the project you can just use the preconfigured build / launch targets (you can switch the target in the bottom left corner).
      Targets are the same as in Visual Studio, just remember to always switch both, the compile and the launch target.
      If you want to use a standalone target, you have to make sure your content is already cooked. You can cook by building once with the "Cook" build target.

      Click image for larger version  Name:	qtSelectBuild.png Views:	1 Size:	13.5 KB ID:	1160511


    OPTIONAL (but recommended): If you also want nice documentation for the engine within Qt Creator (hover over symbol and hit F1 to display Doxygen inside Qt Creator), here is a quick tutorial:
    1. Install Doxygen (Link), make sure the Doxywizard GUI is selected during installation
    2. Open Doxywizard, choose a working directory (doesn’t really matter what you select, as we don't use relative paths) and go to the “Expert” tab
    3. Configure Doxywizard according to the screenshots (you can do this for any engine version of course, I chose 4.6 just as an example. Also the Qt path may vary depending on your Qt version)

      Click image for larger version  Name:	doxygenSmall.png Views:	1 Size:	450.6 KB ID:	1144486
    4. When you are done, go to the “Run” tab and hit “Run doxygen”, this will take some time.
    5. When generation is finished, shift right-click inside the “html” folder of the Doxygen output and select “open command window here”
    6. Drag and drop qhelpgenerator.exe from your “<QT_Installation>\5.x\<your qt msvc kit>\bin” folder into the command window
    7. Insert the command “ index.qhp -o UnrealEngine.qch” and hit enter
    8. When the qch file is generated, open Qt Creator and add your .qch file under “Tools\Options\Help\Documentation”
    Last edited by AlphaN; 08-15-2018, 06:45 AM.

    #2
    Update: Source code released on GitHub, tool should work with Unreal Engine 4.9 and QtCreator 3.5.0

    Comment


      #3
      Great job. Quick question can you build while in debug mode in Qt? In VS I can execute custom batch files like this one

      Code:
      cd /d F:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
      devenv "E:\unreal\Arena 4.9\Arena.sln" /Build
      which allows me to build the gameplay code inside VS while in debug mode.

      Comment


        #4
        Originally posted by maikklein View Post
        Great job. Quick question can you build while in debug mode in Qt? In VS I can execute custom batch files like this one
        This tool adds 5 build / running targets (like in the Visual Studio project) to the Qt project file.
        It looks like this:

        Click image for larger version

Name:	qtSelectBuild.png
Views:	1
Size:	16.5 KB
ID:	1086755

        If you select one of the debug profiles, the project is built in debug mode and then you can debug (Breakpoints, Variable inspection, etc) it directly with QtCreator (if you have setup CDB correctly, see tutorial steps 4-6).

        Under the hood, the compilation is done by custom build steps (The QtCreator build system calls the build.bat in the 4.x\Engine\Build\BatchFiles folder with different arguments depending on the selected build preset)

        Is this what you mean?

        Comment


          #5
          Originally posted by AlphaN View Post
          This tool adds 5 build / running targets (like in the Visual Studio project) to the Qt project file.
          It looks like this:

          [ATTACH=CONFIG]55089[/ATTACH]

          If you select one of the debug profiles, the project is built in debug mode and then you can debug (Breakpoints, Variable inspection, etc) it directly with QtCreator (if you have setup CDB correctly, see tutorial steps 4-6).

          Under the hood, the compilation is done by custom build steps (The QtCreator build system calls the build.bat in the 4.x\Engine\Build\BatchFiles folder with different arguments depending on the selected build preset)

          Is this what you mean?
          No I am sorry I probably didn't explain it good enough.

          Usually I start the editor in debug mode which allows me to easily add breakpoints while playing the game. But I can't recompile the gameplay code inside VS while VS is debugging the editor. You can compile the game code from inside the editor but I want to avoid this.

          That's why I am executing a custom bash file from inside VS.

          Basically what I am asking is can you hit the "build" button in Qt Creator if it is currently debugging the editor?

          Comment


            #6
            Originally posted by maikklein View Post
            Basically what I am asking is can you hit the "build" button in Qt Creator if it is currently debugging the editor?
            I did a quick test.
            Hot reload works (you can rebuild in QtCreator while debugging the game in the editor and the changes take effect), but I had problems with breakpoints. It seems they do no longer work after a recompilation (at least on my computer). I don't know whether Qt Creator doesn't support this or if it is just a configuration issue.
            Last edited by AlphaN; 08-31-2015, 05:35 PM.

            Comment


              #7
              Update: Hotfix 0.2b
              -debug flag was missing in launch configuration "Debug Game Standalone"

              Comment


                #8
                Update: Version 0.2c
                -added a "Cook" build target, which allows you to cook your game assets from within QtCreator (useful if you work with standalone builds)
                -fixed some typos

                Comment


                  #9
                  Unreal Engine 4 installation not found, please enter Unreal Engine 4 base directory (that one with the 4.x folders in it):
                  D:\Epic Games
                  Directory contains no Unreal Engine installations.
                  Any ideas?

                  Comment


                    #10
                    Originally posted by maikklein View Post
                    Any ideas?
                    Does execution of the tool continue or does it abort with this message? If it does continue, then you can ignore the message (It seems to be a missing if statement and I'll fix it)
                    Just a question, are you on 32-Bit Windows? Which Windows version? Because this might be a reason the registry read fails, otherwise you wouldn't have to enter the path manually.

                    Edit: Sorry there is another bug, I didn't remove the quotation marks which are added automatically when you drag and drop a folder to the cmd window from the --> The directory is not found when I try to read it

                    Thank you for your feedback
                    Last edited by AlphaN; 09-01-2015, 01:55 PM.

                    Comment


                      #11
                      Originally posted by AlphaN View Post
                      Does execution of the tool continue or does it abort with this message? If it does continue, then you can ignore the message (It seems to be a missing if statement and I'll fix it)
                      Just a question, are you on 32-Bit Windows? Which Windows version? Because this might be a reason the registry read fails, otherwise you wouldn't have to enter the path manually.

                      Edit: Sorry there is another bug, I didn't remove the quotation marks which are added automatically when you drag and drop a folder to the cmd window from the --> The directory is not found when I try to read it

                      Thank you for your feedback
                      I am on Windows 10 x64 and I removed the quotes manually. It seems to be stuck in a loop because it can't find the engine for some reason.

                      Comment


                        #12
                        Originally posted by maikklein View Post
                        I am on Windows 10 x64 and I removed the quotes manually. It seems to be stuck in a loop because it can't find the engine for some reason.
                        I uploaded a new version, manual entry of Unreal Engine path should now work.

                        Edit: Never mind

                        Update: v0.2d2 now stores your manual engine path input in a file so you only have to enter the path once. Registry-based detection was removed because it wasn't compatible with newer versions of UE.
                        Last edited by AlphaN; 09-01-2015, 03:43 PM.

                        Comment


                          #13
                          Really appreciate that you share you tool with us. Good Work!

                          Comment


                            #14
                            Work this in linux?

                            Comment


                              #15
                              Originally posted by SalahAdDin View Post
                              Work this in linux?
                              No this tool only supports Windows.
                              But doesn't the Unreal Build Tool generate QtCreator projects (and projects for other IDE's) out of the box if you are on Linux?
                              Last edited by AlphaN; 09-07-2015, 01:27 PM.

                              Comment

                              Working...
                              X