This extension requests the following permission:
Import/export files from/to disk
Why is this packaging entire python inside the extension? I'm not sure we'll accept that. Blender follows VFX Reference Platform which is on 3.11.x right now.
Can you provide some example files I can test with?
Certainly, those are all official Teeworlds maps: https://github.com/teeworlds/teeworlds-maps And these are all maps DDNet ships: https://github.com/ddnet/ddnet/tree/master/data/maps
At first look it seems fine, but I need more information about mapres_06 and mapres_07 that are filled with images there. What is the purpose of those? Is it necessary for add-on, or just examples? Because they bloat file size by a lot and if they're not necessary it's better to remove them.
Automatic code review shows me this line
script_file = os.path.realpath(__file__)
Do you just refer to the files as scripts here, or is there some additional stuff going on with scripts that I'm not aware of?
"mapres" is synonymous to "texture" in this context. In Teeworlds/DDNet maps, a texture can either be embedded or external. Embedded is also the term used in Blender iirc, so the texture is stored in the file. External mapres are commonly used textures shipped with every Teeworlds/DDNet clients, so that they don't have to be embedded into every map. That's also why I need to ship them, as otherwise I'd need to download them whenever one of them is used in a map.
When Teeworlds released the version 0.7, their external mapres were changed (backwards incompatible) and new ones added, that's the reason for the two different directories.
script_file = os.path.realpath(__file__)
directory = os.path.dirname(script_file)
if map.version() == "DDNet06":
mapres_dir = os.path.join(directory, "mapres_06")
else:
mapres_dir = os.path.join(directory, "mapres_07")
This is the easiest way I found to locate the images I shipped.
script_file
is set to the absolute path to the module it's in.
I'm not sure anymore why I resolve symlinks with os.path.realpath
, but I guess it doesn't hurt. Maybe I had a problem without it.
The purpose of the code is to find the correct texture directory, based on the version of the map file that is being imported.
Thanks for the explanation
Sign in to comment.
Ready for review