Announcement

Collapse
No announcement yet.

How do you get auto completion and stuff?

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

    How do you get auto completion and stuff?

    I'm trying to write unreal python in vs code. But I'm just writing blindly... How do you import unreal and get all the auto completion, function list, etc?

    #2
    I do most of my Python in Atom or other IDEs a `little bit` more python-happy, but it looks like you can use this to bring Python Autocomplete using Intellisense into VC Code

    https://marketplace.visualstudio.com...odeintellicode

    Comment


      #3
      Thanks but it doesn't provide auto complete when I'm doing Unreal stuff... Do you have code completion writing Unreal stuff?

      Comment


        #4
        I managed to have some level of success with Atom and a stub file generated by Unreal running the python plugin in developer mode. I wrote a pdf (attached) with the steps I have taken. Let me know if you think there are other or better ways to do this.

        Hope this helps,

        Attached Files
        Pierre-Felix Breton

        Sr Technical Product Manager AEC, Unreal Engine Enterprise
        Epic Games - LinkedIn


        Unreal Studio Documentation
        Unreal Studio Technical Support
        Report Unreal Studio Bugs

        Comment


          #5
          Hello Pf_breton, is there any way to use the stub file generated for PyCharm as well?

          Comment


            #6
            Hello,

            In my case, in PyCharm, I simply added the stup into my project directory and then the ''auto complete'' works.

            Click image for larger version

Name:	PyCharmAutoComplete.PNG
Views:	1
Size:	68.9 KB
ID:	1571016
            Have An Awesome And Productive Day
            Alex, Youtube Tutorials

            Comment


              #7
              You can also set it up in PyCharm by adding the Python stub path to the interpreter path (this should technically keep it auto updated if the stub changes in later versions).
              Click image for larger version

Name:	unreal_auto_complete_pycharm.png
Views:	1
Size:	95.2 KB
ID:	1571621

              Comment


                #8
                Thanks both Zyanim and Alex!
                I noticed you don't get all the autocomplete possible from the python API documentation, If i add them manually in Unreal.py will it work ?
                Was thinking populating the unreal stub with stuff I use along the way.

                Thanks!

                Comment


                  #9
                  You could add them manually in to the unreal.py, but version changes could wipe any additions you make. One way to get around this is to create a new python file (for example sake it's called unreal_custom_autocomplete) and add any additional code in there. Then add the following to the start of unreal.py:
                  Code:
                  from unreal_custom_autocomplete import *
                  This way you only need to add that line in every time the stub gets updated.

                  Click image for larger version

Name:	unreal_custom_autocomplete.png
Views:	1
Size:	45.2 KB
ID:	1571645

                  Comment


                    #10
                    Originally posted by Narsoi View Post
                    I noticed you don't get all the autocomplete possible from the python API documentation
                    The unreal.py stub file is actually the same file we use to generate the online docs, however the version we use for the docs is generated from an editor that has every plugin enabled so that you get a complete set of available code.

                    The version you get locally will only contain the things are are currently available to your editor based on your set of enabled plugins. It is generated each time the editor starts though, so enabling a new plugin will automatically add the stub for code it

                    Comment


                      #11
                      Hi Jamie,
                      thanks for the guide and the information.
                      I am able to use the unreal.py stub with the Atom.io IDE however there is still a lot of classes missing and I don't think it depends on plugins (eg EditorLevelLibrary, StaticMeshActor are missing but I am able to use the via script in the Unreal Editor).
                      Since having auto completition will be a huge saving of time for many people isn't there a way to generate the full stub?
                      As an alternative could you share the full stub that you used to generate the online documentation for the current version?

                      As a side question related to this: is there any chance to have the interactive interpreter with auto-complete such as the Blender one? I think it's very useful and powerful to prototype the first draft of a script and the time saving is huge.

                      Thanks,
                      Luca

                      Comment


                        #12
                        luca.15 Are they actually missing from the unreal.py stub file, or is the file too big for your IDE to handle? I had to up the parsing limit in PyCharm quite a bit for it to parse that file, and I don't know whether other IDEs have similar restrictions.

                        We could ship the version we build the docs from, but then you'd be missing all of your project specific exposed code. You can generate a complete unreal.py stub (including code for your own project) by running our commandlet (see Engine\Plugins\Experimental\PythonScriptPlugin\SphinxDocs\PythonAPI_docs_readme.txt for information on how to do that). That will also generate a local set of docs from that stub file.

                        Comment


                          #13
                          Didn't expect this one to be replied again... I actually found out about the stub but was only able to generate a small file that provides minimum actual help... Much like Luca.15's situation I think.

                          Comment


                            #14
                            Originally posted by Jamie Dale View Post
                            luca.15 Are they actually missing from the unreal.py stub file, or is the file too big for your IDE to handle? I had to up the parsing limit in PyCharm quite a bit for it to parse that file, and I don't know whether other IDEs have similar restrictions.

                            We could ship the version we build the docs from, but then you'd be missing all of your project specific exposed code. You can generate a complete unreal.py stub (including code for your own project) by running our commandlet (see Engine\Plugins\Experimental\PythonScriptPlugin\SphinxDocs\PythonAPI_docs_readme.txt for information on how to do that). That will also generate a local set of docs from that stub file.
                            I went to see my stub and it's a 1000 line 35kb file. And somehow I don't have that readme text file...
                            Attached Files

                            Comment


                              #15
                              Originally posted by vito0719 View Post

                              I went to see my stub and it's a 1000 line 35kb file. And somehow I don't have that readme text file...
                              I have the same unreal.py file generated and the same directory content in my C:\Program Files\Epic Games\UE_4.21\Engine\Plugins\Experimental\PythonScriptPlugin\SphinxDocs

                              Comment

                              Working...
                              X