You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an idiom in the Editor where plugins connect to the SceneTree "node_removed" signal. They do this to determine when a node has been removed from the scene, and their editing capabilities are no longer needed. For example, the AnimationTrackEditor registers this handler to keep the content "sticky" at the bottom of the screen, regardless of which object is being edited.
The problem with this idiom is that it gets notified of every node removed from the scene. For example, I clicked on a simple dialog to create a node, and this triggered 600 invocations to the AnomationPlayerEditor::_node_removed, this was a dialog that was not related to animations at all, but this callback is invoked for everything.
To make things a little worse, this idiom is not limited to the AnimationEditor, there are 26 instances of this idiom (judging from a quick grep) in the editor.
I believe that we can achieve the same by monitoring tree_exiting signal on the node we want to monitor, as it seems to be called in the same condition.
@KoBeWi suggested on the chat room that there is a system in Godot to handle this scenario, but I am not familiar with that system.
Steps to reproduce
Set a breakpoint in AnimationPlayerEditor::_node_removed, then select an animation in Godot.
Then add an item to the canvas, like "Node2D", tap create, and watch how it takes 600 hits to the callback.
Minimal reproduction project (MRP)
No minimal project is needed, any project will do.
The text was updated successfully, but these errors were encountered:
Ever since #71770, deleting a node will automatically notify all editors to stop editing it, so some (if not all) of the monitoring checks are redundant.
The adding using this idiom do not rely on the edit(nullptr) pattern to determine whether to stop previewing their resource, and I am not sure they have a system to do this.
The scenario where I discovered this was editing an AnimationPlayer, it keeps track of this node and will ignore requests to edit nullptr as "none of my business", instead it waits for the node that it is tracking to be removed from the scene to give up the editing of that object
Tested versions
Godot 4.3, Godot/master
System information
MacOS
Issue description
There is an idiom in the Editor where plugins connect to the SceneTree "node_removed" signal. They do this to determine when a node has been removed from the scene, and their editing capabilities are no longer needed. For example, the AnimationTrackEditor registers this handler to keep the content "sticky" at the bottom of the screen, regardless of which object is being edited.
The problem with this idiom is that it gets notified of every node removed from the scene. For example, I clicked on a simple dialog to create a node, and this triggered 600 invocations to the
AnomationPlayerEditor::_node_removed
, this was a dialog that was not related to animations at all, but this callback is invoked for everything.To make things a little worse, this idiom is not limited to the AnimationEditor, there are 26 instances of this idiom (judging from a quick grep) in the editor.
I believe that we can achieve the same by monitoring
tree_exiting
signal on the node we want to monitor, as it seems to be called in the same condition.@KoBeWi suggested on the chat room that there is a system in Godot to handle this scenario, but I am not familiar with that system.
Steps to reproduce
Set a breakpoint in AnimationPlayerEditor::_node_removed, then select an animation in Godot.
Then add an item to the canvas, like "Node2D", tap create, and watch how it takes 600 hits to the callback.
Minimal reproduction project (MRP)
No minimal project is needed, any project will do.
The text was updated successfully, but these errors were encountered: