Skip to content

Conversation

prokopst
Copy link
Contributor

Hey @rdeioris, I've made a script to create pyi stubs for unreal_engine as you suggested in #384. It will generate this directory structure:

unreal_engine/__init__.pyi

Tweaked example from readme seems to work fine in PyCharm:

import unreal_engine as ue

ue.log('Hello i am a Python module')


class Hero:
    uobject: ue.UObject
    #        ^^^^^^^^^^ - required to get the type hints

    # this is called on game start
    def begin_play(self):
        ue.log('Begin Play on Hero class')

    # this is called at every 'tick'
    def tick(self, delta_time):
        # get current location
        location = self.uobject.get_actor_location()
        # increase Z honouring delta_time
        location.z += 100 * delta_time
        # set new location
        self.uobject.set_actor_location(location)

This closes #384, closes #221.

@rdeioris rdeioris merged commit 0a95537 into 20tab:master May 1, 2018
@rdeioris
Copy link
Contributor

rdeioris commented May 1, 2018

Thanks, check the 'language server protocol' system for another approach

@prokopst prokopst deleted the pyi-stubs branch May 1, 2018 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto code completion Autocomplete in other IDE?
2 participants