From 03f62495caf33a7b337d95dbed59fa40d36e6fac Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Thu, 10 Aug 2017 11:40:28 -0500 Subject: [PATCH] Improved add texture as node dialog --- editor/editor_themes.cpp | 4 + editor/icons/2x/icon_GUI_radio_checked.png | Bin 0 -> 946 bytes editor/icons/2x/icon_GUI_radio_unchecked.png | Bin 0 -> 799 bytes editor/icons/icon_GUI_radio_checked.png | Bin 0 -> 457 bytes editor/icons/icon_GUI_radio_unchecked.png | Bin 0 -> 420 bytes .../icons/source/icon_GUI_radio_checked.svg | 87 ++++++++++++++++++ .../icons/source/icon_GUI_radio_unchecked.svg | 81 ++++++++++++++++ editor/plugins/canvas_item_editor_plugin.cpp | 28 +++--- 8 files changed, 187 insertions(+), 13 deletions(-) create mode 100644 editor/icons/2x/icon_GUI_radio_checked.png create mode 100644 editor/icons/2x/icon_GUI_radio_unchecked.png create mode 100644 editor/icons/icon_GUI_radio_checked.png create mode 100644 editor/icons/icon_GUI_radio_unchecked.png create mode 100644 editor/icons/source/icon_GUI_radio_checked.svg create mode 100644 editor/icons/source/icon_GUI_radio_unchecked.svg 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 0000000000000000000000000000000000000000..1b38071c00e9ca2011c003eb278afa24151fe454 GIT binary patch literal 946 zcmV;j15NyiP)oIK2dNr57j^wYf&k z9U?_)rC!+f(jQU^LU8xBRFniNwVW!Y%>~p`dx~OPJ5q7!_7+jRc6Po!uomm}`bU5p zd6%_k=DqiMGxOdX;7DF~k;5!*Hk&63g~AemMF0-T;{YHc{}^N1N~xVVj<@IL<{rON zfOfk*)9rRwNuC8z7;8|(ko*O}jY_4`erW)$^^!5>a{$MtflbMON~tTZ>;C$}09xy1 zl9x%ULppzET*Lsl=6T+&Lj!27mq>n<9*$bvEE9Dr&TLPS0t zwG+7j?RI-6ilSQ>-1Z)TYxR2lj_>;>PtW&#wX(8uK}6O_7E@DCY};Ngm&^Z71)#P5 zEQzKcMGwH5=Xt-AENZPUkURrmE?LqPk)K`H-4v0Y*1AUWY8ry%*6i%;mlFY+&E^TE z)Exlnt^cM{sr-;+!?z^g&I1>bUE8+T9mffSAo!5vdTKf@l}hIw#|hIqLzgSb^YnP5 zUaxPGERJ)YMEOp)+ua~pbY1s0fM(is6h%u}ogn~Y%wi_0E#LP|vh5?Cry;b~=aYJH zH#5DMT|We%lqzQoK1{yvO>&;nIg{9WkRBJ2wv^^0Zc})D68NRHwt~rhqhGDoWA{zky1n?BV zQxW+?L^i@OTy-2LY&04R04`0V%)!CIC)H~8w>&>% zA0$B#d<0kxvZ(0IgQ*O%eGRz(q{) zC literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..b76bf63f2d856c4f615dcd48e210a5d18e638744 GIT binary patch literal 799 zcmV+)1K|9LP)j%yCyrp7W@IQ;o}zoMhV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sV{Ur+k O0000 + + + + + + + + + + + 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();