From ce5200b30e6d262905912c6571d51ba6f5979bd7 Mon Sep 17 00:00:00 2001 From: Mateusz Adamczyk Date: Mon, 31 Oct 2016 15:45:20 +0100 Subject: [PATCH] Option for detaching script from node (#6934). --- tools/editor/scene_tree_dock.cpp | 40 +++++++++++++++++++++++++++++--- tools/editor/scene_tree_dock.h | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 16f06c7ac98..b4d32eb5c2c 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -86,6 +86,9 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { else if (ED_IS_SHORTCUT("scene_tree/load_script", p_event)) { _tool_selected(TOOL_LOAD_SCRIPT); } + else if(ED_IS_SHORTCUT("scene_tree/clear_script", p_event)) { + _tool_selected(TOOL_CLEAR_SCRIPT); + } else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { _tool_selected(TOOL_MOVE_UP); } @@ -414,6 +417,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } + } break; + case TOOL_CLEAR_SCRIPT: { + Node *selected = scene_tree->get_selected(); + if(!selected) + break; + + Ref