|
@@ -2936,7 +2936,7 @@ void SceneTreeDock::_selection_changed() {
|
|
|
node_previous_selection.reserve(editor_selection->get_selection().size());
|
|
|
for (const KeyValue<Node *, Object *> &E : editor_selection->get_selection()) {
|
|
|
Node *node = E.key;
|
|
|
- node_previous_selection.push_back(node);
|
|
|
+ node_previous_selection.push_back(node->get_instance_id());
|
|
|
node->connect(CoreStringName(script_changed), callable_mp(this, &SceneTreeDock::_queue_update_script_button));
|
|
|
}
|
|
|
_queue_update_script_button();
|
|
@@ -3376,8 +3376,11 @@ static bool _is_same_selection(const Vector<Node *> &p_first, const List<Node *>
|
|
|
}
|
|
|
|
|
|
void SceneTreeDock::clear_previous_node_selection() {
|
|
|
- for (Node *node : node_previous_selection) {
|
|
|
- node->disconnect(CoreStringName(script_changed), callable_mp(this, &SceneTreeDock::_queue_update_script_button));
|
|
|
+ for (const ObjectID &id : node_previous_selection) {
|
|
|
+ Node *node = ObjectDB::get_instance<Node>(id);
|
|
|
+ if (node) {
|
|
|
+ node->disconnect(CoreStringName(script_changed), callable_mp(this, &SceneTreeDock::_queue_update_script_button));
|
|
|
+ }
|
|
|
}
|
|
|
node_previous_selection.clear();
|
|
|
}
|