File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,13 @@ void TileMapEditorPlugin::edit(Object *p_object) {
369369 tile_set_plugin_singleton->make_visible (true );
370370 edited_tileset = tile_map->get_tileset ()->get_instance_id ();
371371 }
372+ } else if (edited_tileset.is_valid ()) {
373+ // Hide the TileSet editor, unless another TileSet is being edited.
374+ if (tile_set_plugin_singleton->get_edited_tileset () == edited_tileset) {
375+ tile_set_plugin_singleton->edit (nullptr );
376+ tile_set_plugin_singleton->make_visible (false );
377+ }
378+ edited_tileset = ObjectID ();
372379 }
373380}
374381
@@ -426,6 +433,11 @@ TileMapEditorPlugin::~TileMapEditorPlugin() {
426433
427434void TileSetEditorPlugin::edit (Object *p_object) {
428435 editor->edit (Ref<TileSet>(p_object));
436+ if (p_object) {
437+ edited_tileset = p_object->get_instance_id ();
438+ } else {
439+ edited_tileset = ObjectID ();
440+ }
429441}
430442
431443bool TileSetEditorPlugin::handles (Object *p_object) const {
@@ -446,6 +458,10 @@ void TileSetEditorPlugin::make_visible(bool p_visible) {
446458 }
447459}
448460
461+ ObjectID TileSetEditorPlugin::get_edited_tileset () const {
462+ return edited_tileset;
463+ }
464+
449465TileSetEditorPlugin::TileSetEditorPlugin () {
450466 DEV_ASSERT (tile_map_plugin_singleton);
451467 tile_set_plugin_singleton = this ;
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ class TileMapEditorPlugin : public EditorPlugin {
118118 ObjectID tile_map_id;
119119
120120 bool tile_map_changed_needs_update = false ;
121- ObjectID edited_tileset;
121+ ObjectID edited_tileset; // The TileSet associated with the TileMap.
122122
123123 void _tile_map_changed ();
124124 void _update_tile_map ();
@@ -147,11 +147,15 @@ class TileSetEditorPlugin : public EditorPlugin {
147147 TileSetEditor *editor = nullptr ;
148148 Button *button = nullptr ;
149149
150+ ObjectID edited_tileset;
151+
150152public:
151153 virtual void edit (Object *p_object) override ;
152154 virtual bool handles (Object *p_object) const override ;
153155 virtual void make_visible (bool p_visible) override ;
154156
157+ ObjectID get_edited_tileset () const ;
158+
155159 TileSetEditorPlugin ();
156160 ~TileSetEditorPlugin ();
157161};
You can’t perform that action at this time.
0 commit comments