diff options
author | Igor Kordiukiewicz <igorkordiukiewicz@gmail.com> | 2022-03-06 03:19:03 +0100 |
---|---|---|
committer | Igor Kordiukiewicz <igorkordiukiewicz@gmail.com> | 2022-03-06 03:19:03 +0100 |
commit | dc361d32014c3eab0b80a8422d1f850f854b7532 (patch) | |
tree | b8a60af7d0172c1652877d27465026e801129911 | |
parent | d37e8586becf5e3abda5d3b13a06e4fd664364bc (diff) |
Fixed issue where Extend Script option would show up even without script attached to the node
-rw-r--r-- | editor/editor_resource_picker.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index fc1e466e9b..8534f8e49f 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -905,7 +905,12 @@ void EditorScriptPicker::set_create_options(Object *p_menu_node) { } menu_node->add_icon_item(get_theme_icon(SNAME("ScriptCreate"), SNAME("EditorIcons")), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); - menu_node->add_icon_item(get_theme_icon(SNAME("ScriptExtend"), SNAME("EditorIcons")), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); + if (script_owner) { + Ref<Script> script = script_owner->get_script(); + if (script.is_valid()) { + menu_node->add_icon_item(get_theme_icon(SNAME("ScriptExtend"), SNAME("EditorIcons")), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); + } + } menu_node->add_separator(); } |