Repository: godotengine/godot (language: cpp)

Issue:
Exported TileSets on non-TileMaps error with `Condition "!tile_set.is_valid()" is true." when edited
### Tested versions

- v4.2.1.stable.official [b09f793f5]
- v4.3.dev2.official [352434668]

### System information

Godot v4.3.dev2 - Windows 10.0.19045 - Vulkan (Forward+ & Mobile) - dedicated NVIDIA GeForce GTX 970 (NVIDIA; 31.0.15.3667) - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 Threads)

### Issue description

The issue title. The exact error message is:

```
editor/plugins/tiles/tile_set_editor.cpp:244 - Condition "!tile_set.is_valid()" is true.
```

There should be no error.

### Steps to reproduce

1. Create any Node
2. Add a script that exports a `TileSet` var
3. Give it a TileSet
4. Add a source (icon.svg)
5. Close and reopen the TileSet editor, e.g. by deselecting and reselecting the node
6. `editor/plugins/tiles/tile_set_editor.cpp:244 - Condition "!tile_set.is_valid()" is true.`

### Minimal reproduction project (MRP)

[repro4.3 dev2.zip](https://github.com/godotengine/godot/files/13980286/repro4.3.dev2.zip)
[repro4.2.1.zip](https://github.com/godotengine/godot/files/13980287/repro4.2.1.zip)



Discussion / hints:
The issue is occurring on TileMaps and their TileSets as well, perhaps you could consider editing the title because of that?

What I found interesting (and somewhat of a band-aid for now) is that the error prints only when the tileset is expanded in tilemap's/node's inspector. When you close it, the error seems to no longer show up.

Fix patch:
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0aec3cff8ddd..0dad8acc483c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -943,12 +943,12 @@ void EditorNode::_remove_plugin_from_enabled(const String &p_name) {
 void EditorNode::_plugin_over_edit(EditorPlugin *p_plugin, Object *p_object) {
 	if (p_object) {
 		editor_plugins_over->add_plugin(p_plugin);
-		p_plugin->make_visible(true);
 		p_plugin->edit(p_object);
+		p_plugin->make_visible(true);
 	} else {
 		editor_plugins_over->remove_plugin(p_plugin);
-		p_plugin->make_visible(false);
 		p_plugin->edit(nullptr);
+		p_plugin->make_visible(false);
 	}
 }
 


Test patch: