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

Allow loading a TSX file from Python plugins #2085

Merged
merged 3 commits into from
Mar 20, 2019

Conversation

Ruin0x11
Copy link
Contributor

This pull request adds a method to the Python API, loadSharedTilesetFromTsx, which allows loading an existing TSX file as a tileset.

The use case I'm thinking of is embedding the path to a specific version of a TSX in a map format, then attempting to resolve it when the map is loaded in Tiled, and sharing the same TSX across multiple map files. The data system we have may support several groups of tiles loaded from outside sources like mods which can be enabled and disabled, so I was thinking about pregenerating a TSX for a single supported configuration of enabled/disabled mods, caching the tile images somewhere, and allowing them to be used in the editor.

@bjorn
Copy link
Member

bjorn commented Mar 16, 2019

Thanks for your patch! It definitely makes sense for the Python plugins to be able to load external tilesets while loading a map.

Since generally we want to avoid loading the same tileset multiple times, there is the TilesetManager through which tilesets are loaded. Also, I think it would make sense for this function to work with any supported tileset format rather than just TSX. So, what about renaming this to simply loadTileset and implementing it based on TilesetManager::loadTileset?

@Ruin0x11
Copy link
Contributor Author

Yes, that makes sense. It also prevents the behavior where the same tileset shows up in the editor multiple times.

@bjorn bjorn merged commit d5964eb into mapeditor:master Mar 20, 2019
@bjorn
Copy link
Member

bjorn commented Mar 20, 2019

Thanks!

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