Skip to content

Support point objects without width & height.#5

Open
max-vogler wants to merge 1 commit intoKekun:mainfrom
max-vogler:patch-1
Open

Support point objects without width & height.#5
max-vogler wants to merge 1 commit intoKekun:mainfrom
max-vogler:patch-1

Conversation

@max-vogler
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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