summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2018-10-29 22:25:52 +0900
committervolzhs <volzhs@gmail.com>2018-10-29 22:25:52 +0900
commit8f4e842b472d4c582f473b9a9ac09e5efafbddd6 (patch)
tree060278098294e20602cccfd321133f2dff3c21f0 /editor
parent0a80ceaf02b258c548e500297079a350d8567023 (diff)
Hide "Attach Script" if node has one
Diffstat (limited to 'editor')
-rw-r--r--editor/scene_tree_dock.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index f992d4d2e0..fe438236c9 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2071,7 +2071,9 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
existing_script = selected->get_script();
}
- menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
+ if (!existing_script.is_valid()) {
+ menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
+ }
if (selection.size() > 1 || existing_script.is_valid()) {
menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT);
menu->add_icon_shortcut(get_icon("ScriptExtend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_ATTACH_SCRIPT);