Add separate editor plugin for TileMap and TileSet
Right now TilesEditorPlugin handles both TileMap and TileSet, which results in some errors when both are edited at the same time. Editing multiple objects is not supported; this PR adds separate dummy plugins for TileMap and TileSet, which just forward their methods to the original plugin. It's a bit awkward, but it functions the same as before and doesn't spit errors.
I also added a note in EditorPlugin docs.
EDIT: Fixes #74543
EDIT2:
I had to add a few ERR_FAIL_NULLs due to failing sanitizer checks. They aren't necessary normally.
Is this a fix for #74543?
CC @groud
I think this is a good thing to do. I think the implementation is OK but it's maybe too many layers right now, it becomes a bit complex.
I think we should probably remove TilesEditorPlugin and move functions related to TileMaps / TileSets in their respective plugin. For synchronization, we should probably have a TilesEditorSync singleton that would hold and forward the changes. Have you considered such an approach too ?
Hmmm, now that I think about it, TilesEditorPlugin was a hack to allow 2 editors at once, but it's no longer necessary probably 🤔 Removing it might fix some bugs.
Ok done. TilesEditorPlugin now handles some singleton things, but otherwise all editing is done by TileMapEditorPlugin and TileSetEditorPlugin. I had to resort to some tricks to make everything work correctly; I didn't do much testing though (yet).
TilesEditorPlugin now handles some singleton things, but otherwise all editing is done by TileMapEditorPlugin and TileSetEditorPlugin
I think you can renames it then, to avoid any confusion. Something like TilesEditorSynchronizer or something.
But the class does more than just synchronizing, so if anything, it needs a better name.
But the class does more than just synchronizing, so if anything, it needs a better name.
Maybe TilesEditorsCommons? Or TilesEditorShared? TilesEditorHelper? TilesEditorHelpDesk? TilesEditorHotline? TilesEditorReferee? TilesEditorIDK :sweat_smile: ?
Renamed to TilesEditorUtils.
These plugins are not exposed, so they can be renamed at any time.
Thanks!
Is this cherry pickable for 4.1? Or a variation of it? The issue appears to also occur there