Layer groups do not appear to be working
When I try to use a .tmx with all layers stored in layer groups, I get this error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytmx/pytmx.py", line 682, in get_layer_by_name
return self.layernames[name]
KeyError: 'background'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "convoke/world.py", line 81, in <module>
Scene(landscape_path).run()
File "convoke/world.py", line 34, in __init__
bg_layer = scene_data.get_layer_by_name('background')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytmx/pytmx.py", line 686, in get_layer_by_name
raise ValueError
ValueError
I tried printing the value in .layernames and .layers, both were empty. I changed the map to not use layer groups at all, and PyTMX recognized all of the layers. Seems like it is failing to recognize layer groups.
Thanks for the bug report. I think you are probably correct, Layer Groups are probably not recognized. I don't recall having made a feature for them.
Ah, there are some misleading points in the README, then. Here is an example:
# get a layer by name layer_or_group = tiled_map.get_layer_by_name("base layer") # TiledMap.layers is a list of layers and groups layer = tiled_map.layers[layer_index_number]
This sounds like I can access layer groups the same way I access layers.
Layer groups are not supported right now, so they will not be included anywhere.