-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Opening empty tsj results in error #3542
Comments
I see my tsx tileset loaded in the background is misleading because it has tiles loaded in. It's just a screenshot from when the problem originally cropped up and not a clean demo showing that the tsx can load empty. |
Could you please clarify what you mean by "empty" TSJ? From reading your issue, it sounds like a non-empty Image Collection (i.e. an Image Collection that has tiles) with unset dimensions on the tiles? Does the TSX file you save have tile size on the tiles? Does the TSJ file? |
using the code in the steps to reproduce, empty tsx file looks like this
empty tsj file looks like this
In an issue I am running into at the moment, the following tsj is generated:
In this case, I am adding a single tile to a newly generated tileset "favorites" and it is referring to a valid path. It found the correct dimensions for the image, but did not pass it to
The section of code that is generating it:
so using that script, it doesn't actually try to open the tileset the first time, so it saves a single tile to it successfully. However, next time, it will try to open it and fail if a single tile was added at once, but will succeed if multiple tiles were added at once. When I was doing this with tsx files, I could make an empty tileset and later open it to do whatever. With the tsj, it seems something is off since it should open even without any tiles, but returns an error instead. In my previous example in discord, I was working on a section to add 'unknown' tiles and made some mistakes about the path of the file. Those tilesets should still have opened then since tiled just shows a fallback icon for bad paths to images in tilesets. Once the paths were fixed, the error stopped occurring, I think because the maps I import using that function rarely have a single undefined tile. On the other hand, adding a tile to favorites is often done 1 by 1, so the issue has resurfaced. It's interesting that adding 2 tiles fills the width and height. |
The bug appears to be, that it complains about tileset parameters for an image collection tileset, where a tilewidth of 0 should be considered valid since for image collections this value represents the maximum tile width, which would be 0 when the collection is still empty. |
Describe the bug
opening an empty tsj file created by script results in an error:
"Error opening [path.tsj]: Invalid tileset parameters for tileset '[tileset name]"
To Reproduce
Steps to reproduce the behavior:
let path = `${pathtoproject}/test.tsj`; unknowns = new Tileset("test_tileset"); tiled.tilesetFormat("json").write(unknowns,path); tiled.open(path);
compared to a tsx:
let path = `${pathtoproject}/test.tsx`; unknowns = new Tileset("test_tileset"); tiled.tilesetFormat("tsx").write(unknowns,path); tiled.open(path);
manually editing the tsj files to have a non-zero value for
tileheight
andtilewidth
allowed the tsj to be opened.Expected behavior
The empty tsj tileset should open like the tsx.
Media
![Screenshot (40)](https://user-images.githubusercontent.com/30750303/206917683-f37aebb8-c849-40e3-b6bf-b81f27b94e92.png)
Specifications:
The text was updated successfully, but these errors were encountered: