godot icon indicating copy to clipboard operation
godot copied to clipboard

Add separate editor plugin for TileMap and TileSet

Open KoBeWi opened this issue 2 years ago • 1 comments

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.

KoBeWi avatar Mar 10 '23 13:03 KoBeWi

Is this a fix for #74543?

AThousandShips avatar Mar 10 '23 13:03 AThousandShips

CC @groud

akien-mga avatar Jun 12 '23 20:06 akien-mga

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 ?

groud avatar Jun 15 '23 08:06 groud

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.

KoBeWi avatar Jun 15 '23 11:06 KoBeWi

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).

KoBeWi avatar Jun 15 '23 17:06 KoBeWi

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.

groud avatar Jun 15 '23 17:06 groud

But the class does more than just synchronizing, so if anything, it needs a better name.

KoBeWi avatar Jun 15 '23 17:06 KoBeWi

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: ?

groud avatar Jun 15 '23 18:06 groud

Renamed to TilesEditorUtils.

KoBeWi avatar Jun 15 '23 21:06 KoBeWi

These plugins are not exposed, so they can be renamed at any time.

KoBeWi avatar Jul 27 '23 13:07 KoBeWi

Thanks!

YuriSizov avatar Jul 27 '23 17:07 YuriSizov

Is this cherry pickable for 4.1? Or a variation of it? The issue appears to also occur there

AThousandShips avatar Dec 09 '23 15:12 AThousandShips