-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_enum.py
50 lines (37 loc) · 1.07 KB
/
generate_enum.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name = input('Enum name, PascalCase:')
desc = input('Description of what it represents:')
contents = ''
i = 0
while True:
i += 1
comp_desc = input('PascalCase name of component #' + str(i) + ' (leave empty if done):')
if comp_desc == '':
break
comp_disp = input('In-Editor display name for component #' + str(i) + ':')
disp = repr(comp_disp) if comp_disp != '' else comp_desc
if i != 1:
contents += ',\n'
contents += ' ' + '%s UMETA(DisplayName = %s)' % (comp_desc, disp)
vars = { 'desc': desc, 'name': name, 'contents': contents }
body = u"""//
// Copyright, 59 Volt Entertainment, all rights reserved.
//
#include "Enums/E{name}.h"
#include "StarryExpanse.h"
"""
header = u"""
//
// Copyright, 59 Volt Entertainment, all rights reserved.
//
// Description: {desc}
#pragma once
#include "Engine/UserDefinedEnum.h"
UENUM(BlueprintType)
enum class E{name} : uint8 {{
{contents}
}};
""" % vars
with open('StarryExpanse/Enums/E%s.cpp' % name, 'w') as f:
f.write(body.format(**vars))
with open('StarryExpanse/Enums/E%s.h' % name, 'w') as f:
f.write(header.format(**vars))