diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 156f00f6a36..7b1a6a8e27a 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -175,6 +175,10 @@ Ref create_editor_theme() { theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons")); theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); + theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons")); + theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); + theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); + theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); // Editor background Ref style_panel = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); diff --git a/editor/icons/2x/icon_GUI_radio_checked.png b/editor/icons/2x/icon_GUI_radio_checked.png new file mode 100644 index 00000000000..1b38071c00e Binary files /dev/null and b/editor/icons/2x/icon_GUI_radio_checked.png differ diff --git a/editor/icons/2x/icon_GUI_radio_unchecked.png b/editor/icons/2x/icon_GUI_radio_unchecked.png new file mode 100644 index 00000000000..b76bf63f2d8 Binary files /dev/null and b/editor/icons/2x/icon_GUI_radio_unchecked.png differ diff --git a/editor/icons/icon_GUI_radio_checked.png b/editor/icons/icon_GUI_radio_checked.png new file mode 100644 index 00000000000..699d0966a90 Binary files /dev/null and b/editor/icons/icon_GUI_radio_checked.png differ diff --git a/editor/icons/icon_GUI_radio_unchecked.png b/editor/icons/icon_GUI_radio_unchecked.png new file mode 100644 index 00000000000..e8ce1f8e6d7 Binary files /dev/null and b/editor/icons/icon_GUI_radio_unchecked.png differ diff --git a/editor/icons/source/icon_GUI_radio_checked.svg b/editor/icons/source/icon_GUI_radio_checked.svg new file mode 100644 index 00000000000..c0dc46448b4 --- /dev/null +++ b/editor/icons/source/icon_GUI_radio_checked.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/editor/icons/source/icon_GUI_radio_unchecked.svg b/editor/icons/source/icon_GUI_radio_unchecked.svg new file mode 100644 index 00000000000..d21ba299b69 --- /dev/null +++ b/editor/icons/source/icon_GUI_radio_unchecked.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ac6d78adc2a..a35d7a9a503 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3485,7 +3485,7 @@ void CanvasItemEditorViewport::_on_change_type() { } void CanvasItemEditorViewport::_create_preview(const Vector &files) const { - label->set_position(get_global_position() + Point2(14, 14)); + label->set_position(get_global_position() + Point2(14, 14) * EDSCALE); label_desc->set_position(label->get_position() + Point2(0, label->get_size().height)); for (int i = 0; i < files.size(); i++) { String path = files[i]; @@ -3791,10 +3791,16 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p } void CanvasItemEditorViewport::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - connect("mouse_exited", this, "_on_mouse_exit"); - } else if (p_what == NOTIFICATION_EXIT_TREE) { - disconnect("mouse_exited", this, "_on_mouse_exit"); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + connect("mouse_exited", this, "_on_mouse_exit"); + label->add_color_override("font_color", get_color("warning_color", "Editor")); + } break; + case NOTIFICATION_EXIT_TREE: { + disconnect("mouse_exited", this, "_on_mouse_exit"); + } break; + + default: break; } } @@ -3824,11 +3830,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte accept = memnew(AcceptDialog); editor->get_gui_base()->add_child(accept); - selector = memnew(WindowDialog); + selector = memnew(AcceptDialog); selector->set_title(TTR("Change default type")); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->add_constant_override("separation", 10 * EDSCALE); + vbc->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->set_v_size_flags(SIZE_EXPAND_FILL); vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE); selector_label = memnew(Label); @@ -3851,17 +3858,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte } vbc->add_child(btn_group); - Button *ok = memnew(Button); - ok->set_text(TTR("OK")); - ok->set_h_size_flags(0); - vbc->add_child(ok); - ok->connect("pressed", this, "_on_change_type"); + selector->connect("confirmed", this, "_on_change_type"); selector->add_child(vbc); editor->get_gui_base()->add_child(selector); label = memnew(Label); - label->add_color_override("font_color", Color(1, 1, 0, 1)); label->add_color_override("font_color_shadow", Color(0, 0, 0, 1)); label->add_constant_override("shadow_as_outline", 1 * EDSCALE); label->hide();