diff options
author | Chia-Hsiang Cheng <88014292+garychia@users.noreply.github.com> | 2023-09-10 17:16:09 +0800 |
---|---|---|
committer | Chia-Hsiang Cheng <88014292+garychia@users.noreply.github.com> | 2023-09-10 17:16:09 +0800 |
commit | d12d955e68a38db4a8f2db8ecd715481596e3351 (patch) | |
tree | dac013f43c570ddfc193c4b60e02995809a01f2c /editor/scene_tree_dock.cpp | |
parent | fc99492d3066098e938449b10e02f8e01d07e2d1 (diff) | |
download | redot-engine-d12d955e68a38db4a8f2db8ecd715481596e3351.tar.gz |
Avoid changing the currently edited object when attaching a script
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 161598b50f..69d57a555c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -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) { |