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 tmxrasterizer to support additional map formats #2152

Merged
merged 7 commits into from Jul 10, 2019

Conversation

gauauu
Copy link
Contributor

@gauauu gauauu commented Jul 9, 2019

A simple change that loads the plugin manager, and uses readMap from mapformat.h to allow reading other map types in addition to tmx.

I don't have a great grasp of how the plugin system works, so if I should do something different other than

 PluginManager::instance()->loadPlugins();

to load the plugins, let me know. (Or feel free to reject the PR if I'm way off the mark)

Copy link
Member

@bjorn bjorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that looks even easier than I expected. :-)

@@ -32,9 +32,11 @@
#include "imagelayer.h"
#include "isometricrenderer.h"
#include "map.h"
#include "mapformat.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't seem to need this include.

Copy link
Contributor Author

@gauauu gauauu Jul 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the build fails for me without it (MapReader.readMap doesn't seem to look for all the different map types from plugins, so I'm using the readMap from mapformat.cpp which does). That said, now that you mention this, I should remove the now-unnecessary MapReader instances that get created.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I didn't realize I put readMap in mapformat.h!

@@ -116,6 +118,8 @@ bool TmxRasterizer::shouldDrawLayer(const Layer *layer) const
int TmxRasterizer::render(const QString &fileName,
const QString &imageFileName)
{
PluginManager::instance()->loadPlugins();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if this was put in the main function rather than in the TmxRasterizer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I'll drop it in right after the app initialization calls in main unless you have another convention of where it should go.

gauauu and others added 2 commits July 9, 2019 21:57
* Don't mention TMX format, since plugins can add support for other
  formats (JSON and tBIN are now supported, for example).

* Make it more clear that world files are also accepted.
@bjorn bjorn merged commit 711bbfa into mapeditor:master Jul 10, 2019
@bjorn
Copy link
Member

bjorn commented Jul 10, 2019

Great improvement, 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.

None yet

2 participants