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

Support point objects without width & height. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

max-vogler
Copy link
Contributor

When using Tiled's point object
image

An object without width or height is created:
image

Which fails during compilation:

Traceback (most recent call last):
  File "butano-tiled/bntmx.py", line 341, in <module>
    process(args.target, args.mapsdirs, args.build)
  File "butano-tiled/bntmx.py", line 293, in process
    converter = TMXConverter(target, tmx_filename)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "butano-tiled/bntmx.py", line 64, in __init__
    self._objects = list(map(lambda layer_path: self._tmx.objects(layer_path), self._descriptor["objects"]))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "butano-tiled/bntmx.py", line 64, in <lambda>
    self._objects = list(map(lambda layer_path: self._tmx.objects(layer_path), self._descriptor["objects"]))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "butano-tiled/tmx.py", line 278, in objects
    item_x, item_y = _object_position(item_node)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "butano-tiled/tmx.py", line 35, in _object_position
    x = int(object_node.get("x")) + int(object_node.get("width")) // 2
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

@Kekun
Copy link
Owner

Kekun commented Oct 15, 2023

Thanks! Please merge your fix commit into the initial one and I'll merge it.

@max-vogler
Copy link
Contributor Author

Done!

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

Successfully merging this pull request may close these issues.

2 participants