-
-
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
TileSet Python export plugins (fixes #1865) #3857
Conversation
Extended the Python plugin to support custom tileset exporters and readers written in Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if this plugin isn't very well maintained and I would discourage writing new plugins in Python, I still think this is a very welcome addition. Thanks!
I've left a number of comments which need to be addressed before this can be merged.
Let me know how it looks now. I think I got all the changes in. |
@DrDub I've pushed some changes, and also was running into a crash, likely the same you encountered. I've fixed it by adding a check on the return value of
It appears there is something broken about |
* Un-duplicated setPythonClass function * Removed unused pluginmanager.h include * Fixed cleanup code related to reloading plugins in case a plugin changes from defining a map format to a tileset format or vice versa. * Allow a Python plugin to include both a map and a tileset format (though only one of each).
It appears Qt Creator's Qbs support does not include looking for compiler flags setting include paths (-I). They need to be actually set using cpp.includePaths.
There are actually no defines coming from python3-embed for me.
The problem was that handleError was not called when PyObject_IsSubclass returned -1, which it commonly did when called with a value that wasn't a class. With the error indicator still set, the next call to PyObject_Dir was failing. Since the errors aren't usually very useful, we just call PyErr_Clear when PyObject_IsSubclass fails. I couldn't find a convenient way to check if the value is a class, which could avoid raising these errors in the first place.
The PyErr_Print call already clears the error indicator, according to the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's working fine now. Can you give it one last try @DrDub before we merge this?
Extended the Python plugin to support custom tileset exporters and readers written in Python.
I understand the Python plugin has its issues and the JavaScript plugin is preferred, but this extension might make it more useful. (The issue of system Python vs. Tiled Python sadly remains.)