Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Copy Value as Text to the inspector #75604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ void EditorProperty::shortcut_input(const Ref<InputEvent> &p_event) {
} else if (ED_IS_SHORTCUT("property_editor/paste_value", p_event) && !is_read_only()) {
menu_option(MENU_PASTE_VALUE);
accept_event();
} else if (ED_IS_SHORTCUT("property_editor/copy_value_as_text", p_event)) {
menu_option(MENU_COPY_VALUE_AS_TEXT);
accept_event();
} else if (ED_IS_SHORTCUT("property_editor/copy_property_path", p_event)) {
menu_option(MENU_COPY_PROPERTY_PATH);
accept_event();
Expand Down Expand Up @@ -940,6 +943,9 @@ void EditorProperty::menu_option(int p_option) {
case MENU_PASTE_VALUE: {
emit_changed(property, InspectorDock::get_inspector_singleton()->get_property_clipboard());
} break;
case MENU_COPY_VALUE_AS_TEXT: {
DisplayServer::get_singleton()->clipboard_set(object->get(property).get_construct_string());
} break;
case MENU_COPY_PROPERTY_PATH: {
DisplayServer::get_singleton()->clipboard_set(property_path);
} break;
Expand Down Expand Up @@ -1034,6 +1040,7 @@ void EditorProperty::_update_popup() {
}
menu->add_icon_shortcut(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), ED_GET_SHORTCUT("property_editor/copy_value"), MENU_COPY_VALUE);
menu->add_icon_shortcut(get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")), ED_GET_SHORTCUT("property_editor/paste_value"), MENU_PASTE_VALUE);
menu->add_icon_shortcut(get_theme_icon(SNAME("RichTextEffect"), SNAME("EditorIcons")), ED_GET_SHORTCUT("property_editor/copy_value_as_text"), MENU_COPY_VALUE_AS_TEXT);
menu->add_icon_shortcut(get_theme_icon(SNAME("CopyNodePath"), SNAME("EditorIcons")), ED_GET_SHORTCUT("property_editor/copy_property_path"), MENU_COPY_PROPERTY_PATH);
menu->set_item_disabled(MENU_PASTE_VALUE, is_read_only());
if (!pin_hidden) {
Expand Down Expand Up @@ -4110,5 +4117,6 @@ EditorInspector::EditorInspector() {

ED_SHORTCUT("property_editor/copy_value", TTR("Copy Value"), KeyModifierMask::CMD_OR_CTRL | Key::C);
ED_SHORTCUT("property_editor/paste_value", TTR("Paste Value"), KeyModifierMask::CMD_OR_CTRL | Key::V);
ED_SHORTCUT("property_editor/copy_value_as_text", TTR("Copy Value as Text"));
ED_SHORTCUT("property_editor/copy_property_path", TTR("Copy Property Path"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::C);
}
1 change: 1 addition & 0 deletions editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class EditorProperty : public Container {
enum MenuItems {
MENU_COPY_VALUE,
MENU_PASTE_VALUE,
MENU_COPY_VALUE_AS_TEXT,
MENU_COPY_PROPERTY_PATH,
MENU_PIN_VALUE,
MENU_OPEN_DOCUMENTATION,
Expand Down