|
| 1 | +import unreal_engine as ue |
| 2 | +import json |
| 3 | +import os |
| 4 | + |
| 5 | +data = { |
| 6 | + 'scope': 'source.python', |
| 7 | + 'completions': [] |
| 8 | +} |
| 9 | + |
| 10 | +for item in ('unreal_engine', 'unreal_engine.classes', 'unreal_engine.structs', 'unreal_engine.enums'): |
| 11 | + data['completions'].append({'trigger': item, 'contents': item}) |
| 12 | + |
| 13 | +for item in dir(ue): |
| 14 | + value = 'unreal_engine.{0}'.format(item) |
| 15 | + data['completions'].append({'trigger': value, 'contents': value}) |
| 16 | + |
| 17 | +for item in dir(ue.UObject): |
| 18 | + value = 'unreal_engine.UObject.{0}'.format(item) |
| 19 | + data['completions'].append({'trigger': value, 'contents': value}) |
| 20 | + |
| 21 | +for _class in ue.all_classes(): |
| 22 | + data['completions'].append({'trigger': _class.get_name(), 'contents': _class.get_name()}) |
| 23 | + for function in _class.functions(): |
| 24 | + value = '{0}.{1}()'.format(_class.get_name(), function) |
| 25 | + data['completions'].append({'trigger': value, 'contents': value}) |
| 26 | + for _property in _class.properties(): |
| 27 | + value = '{0}.{1}'.format(_class.get_name(), _property) |
| 28 | + data['completions'].append({'trigger': value, 'contents': value}) |
| 29 | + |
| 30 | +j = json.dumps(data, indent=4) |
| 31 | + |
| 32 | +with open(os.path.join(ue.get_content_dir(), 'UnrealEnginePython..sublime-completions'), 'w') as f: |
| 33 | + f.write(j) |
0 commit comments