mirror of
https://github.com/godotengine/godot.git
synced 2025-01-06 17:37:18 +08:00
Fix TileSet not disappearing on deselecting TileMap
This commit is contained in:
parent
4714e95896
commit
6b7829b5ff
@ -362,6 +362,13 @@ void TileMapEditorPlugin::edit(Object *p_object) {
|
||||
tile_set_plugin_singleton->make_visible(true);
|
||||
edited_tileset = tile_map->get_tileset()->get_instance_id();
|
||||
}
|
||||
} else if (edited_tileset.is_valid()) {
|
||||
// Hide the TileSet editor, unless another TileSet is being edited.
|
||||
if (tile_set_plugin_singleton->get_edited_tileset() == edited_tileset) {
|
||||
tile_set_plugin_singleton->edit(nullptr);
|
||||
tile_set_plugin_singleton->make_visible(false);
|
||||
}
|
||||
edited_tileset = ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,6 +426,11 @@ TileMapEditorPlugin::~TileMapEditorPlugin() {
|
||||
|
||||
void TileSetEditorPlugin::edit(Object *p_object) {
|
||||
editor->edit(Ref<TileSet>(p_object));
|
||||
if (p_object) {
|
||||
edited_tileset = p_object->get_instance_id();
|
||||
} else {
|
||||
edited_tileset = ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
bool TileSetEditorPlugin::handles(Object *p_object) const {
|
||||
@ -439,6 +451,10 @@ void TileSetEditorPlugin::make_visible(bool p_visible) {
|
||||
}
|
||||
}
|
||||
|
||||
ObjectID TileSetEditorPlugin::get_edited_tileset() const {
|
||||
return edited_tileset;
|
||||
}
|
||||
|
||||
TileSetEditorPlugin::TileSetEditorPlugin() {
|
||||
DEV_ASSERT(tile_map_plugin_singleton);
|
||||
tile_set_plugin_singleton = this;
|
||||
|
@ -118,7 +118,7 @@ class TileMapEditorPlugin : public EditorPlugin {
|
||||
TileMap *tile_map = nullptr;
|
||||
|
||||
bool tile_map_changed_needs_update = false;
|
||||
ObjectID edited_tileset;
|
||||
ObjectID edited_tileset; // The TileSet associated with the TileMap.
|
||||
|
||||
void _tile_map_changed();
|
||||
void _update_tile_map();
|
||||
@ -147,11 +147,15 @@ class TileSetEditorPlugin : public EditorPlugin {
|
||||
TileSetEditor *editor = nullptr;
|
||||
Button *button = nullptr;
|
||||
|
||||
ObjectID edited_tileset;
|
||||
|
||||
public:
|
||||
virtual void edit(Object *p_object) override;
|
||||
virtual bool handles(Object *p_object) const override;
|
||||
virtual void make_visible(bool p_visible) override;
|
||||
|
||||
ObjectID get_edited_tileset() const;
|
||||
|
||||
TileSetEditorPlugin();
|
||||
~TileSetEditorPlugin();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user