Closed grschafer closed 2 years ago
Thanks dude, im on vacation at the moment, and ill take a look at it after next week :)
Ok, im ready to take a look at this
Got this error for now
D:\spring\springrts_smf_compiler>pymapconv.exe
[0.00] Welcome to the SMF compiler/decompiler by Beherith (mysterme@gmail.com) 4.0
[19.71] Namespace(decompile=None, dirty=None, featurelist=None, featuremap=None, featureplacement=None, geoventfile='geovent.bmp', grassmap=None, heightmap='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_height_final.png', help=None, highresheightmapfilter='nearest', intex='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_texture.bmp', linux=None, mapnormals='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_normals.bmp', maxheight=100.0, metalmap='D:/spring/maps/shoretoshore_V2/Shoretoshore-v2_metal.bmp', minheight=-50.0, minimap='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_minimap.png', numthreads=4, nvdxt_options='-Sinc -quality_highest', outfile='D:/spring/maps/shoretoshore_V2/newshores_vx.smf', skiptexture=None, specular='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_speculartex.bmp', splatdistribution='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_splat_distribution.dds', typemap=None)
[0.00] Compiling SMF with the following options: Namespace(decompile=None, dirty=None, featurelist=None, featuremap=None, featureplacement=None, geoventfile='geovent.bmp', grassmap=None, heightmap='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_height_final.png', help=None, highresheightmapfilter='nearest', intex='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_texture.bmp', linux=None, mapnormals='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_normals.bmp', maxheight=100.0, metalmap='D:/spring/maps/shoretoshore_V2/Shoretoshore-v2_metal.bmp', minheight=-50.0, minimap='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_minimap.png', numthreads=4, nvdxt_options='-Sinc -quality_highest', outfile='D:/spring/maps/shoretoshore_V2/newshores_vx.smf', skiptexture=None, specular='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_speculartex.bmp', splatdistribution='D:/spring/maps/shoretoshore_V2/shoretoshore_v4_splat_distribution.dds', typemap=None)
[0.00] The map will be output to: D:/spring/maps/shoretoshore_V2/newshores_vx.smf
[0.01] Submitting nvtt_export.exe jobs: ['nvtt_export.exe --output "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_normals.dds" --save-flip-y --mip-filter 0 --quality 3 --format bc1 "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_normals.bmp"', 'nvtt_export.exe --output "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_speculartex.dds" --save-flip-y --mip-filter 0 --quality 3 --format bc3 "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_speculartex.bmp"', 'nvtt_export.exe --output "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_splat_distribution.dds" --save-flip-y --mip-filter 0 --quality 3 --format bc3 "D:/spring/maps/shoretoshore_V2/shoretoshore_v4_splat_distribution.dds"', 'echo nvtt_export jobs complete']
Traceback (most recent call last):
File "argparseui.py", line 665, in onOk
self.ok_button_handler(self)
File "pymapconv.py", line 1224, in okbuttonhandler
compilesuccess = compileSMF(parsed_args)
File "pymapconv.py", line 260, in compileSMF
nvtt_jobs.stdin.write(cmd + "\n")
TypeError: a bytes-like object is required, not 'str'
D:\spring\springrts_smf_compiler>
Doh, sorry I missed that -- thanks for catching and fixing it!
This PR updates pymapconv.py from Python 2 to Python 3 and from pyqt4 to pyqt5. I've broken up the changes into separate commits. Here's a summary of what's in each commit:
requirements.txt
and dependencies specific to development (i.e. pyinstaller) inrequirements-dev.txt
.png.py
file because it can just be installed by pip. If there was a reason this file was directly included in the repo, let me know!Out-of-scope changes
Throughout the above, I tried to minimize my changes so this PR didn't get too big! So, I didn't make any style or formatting changes to make the code more python3-esque, e.g. changing string interpolation from the older
"%s %s" % (value1, value2)
style to the newerf"{value1} {value2}"
style.Other scripts
I also did NOT update scripts other than
pymapconv.py
(e.g.dds_to_jpg.py
,fast_decompiler.py
,springrts_smf_minimapper.py
, ...). I'm unsure if these other scripts are actively used? If any are important, let me know and I can update them in a later PR.Regression testing
After updating
pymapconv.py
to python3 and running the regression tester script on ~120 maps, the only difference in file output between py2/py3 that appeared was the random mapid when compiling SMF files. I didn't see any other differences crop up. One difference I expected to crop up was random feature rotation (rot = "-1"
) -- is that handled in the engine rather than in the map files?Performance
Python 3 is generally recognized as being faster than Python 2 and that was true in my testing, though the speedup is modest:
sertagatta_v5.sdd\maps\Sertagatta_V5.smf
and then got an error when compiling likeNo such file or directory ... sertagatta_v5.sdd\\maps\\Sertagatta_V4.smt
.Let me know if you have any feedback, concerns, suggestions, etc. on any of the above or any code changes!