Avoid changing the currently edited object when attaching a script

This commit is contained in:
Chia-Hsiang Cheng 2023-09-10 17:16:09 +08:00
parent fc99492d30
commit d12d955e68

View file

@ -2089,8 +2089,13 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
}
undo_redo->commit_action();
// Avoid changing the currently edited object.
Object *edited_object = InspectorDock::get_inspector_singleton()->get_edited_object();
_push_item(p_script.ptr());
_update_script_button();
InspectorDock::get_inspector_singleton()->edit(edited_object);
}
void SceneTreeDock::_shader_created(Ref<Shader> p_shader) {