-
Notifications
You must be signed in to change notification settings - Fork 0
/
tectonicus_cli.py
394 lines (335 loc) · 11.8 KB
/
tectonicus_cli.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
#!/usr/bin/env python3
# tectonicus_cli.py
# Restores the old cli options that were removed in tectonius 2.00.
# We generate the xml on runtime and *maybe* cache it for later use.
# Also, we'll keep the default options of the older, sub-2.00 tectonicus.
import argparse
import xml.etree.ElementTree as etree
parser = argparse.ArgumentParser(
description='''Command-line interface to the Tectoniucs map renderer.''',
argument_default=''
)
parser.add_argument(
'--alphaBits',
type=int,
default=8,
help='''alphaBits specifies how many bits are assigned to designate the alpha on the tiles of the map. It is recommended to use 0 (off) or 8 (full). However, Tectonicus passes the value directly to your graphics card, so you can theoretically pass any value your graphics card supports.'''
)
parser.add_argument(
'--bedsInitiallyVisible',
type=bool,
default=True,
help='''Specifies whether or not bed markers are initially visible.'''
)
parser.add_argument(
'--cacheDir',
type=str,
help='''Specifies the directory to be used for caching. Caching is enabled by default, and the default directory location is a subdirectory within the output directory.'''
)
parser.add_argument(
'--cameraAngle',
type=int,
default=45,
help='''This changes the orientation of north. The default setting of 45 produces an oblique view with north at the upper left of the map. 0 will give you north at the top; 90 will give you east at the top; and so on. As you increase this number imagine the map's cardinal directions rotating in a counter-clockwise direction.'''
)
parser.add_argument(
'--cameraElevation',
type=int,
default=45,
help='''This specifies the angle of elevation for the camera, in degrees. 0 is looking horizontally, 90 is looking directly down. Defaults to 45. Choose 30 for a more traditional isometric view.'''
)
parser.add_argument(
'--closestZoomSize',
type=int,
default=12,
help='''Sets the closest zoom size. When zoomed-in all the way this value determines the area that will be visible in one of the rendered picture files. Increase [x] to "widen" the camera lens of this closest view.'''
)
parser.add_argument(
'--colourDepth',
type=int,
default=16,
help='''Color Depth, like alpha bits, specifies how many bits are assigned to the colors in the tiles of the map. It is also passed directly to you graphics card, so you can pass any supported value. However, 24 ("millions of colors" or "truecolor"), or 16 ("thousands of colors"), is recommended.'''
)
parser.add_argument(
'--dimension',
type=str,
default='terra',
choices=['terra', 'nether'],
help='''Use along with --renderStyle=nether to render ther nether.'''
)
parser.add_argument(
'--eraseOutputDir',
type=bool,
default=False,
help='''Specify 'True' to erase the entire output directory and render from scratch.'''
)
parser.add_argument(
'--extractLwjglNatives',
type=bool,
default=True,
)
parser.add_argument(
'--force32BitNatives',
type=bool,
default=False,
help='''Force the use of 32bit libraries.'''
)
parser.add_argument(
'--force64BitNatives',
type=bool,
default=False,
help='''Force the use of 64bit libraries.'''
)
parser.add_argument(
'--forceLoadAwt',
type=bool,
default=False
)
parser.add_argument(
'--imageCompressionLevel',
type=int,
default=0.95,
help='''For jpeg renders only, specify a number between 1.0 and 0.1 to change the compression level. Defaults to 0.95.'''
)
parser.add_argument(
'--imageFormat',
type=str,
default='png',
choices=['jpg', 'gif', 'png'],
help='''Specifies the type of image to output to.'''
)
parser.add_argument(
'--lighting',
type=str,
default='day',
choices=['none', 'night', 'day'],
help='''Choose the lighting style to render with.'''
)
parser.add_argument(
'--logFile',
type=str,
default='TectonicusLog.txt',
help='The file name to use for the log file.'
)
parser.add_argument(
'--minecraftJar',
type=str,
help='''The path to your client minecraft jar.'''
)
parser.add_argument(
'--maxTiles',
type=int,
default=-1,
help='''This specialized argument is used only for troubleshooting. For example --maxTiles=100 will create a kind of "preview" map render consisting of only 100 base tiles (i.e. not the entire map).'''
)
parser.add_argument(
'--mode',
type=str,
default='cmd',
choices=['cmd', 'gui', 'players'],
help='''Selects the mode in which Tectonicus runs. --mode=players will not render a map but update the player locations.'''
)
parser.add_argument(
'--name',
type=str,
default='world',
help='''Name of the world.'''
)
parser.add_argument(
'--numDownsampleThreads',
type=int,
default=1,
help='''Set to the number of cores you want to use for distributing the downsampling computing.'''
)
parser.add_argument(
'--numSamples',
type=int,
default=4,
choices=list(range(5)),
help='''Specifies the number of samples for antialiasing. Defaults to 4 (high quality). Setting ==numSamples=0 can sometimes eliminate problems with graphics cards that do not support anti-aliasing.'''
)
parser.add_argument(
'--numZoomLevels',
type=int,
default=8,
help='''This defines how many zoom levels the resulting map will have.'''
)
parser.add_argument(
'--outputDir',
type=str,
help='''This specifies the directory you want the rendered map files to placed in.'''
)
parser.add_argument(
'--outputHtmlName',
type=str,
default='map.html',
help='''Use this to change the name of the html file tectonicus outputs.'''
)
parser.add_argument(
'--playerFilterFile',
type=str,
help='''Specifies the whitelist or blacklist file for use with the --players argument.'''
)
parser.add_argument(
'--players',
type=str,
default='all',
choices=['none', 'ops', 'blacklist', 'whitelist', 'all'],
help='''Sets Tectonicus to render none, all, ops, or omit or include from a blacklist or a whitelist.'''
)
parser.add_argument(
'--playersInitiallyVisible',
type=bool,
default=True,
help='''Determines if the players will be visible on initial loading of the map.'''
)
parser.add_argument(
'--portals',
type=str,
default='all',
choices=['none', 'all'],
help='''Determines if the portals will be visible on the map.'''
)
parser.add_argument(
'--portalsInitiallyVisible',
type=bool,
default=True,
help='''Determines if the portals will be visible on initial loading of the map.'''
)
parser.add_argument(
'--renderStyle',
type=str,
default='regular',
choices=['cave', 'nether', 'regular'],
help='''Specifies the map type to render. Caves only, the nether (requires setting: --dimension=nether) or the regular world map.'''
)
parser.add_argument(
'--showSpawn',
type=bool,
default=True,
help='''Specifies whether or not to show an icon for the spawn position.'''
)
parser.add_argument(
'--signs',
type=str,
default='special',
choices=['none', 'all', 'special'],
help='''Signs that use special characters !, -, = or ~ will be visible on the map as location markers. The text on these signs must begin and end with any of the listed special characters. For example a sign reading "-- Lookout point --" will appear as a location marker at all zoom levels. When clicked, the marker will pop up a tooltip bubble showing the full text of the sign. Setting --signs=all will make all signs into map markers regardless of the writing on the signs. Empty signs are always skipped since they are used for aesthetic purposes.'''
)
parser.add_argument(
'--signsInitiallyVisible',
type=bool,
default=True,
help='''Determines if the signs will be visible on initial loading of the map.'''
)
parser.add_argument(
'--singlePlayerName',
type=str,
help='''Name to use when rendering single player world.'''
)
parser.add_argument(
'--spawnInitiallyVisible',
type=bool,
default=True,
help='''etermines if the spawn point will be visible on initial loading of the map.'''
)
parser.add_argument(
'--texturePack',
type=str,
help='''Specify the location of a custom texturepack to use. Uses the standard textures located in minecraft.jar by default.'''
)
parser.add_argument(
'--tileSize',
type=int,
default=512,
help='''Specifies the size of the output image tiles, in pixels. Minimum: 64 Maximum: 1024'''
)
parser.add_argument(
'--useBiomeColours',
type=bool,
default=False,
help='''Set to use biome colours for grass and leaves. Use True or False.'''
)
parser.add_argument(
'--useCache',
type=bool,
default=True,
help='''Enable or disable the use of the cache to speed up repeated map rendering.'''
)
parser.add_argument(
'--verbose',
type=bool,
default=False,
help='''Set to True to print additional debug output during render.'''
)
parser.add_argument(
'--worldDir',
type=str,
help='''Path to your minecraft world directory.'''
)
args = vars(parser.parse_args())
tectonicus = etree.Element('tectonicus', version='2')
config = etree.SubElement(tectonicus, 'config',
mode=args['mode'],
outputDir=args['outputDir'],
outputHtmlName=args['outputHtmlName'],
minecraftJar=args['minecraftJar'],
texturePack=args['texturePack'],
numZoomLevels=str(args['numZoomLevels']),
singlePlayerName=args['singlePlayerName'],
spawnInitiallyVisible=str(args['spawnInitiallyVisible']).lower(),
playersInitiallyVisible=str(args['playersInitiallyVisible']).lower(),
bedsInitiallyVisible=str(args['bedsInitiallyVisible']).lower(),
signsInitiallyVisible=str(args['signsInitiallyVisible']).lower(),
portalsInitiallyVisible=str(args['portalsInitiallyVisible']).lower(),
numDownsampleThreads=str(args['numDownsampleThreads']),
eraseOutputDir=str(args['eraseOutputDir']).lower(),
useCache=str(args['useCache']).lower(),
logFile=args['logFile']
)
rasterizer = etree.SubElement(tectonicus, 'rasterizer',
type='lwjgl',
colorDepth=str(args['colourDepth']),
alphaBits=str(args['alphaBits']),
numSamples=str(args['numSamples']),
tileSize=str(args['tileSize'])
)
map = etree.SubElement(tectonicus, 'map',
name=args['name'],
cameraAngle=str(args['cameraAngle']),
cameraElevation=str(args['cameraElevation']),
closestZoomSize=str(args['closestZoomSize']),
worldDir=args['worldDir'],
dimension=args['dimension'],
useBiomeColours=str(args['useBiomeColours']).lower(),
)
signs = etree.SubElement(map, 'signs',
filter=args['signs']
)
players = etree.SubElement(map, 'players',
filter=args['players'],
playerFilterFile=args['playerFilterFile'],
initiallyVisible=str(args['playersInitiallyVisible']).lower()
)
portals = etree.SubElement(map, 'portals',
filter=args['portals'],
initiallyVisible=str(args['portalsInitiallyVisible']).lower()
)
spawn = etree.SubElement(map, 'spawn',
show=str(args['showSpawn']).lower(),
initiallyVisible=str(args['spawnInitiallyVisible']).lower()
)
layer = etree.SubElement(map, 'layer',
name=args['renderStyle'],
lighting=args['lighting']
)
tweeks = etree.SubElement(tectonicus, 'tweeks',
extractLwjglNatives=str(args['extractLwjglNatives']).lower(),
forceLoadAwt=str(args['forceLoadAwt']).lower(),
force32BitNatives=str(args['force32BitNatives']).lower(),
force64BitNatives=str(args['force64BitNatives']).lower()
)
debug = etree.SubElement(tectonicus, 'debug',
maxTiles=str(args['maxTiles'])
)
etree.ElementTree(tectonicus).write('tectonicus.xml', encoding='utf-8')