diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-16 18:32:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 18:32:23 +0200 |
commit | 8383e4e06d6420eba6e04106d5037aa18c4ed30b (patch) | |
tree | c9a59f62c829e1a249e8d24eccce7f18f57f918c /editor | |
parent | 2735f829c9e5b9dc647991941861831f58843c7f (diff) | |
parent | 93c1bbe697c52fbc7f485e4a1618777903293887 (diff) |
Merge pull request #51733 from timothyqiu/resource-menu-item
Disable "Edit Resource from Clipboard" when nothing in clipboard
Diffstat (limited to 'editor')
-rw-r--r-- | editor/inspector_dock.cpp | 7 | ||||
-rw-r--r-- | editor/inspector_dock.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 952bec4d87..778046f45c 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -209,6 +209,12 @@ void InspectorDock::_paste_resource() { } } +void InspectorDock::_prepare_resource_extra_popup() { + RES r = EditorSettings::get_singleton()->get_resource_clipboard(); + PopupMenu *popup = resource_extra_button->get_popup(); + popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null()); +} + void InspectorDock::_prepare_history() { EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history(); @@ -525,6 +531,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { resource_extra_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); resource_extra_button->set_tooltip(TTR("Extra resource options.")); general_options_hb->add_child(resource_extra_button); + resource_extra_button->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_resource_extra_popup)); resource_extra_button->get_popup()->add_icon_shortcut(get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/paste_resource", TTR("Edit Resource from Clipboard")), RESOURCE_EDIT_CLIPBOARD); resource_extra_button->get_popup()->add_icon_shortcut(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/copy_resource", TTR("Copy Resource")), RESOURCE_COPY); resource_extra_button->get_popup()->set_item_disabled(1, true); diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h index d50785d95c..6615845b66 100644 --- a/editor/inspector_dock.h +++ b/editor/inspector_dock.h @@ -102,6 +102,7 @@ class InspectorDock : public VBoxContainer { void _unref_resource(); void _copy_resource(); void _paste_resource(); + void _prepare_resource_extra_popup(); void _warning_pressed(); void _resource_created(); |