mirror of
https://github.com/godotengine/godot.git
synced 2025-10-30 13:11:13 +00:00
Add more menus support to EditorContextMenuPlugin
This commit is contained in:
parent
fafc07335b
commit
ba54a2805a
7 changed files with 93 additions and 3 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/gui/editor_toaster.h"
|
||||
#include "editor/plugins/editor_context_menu_plugin.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/rich_text_label.h"
|
||||
|
|
@ -1721,6 +1722,11 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
_lookup_symbol(text, tx->get_caret_line(0), tx->get_caret_column(0));
|
||||
}
|
||||
} break;
|
||||
default: {
|
||||
if (p_op >= EditorContextMenuPlugin::BASE_ID) {
|
||||
EditorContextMenuPluginManager::get_singleton()->activate_custom_option(EditorContextMenuPlugin::CONTEXT_SLOT_SCRIPT_EDITOR_CODE, p_op, tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2310,6 +2316,9 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
|
|||
}
|
||||
}
|
||||
|
||||
const PackedStringArray paths = { code_editor->get_text_editor()->get_path() };
|
||||
EditorContextMenuPluginManager::get_singleton()->add_options_from_plugins(context_menu, EditorContextMenuPlugin::CONTEXT_SLOT_SCRIPT_EDITOR_CODE, paths);
|
||||
|
||||
const CodeEdit *tx = code_editor->get_text_editor();
|
||||
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_UNDO), !tx->has_undo());
|
||||
context_menu->set_item_disabled(context_menu->get_item_index(EDIT_REDO), !tx->has_redo());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue