Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer groups do not appear to be working #124

Open
dawsoneliasen opened this issue May 8, 2020 · 3 comments
Open

Layer groups do not appear to be working #124

dawsoneliasen opened this issue May 8, 2020 · 3 comments

Comments

@dawsoneliasen
Copy link

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.

@bitcraft
Copy link
Owner

bitcraft commented May 8, 2020

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.

@dawsoneliasen
Copy link
Author

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.

@bitcraft
Copy link
Owner

Layer groups are not supported right now, so they will not be included anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants