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

Lua export embeds all tiles with custom properties when an object is placed #2120

Closed
squishyu opened this issue May 11, 2019 · 5 comments
Closed
Assignees
Milestone

Comments

@squishyu
Copy link

How to reproduce the issue:

  • Create a map with a tileset containing tiles with custom properties
  • Create an object layer and place an object
  • Export the map in the .lua format

What I expected to happen:
Since I don't need any of the tile properties, plus I had the "Embed tilesets" option disabled in the preferences I shouldn't see them in the Lua file.

What actually happened:
The customized tiles got included in the .lua map file. (They didn't get included in the .tmx file and they didn't even appear when I tried exporting the map as .json)
This can make the map files several times bigger than they need to be.

Info

  • Tiled version: 1.2.2
  • OS: Windows 10 Home Build 15063

tiled_issue

@bjorn
Copy link
Member

bjorn commented May 11, 2019

Right, this has actually nothing to do with placing an object. For what may now be just historical reasons, the Lua export always exports tilesets as embedded.

But when not embedding the tileset, the Lua export would end up referring to the external tileset, which is currently never in Lua format, because you can only export to Lua, you can't save to Lua. This would not be very helpful, though as a user you could export the tileset to Lua as well and just replace the extension.

Alternatively, when exporting a map that refers to external tilesets, it could somehow refer to those tilesets by their exported location. That means you'd need to export your tileset first, and then Tiled would need to remember (and possibly store) the last export location. Trying to export a map with external tilesets that haven't been exported yet should then probably yield a warning.

@squishyu
Copy link
Author

Okay but shouldn't there be a way to disable it ? I still don't like having the tileset embedded in every map.

@squishyu
Copy link
Author

@bjorn Any updates on this? I'm slowly reaching my deadline on a project I'm working on and seeing every map contain +350kB extra just because they got the tileset embedded in them is not pretty.
image
image
I'd be fine with the temporary solution of Lua not embedding the tileset when the "Embed tilesets" option is off, I'm handling the tileset loading myself anyways.

@bjorn
Copy link
Member

bjorn commented Dec 16, 2020

@squishyu Ah, since my last comment I made change 86c82f8, which will make the behavior I suggested above easier to implement. So, my idea would be to reference the exported Lua file when set and fall back to the original tileset file name if not. Or would it be better to just always use the original tileset file name, since it would be more reliable?

@bjorn bjorn self-assigned this Dec 16, 2020
@bjorn bjorn added this to the Tiled 1.5 milestone Dec 16, 2020
@bjorn bjorn closed this as completed in 56033ba Dec 16, 2020
@bjorn
Copy link
Member

bjorn commented Dec 16, 2020

I've decided to include the export filename in addition, when available, rather than replacing the original filename property. This change will be available in a new development snapshot later today.

@squishyu Good luck finishing your project! And if you haven't already, please consider supporting Tiled as well. ❤️

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

No branches or pull requests

2 participants