mirror of https://github.com/godotengine/godot
Fixes #107059. The SceneTreeDock was not tracking script changes in selected nodes in any capacity as far as I could assess. To do that, my solution essentially connects the "script_changed" signal from selected nodes to "SceneTreeDock::_update_script_button()" whenever the selection changes. It actually queues the update to make sure it happens only once no matter how many nodes are selected. However, only connecting that signal would leave previously selected nodes with a signal connection that should no longer exist. To properly disconnect previously selected nodes, we have to store the list of currently selected nodes so we can disconnect them when the selection changes. The commit also includes some improvements to the SceneTreeDock class: 1. Remove unnecessary initialization in SceneTreeDock This field is already initialized in the line that declares it. As such, initializing it on the constructor as well as is redundant. 2. Queue script button updates in scene tree dock Since we now have the option to defer the script button update and make sure it only runs once per frame, it's always best to use the queued version of the update from a performance perspective. I'm not entirely sure if there could be any unexpected side effects but it is a minor self-contained UI update, so it's likely a relatively safe change. The replacement includes the bindings since it is a requirement for the other replacements in the class to work (UndoRedo needs their method names registered in the class DB). It should be OK to remove the old non-queued bindings too even though they are accessible in the public API because it is a "unofficial" method starting with an underscore. |
||
|---|---|---|
| .. | ||
| SCsub | ||
| editor_dock_manager.cpp | ||
| editor_dock_manager.h | ||
| filesystem_dock.cpp | ||
| filesystem_dock.h | ||
| groups_editor.cpp | ||
| groups_editor.h | ||
| history_dock.cpp | ||
| history_dock.h | ||
| import_dock.cpp | ||
| import_dock.h | ||
| inspector_dock.cpp | ||
| inspector_dock.h | ||
| node_dock.cpp | ||
| node_dock.h | ||
| scene_tree_dock.cpp | ||
| scene_tree_dock.h | ||