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

Add separate editor plugin for TileMap and TileSet #74717

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Mar 10, 2023

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

EDIT3:
Fixes #65467

@KoBeWi KoBeWi added this to the 4.1 milestone Mar 10, 2023
@KoBeWi KoBeWi requested a review from a team as a code owner March 10, 2023 13:14
@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch from 17015f2 to a40775b Compare March 10, 2023 13:15
@akien-mga akien-mga requested a review from groud March 10, 2023 13:25
@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch from a40775b to 7abcd7c Compare March 10, 2023 13:26
@AThousandShips
Copy link
Member

Is this a fix for #74543?

@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch 3 times, most recently from 91a6343 to 1565631 Compare March 10, 2023 17:40
@akien-mga
Copy link
Member

CC @groud

@groud
Copy link
Member

groud commented Jun 15, 2023

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 ?

@KoBeWi
Copy link
Member Author

KoBeWi commented Jun 15, 2023

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 KoBeWi force-pushed the tilesetmap_handler_plugin branch from 1565631 to dfc075d Compare June 15, 2023 17:23
@KoBeWi
Copy link
Member Author

KoBeWi commented Jun 15, 2023

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

@groud
Copy link
Member

groud commented Jun 15, 2023

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.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jun 15, 2023

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

@groud
Copy link
Member

groud commented Jun 15, 2023

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

@KoBeWi
Copy link
Member Author

KoBeWi commented Jun 15, 2023

Renamed to TilesEditorUtils.

@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch from dfc075d to c7c6c95 Compare June 15, 2023 21:37
@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch 3 times, most recently from d2c1b3d to 4769fc8 Compare June 23, 2023 09:39
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov requested a review from groud July 26, 2023 14:47
Copy link
Contributor

@YuriSizov YuriSizov left a comment

Choose a reason for hiding this comment

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

Superficially looks fine, but I'd still want an approval from @groud.

@KoBeWi KoBeWi force-pushed the tilesetmap_handler_plugin branch from 4769fc8 to ec24d50 Compare July 26, 2023 15:23
Copy link
Member

@groud groud left a comment

Choose a reason for hiding this comment

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

I am not super convinced by the TileMapSubEditorPlugin name (maybe TileMapEditorTerrainsPlugin should maybe be TileMapSubEditorTerrainsPlugin, and same for TileMapEditorTilesPlugin ?). But it's a bit weird anyway.

Anyway, I'd rather have a better name but I agree it's a bit difficult to find. So I guess we I am in favor of YOLO-ing and it merge as is, as the code looks good anyway.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jul 27, 2023

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

@YuriSizov YuriSizov merged commit 6c11fcd into godotengine:master Jul 27, 2023
@YuriSizov
Copy link
Contributor

Thanks!

@AThousandShips
Copy link
Member

AThousandShips commented Dec 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants