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

Ruin0x11 commented Mar 16, 2019

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

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Contributor Author

Ruin0x11 commented Mar 18, 2019

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 bjorn:master Mar 20, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bjorn

This comment has been minimized.

Copy link
Owner

bjorn commented Mar 20, 2019

Thanks!

Ruin0x11 added a commit to Ruin0x11/tiled that referenced this pull request May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.